liushengqiang %!s(int64=2) %!d(string=hai) anos
pai
achega
ce6319b3dd

+ 8 - 12
src/page-instrument/custom-plugins/work-ealuating/index.tsx

@@ -13,12 +13,8 @@ export default defineComponent({
 			type: Object,
 			default: () => ({}),
 		},
-		pageShow:{
-			type: Boolean,
-			default: true,
-		}
 	},
-	setup(props) {
+	setup(props, {expose}) {
 		const query = getQuery();
 		const evaluatingWorkData = reactive({
 			difficulty: "" as IDifficulty,
@@ -59,19 +55,19 @@ export default defineComponent({
 				console.log(error);
 			}
 		};
-		watch(
-			() => evaluatingData.resulstMode,
-			() => {
-				if (evaluatingData.resulstMode && evaluatingData.isComplete) {
-					addEvaluatingWorkRecored(evaluatingData.resultData);
-				}
+		const handleAdd = () => {
+			if (evaluatingData.resulstMode && evaluatingData.isComplete) {
+				addEvaluatingWorkRecored(evaluatingData.resultData);
 			}
-		);
+		}
 		onMounted(() => {
 			handleHide();
 			getWorkData();
 			// verifyMembershipServices();
 		});
+		expose({
+			handleAdd
+		})
 		return () => <div></div>;
 	},
 });

+ 10 - 14
src/page-instrument/custom-plugins/work-home/index.tsx

@@ -10,14 +10,10 @@ export default defineComponent({
 		workeData: {
 			type: Object,
 			default: () => ({}),
-		},
-		pageShow: {
-			type: Boolean,
-			default: true,
-		},
+		}
 	},
 	emits: ["change"],
-	setup(props) {
+	setup(props, {expose}) {
 		const training = reactive({
 			trainingTimes: "",
 			trainingSpeed: 0,
@@ -113,20 +109,20 @@ export default defineComponent({
 				}
 			}
 		);
-		watch(
-			() => props.pageShow,
-			(val) => {
-				if (!val && state.playState === "play") {
-					console.log("退出");
-					addHomeworkRecored();
-				}
+		const handleAdd = () => {
+			if (state.playState === "play") {
+				console.log("退出");
+				addHomeworkRecored();
 			}
-		);
+		}
 		onMounted(() => {
 			handleHide();
 			getWorkData();
 			// verifyMembershipServices();
 		});
+		expose({
+			handleAdd
+		})
 		return () => (
 			<div class={styles.homework}>
 				{training.trainingTimes} / {training.times} 分钟

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

@@ -1,25 +1,33 @@
-import { defineComponent, onMounted, reactive } from "vue";
+import { defineComponent, onMounted, reactive, ref } from "vue";
 import WorkHome from "../work-home";
 import WorkEaluating from "../work-ealuating";
 import { getQuery } from "/src/utils/queryString";
 import { api_lessonTrainingTrainingStudentDetail } from "../../api";
 import { headTopData } from "../../header-top";
 
+const workHomeRef = ref();
+const workEaluatRef = ref();
+
+const data = reactive({
+	/** 作业类型:练习PRACTICE, 评测EVALUATION */
+	trainingType: "" as "PRACTICE" | "EVALUATION",
+	worke: {},
+});
+
+export const HANDLE_WORK_ADD = () => {
+	if (data.trainingType === "PRACTICE"){
+		workHomeRef.value?.handleAdd();
+	}
+	if (data.trainingType === "EVALUATION"){
+		workEaluatRef.value?.handleAdd();
+	}
+};
+
 export default defineComponent({
 	name: "workIndex",
-	props: {
-		pageShow: {
-			type: Boolean,
-			default: true,
-		}
-	},
 	setup(props) {
 		const query = getQuery();
-		const data = reactive({
-			/** 作业类型:练习PRACTICE, 评测EVALUATION */
-			trainingType: "" as "PRACTICE" | "EVALUATION",
-			worke: {},
-		});
+
 		const setModelType = () => {
 			if (!data.trainingType) return;
 			const type = data.trainingType === "PRACTICE" ? "practise" : "evaluating";
@@ -39,9 +47,11 @@ export default defineComponent({
 		return () => (
 			<>
 				{/* 课后训练作业 */}
-				{data.trainingType === "PRACTICE" && <WorkHome workeData={data.worke} pageShow={props.pageShow} />}
+				{data.trainingType === "PRACTICE" && <WorkHome ref={workHomeRef} workeData={data.worke} />}
 				{/* 评测作业 */}
-				{data.trainingType === "EVALUATION" && <WorkEaluating workeData={data.worke} pageShow={props.pageShow} />}
+				{data.trainingType === "EVALUATION" && (
+					<WorkEaluating ref={workEaluatRef} workeData={data.worke} />
+				)}
 			</>
 		);
 	},

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

@@ -24,6 +24,7 @@ import { getQuery } from "/src/utils/queryString";
 import { storeData } from "/src/store";
 import TeacherTop from "../custom-plugins/guide-page/teacher-top";
 import StudentTop from "../custom-plugins/guide-page/student-top";
+import { HANDLE_WORK_ADD } from "../custom-plugins/work-index";
 
 /** 头部数据和方法 */
 export const headTopData = reactive({
@@ -247,7 +248,7 @@ export default defineComponent({
 		});
 		/** 返回 */
 		const handleBack = () => {
-			emit("close");
+			HANDLE_WORK_ADD();
 			// 不在APP中,
 			if (!storeData.isApp) {
 				window.close();

+ 2 - 4
src/page-instrument/view-detail/index.tsx

@@ -57,8 +57,6 @@ export default defineComponent({
 			skeletonLoading: true,
 			paddingLeft: "",
 			headerHide: false,
-			/** 页面显示 */
-			pageShow: true,
 		});
 		const getAPPData = async () => {
 			const screenData = await isSpecialShapedScreen();
@@ -306,7 +304,7 @@ export default defineComponent({
 					)}
 				</Transition>
 				<div class={[styles.headHeight, detailData.headerHide && styles.headHide]}>
-					{state.musicRendered && <HeaderTop onClose={() => (detailData.pageShow = false)} />}
+					{state.musicRendered && <HeaderTop />}
 				</div>
 				<div
 					id="scrollContainer"
@@ -360,7 +358,7 @@ export default defineComponent({
 						{/* 统计训练时长 */}
 						<RecordingTime />
 						{/* 作业 */}
-						{query.workRecord && <WorkIndex pageShow={detailData.pageShow} />}
+						{query.workRecord && <WorkIndex />}
 						{followData.start + ""}
 						{/* 曲谱列表 */}
 						{state.playState == "play" ||