Browse Source

fix: 评测报告bug修复

TIANYONG 11 months ago
parent
commit
abfd4588ee

+ 5 - 5
src/helpers/formateMusic.ts

@@ -971,17 +971,17 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			// }
 			
 			activeVerticalMeasureList = [note.sourceMeasure?.verticalMeasureList?.[0]] || [];
-
+			const currenrtVfVoices = activeVerticalMeasureList[0]?.vfVoices['1'] ? activeVerticalMeasureList[0]?.vfVoices['1'] : activeVerticalMeasureList[0]?.vfVoices['2'] ? activeVerticalMeasureList[0]?.vfVoices['2'] : null;
 			/**
 			 * TODO:多分轨合并的小节,音符可能没有id,此时就去其它分轨找
 			 */
 			const vmLength = note.sourceMeasure?.verticalMeasureList?.length
 			let currentVmIndex = 0;
-			let hasSvgElement = activeVerticalMeasureList[0]?.vfVoices['1']?.tickables[staveNoteIndex];
+			let hasSvgElement = currenrtVfVoices?.tickables[staveNoteIndex];
 			while (!hasSvgElement && vmLength > 1 && currentVmIndex <= vmLength - 1) {
 				currentVmIndex += 1;
 				activeVerticalMeasureList = [note.sourceMeasure?.verticalMeasureList?.[currentVmIndex]] || [];
-				hasSvgElement = activeVerticalMeasureList[0]?.vfVoices['1']?.tickables[staveNoteIndex];
+				hasSvgElement = currenrtVfVoices?.tickables[staveNoteIndex];
 			}
 
 			const { realValue } = iterator.currentTimeStamp;
@@ -1130,7 +1130,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			// console.log('relaEndtime',noteLength, relativeTime)
 			const fixedKey = note.fixedKey || 0;
 			// const svgElement = activeVerticalMeasureList[0]?.vfVoices["1"]?.tickables[si];
-			const svgElement = activeVerticalMeasureList[0]?.vfVoices['1']?.tickables[staveNoteIndex];
+			const svgElement = currenrtVfVoices?.tickables[staveNoteIndex];
 
 			// console.log('si',si,i)
 			// console.log(note.sourceMeasure.MeasureNumberXML,note,svgElement, NoteRealValue, measureLength)
@@ -1287,7 +1287,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			}		
 			nodeDetail.realKey = formatRealKey(note.halfTone - fixedKey * 12, nodeDetail);
 			nodeDetail.duration = nodeDetail.endtime - nodeDetail.time;
-			let tickables = activeVerticalMeasureList[0]?.vfVoices["1"]?.tickables || [];
+			let tickables = currenrtVfVoices?.tickables || [];
 			if ([121].includes(state.subjectId)) {
 				tickables = note.sourceMeasure.verticalSourceStaffEntryContainers;
 			}

File diff suppressed because it is too large
+ 1 - 0
src/page-instrument/view-detail/images/index.json


+ 19 - 12
src/page-instrument/view-detail/index.module.less

@@ -17,19 +17,26 @@
     overflow: hidden;
     --header-height: 80px;
     --pc-header-height: 72px;
-    &.practise{
-        background: url("./images/bg1.png") no-repeat;
-        background-size: 100% 100%;
-    }    
-    &.follow{
-        background: url("./images/bg3.png") no-repeat;
-        background-size: 100% 100%;
-    }    
-    &.evaluating{
-        background: url("./images/bg2.png") no-repeat;
-        background-size: 100% 100%;
+    // &.practise{
+    //     background: url("./images/bg1.png") no-repeat;
+    //     background-size: 100% 100%;
+    // }    
+    // &.follow{
+    //     background: url("./images/bg3.png") no-repeat;
+    //     background-size: 100% 100%;
+    // }    
+    // &.evaluating{
+    //     background: rgba(255, 255, 255, 0.2) url("./images/bg2.png") no-repeat;
+    //     background-size: 100% 100%;
+    // }
+    .pageBg {
+        position: absolute;
+        left: 0;
+        top: 0;
+        width: 100%;
+        height: 100%;
+        object-fit: cover; /* 保持宽高比 */
     }
-
     .headHeight {
         position: absolute;
         bottom: 0;

+ 6 - 0
src/page-instrument/view-detail/index.tsx

@@ -38,6 +38,7 @@ import { initSmoothAnimation } from "./smoothAnimation"
 import EmptyMusic, { isEmptyMusicShow } from "./emptyMusic"
 import { position } from "html2canvas/dist/types/css/property-descriptors/position";
 import Loading from "./loading"
+import bgJson from "./images/index.json";
 
 // const DelayCheck = defineAsyncComponent(() =>
 //   import('/src/page-instrument/evaluat-model/delay-check')
@@ -467,6 +468,11 @@ export default defineComponent({
           background: state.setting.camera ? `rgba(${state.setting.eyeProtection ? "253,244,229" : "255,255,255"} ,${state.setting.cameraOpacity / 100}) !important` : "",
         }}
       >
+        <img 
+          style={{opacity: state.setting.camera && state.modeType === 'evaluating' ? state.setting.cameraOpacity / 100 : 1}} 
+          class={styles.pageBg} 
+          src={state.modeType === 'practise' ? bgJson[1] : state.modeType === 'evaluating' ? bgJson[2] : state.modeType === 'follow' ? bgJson[3] : ''} 
+        />
         {/* 骨架屏 */}
         {/* <Transition name="van-fade">
           {detailData.skeletonLoading && (

+ 1 - 1
src/page-instrument/view-evaluat-report/component/share-top/index.module.less

@@ -420,7 +420,7 @@
 }
 
 .shiyiPopup {
-    background: #7AAEE0;
+    background: #B0D8FF;
     border-radius: 20px;
     width: 80vw;
     max-width: 460px;

+ 2 - 2
src/page-instrument/view-evaluat-report/component/share-top/index.tsx

@@ -466,7 +466,7 @@ export default defineComponent({
                   </div>
                   <div class={styles.item}>
                     <Note fill="#4BED98" />
-                    <span>绿色音符:演奏/时值正确</span>
+                    <span>绿色音符:演奏正确</span>
                   </div>
                   <div class={styles.item}>
                     <Note fill="#FFB900" />
@@ -504,7 +504,7 @@ export default defineComponent({
                   </div>
                   <div class={styles.itemTone}>
                     <i style={{ background: bgColors.right }}></i>
-                    <span>绿色音符:演奏/时值正确</span>
+                    <span>绿色音符:演奏正确</span>
                   </div>
                   <div class={styles.itemTone}>
                     <i style={{ background: bgColors.low }}></i>

+ 8 - 4
src/page-instrument/view-evaluat-report/index.tsx

@@ -64,6 +64,7 @@ export default defineComponent({
   setup() {
     const query: any = getQuery();
     const useedid = ref<string[]>([]);
+    const allNote = ref<any[]>([]);
     const scoreData = reactive({
       videoFilePath: "", // 回放视频路径
       cadence: 0,
@@ -259,7 +260,7 @@ export default defineComponent({
       const notes = filterNotes();
       // console.log(1111,notes)
       for (const note of notes) {
-        const active = state.times[note.index];
+        const active = allNote.value[note.musicalNotesIndex];
         setTimeout(() => {
           if (useedid.value.includes(active.id)) {
             return;
@@ -362,7 +363,7 @@ export default defineComponent({
     const setPathColor = () => {
       console.log(11111, detailData.musicalNotesPlayStats, scoreData.itemType);
       for (const note of detailData.musicalNotesPlayStats) {
-        const active = state.times[note.index];
+        const active = allNote.value[note.index];
         const svgEl = active?.id ? document.getElementById("vf-" + active?.id) : null;
         switch (scoreData.itemType) {
           case "intonation":
@@ -389,8 +390,11 @@ export default defineComponent({
     const handleRendered = (osmd: any) => {
       state.musicRendered = true;
       state.osmd = osmd;
-      state.times = formateTimes(osmd);
-      console.log("🚀 ~ state.times:", state.times);
+      allNote.value = formateTimes(osmd);
+      console.log("🚀 ~ state.times:", allNote.value);
+      // @ts-ignore
+      const startMeasureNum = detailData.musicalNotesPlayStats?.[0].measureRenderIndex, endMeasureNum = detailData.musicalNotesPlayStats?.last()?.measureRenderIndex;
+      allNote.value = allNote.value.filter((item: any) => (item.MeasureNumberXML >= startMeasureNum+1 && item.MeasureNumberXML <= endMeasureNum+1))
       // @ts-ignore
       const beams = Array.from(new Set(document.getElementsByClassName("vf-beam")));
       beams.forEach((item: any) => {

+ 1 - 1
src/view/music-score/index.tsx

@@ -96,7 +96,7 @@ export default defineComponent({
 				renderSingleHorizontalStaffline: state.isSingleLine ? true : false,
 				// autoGenerateMultipleRestMeasuresFromRestMeasures: state.isSingleLine ? false : true, // 连续休止小节是否合并显示
 				autoGenerateMultipleRestMeasuresFromRestMeasures: true,
-				drawLyrics: (state.playType === 'sing' && !state.isSimplePage) ? true : false, // 演唱模式才渲染歌词,simple页面不显示歌词
+				drawLyrics: ( ((!state.accompany && !state.music ) || state.playType === 'sing') && !state.isSimplePage) ? true : false, // 演唱模式才渲染歌词,simple页面不显示歌词
 				// darkMode: true, // 暗黑模式
 				// pageFormat: 'A4_P',
 				// autoBeam: true,

Some files were not shown because too many files changed in this diff