Prechádzať zdrojové kódy

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

TIANYONG 8 mesiacov pred
rodič
commit
f56da4887a

+ 3 - 1
src/helpers/formateMusic.ts

@@ -1218,6 +1218,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			if (svgElement?.modifiers?.length) {
 				hasGraceNote = svgElement?.modifiers.some((item: any) => item?.attrs?.type === "GraceNoteGroup")
 			}
+			const filterRepeatIdx = allNotes.filter((item: any) => item.noteId === note.NoteToGraphicalNoteObjectId).length
 			const nodeDetail = {
 				isStaccato: note.voiceEntry.isStaccato(),
 				isRestFlag: note.isRestFlag,
@@ -1265,7 +1266,8 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 				totalMultipleRestMeasures, // 当前小节总的合并小节数
 				measureSpeed,  // 小节速度
 				maxNoteNum: note.maxNoteNum, // 当前小节音符最多的分轨的音符数量
-				repeatIdx: iterator.repeatIdx || 0, // 标记是第几遍循环,从0开始
+				// repeatIdx: iterator.repeatIdx || 0, // 标记是第几遍循环,从0开始
+				repeatIdx: filterRepeatIdx,
 				xmlNoteTime: retain(xmlNoteTime), // xml上音符开始时间 唱名用
 				xmlNoteEndTime: retain(xmlNoteTime + noteLength), //xml上音符结束时间 唱名用
 				xmlMp3BeatFixTime,  //xml上节拍器的时间

+ 14 - 14
src/page-instrument/header-top/index.module.less

@@ -56,16 +56,20 @@
         margin-left: 10px;
         &.isMusicList{
             :global{
-                .van-notice-bar .van-notice-bar__content::after{
-                    position: absolute;
-                    top: 50%;
-                    right: 0;
-                    transform: translateY(-50%);
-                    content: "";
-                    width: 11px;
-                    height: 6px;
-                    background: url("./image/sj.png") no-repeat;
-                    background-size: 100% 100%;                         
+                .van-notice-bar{
+                    &::after{
+                        max-width: calc(216px + 16px);
+                        position: absolute;
+                        top: 0;
+                        left: 0;
+                        content: "";
+                        width: calc(var(--noticeBarWidth,100%) + 16px);
+                        height: 100%;
+                        background: url("./image/sj.png") no-repeat;
+                        background-size: 9px 6px;
+                        background-position: center right;                   
+                    }
+                    
                 }
             }
         }
@@ -77,10 +81,6 @@
                 font-weight: 600;
                 font-size: 18px;
                 color: #FFFFFF;
-                .van-notice-bar__content{
-                    position: relative;
-                    padding-right: 16px;
-                }
             }
         }
     }

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

@@ -1,4 +1,4 @@
-import { Transition, computed, defineComponent, onMounted, onUnmounted, reactive, ref, watch, toRef, ComputedRef } from "vue";
+import { Transition, computed, defineComponent, onMounted, onUnmounted, reactive, ref, watch, toRef, ComputedRef, nextTick } from "vue";
 import styles from "./index.module.less";
 
 import iconBack from "./image/icon-back.png";
@@ -494,7 +494,10 @@ export default defineComponent({
       /** 作业模式 end */
       if (state.defaultModeType == 1) {
         headTopData.handleChangeModeType("practise");
-        if (state.platform === IPlatform.PC || state.isPreView) {
+        // if (state.platform === IPlatform.PC || state.isPreView) {
+        //   headTopData.showBack = false;
+        // }
+        if (state.isPreView) {
           headTopData.showBack = false;
         }
       } else {
@@ -555,7 +558,16 @@ export default defineComponent({
     onUnmounted(() => {
       window.removeEventListener("message", changePlay);
     });
-
+    const noticeBarWidth = ref<number>()
+    watch(()=>smoothAnimationState.isShow.value, ()=>{
+      // NoticeBar能不能滚动
+      if(smoothAnimationState.isShow.value && isMusicList.value){
+        nextTick(()=>{
+          const widthCon = (document.querySelector("#noticeBarRollDom .van-notice-bar__content") as any)?.offsetWidth || undefined
+          noticeBarWidth.value = widthCon
+        })
+      }
+    },{ immediate: true })
     // 设置改变触发
     watch(state.setting, () => {
       console.log(state.setting, "state.setting");
@@ -608,11 +620,18 @@ export default defineComponent({
           {/* 返回和标题 */}
           {
             !(state.playState == "play" || followData.start || evaluatingData.startBegin) &&
-              <div class={styles.headTopLeftBox}>
+              <div id="noticeBarRollDom" class={styles.headTopLeftBox}>
                 <img src={iconBack} class={['headTopBackBtn', styles.img, !headTopData.showBack && styles.hidenBack]} onClick={handleBack} />
                 {
                   smoothAnimationState.isShow.value ?
-                    <div class={[styles.title,isMusicList.value && styles.isMusicList, "driver-8"]} onClick={()=>{
+                    <div 
+                      style={
+                        noticeBarWidth.value ? {
+                          "--noticeBarWidth":noticeBarWidth.value + "px"
+                        } : {}
+                      }
+                      class={[styles.title,isMusicList.value && styles.isMusicList, "driver-8"]} 
+                      onClick={()=>{
                         isMusicList.value && (musicListShow.value = true)
                       }}>
                         <NoticeBar

+ 2 - 2
src/page-instrument/view-detail/smoothAnimation/bird/index.module.less

@@ -3,7 +3,7 @@
 }
 .note{
     position: absolute;
-    width: 40Px;
+    width: 54Px;
     top: -16Px;
-    left: -28Px;
+    left: -38Px;
 }

+ 2 - 2
src/page-instrument/view-detail/smoothAnimation/index.less

@@ -12,8 +12,8 @@
         position: relative;
         .smoothBot{
             position: absolute;
-            width: 40Px;
-            height: 50Px;
+            width: 36Px;
+            height: 46Px;
             left: 0;
             top: 0;
         }

+ 3 - 3
src/page-instrument/view-detail/smoothAnimation/index.ts

@@ -162,8 +162,8 @@ export function moveSmoothAnimation(progress: number, activeIndex: number, isMov
    // 移动
    smoothAnimationMove(
       {
-         x: nowPointsPos.x - 20,
-         y: nowPointsPos.y - 25
+         x: nowPointsPos.x - 18,
+         y: nowPointsPos.y - 23
       },
       smoothAnimationState.pointsPos,
       smoothAnimationState.pointsPos.slice(0, nowIndex)
@@ -468,7 +468,7 @@ function createSmoothCurvePoints(pointsPos: pointsPosType, tension?: number, clo
  * 根据坐标划线
  */
 function drawSmoothCurve(context: CanvasRenderingContext2D, pointsPos: pointsPosType, progresspointsPos?: pointsPosType) {
-   context.lineWidth = 4
+   context.lineWidth = 2
    context.lineJoin = 'round';// 优化锯齿
    context.lineCap = 'round'; // 优化锯齿
    context.strokeStyle = "rgba(255,255,255,0.6)"

+ 4 - 3
src/state.ts

@@ -1533,9 +1533,9 @@ const setState = (data: any, index: number) => {
   let pitchTrack = null
   if (state.isConcert) {
     musicalCode = musicalInstrumentCodeInfo.find((item: any) => item.id === state.musicalCodeId)?.code
-    pitchTrack = data.musicalInstruments?.find((item: any) => item.code === musicalCode)
+    pitchTrack = data.musicalInstruments?.find((item: any) => item.code?.split(',')[0] === musicalCode)
   } else {
-    pitchTrack = data.musicalInstruments?.find((item: any) => item.code === musicalCode)
+    pitchTrack = data.musicalInstruments?.find((item: any) => item.code?.split(',')[0] === musicalCode)
   }
   let musicalRenderType = ''
   // if (pitchTrack?.defaultScore) {
@@ -1703,7 +1703,8 @@ export const fillWordColor = () => {
   })
   const currentLyrics: SVGAElement[] = Array.from(document.querySelectorAll(`.lyric${currentNote?.noteId}`));
   currentLyrics.forEach((lyric, index) => {
-    if (index === currentNote.repeatIdx) {
+    const lyricIndex = lyric.getAttribute('lyricIndex');
+    if ((index === currentNote.repeatIdx && currentNote.repeatIdx + 1 == lyricIndex) || (currentNote.repeatIdx > 0 && currentNote.formatLyricsEntries?.length === 1)) {
       lyric?.classList.add('lyricActive')
     }
   })

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

@@ -273,6 +273,8 @@ export const matchVoicePart = (id: number | string, type: "SINGLE" | "CONCERT"):
       "Bass Clarinet in Bb": 4,
       Bassoon: 1,
       "Alto Saxophone": 5,
+      "Alto Saxophone1": 5,
+      "Alto Saxophone2": 5,
       "Tenor Saxophone": 5,
       "Baritone Saxophone": 5,
       "Trumpet in Bb 1": 12,
@@ -338,7 +340,13 @@ 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") pitchKey = pitchKey.toLocaleLowerCase().replace(/ /g, "");
+        if (typeof sKey === "string") {
+          pitchKey = pitchKey.toLocaleLowerCase().replace(/ /g, "");
+        }
+        if (typeof sKey === "string") {
+          // 去掉声轨后面的数字
+          code = code.replace(/[_0-9]+$/, '');
+        }
         if (pitchKey === code) {
           _track = subject[sKey];
           break;