Browse Source

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

tanxue 1 month ago
parent
commit
af02755b46
1 changed files with 47 additions and 18 deletions
  1. 47 18
      pages/chanpinneirong/index.vue

+ 47 - 18
pages/chanpinneirong/index.vue

@@ -19,10 +19,10 @@
 					<view class="xx-progress-btn-box">
 						<view class="xx-progress-box">
 							<view>当前学习进度</view>
-							<progress :percent="curProcess" class="xx-progress" stroke-width="10" backgroundColor="#3c7dfd"
-								activeColor="#ffd11c" />
+							<progress :percent="curProcess" class="xx-progress" stroke-width="10"
+								backgroundColor="#3c7dfd" activeColor="#ffd11c" />
 						</view>
-						<view class="jxxx-btn" @click="handlePlay(danyuanInfo,'jixu')"></view>
+						<view class="jxxx-btn" @click="handlePlay(curJieObject,'jixu')"></view>
 					</view>
 					<view class="jd-item-box">
 						<view class="jd-item-btn" @click="handleClickDanyuan">
@@ -71,6 +71,7 @@
 	} 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';
 
 	export default {
 		data() {
@@ -88,8 +89,10 @@
 				dengjiId: '',
 				customType: '',
 				curProcess: '',
-				cacheManagerLocal: null
-
+				curWanchengStatus: false, //false是可以点击 true是不可以点击
+				cacheManagerLocal: null,
+				curJieObject:null
+				
 
 
 			}
@@ -124,7 +127,7 @@
 				this.banbenId = cacheManager.get('auth').banbenId
 				//用于返回
 				this.dengjiId = cacheManager.get('auth').dengjiId
-				this.cacheManagerLocal = cacheManager.get('xuexi-' + this.chanpinId)
+				this.cacheManagerLocal = cacheManager.get('xuexi-shuxue')
 				// 使用缓存
 				this.danyuanInfo = this.cacheManagerLocal
 				this.curProcess = this.cacheManagerLocal.curProcess
@@ -135,9 +138,27 @@
 		},
 
 		methods: {
+			// 继续学习按钮是否可以点击
+			jisuanWanchengStatus(dagangList) {
+				// 查找第一个未完成的项目
+				const firstUncompleted = dagangList.find(item => item.wanchengFlag === 0);
+				if (firstUncompleted) {
+					return {
+						allCompleted: false,
+						firstUncompleted: firstUncompleted
+					};
+				} else {
+					return {
+						allCompleted: true,
+						firstUncompleted: null
+					};
+				}
+			},
+
+
 			handleSelectDanyuan(item) {
 				console.log('切换单元', item)
-				this.danyuanId =item.danyuanId
+				this.danyuanId = item.danyuanId
 				this.loadDataFromApi()
 			},
 			handleClickMulu() {
@@ -159,13 +180,25 @@
 					this.fontDanyuanId = res.data.fontDanyuanId
 					this.nextDanyuanId = res.data.nextDanyuanId
 					this.dagangList = res.data.dagangList || []
-					cacheManager.set('xuexi-' + this.chanpinId, res.data)
+					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,
 						banbenId: this.banbenId,
 						danyuanId: this.danyuanId,
 						dengjiId: this.dengjiId
-					})	
+					})
 				})
 			},
 
@@ -189,15 +222,11 @@
 				console.log('da', da)
 				let jieId = null;
 				if (code == 'jixu') {
-
-					// 判断学习状态
-					/* if (已学完) {
-						
-						return;
-					} */
-
-
-					jieId = da.curJieId;
+					if(this.curWanchengStatus){
+						toast("当前单元节内容全部学习完毕,请切换下一单元!")
+						return
+					}
+					jieId = da.jieId;
 					uni.navigateTo({
 						url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
 					})