Browse Source

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

tanxue 1 month ago
parent
commit
056e199191
2 changed files with 27 additions and 26 deletions
  1. 26 25
      pages/chanpinneirong/index.vue
  2. 1 1
      utils/cacheManager.js

+ 26 - 25
pages/chanpinneirong/index.vue

@@ -22,7 +22,7 @@
 							<progress :percent="curProcess" class="xx-progress" stroke-width="10"
 								backgroundColor="#3c7dfd" activeColor="#ffd11c" />
 						</view>
-						<view class="jxxx-btn" @click="handlePlay(curJieObject,'jixu')"></view>
+						<view class="jxxx-btn" @click="handlePlay(danyuanInfo,'jixu')"></view>
 					</view>
 					<view class="jd-item-box">
 						<view class="jd-item-btn" @click="handleClickDanyuan">
@@ -47,7 +47,7 @@
 					</view>
 				</view>
 				<!-- 底部占位 -->
-				<view v-if="currentIndex != dagangList.length - 1" class="xx-next-btn" @click="next">
+				<view v-if="nextDanyuanId!=0" class="xx-next-btn" @click="next">
 					学习下一单元</view>
 				<!-- 	<view class="xx-xw-text">课程已学完</view> -->
 			</view>
@@ -71,7 +71,9 @@
 	} from "@/api/chanpinneirong.js"
 	import danyuanInfoVue from '@/pages/xinshuxue/components/danyuanInfo.vue';
 	import danyuanMuluVue from '@/pages/xinshuxue/components/danyuanMulu.vue';
-import { toast } from '../../utils/common';
+	import {
+		toast
+	} from '../../utils/common';
 
 	export default {
 		data() {
@@ -89,10 +91,9 @@ import { toast } from '../../utils/common';
 				dengjiId: '',
 				customType: '',
 				curProcess: '',
-				curWanchengStatus: false, //false是可以点击 true是不可以点击
 				cacheManagerLocal: null,
-				curJieObject:null
-				
+				curJieObject: null
+
 
 
 			}
@@ -127,13 +128,24 @@ import { toast } from '../../utils/common';
 				this.banbenId = cacheManager.get('auth').banbenId
 				//用于返回
 				this.dengjiId = cacheManager.get('auth').dengjiId
-				this.cacheManagerLocal = cacheManager.get('xuexi-shuxue')
+				this.cacheManagerLocal = cacheManager.get('xuexi-shuxue') ||{}
 				// 使用缓存
 				this.danyuanInfo = this.cacheManagerLocal
 				this.curProcess = this.cacheManagerLocal.curProcess
 				this.fontDanyuanId = this.cacheManagerLocal.fontDanyuanId
 				this.nextDanyuanId = this.cacheManagerLocal.nextDanyuanId
 				this.dagangList = this.cacheManagerLocal.dagangList || []
+				const result = this.jisuanWanchengStatus(this.dagangList);
+				if (result.allCompleted) {
+					console.log('全部完成');
+				} else {
+					this.danyuanInfo.curJieId = result.firstUncompleted.jieId
+					console.log('未完成项目:', result.firstUncompleted);
+					console.log('未完成项目jieId:', result.firstUncompleted.jieId);
+				}
+
+
+
 			}
 		},
 
@@ -141,7 +153,7 @@ import { toast } from '../../utils/common';
 			// 继续学习按钮是否可以点击
 			jisuanWanchengStatus(dagangList) {
 				// 查找第一个未完成的项目
-				const firstUncompleted = dagangList.find(item => item.wanchengFlag === 0);
+				const firstUncompleted = dagangList.find(item => item.wanchengFlag == 0);
 				if (firstUncompleted) {
 					return {
 						allCompleted: false,
@@ -180,18 +192,6 @@ import { toast } from '../../utils/common';
 					this.fontDanyuanId = res.data.fontDanyuanId
 					this.nextDanyuanId = res.data.nextDanyuanId
 					this.dagangList = res.data.dagangList || []
-					const result = this.jisuanWanchengStatus(this.dagangList);
-					if (result.allCompleted) {
-						console.log('全部完成');
-						this.curWanchengStatus = true
-						this.curJieObject = null
-					} else {
-						this.curWanchengStatus = false
-						this.curJieObject = result.firstUncompleted
-						// 当前单元下 第一个未完成的jie 内容
-						console.log('未完成项目:', result.firstUncompleted);
-					}
-					console.log('this.curWanchengStatus', this.curWanchengStatus);
 					cacheManager.set('xuexi-shuxue', res.data)
 					cacheManager.updateObject('auth', {
 						chanpinId: this.chanpinId,
@@ -219,21 +219,22 @@ import { toast } from '../../utils/common';
 			},
 
 			handlePlay(da, code) {
-				
 				let jieId = null;
 				if (code == 'jixu') {
-					if(this.curWanchengStatus){
+					if (da.curProcess >= 100) {
 						toast("当前单元节内容全部学习完毕,请切换下一单元!")
 						return
 					}
-					
+					if (!da.jieId) {
+						toast("无jieId");
+						return;
+					}
+					jieId = da.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}`
 						})

+ 1 - 1
utils/cacheManager.js

@@ -123,7 +123,7 @@ const cacheManager = (function() {
 		let newProgress = (parseFloat(obj.curProcess) || 0) + (100 / obj.dagangList.length);
 		if (newProgress > 100) newProgress = 100;
 		obj.curProcess = newProgress.toFixed(2);
-		set('xuexi-shuxue' obj);
+		set('xuexi-shuxue', obj);
 	}
 	return {
 		set,