wangguoyu 1 month ago
parent
commit
1b54572257
1 changed files with 19 additions and 17 deletions
  1. 19 17
      pages/chanpinneirong/index.vue

+ 19 - 17
pages/chanpinneirong/index.vue

@@ -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>
@@ -91,7 +91,6 @@
 				dengjiId: '',
 				customType: '',
 				curProcess: '',
-				curWanchengStatus: false, //false是可以点击 true是不可以点击
 				cacheManagerLocal: null,
 				curJieObject: null
 
@@ -129,13 +128,24 @@
 				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);
+				}
+
+
+
 			}
 		},
 
@@ -143,7 +153,7 @@
 			// 继续学习按钮是否可以点击
 			jisuanWanchengStatus(dagangList) {
 				// 查找第一个未完成的项目
-				const firstUncompleted = dagangList.find(item => item.wanchengFlag === 0);
+				const firstUncompleted = dagangList.find(item => item.wanchengFlag == 0);
 				if (firstUncompleted) {
 					return {
 						allCompleted: false,
@@ -182,18 +192,6 @@
 					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,
@@ -223,10 +221,14 @@
 			handlePlay(da, code) {
 				let jieId = null;
 				if (code == 'jixu') {
-					if (da.curProcess >=100) {
+					if (da.curProcess >= 100) {
 						toast("当前单元节内容全部学习完毕,请切换下一单元!")
 						return
 					}
+					if (!da.jieId) {
+						toast("无jieId");
+						return;
+					}
 					jieId = da.jieId;
 					if (da.type == 1) {
 						uni.navigateTo({