Browse Source

修改详情页面

wangxy 3 weeks ago
parent
commit
5d6935b43c
3 changed files with 21 additions and 16 deletions
  1. 7 14
      pages/chanpinneirong/chanpin2.vue
  2. 1 1
      pages/jisuantexun/lookShipin.vue
  3. 13 1
      utils/cacheManager.js

+ 7 - 14
pages/chanpinneirong/chanpin2.vue

@@ -132,7 +132,7 @@
 			handleConfirmBtn() {
 				// 加锁视频需要购买
 				uni.navigateTo({
-					url: "/pages/chanpinShop/cp1/dingdan"
+					url: "/pages/chanpinShop/cp2/dingdan"
 				})
 			},
 			initData(dengjiId) {
@@ -249,9 +249,8 @@
 				return null;
 			},
 
-			async saveAndNavigate(jieId, type, da, code) {
+			async saveAndNavigate(jieId,  da, code) {
 
-				console.log('da', da);
 				if (code == 'jixu') {
 					if (!da.jieId) {
 						toast("jieId 丢失")
@@ -281,21 +280,15 @@
 					cacheData.type = curJieAndDanyuan.jie.type;
 					cacheManager.set('contentInfo', cacheData);
 
-					if (type == 1) {
-						uni.navigateTo({
-							url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
-						})
-					} else {
-						uni.navigateTo({
-							url: `/pages/xinshuxue/unitTest?jieId=${jieId}`
-						})
-					}
+					uni.navigateTo({
+						url: `/pages/jisuantexun/lookShipin?jieId=${jieId}`
+					})
 				} else {
 					return false;
 				}
 			},
 			handlePlay(da, code) {
-
+				console.log('ddd',da)
 				if (da.lock && code == 'play') {
 					
 					this.$refs.gmtRef.handleShow();
@@ -311,7 +304,7 @@
 					toast("无课程ID");
 					return;
 				}
-				this.saveAndNavigate(jieId, da.type, da, code);
+				this.saveAndNavigate(jieId, da, code);
 			},
 			handleClickDanyuan(jieId) {
 

+ 1 - 1
pages/jisuantexun/lookShipin.vue

@@ -106,7 +106,7 @@
 				}).then(res => {
 					if (res.data) {
 						// 更新单员状态
-						cacheManager.updateShuxueWanchengStatus(this.jieInfo.jieId)
+						cacheManager.updateJisuanWanchengStatus(this.jieInfo.jieId)
 						// 学习完成提示弹窗
 						this.$refs.popupRef.open();
 					}

+ 13 - 1
utils/cacheManager.js

@@ -122,6 +122,17 @@ const cacheManager = (function() {
 	    }
 	    set('contentInfo', obj);
 	}
+	
+	function updateJisuanWanchengStatus(currentJieId) {
+	    let obj = get('contentInfo') || {};
+	    if (obj && obj.jieList) {
+			const jie = obj.jieList.find(j => j.jieId == currentJieId);
+			if (jie) {
+			    jie.wanchengFlag = 1;
+			}
+	    }
+	    set('contentInfo', obj);
+	}
 
 	return {
 		set,
@@ -132,7 +143,8 @@ const cacheManager = (function() {
 		updateShuxueWanchengStatus,
 		updateObject,
 		findArrayInObject,
-		clearAll
+		clearAll,
+		updateJisuanWanchengStatus
 	};
 })();