Преглед на файлове

feat: 指法逻辑修改

TIANYONG преди 11 месеца
родител
ревизия
91b96e6698
променени са 4 файла, в които са добавени 27 реда и са изтрити 18 реда
  1. 10 8
      src/page-instrument/view-detail/index.tsx
  2. 13 6
      src/state.ts
  3. 3 3
      src/view/audio-list/index.tsx
  4. 1 1
      src/view/fingering/fingering-config.ts

+ 10 - 8
src/page-instrument/view-detail/index.tsx

@@ -86,6 +86,8 @@ const setNoteHalfTone = (list: any[]) => {
 
 export const musicScoreRef = ref();
 
+export const headerColumnHide = ref(false); // 是否隐藏功能按钮,播放时自动隐藏
+
 export default defineComponent({
   name: "music-list",
   setup() {
@@ -296,7 +298,7 @@ export default defineComponent({
         if (state.fingeringInfo.direction === "transverse") {
           return {
             container: {
-              paddingBottom: detailData.headerHide ? state.fingeringInfo.height : state.fingeringInfo.scaleData?.offset
+              paddingBottom: headerColumnHide.value ? state.fingeringInfo.height : state.fingeringInfo.scaleData?.offset
             },
             // 横向指法,跟练&评测模式,默认展示贴底展示
             fingerBox: (state.modeType === 'follow' || state.modeType === 'evaluating') ? 
@@ -306,7 +308,7 @@ export default defineComponent({
               bottom: 0,
               width: '100%'
             } : 
-            detailData.headerHide ? {
+            headerColumnHide.value ? {
               height: state.fingeringInfo.height
             } : {
               height: state.fingeringInfo.height,
@@ -389,9 +391,9 @@ export default defineComponent({
       () => state.playState,
       () => {
         // if (state.platform != IPlatform.PC) {
-        //   detailData.headerHide = state.playState === "play" ? true : false;
+        //   headerColumnHide.value = state.playState === "play" ? true : false;
         // }
-        detailData.headerHide = state.playState === "play" ? true : false;
+        headerColumnHide.value = state.playState === "play" ? true : false;
         sendParentMessage(state.playState);
       }
     );
@@ -399,7 +401,7 @@ export default defineComponent({
     watch(
       () => followData.start,
       () => {
-        detailData.headerHide = followData.start;
+        headerColumnHide.value = followData.start;
       }
     );
     /** 指法预览切换 */
@@ -494,7 +496,7 @@ export default defineComponent({
         {/** 功能按钮 */}
         {
           !state.isPreView && 
-          <div class={[styles.headHeight, detailData.headerHide && styles.headHide]}>{state.musicRendered && <HeaderTop />}</div>
+          <div class={[styles.headHeight, headerColumnHide.value && styles.headHide]}>{state.musicRendered && <HeaderTop />}</div>
         }
         <div
           id="scrollContainer"
@@ -503,11 +505,11 @@ export default defineComponent({
           onClick={(e: Event) => {
             e.stopPropagation();
             // if (state.playState === "play" && state.platform != IPlatform.PC) {
-            //   detailData.headerHide = !detailData.headerHide;
+            //   headerColumnHide.value = !headerColumnHide.value;
             // }
             // 点击谱面跟练也需要切换显示按钮栏
             if (state.playState === "play" || followData.start) {
-              detailData.headerHide = !detailData.headerHide;
+              headerColumnHide.value = !headerColumnHide.value;
             }
           }}
         >

+ 13 - 6
src/state.ts

@@ -18,7 +18,7 @@ import { changeSongSourceByBate } from "/src/view/audio-list"
 import { moveSmoothAnimation, smoothAnimationState, moveSmoothAnimationByPlayTime, moveTranslateXNum, destroySmoothAnimation, calcClientWidth } from "/src/page-instrument/view-detail/smoothAnimation"
 import { storeData } from "/src/store";
 import { downloadXmlStr } from "./view/music-score"
-import { musicScoreRef } from "/src/page-instrument/view-detail/index"
+import { musicScoreRef, headerColumnHide } from "/src/page-instrument/view-detail/index"
 import { headTopData } from "/src/page-instrument/header-top/index";
 
 const query: any = getQuery();
@@ -637,11 +637,18 @@ export const onEnded = () => {
 
 // 根据当前小节动态设置,右上角展示的速度
 const dynamicShowPlaySpeed = (index: number) => {
-  const item: any = state.times[index];
-  if (item && item.measureSpeed ) {
-    // console.log('速度1',item.measureSpeed)
-    state.speed = Math.floor(state.basePlayRate * item.measureSpeed)
+  if (!headerColumnHide.value) {
+    console.log('动态计算速度')
+    const item: any = state.times[index];
+    if (item && item.measureSpeed ) {
+      // console.log('速度1',item.measureSpeed)
+      const newSpeed = Math.floor(state.basePlayRate * item.measureSpeed)
+      if (state.speed !== newSpeed) {
+        state.speed = newSpeed;
+      }
+    }
   }
+
 }
 
 // 开始播放时,计算mp3的播放倍率
@@ -1336,7 +1343,7 @@ const getMusicInfo = async (res: any) => {
   const realTrack = musicalInstrumentId && res.data?.musicalInstruments?.length ? res.data?.musicalInstruments.find((item: any) => item?.id == musicalInstrumentId)?.code?.split(',')?.[0] : '';
   const musicInfo = {
     ...res.data,
-    track: realTrack
+    track: res.data.musicSheetType === 'CONCERT' ? track : realTrack
   };
   console.log("🚀 ~ musicInfo:", musicInfo);
   setState(musicInfo, index);

+ 3 - 3
src/view/audio-list/index.tsx

@@ -269,9 +269,9 @@ export default defineComponent({
 			const time = currentTime / 1000;
 			audioData.progress = time;
 			tickAnimate(time);
-			audioData.songEle && (audioData.songEle.currentTime = time);
-			audioData.backgroundEle && (audioData.backgroundEle.currentTime = time);
-			audioData.mingSongEle && (audioData.mingSongEle.currentTime = time);
+			// audioData.songEle && (audioData.songEle.currentTime = time);
+			// audioData.backgroundEle && (audioData.backgroundEle.currentTime = time);
+			// audioData.mingSongEle && (audioData.mingSongEle.currentTime = time);
 			audioData.duration = total / 1000;
 			if (
 				res?.content?.totalDuration > 1000 &&

+ 1 - 1
src/view/fingering/fingering-config.ts

@@ -338,7 +338,7 @@ export const matchVoicePart = (id: number | string, type: "SINGLE" | "CONCERT"):
       code = code.toLocaleLowerCase().replace(/ /g, "");
       for (let sKey in subject) {
         let pitchKey = sKey;
-        if (typeof sKey === "string") {
+        if (typeof sKey === "string" && isNaN(Number(sKey)) ) {
           pitchKey = pitchKey.toLocaleLowerCase().replace(/ /g, "");
           pitchKey = pitchKey.replace(/[_0-9]+$/, '');
         }