Browse Source

Merge branch '2025鹅状元数学' of https://gogs.mtavip.com/wangguoyu/uniProject into 2025鹅状元数学

tanxue 1 month ago
parent
commit
31d118def5

+ 13 - 5
pages/chanpinneirong/index.vue

@@ -219,17 +219,25 @@ import { toast } from '../../utils/common';
 			},
 
 			handlePlay(da, code) {
-				console.log('da', da)
+				
 				let jieId = null;
 				if (code == 'jixu') {
 					if(this.curWanchengStatus){
 						toast("当前单元节内容全部学习完毕,请切换下一单元!")
 						return
 					}
-					jieId = da.jieId;
-					uni.navigateTo({
-						url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
-					})
+					
+					if (da.type == 1) {
+						jieId = da.jieId;
+						uni.navigateTo({
+							url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
+						})
+					} else {
+						jieId = da.jieId;
+						uni.navigateTo({
+							url: `/pages/xinshuxue/unitTest?jieId=${jieId}`
+						})
+					}
 				} else {
 					jieId = da.jieId;
 					if (da.type == 1) {

+ 3 - 1
pages/xinshuxue/components/useShuxueUnitTest.js

@@ -10,6 +10,7 @@ import {
 	catchError,
 	toast
 } from "@/utils/common.js"
+import cacheManager from "@/utils/cacheManager.js";
 
 
 export function useShuxueTest(handleSeeResult,handleSeeResultClose) {
@@ -121,7 +122,8 @@ export function useShuxueTest(handleSeeResult,handleSeeResultClose) {
 			toast("单元测试数据提交异常");
 			return;
 		}
-
+		// 更新单元测试状态
+		cacheManager.updateStatusAndProess(data.jieId)
 		// 执行跳页
 		uni.$emit('unitShuxueTest-submit', {
 			rightAnswer: cdata.dui,

+ 2 - 0
pages/xinshuxue/lookShipin.vue

@@ -125,6 +125,8 @@
 			saveJieWancheng() {
 				httpApi.getShuxueChanpinWancheng({jieId: this.jieInfo.jieId}).then(res => {
 					if (res.data) {
+						// 更新单员状态
+						cacheManager.updateStatusAndProess(this.jieInfo.jieId)
 						// 学习完成提示弹窗
 						this.$refs.popupRef.open();
 					}

+ 7 - 19
utils/cacheManager.js

@@ -109,33 +109,21 @@ const cacheManager = (function() {
 		}, obj);
 	}
 	// 用于新数学产品当前单元节视频看完了 更新完成状态和计算当前单元的进度
-	// key : xuexi-shuxue
-	// index : 当前单元下的第几个节index
 	// currentJieId:当前jieId
-	function updateStatusAndProess(key, index, currentJieId) {
-		let obj = get(key) || {};
-		// 更新完成状态
+	function updateStatusAndProess(currentJieId) {
+		let obj = get('xuexi-shuxue') || {};
+		// 标记完成
 		for (let jie of obj.dagangList) {
-			if (jie.jieId == currentJieId && jie.wanchengFlag == 0) {
+			if (jie.jieId == currentJieId) {
 				jie.wanchengFlag = 1;
 				break;
 			}
 		}
-		// 统计视频课程数量(排除单元测试)
-		const videoSections = obj.dagangList.filter(item => {
-			return item.type == 1;
-		});
-		const videoCount = videoSections.length;
 		// 计算新进度
-		const currentProgress = parseFloat(obj.curProcess) || 0;
-		const progressPerVideo = 100 / videoCount;
-		let newProgress = currentProgress + progressPerVideo;
-		// 确保进度不超过100%
-		if (newProgress > 100) {
-			newProgress = 100;
-		}
+		let newProgress = (parseFloat(obj.curProcess) || 0) + (100 / obj.dagangList.length);
+		if (newProgress > 100) newProgress = 100;
 		obj.curProcess = newProgress.toFixed(2);
-		set(key, obj);
+		set('xuexi-shuxue' obj);
 	}
 	return {
 		set,