浏览代码

Merge branch 'feature-tianyong-newVersion' into ktyq-test-new

TIANYONG 1 年之前
父节点
当前提交
f9a6550ee0

+ 14 - 1
src/page-instrument/evaluat-model/index.tsx

@@ -1,4 +1,4 @@
-import { Transition, defineComponent, onMounted, reactive, watch, defineAsyncComponent, computed } from "vue";
+import { Transition, defineComponent, onMounted, reactive, watch, defineAsyncComponent, computed, onUnmounted } from "vue";
 import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone, handleCancelEvaluat } from "/src/view/evaluating";
 import Earphone from "./earphone";
 import styles from "./index.module.less";
@@ -38,6 +38,7 @@ type TCriteria = "frequency" | "amplitude" | "decibels";
  */
 let actualBeatLength = 0;
 let calculateInfo: any = {};
+let checkErjiTimer: any = null
 
 export default defineComponent({
   name: "evaluat-model",
@@ -133,9 +134,15 @@ export default defineComponent({
         evaluatingData.earphoneMode = true;
         evaluatingData.earPhoneType = res?.content?.type || "";
         if (evaluatingData.earPhoneType === "有线耳机") {
+          clearTimeout(checkErjiTimer);
           setTimeout(() => {
             evaluatingData.earphoneMode = false;
           }, 3000);
+        } else {
+          // 如果没有佩戴有限耳机,需要持续检测耳机状态
+          checkErjiTimer = setTimeout(() => {
+            checkEarphoneStatus();
+          }, 1000);
         }
       }
       console.log("检测结束,生成数据", evaluatingData.websocketState, evaluatingData.startBegin, evaluatingData.checkEnd);
@@ -431,6 +438,11 @@ export default defineComponent({
       api_finishDelayCheck(handleFinishDelayCheck);
       api_retryEvaluating(handRetryEvaluating);
     });
+    
+    onUnmounted(() => {
+			clearTimeout(checkErjiTimer);
+		});
+
     return () => (
       <div>
         <div class={styles.operatingBtn}>
@@ -471,6 +483,7 @@ export default defineComponent({
           <Earphone
             earphoneType={evaluatingData.earPhoneType}
             onClose={() => {
+              clearTimeout(checkErjiTimer);
               evaluatingData.earphoneMode = false;
               // handlePerformDetection();
               checkEarphoneStatus("start");

+ 1 - 1
src/page-instrument/header-top/index.tsx

@@ -754,7 +754,7 @@ export default defineComponent({
                   <span style={{ whiteSpace: "nowrap" }}>节拍</span>
                   <div class={styles.speedCon}>
                     <img src={headImg("speed.png")} />
-                    <div>{state.speed}</div>
+                    <div>{Math.floor(state.speed)}</div>
                   </div>
                 </div>
                 {

+ 9 - 5
src/page-instrument/header-top/speed/index.tsx

@@ -3,7 +3,7 @@ import { Switch, Slider } from "vant";
 import styles from "./index.module.less"
 import { headData } from "../index" 
 import { headImg } from "../image";
-import state, { handleSetSpeed } from "../../../state";
+import state, { handleSetSpeed, resetBaseRate } from "../../../state";
 import { metronomeData } from "../../../helpers/metronome"; 
 
 export default defineComponent({
@@ -22,11 +22,15 @@ export default defineComponent({
 			canSpeed = Math.max(canSpeed, 45);
 			speed.value = canSpeed;
 		};
+		// 重置当前小节的速度
+		const resetCurrentSpeed = () => {
+			resetBaseRate(state.activeNoteIndex);
+		};
 		watch(
 			() => speed.value,
 			() => {
 				// handleSetSpeed(speed.value);
-				state.speed = speed.value;
+				state.speed = Math.floor(speed.value);
 			}
 		);
 		watch(
@@ -57,11 +61,11 @@ export default defineComponent({
 						<div class={styles.spendCon}>
 							<img src={headImg("cutImg.png")} class={[styles.btn]} onClick={minusSpeed} />
 							<div class={styles.sliderCon}>
-								<Slider class={styles.slider} max={270} min={45} v-model={speed.value}>
+								<Slider class={styles.slider} max={270} min={speed.value < 45 ? speed.value : 45} v-model={speed.value}>
 									{{
 										button: () => 
 										<div class={styles.customButton}>
-											<div class={styles.speedVal}>{ speed.value }</div>
+											<div class={styles.speedVal}>{ Math.floor(speed.value) }</div>
 											<div class={styles.speedBtn}></div>
 										</div>
 									}}
@@ -70,7 +74,7 @@ export default defineComponent({
 							<img src={headImg("addImg.png")} class={[styles.btn]} onClick={plusSpeed} />	
 						</div>
 						<div class={styles.speedSel}>
-							<div onClick={()=>{ speed.value = state.originSpeed }}>原速</div>
+							<div onClick={resetCurrentSpeed}>原速</div>
 							<div onClick={()=>{ speed.value = 70 }}>70</div>
 							<div onClick={()=>{ speed.value = 80 }}>80</div>
 							<div onClick={()=>{ speed.value = 90 }}>90</div>

+ 16 - 2
src/state.ts

@@ -234,11 +234,21 @@ export const musicalInstrumentCodeInfo = [
     id: 35
   },
   {
+    name: '葫芦丝',
+    code: 'Hulusi',
+    id: 35
+  },
+  {
     name: '口风琴',
     code: 'Nai',
     id: 36
   },
   {
+    name: '口风琴',
+    code: 'Melodica',
+    id: 36
+  },
+  {
     name: '德式竖笛',
     code: 'Tenor Recorder',
     id: 37
@@ -616,8 +626,9 @@ export const initSetPlayRate = () => {
 }
 
 // 重置播放倍率
-export const resetBaseRate = () => {
-  const currentItem: any = state.times[0];
+export const resetBaseRate = (idx?: number) => {
+  const index = idx ? idx : 0;
+  const currentItem: any = state.times[index];
   const currentSpeed = currentItem?.measureSpeed ? currentItem.measureSpeed : state.originSpeed;
   // console.log('速度2',currentSpeed)
   state.speed = currentSpeed
@@ -1624,12 +1635,15 @@ export const fillWordColor = () => {
   state.times.forEach((item: any, idx: number) => {
     const svgEl = document.getElementById(`vf-${state.times[idx]?.svgElement?.attrs?.id}`)
     const stemEl = document.getElementById(`vf-${state.times[idx]?.svgElement?.attrs?.id}-stem`)
+    const stemLine = document.getElementById(`vf-${state.times[idx]?.svgElement?.attrs?.id}-lines`)
     if ((item.i === state.activeNoteIndex || item.id === state.times[state.activeNoteIndex].id) && item.svgElement) {
       svgEl?.classList.add('noteActive')
       stemEl?.classList.add('noteActive')
+      stemLine?.classList.add('noteActive')
     } else {
       svgEl?.classList.remove('noteActive')
       stemEl?.classList.remove('noteActive')
+      stemLine?.classList.remove('noteActive')
     }
   })
 

文件差异内容过多而无法显示
+ 0 - 0
src/view/fingering/fingering-img/hulusi-flute/index.json


文件差异内容过多而无法显示
+ 0 - 0
src/view/fingering/fingering-img/pan-flute/index.json


+ 3 - 0
src/view/music-score/index.module.less

@@ -28,6 +28,9 @@
             fill: #FFC121;
             stroke: #FFC121;
         }
+        rect {
+            stroke: #FFC121;
+        }
         transform-box: fill-box;
         transform-origin: center;
         // animation: noteAnimate 0.3s linear;

+ 2 - 2
vite.config.ts

@@ -76,8 +76,8 @@ export default defineConfig({
         // target: "https://kt.colexiu.com",
         // target: "https://test.lexiaoya.cn",
         // target: "https://kt.colexiu.com",
-        // target: "https://dev.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
-        target: "https://test.kt.colexiu.com",
+        target: "https://dev.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
+        // target: "https://test.kt.colexiu.com",
         //target: "https://mec.colexiu.com",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),

部分文件因为文件数量过多而无法显示