Преглед изворни кода

feat: 评测作业,非完整评测不显示评测结果弹窗

TIANYONG пре 1 година
родитељ
комит
2c316c3bf9

+ 2 - 1
src/page-instrument/custom-plugins/work-ealuating/index.tsx

@@ -69,7 +69,8 @@ export default defineComponent({
 		watch(
 			() => evaluatingData.resultData.recordId,
 			() => {
-				if (evaluatingData.resulstMode && evaluatingData.resultData.recordId) {
+				// 评测作业,完整评测才调用保存作业接口
+				if (evaluatingData.resulstMode && evaluatingData.resultData.recordId && evaluatingData.isComplete) {
 					addEvaluatingWorkRecored(evaluatingData.resultData);
 				}
 			}

+ 1 - 1
src/page-instrument/custom-plugins/work-index/index.tsx

@@ -8,7 +8,7 @@ import { evaluatingData } from "/src/view/evaluating";
 
 const workHomeRef = ref();
 
-const data = reactive({
+export const data = reactive({
 	/** 作业类型:练习PRACTICE, 评测EVALUATION */
 	trainingType: "" as "PRACTICE" | "EVALUATION",
 	worke: {},

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

@@ -79,100 +79,105 @@ export default defineComponent({
 			}
 		})
 		return () => (
-			<div class={styles.evaluatResult}>
-				<div class={styles.closeBtn} onClick={() => emit("close")}>
-					<img src={icons["arrow-left-background"]} />
-				</div>
-
-				{
-				!state.isHideEvaluatReportSaveBtn &&
-				<div class={styles.headerButton}>
-					<div class={[styles.headBtn, evaluatingData.resultData.recordId ? '' : styles.disabled]} onClick={debounce(saveResult,300)}>
-						保存演奏
+			<>
+			{
+				!evaluatingData.hideResultModal && 
+				<div class={styles.evaluatResult}>
+					<div class={styles.closeBtn} onClick={() => emit("close")}>
+						<img src={icons["arrow-left-background"]} />
 					</div>
-				</div>
-				}
 
-				<div class={styles.fraction}>
-					<img class={styles.bg} src={imgs.bg} />
-					<div class={styles.top}>
-						{evaluatingData.resultData.score > 79 && (
-							<img style={{}} class={styles.badge} src={iconBadge} />
-						)}
-						<div class={styles.text}>
-							<div>
-								<span class={styles.num}>{evaluatingData.resultData.score}</span>分
-							</div>
-							<div style={{ marginLeft: "6px" }}>{evaluatingData.resultData.clxmome}</div>
+					{
+					!state.isHideEvaluatReportSaveBtn &&
+					<div class={styles.headerButton}>
+						<div class={[styles.headBtn, evaluatingData.resultData.recordId ? '' : styles.disabled]} onClick={debounce(saveResult,300)}>
+							保存演奏
 						</div>
-						<img
-							style={{ display: evaluatingData.resultData.leve === 0 ? "" : "none" }}
-							class={styles.rightBadge}
-							src={icon_expression0}
-						/>
-						<img
-							style={{ display: evaluatingData.resultData.leve === 1 ? "" : "none" }}
-							class={styles.rightBadge}
-							src={icon_expression1}
-						/>
-						<img
-							style={{ display: evaluatingData.resultData.leve === 2 ? "" : "none" }}
-							class={styles.rightBadge}
-							src={icon_expression2}
-						/>
-						<img
-							style={{ display: evaluatingData.resultData.leve === 3 ? "" : "none" }}
-							class={styles.rightBadge}
-							src={icon_expression3}
-						/>
-						<img
-							style={{ display: evaluatingData.resultData.leve === 4 ? "" : "none" }}
-							class={styles.rightBadge}
-							src={icon_expression4}
-						/>
 					</div>
-					{state.isPercussion ? (
-						<div class={styles.percussion}>
-							<img class={styles.leftIcon} src={evaluatingData.resultData.img || icon1} />
-							<div class={styles.scoreDes}>
-								<span class={styles.scoreNum}>{evaluatingData.resultData.score}</span>分
-								<span style={{ marginLeft: "8px" }}>{evaluatingData.resultData.mome}</span>
+					}
+
+					<div class={styles.fraction}>
+						<img class={styles.bg} src={imgs.bg} />
+						<div class={styles.top}>
+							{evaluatingData.resultData.score > 79 && (
+								<img style={{}} class={styles.badge} src={iconBadge} />
+							)}
+							<div class={styles.text}>
+								<div>
+									<span class={styles.num}>{evaluatingData.resultData.score}</span>分
+								</div>
+								<div style={{ marginLeft: "6px" }}>{evaluatingData.resultData.clxmome}</div>
 							</div>
+							<img
+								style={{ display: evaluatingData.resultData.leve === 0 ? "" : "none" }}
+								class={styles.rightBadge}
+								src={icon_expression0}
+							/>
+							<img
+								style={{ display: evaluatingData.resultData.leve === 1 ? "" : "none" }}
+								class={styles.rightBadge}
+								src={icon_expression1}
+							/>
+							<img
+								style={{ display: evaluatingData.resultData.leve === 2 ? "" : "none" }}
+								class={styles.rightBadge}
+								src={icon_expression2}
+							/>
+							<img
+								style={{ display: evaluatingData.resultData.leve === 3 ? "" : "none" }}
+								class={styles.rightBadge}
+								src={icon_expression3}
+							/>
+							<img
+								style={{ display: evaluatingData.resultData.leve === 4 ? "" : "none" }}
+								class={styles.rightBadge}
+								src={icon_expression4}
+							/>
 						</div>
-					) : (
-						<div class={styles.detail}>
-							<div class={styles.progressitem}>
-								<div class={styles.intonation}>音准</div>
-								<span>{evaluatingData.resultData.intonation}分</span>
+						{state.isPercussion ? (
+							<div class={styles.percussion}>
+								<img class={styles.leftIcon} src={evaluatingData.resultData.img || icon1} />
+								<div class={styles.scoreDes}>
+									<span class={styles.scoreNum}>{evaluatingData.resultData.score}</span>分
+									<span style={{ marginLeft: "8px" }}>{evaluatingData.resultData.mome}</span>
+								</div>
 							</div>
-							<div class={styles.progressitem}>
-								<div class={styles.cadence}>节奏</div>
-								<span>{evaluatingData.resultData.cadence}分</span>
+						) : (
+							<div class={styles.detail}>
+								<div class={styles.progressitem}>
+									<div class={styles.intonation}>音准</div>
+									<span>{evaluatingData.resultData.intonation}分</span>
+								</div>
+								<div class={styles.progressitem}>
+									<div class={styles.cadence}>节奏</div>
+									<span>{evaluatingData.resultData.cadence}分</span>
+								</div>
+								<div class={styles.progressitem}>
+									<div class={styles.integrity}>完成度</div>
+									<span>{evaluatingData.resultData.integrity}分</span>
+								</div>
 							</div>
-							<div class={styles.progressitem}>
-								<div class={styles.integrity}>完成度</div>
-								<span>{evaluatingData.resultData.integrity}分</span>
-							</div>
-						</div>
-					)}
+						)}
 
-					<div class={styles.tips}>{evaluatingData.resultData.clxtip}</div>
-					<div class={styles.ctrls}>
-						<img
-							style={{ display: query.workRecord ? "none" : "" }}
-							src={imgs.btn1}
-							class={styles.ctrlsBtn}
-							onClick={() => emit("close", "practise")}
-						/>
-						<img src={imgs.btn2} class={styles.ctrlsBtn} onClick={() => emit("close", "tryagain")} />
-						<img
-							src={imgs.btn3}
-							class={[styles.ctrlsBtn, data.saveLoading ? styles.disablued : ""]}
-							onClick={() => emit("close", "look")}
-						/>
+						<div class={styles.tips}>{evaluatingData.resultData.clxtip}</div>
+						<div class={styles.ctrls}>
+							<img
+								style={{ display: query.workRecord ? "none" : "" }}
+								src={imgs.btn1}
+								class={styles.ctrlsBtn}
+								onClick={() => emit("close", "practise")}
+							/>
+							<img src={imgs.btn2} class={styles.ctrlsBtn} onClick={() => emit("close", "tryagain")} />
+							<img
+								src={imgs.btn3}
+								class={[styles.ctrlsBtn, data.saveLoading ? styles.disablued : ""]}
+								onClick={() => emit("close", "look")}
+							/>
+						</div>
 					</div>
-				</div>
-			</div>
+				</div>				
+			}
+			</>
 		);
 	},
 });

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

@@ -429,8 +429,9 @@ export default defineComponent({
 					/>
 				</Popup> */}
 
+        {/* 评测作业,非完整评测不显示评测结果弹窗 */}
         {
-          
+          evaluatingData.hideResultModal ? <EvaluatResult onClose={handleEvaluatResult} /> :
           <Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={evaluatingData.resulstMode}>
             <EvaluatResult onClose={handleEvaluatResult} />
           </Popup>    

+ 21 - 6
src/view/evaluating/index.tsx

@@ -52,6 +52,7 @@ import icon_bg from '../abnormal-pop/icon_bg.svg'
 import icon_close from '../abnormal-pop/icon_close.svg'
 import icon_btn from '../abnormal-pop/icon_btn.svg'
 import icon_success from '../abnormal-pop/icon_success.svg'
+import { data } from '../../page-instrument/custom-plugins/work-index'
 
 const browserInfo = browser();
 
@@ -107,6 +108,7 @@ export const evaluatingData = reactive({
 	preloadJson: true, // 预加载延迟检测的资源
 	jsonLoading: false, // 延迟检测的资源加载中状态
 	jsonLoadDone: false, // 延迟检测的动画dom加载完成状态
+	hideResultModal: false, // 评测作业,如果不是完整评测,需要隐藏评测结果弹窗
 });
 
 const sendOffsetTime = async (offsetTime: number) => {
@@ -316,6 +318,12 @@ const handleScoreResult = (res?: IPostMessage) => {
 			// console.log("评测结束", body);
 			state.isHideEvaluatReportSaveBtn = false;
 			setTimeout(() => {
+				// 评测作业,如果不是完整评测,不展示评测弹窗
+				if (data.trainingType === 'EVALUATION' && !evaluatingData.isComplete) {
+					evaluatingData.hideResultModal = true;
+				} else {
+					evaluatingData.hideResultModal = false;
+				}
 				evaluatingData.resulstMode = evaluatingData.isErrorState ? false : true
 			}, 200);
 			evaluatingData.resultData = {
@@ -464,12 +472,19 @@ export const handleEndEvaluat = (isComplete = false) => {
 	endEvaluating({
 		musicScoreId: state.examSongId,
 	});
-	showLoadingToast({
-		message: "评分中",
-		duration: 0,
-		overlay: true,
-		overlayClass: styles.scoreMode,
-	});
+	// 评测作业如果不是完整评测,给出提示
+    if (!isComplete && data.trainingType === 'EVALUATION') {
+		showToast({
+			message: "完整演奏结束才算测验分数!",
+		});
+	} else {
+		showLoadingToast({
+			message: "评分中",
+			duration: 0,
+			overlay: true,
+			overlayClass: styles.scoreMode,
+		});
+	}
 	setTimeout(() => {
 		evaluatingData.startBegin = false;
 	}, 500);

+ 2 - 1
src/view/plugins/move-music-score/index.tsx

@@ -18,7 +18,7 @@ const showToolBox = ref(true);
 export const moveData = reactive({
 	/** 开启移动 */
 	open: false,
-	zoom: state.zoom,
+	zoom: 1,
 	partIndex: "0",
 	hasExtJson: false,
 	isWeb: false,
@@ -535,6 +535,7 @@ export const renderForMoveData = () => {
 export default defineComponent({
 	name: "move-music-score",
 	setup() {
+		moveData.zoom = state.zoom;
 		const query = getQuery();
 		const isOpen = query.isMove === "1" ? true : false;
 		console.log("🚀 ~ isOpen:", isOpen);

+ 2 - 2
vite.config.ts

@@ -78,8 +78,8 @@ export default defineConfig({
         // target: "https://kt.colexiu.com",
         // target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
         // target: "https://dev.resource.colexiu.com",
-        // target: "https://test.kt.colexiu.com",
-        target: "https://mec.colexiu.com",
+        target: "https://test.kt.colexiu.com",
+        // target: "https://mec.colexiu.com",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),
       },