Browse Source

fix: 评测bug修复

TIANYONG 11 months ago
parent
commit
cefa47a48e

+ 1 - 1
src/helpers/customMusicScore.ts

@@ -558,7 +558,7 @@ export const resetFormate = () => {
 				} 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 rectBottom = `<rect class="vf-custom-bot" x="${bbox.x}" y="${bbox.y+bbox.height}" width="${bbox.width}" height="7.5" fill="#2B70A5" />`
 				const customG = `<g>${rect}${rectBottom}</g>`
 				try {
 					if (list.length) {

+ 2 - 2
src/page-instrument/component/authorName/index.module.less

@@ -1,5 +1,5 @@
 .authorName{
-    height: 2.4rem;
+    height: 1.8rem;
 }
 .title{
     width: 216px;
@@ -10,7 +10,7 @@
             line-height: 30px;
             padding: 0;
             font-weight: 600;
-            font-size: 18px;
+            font-size: 22px;
             color: #FFFFFF;
             .van-notice-bar__wrap{
                 justify-content: center;

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

@@ -66,6 +66,7 @@ export default defineComponent({
         playTime: evaluatingData.resultData.playTime / 1000, // 播放时长
         heardLevel: state.setting.evaluationDifficulty, // 听力等级
         recordFilePath: evaluatingData.resultData.url, // 录音文件路径
+        delFlag: evaluatingData.oneselfCancleEvaluating
       };
       data.saveLoading = true;
       const res = await api_musicPracticeRecordSave(body);

+ 24 - 4
src/page-instrument/evaluat-model/index.tsx

@@ -1,5 +1,5 @@
 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 { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone, handleCancelEvaluat, checkMinInterval } from "/src/view/evaluating";
 import Earphone from "./earphone";
 import styles from "./index.module.less";
 import SoundEffect from "./sound-effect";
@@ -418,6 +418,7 @@ export default defineComponent({
       evaluatingData.socketErrorPop = false;
       if (res?.content) {
         evaluatingData.checkEnd = true;
+        state.setting.soundEffect = false;
         checkEarphoneStatus();
       }
     };
@@ -431,9 +432,20 @@ export default defineComponent({
 			return evaluatingData.earphoneMode && !state.isLoading && !state.hasDriverPop;
 		});
 
+    watch(
+      () => state.setting.soundEffect,
+      (val) => {
+        if (val) {
+          headTopData.settingMode = false
+          api_startDelayCheck({});
+        }
+      }
+    );
+
     onMounted(async () => {
       // 如果打开了延迟检测开关,需要先发送开始检测的消息
-      if (state.setting.soundEffect) {
+      const delayData = await api_getDeviceDelay();
+      if (state.setting.soundEffect || (delayData && delayData.content?.value < 0)) {
         await api_startDelayCheck({});
       } else {
         evaluatingData.checkEnd = true;
@@ -466,8 +478,16 @@ export default defineComponent({
           )}
           {evaluatingData.websocketState && evaluatingData.startBegin && (
             <>
-              <img class={styles.iconBtn} src={headImg("icon_reset.png")} onClick={() => handleEvaluatResult("selfCancel")} />
-              <img class={styles.iconBtn} src={headImg("submit.png")} onClick={() => handleEndBegin()} />
+              <img class={styles.iconBtn} src={headImg("icon_reset.png")} onClick={() => {
+                // 校验评测最小间隔时间
+                checkMinInterval()
+                handleEvaluatResult("selfCancel")
+              }} />
+              <img class={styles.iconBtn} src={headImg("submit.png")} onClick={() => {
+                // 校验评测最小间隔时间
+                checkMinInterval()
+                handleEndBegin()
+              }} />
             </>
           )}
         </div>

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

@@ -87,7 +87,7 @@ export default defineComponent({
                                     </div>   
                                 }                     
                                 <div class={styles.cellBox}>
-                                    <div class={styles.tit}>延迟检测</div>
+                                    <div class={styles.tit}>重新延迟检测</div>
                                     <Switch v-model={state.setting.soundEffect}></Switch>
                                 </div> 
                                 <div class={[styles.cellBox, state.setting.camera && styles.isCamera]}>

+ 3 - 0
src/page-instrument/view-detail/index.module.less

@@ -50,6 +50,9 @@
             :global{
                 .practiseModeWarn{
                     opacity: 1;
+                    img {
+                        opacity: 0.7;
+                    }
                 }
             }
         }

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

@@ -107,7 +107,9 @@ export const evaluatingData = reactive({
 	jsonLoadDone: true, // 延迟检测的动画dom加载完成状态
 	hideResultModal: false, // 评测作业,如果不是完整评测,需要隐藏评测结果弹窗
 	oneselfCancleEvaluating: false, // 是否是自主取消评测,自主取消评测,不生产评测记录
-	isBeginMask: false // 倒计时和系统节拍器时候的遮罩,防止用户点击
+	isBeginMask: false, // 倒计时和系统节拍器时候的遮罩,防止用户点击,
+  recordingTime: 0, // 调用startRecording的时间 
+  endEvaluatingTime: 0, // 调用endEvaluating的时间 
 });
 
 const sendOffsetTime = async (offsetTime: number) => {
@@ -305,9 +307,9 @@ export const addMeasureScore = (measureScore: any, show = true) => {
 const handleScoreResult = (res?: IPostMessage) => {
   console.log("返回", res, evaluatingData.oneselfCancleEvaluating);
   // 如果是手动取消评测,不生成评测记录
-  if (evaluatingData.oneselfCancleEvaluating) {
-    return;
-  }
+  // if (evaluatingData.oneselfCancleEvaluating) {
+  //   return;
+  // }
   if (res?.content) {
     const { header, body } = res.content;
     // 效音返回
@@ -331,6 +333,10 @@ const handleScoreResult = (res?: IPostMessage) => {
         } else {
           evaluatingData.hideResultModal = false;
         }
+        // 手动取消评测,不展示评测弹窗
+        if (evaluatingData.oneselfCancleEvaluating) {
+          evaluatingData.hideResultModal = true;
+        }
         evaluatingData.resulstMode = evaluatingData.isErrorState ? false : true;
       }, 200);
       evaluatingData.resultData = {
@@ -415,6 +421,11 @@ export const handleStartBegin = async (preTimes?: number) => {
 			}, 300);
 		}
 	})
+  /**
+   * 安卓端,快速点击开始评测和结束评测,间隔太小了时,会出现异常情况(音频没有停止播放)
+   * 记录一下startRecord的开始时间
+   */
+  evaluatingData.recordingTime = +new Date();
 	// 如果开启了摄像头, 开启录制视频
 	if (state.setting.camera) {
 		console.log("开始录制视频");
@@ -512,6 +523,15 @@ export const handleEndEvaluat = (isComplete = false) => {
   }
 };
 
+// 校验评测结束最小的时间间隔
+export const checkMinInterval = () => {
+  const currentTime = +new Date();
+  // 开始评测和结束评测的间隔时间小于800毫秒,则不处理
+  if (currentTime - evaluatingData.recordingTime < 800) {
+    return;
+  }
+}
+
 /**
  * 结束评测(手动结束评测)
  */

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

@@ -115,7 +115,7 @@ export default defineComponent({
 			// }
 			//osmd.EngravingRules.PageBottomMargin = state.platform === IPlatform.PC ? 1 : 2;
 			if (state.isSimplePage) {
-				osmd.EngravingRules.PageTopMargin = state.musicRenderType === 'staff' ? 0 : 3;
+				osmd.EngravingRules.PageTopMargin = state.musicRenderType === 'staff' ? 2 : 4;
 				osmd.EngravingRules.PageTopMarginNarrow = 0;
 				osmd.EngravingRules.PageLeftMargin = 1;
 				osmd.EngravingRules.PageRightMargin = 0;

+ 1 - 1
src/view/selection/index.module.less

@@ -301,7 +301,7 @@
         content: "";
         position: absolute;
         left: 0;
-        bottom: -10Px;
+        bottom: -3Px;
         width: 100%;
         height: 8Px;
         background: linear-gradient(rgba(7, 24, 56, 0.5) 0%, #010D31 100%);

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

@@ -41,6 +41,7 @@ export default defineComponent({
 
 		onMounted(() => {
 			(window as any).appName = "colexiu";
+			state.isSingleLine = false;
 			state.isCreateImg = true;
 			state.isEvxml = true;
 			state.xmlUrl = decodeURIComponent(query.xmlUrl);