Browse Source

Merge branch 'feature-tianyong-newVersion' of http://git.dayaedu.com/liushengqiang/music-score into hqyDevNewVersion

黄琪勇 11 months ago
parent
commit
692c9dba64

+ 35 - 33
src/helpers/customMusicScore.ts

@@ -534,39 +534,41 @@ export const resetFormate = () => {
 		};
 		};
 
 
 		// 给小节添加背景色
 		// 给小节添加背景色
-		staves.forEach((stave: any) => {
-			const list = [
-				Array.from(stave?.querySelectorAll(".vf-StaveSection") || []),
-				Array.from(stave?.querySelectorAll(".vf-Volta") || []),
-				Array.from(stave?.querySelectorAll(".vf-clef") || []),
-				Array.from(stave?.querySelectorAll(".vf-keysignature") || []),
-				Array.from(stave?.querySelectorAll(".vf-Repetition") || []),
-				Array.from(stave?.getElementsByTagName("text") || []),
-			].flat();
-			try {
-				if (list.length) {
-					list.forEach((_el: any) => {
-						stave?.removeChild(_el)
-						_el?.style?.setProperty("display", "none");
-					});
-				}
-			} catch (error) {}
-			const bbox = stave?.getBBox() || {};
-			const rect = `<rect class="vf-custom-bg" x="${bbox.x}" y="${bbox.y}" width="${bbox.width}" height="${bbox.height}" fill="#609FCF" />`
-			const rectBottom = `<rect class="vf-custom-bot" x="${bbox.x}" y="${bbox.y+bbox.height}" width="${bbox.width}" height="12" fill="#2B70A5" />`
-			const customG = `<g>${rect}${rectBottom}</g>`
-			try {
-				if (list.length) {
-					list.forEach((_el: any) => {
-						stave?.appendChild(_el)
-						_el?.style?.removeProperty("display");
-					});
-				}
-			} catch (error) {}
-			stave.innerHTML = customG + stave.innerHTML;
-		});
-		
-		state.vfmeasures = state.vfmeasures.concat(vfmeasures);
+		if (!state.isCreateImg) {
+			staves.forEach((stave: any) => {
+				const list = [
+					Array.from(stave?.querySelectorAll(".vf-StaveSection") || []),
+					Array.from(stave?.querySelectorAll(".vf-Volta") || []),
+					Array.from(stave?.querySelectorAll(".vf-clef") || []),
+					Array.from(stave?.querySelectorAll(".vf-keysignature") || []),
+					Array.from(stave?.querySelectorAll(".vf-Repetition") || []),
+					Array.from(stave?.getElementsByTagName("text") || []),
+				].flat();
+				try {
+					if (list.length) {
+						list.forEach((_el: any) => {
+							stave?.removeChild(_el)
+							_el?.style?.setProperty("display", "none");
+						});
+					}
+				} catch (error) {}
+				const bbox = stave?.getBBox() || {};
+				const rect = `<rect class="vf-custom-bg" x="${bbox.x}" y="${bbox.y}" width="${bbox.width}" height="${bbox.height}" fill="#609FCF" />`
+				const rectBottom = `<rect class="vf-custom-bot" x="${bbox.x}" y="${bbox.y+bbox.height}" width="${bbox.width}" height="12" fill="#2B70A5" />`
+				const customG = `<g>${rect}${rectBottom}</g>`
+				try {
+					if (list.length) {
+						list.forEach((_el: any) => {
+							stave?.appendChild(_el)
+							_el?.style?.removeProperty("display");
+						});
+					}
+				} catch (error) {}
+				stave.innerHTML = customG + stave.innerHTML;
+			});
+			state.vfmeasures = state.vfmeasures.concat(vfmeasures);
+		}
+
 	}
 	}
 	
 	
 	// setTimeout(() => this.resetGlobalText());
 	// setTimeout(() => this.resetGlobalText());

+ 3 - 3
src/page-instrument/evaluat-model/evaluat-result/index.tsx

@@ -164,10 +164,10 @@ export default defineComponent({
               <div class={styles.tips}>{evaluatingData.resultData.clxtip}</div>
               <div class={styles.tips}>{evaluatingData.resultData.clxtip}</div>
               <div class={styles.ctrls}>
               <div class={styles.ctrls}>
                 <img src={zlycImg} class={[styles.ctrlsBtn, "evaluting-result-2"]} onClick={() => emit("close", "tryagain")} />
                 <img src={zlycImg} class={[styles.ctrlsBtn, "evaluting-result-2"]} onClick={() => emit("close", "tryagain")} />
-                {!state.isHideEvaluatReportSaveBtn && evaluatingData.resultData.recordId ? (
+                {evaluatingData.resultData.recordId ? (
                   <div class={styles.saveBtn}>
                   <div class={styles.saveBtn}>
-                    <img src={noSaveTips.value ? bczpJzImg : bczpImg} class={[styles.ctrlsBtn, "evaluting-result-3"]} onClick={() => {
-                      if (!noSaveTips.value) {
+                    <img src={noSaveTips.value ? bczpJzImg : bczpImg} class={[styles.ctrlsBtn, "evaluting-result-3"]} style={{ opacity: state.isHideEvaluatReportSaveBtn ? 0.4 : 1 }} onClick={() => {
+                      if (!noSaveTips.value && !state.isHideEvaluatReportSaveBtn) {
                         saveResult()
                         saveResult()
                       }
                       }
                     }} />
                     }} />

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

@@ -295,4 +295,11 @@
             max-width: 220px;
             max-width: 220px;
         }
         }
     }
     }
+}
+
+.hiddenPop {
+    width: 1px;
+    height: 1px;
+    overflow: hidden;
+    opacity: 0;
 }
 }

+ 19 - 0
src/page-instrument/header-top/modeView.tsx

@@ -13,6 +13,9 @@ import state from "/src/state"
 import { studentQueryUserInfo } from "../api"
 import { studentQueryUserInfo } from "../api"
 import { usePageVisibility } from "@vant/use"
 import { usePageVisibility } from "@vant/use"
 import { Vue3Lottie } from "vue3-lottie";
 import { Vue3Lottie } from "vue3-lottie";
+import { popImgs, hanldeConfirmPop, hanldeClosePop, evaluatingData } from "/src/view/evaluating"
+import { Popup } from "vant";
+import AbnormalPop from "/src/view/abnormal-pop";
 
 
 export default defineComponent({
 export default defineComponent({
    name: "modeView",
    name: "modeView",
@@ -82,6 +85,16 @@ export default defineComponent({
       onMounted(() => {
       onMounted(() => {
          openGuid()
          openGuid()
       })
       })
+      watch(
+         () => evaluatingData.socketErrorStatus,
+         () => {
+           if (evaluatingData.socketErrorStatus === 2) {
+             setTimeout(() => {
+               evaluatingData.socketErrorPop = false;
+             }, 1000);
+           }
+         }
+       );      
       return () => (
       return () => (
          <div class={[styles.modeView, headTopData.modeType !== "init" && styles.hidden]}>
          <div class={[styles.modeView, headTopData.modeType !== "init" && styles.hidden]}>
             <img
             <img
@@ -110,6 +123,12 @@ export default defineComponent({
                }
                }
             </div>
             </div>
             {data.showVip && <TheVip />}
             {data.showVip && <TheVip />}
+            {/** 延迟检测中途,socket出错,网络提示弹窗 */}
+            <div>
+               <Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={evaluatingData.socketErrorPop}>
+                  <AbnormalPop onConfirm={hanldeConfirmPop} onClose={hanldeClosePop} />
+               </Popup>
+            </div>            
          </div>
          </div>
       )
       )
    }
    }

+ 7 - 0
src/state.ts

@@ -545,6 +545,8 @@ const state = reactive({
   noSavePopShow: true,
   noSavePopShow: true,
   /** xml里面是否有歌词 */
   /** xml里面是否有歌词 */
   xmlHasLyric: false,
   xmlHasLyric: false,
+  /** 生成图片的模式 */
+  isCreateImg: false,
 });
 });
 const browserInfo = browser();
 const browserInfo = browser();
 let offset_duration = 0;
 let offset_duration = 0;
@@ -1756,6 +1758,11 @@ watch(
       if (measureNum >= 0 && (measureNum === state.activeMeasureIndex || (measureNum < state.activeMeasureIndex && nextMeasureNum > state.activeMeasureIndex)) ) {
       if (measureNum >= 0 && (measureNum === state.activeMeasureIndex || (measureNum < state.activeMeasureIndex && nextMeasureNum > state.activeMeasureIndex)) ) {
         item.querySelector('.vf-custom-bg')?.setAttribute("fill", "#132D4C")
         item.querySelector('.vf-custom-bg')?.setAttribute("fill", "#132D4C")
         item.querySelector('.vf-custom-bot')?.setAttribute("fill", "#040D1E")
         item.querySelector('.vf-custom-bot')?.setAttribute("fill", "#040D1E")
+        // 预备小节
+        if(state.sectionFirst && measureNum === state.sectionFirst.MeasureNumberXML){
+          item?.querySelector('.vf-custom-bg')?.setAttribute("fill", "#71B8BD")
+          item?.querySelector('.vf-custom-bot')?.setAttribute("fill", "#448F9C")
+        }
       } else {
       } else {
         // 有选段只清除选段处的
         // 有选段只清除选段处的
         if (state.section.length === 2) {
         if (state.section.length === 2) {

+ 7 - 4
src/view/evaluating/index.tsx

@@ -653,7 +653,6 @@ const handleSocketStatus = (res?: IPostMessage) => {
     const diffTime = currentTime - socketStartTime;
     const diffTime = currentTime - socketStartTime;
     if (diffTime < 1000) {
     if (diffTime < 1000) {
       const remainingTime = 1000 - diffTime;
       const remainingTime = 1000 - diffTime;
-      console.log(remainingTime, 99999);
       setTimeout(() => {
       setTimeout(() => {
         evaluatingData.socketErrorStatus = 2;
         evaluatingData.socketErrorStatus = 2;
       }, remainingTime);
       }, remainingTime);
@@ -662,14 +661,14 @@ const handleSocketStatus = (res?: IPostMessage) => {
 };
 };
 
 
 // 评测出现异常,再试一次
 // 评测出现异常,再试一次
-const hanldeConfirmPop = async () => {
+export const hanldeConfirmPop = async () => {
   api_checkSocketStatus();
   api_checkSocketStatus();
   evaluatingData.socketErrorStatus = 1;
   evaluatingData.socketErrorStatus = 1;
   socketStartTime = +new Date();
   socketStartTime = +new Date();
 };
 };
 
 
 // 关闭异常弹窗
 // 关闭异常弹窗
-const hanldeClosePop = () => {
+export const hanldeClosePop = () => {
   evaluatingData.socketErrorPop = false;
   evaluatingData.socketErrorPop = false;
   evaluatingData.socketErrorStatus = 0;
   evaluatingData.socketErrorStatus = 0;
 };
 };
@@ -771,7 +770,11 @@ export default defineComponent({
       api_remove_recordStartTime(recordStartTimePoint);
       api_remove_recordStartTime(recordStartTimePoint);
       handle_reduction();
       handle_reduction();
       removeAccompanyError(handleAccompanyError);
       removeAccompanyError(handleAccompanyError);
-      removeSocketStatus(handleSocketStatus);
+      if (evaluatingData.socketErrorPop && state.setting.soundEffect) {
+        console.log('延迟检测出错')
+      } else {
+        removeSocketStatus(handleSocketStatus);
+      }
       api_disconnectSocket();
       api_disconnectSocket();
       console.log("卸载评测模块成功");
       console.log("卸载评测模块成功");
     });
     });

+ 6 - 4
src/view/music-score/index.module.less

@@ -43,10 +43,12 @@
             stroke: #FFC121;
             stroke: #FFC121;
         }
         }
     }
     }
-    .vf-stave {
-        >path {
-            fill: rgba(255,255,255,0.5);
-            stroke: rgba(255,255,255,0.5);
+    .blueMusicXml {
+        .vf-stave {
+            >path {
+                fill: rgba(255,255,255,0.5);
+                stroke: rgba(255,255,255,0.5);
+            }
         }
         }
     }
     }
     .vf-custom-rect {
     .vf-custom-rect {

+ 4 - 2
src/view/music-score/index.tsx

@@ -94,7 +94,8 @@ export default defineComponent({
 				defaultColorMusic: props.musicColor, // 颜色
 				defaultColorMusic: props.musicColor, // 颜色
 				// pageBackgroundColor: '#609FCF',
 				// pageBackgroundColor: '#609FCF',
 				renderSingleHorizontalStaffline: state.isSingleLine ? true : false,
 				renderSingleHorizontalStaffline: state.isSingleLine ? true : false,
-				autoGenerateMultipleRestMeasuresFromRestMeasures: state.isSingleLine ? false : true, // 连续休止小节是否合并显示
+				// autoGenerateMultipleRestMeasuresFromRestMeasures: state.isSingleLine ? false : true, // 连续休止小节是否合并显示
+				autoGenerateMultipleRestMeasuresFromRestMeasures: true,
 				drawLyrics: (state.playType === 'sing' && !state.isSimplePage) ? true : false, // 演唱模式才渲染歌词,simple页面不显示歌词
 				drawLyrics: (state.playType === 'sing' && !state.isSimplePage) ? true : false, // 演唱模式才渲染歌词,simple页面不显示歌词
 				// darkMode: true, // 暗黑模式
 				// darkMode: true, // 暗黑模式
 				// pageFormat: 'A4_P',
 				// pageFormat: 'A4_P',
@@ -217,7 +218,8 @@ export default defineComponent({
 				class={[
 				class={[
 					isInTheGradualRange.value && styles.inGradualRange,
 					isInTheGradualRange.value && styles.inGradualRange,
 					state.musicRenderType == EnumMusicRenderType.staff ? "staff" : "jianpuTone",
 					state.musicRenderType == EnumMusicRenderType.staff ? "staff" : "jianpuTone",
-					state.isSingleLine && "singleLineMusicBox"
+					state.isSingleLine && "singleLineMusicBox",
+					!state.isCreateImg ? "blueMusicXml" : ""
 				]}
 				]}
 			>
 			>
 				{slots.default?.()}
 				{slots.default?.()}

+ 2 - 3
src/view/selection/index.module.less

@@ -138,9 +138,8 @@
     width: 20px;
     width: 20px;
     height: 20px;
     height: 20px;
     border-radius: 50%;
     border-radius: 50%;
-    background-color: rgb(255, 145, 0);
-    color: #fff;
-    font-weight: bold;
+    background-color: #FFC121;
+    color: #673207;
     font-size: 14px;
     font-size: 14px;
 }
 }
 
 

+ 1 - 1
src/view/transfer-to-img/index.module.less

@@ -29,4 +29,4 @@
             max-height: initial !important;
             max-height: initial !important;
         }
         }
     }
     }
-}
+}

+ 1 - 0
src/view/transfer-to-img/index.tsx

@@ -41,6 +41,7 @@ export default defineComponent({
 
 
 		onMounted(() => {
 		onMounted(() => {
 			(window as any).appName = "colexiu";
 			(window as any).appName = "colexiu";
+			state.isCreateImg = true;
 			state.isEvxml = true;
 			state.isEvxml = true;
 			state.xmlUrl = decodeURIComponent(query.xmlUrl);
 			state.xmlUrl = decodeURIComponent(query.xmlUrl);
 			const specialXmls = ['https://oss.dayaedu.com/MECMP/1715332965751.xml','https://oss.dayaedu.com/MECMP/1715326622946.xml'];
 			const specialXmls = ['https://oss.dayaedu.com/MECMP/1715332965751.xml','https://oss.dayaedu.com/MECMP/1715326622946.xml'];