wangxy il y a 14 heures
Parent
commit
48c726b204
2 fichiers modifiés avec 42 ajouts et 35 suppressions
  1. 12 0
      api/chanpinneirong.js
  2. 30 35
      pages/chanpinneirong/chanpin3.vue

+ 12 - 0
api/chanpinneirong.js

@@ -95,3 +95,15 @@ export function yingyuDanciInfo(data = {}) {
     timeout: 20000
   })
 }
+
+export function yingyuSave2(data = {}) {
+  return request({
+    'url': '/app/danci/chanpin/save',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 30 - 35
pages/chanpinneirong/chanpin3.vue

@@ -29,8 +29,7 @@
 
 			<view class="xx-item-list">
 				<view class="xx-item-title">— 以下为当前等级课程目录 —</view>
-
-				<view v-for="(item, index) in danyuanList" :key="item.jieId">
+				<view v-for="(item, index) in danyuanList" :key="item.danyuanId">
 					<!-- 节列表 -->
 					<ezyActiveVue class="ezy-list-item-active xx-item-box" :class="item.lock?'xx-disabled-item-box':''"  @aclick="handlePlay(item,'play')">
 						<view class="xx-item-status"
@@ -72,7 +71,7 @@
 	import cacheManager from "@/utils/cacheManager.js";
 	import {
 		yingyuDanciInfo,
-		shuxueSave2
+		yingyuSave2
 	} from "@/api/chanpinneirong.js"
 	import {
 		onLoad,
@@ -97,7 +96,7 @@
 				danyuanList: [],
 				neirongInfo: {},
 				banbenId: '',
-				jieId: '',
+				danyuanId: '',
 				chanpinId: '',
 				dengjiId: '',
 				curProcess: '',
@@ -177,7 +176,8 @@
 					};
 					this.curProcess = cacheData.curProcess;
 					this.danyuanList = [...(cacheData.danyuanList || [])];
-					this.banbenId = cacheData.banbenId
+					this.banbenId = cacheData.banbenId;
+          this.dengjiId = cacheData.dengjiId;
 
 
 					if (this.danyuanList.length == 0) {
@@ -208,7 +208,7 @@
 					if (res.code === 0) {
 						
 						this.neirongInfo = res.data;
-						this.neirongInfo.jieId = res.data.curJieId;
+						this.neirongInfo.danyuanId = res.data.curDanyuanId;
 						this.curProcess = res.data.curProcess * 100;
 						this.danyuanList = res.data.danyuanList || [];
 						if (this.danyuanList.length == 0) {
@@ -237,11 +237,11 @@
 				this.showGoTop = scrollTop > this.scrollThreshold;
 			},
 
-			getJieAndDanyuan(data, jieId) {
-				for (let jie of data.jieList) {
-						if (jie.jieId == jieId) {
+			getJieAndDanyuan(data, danyuanId) {
+				for (let danyuan of data.danyuanList) {
+						if (danyuan.danyuanId == danyuanId) {
 							return {
-								jie
+                danyuan
 							}
 						}
 					
@@ -249,23 +249,23 @@
 				return null;
 			},
 
-			async saveAndNavigate(jieId,  da, code) {
+			async saveAndNavigate(danyuanId,  da, code) {
 
 				if (code == 'jixu') {
-					if (!da.jieId) {
-						toast("jieId 丢失")
+					if (!da.danyuanId) {
+						toast("danyuanId 丢失")
 						return false
 					}
 				}
 
 				let req = {
-					"dengjiId": da.dengjiId,
-					"jieId": da.jieId
+					"banbenId": this.banbenId,
+					"danyuanId": da.danyuanId
 				}
 				console.log('req', req);
-				const res = await shuxueSave2(req);
+				const res = await yingyuSave2(req);
 				if (res.code == 0) {
-					let curJieAndDanyuan = this.getJieAndDanyuan(this.neirongInfo, jieId);
+					let curJieAndDanyuan = this.getJieAndDanyuan(this.neirongInfo, danyuanId);
 					console.log('curJieAndDanyuan',curJieAndDanyuan);
 					
 					if (!curJieAndDanyuan) {
@@ -274,14 +274,14 @@
 					}
 
 					const cacheData = cacheManager.get('contentInfo') || {};
-					cacheData.curKechengName = curJieAndDanyuan.jie.jieIntro;
-					cacheData.jieId = curJieAndDanyuan.jie.jieId;
-					cacheData.curJieId = jieId;
-					cacheData.type = curJieAndDanyuan.jie.type;
+					cacheData.curKechengName = curJieAndDanyuan.danyuan.danyuanIntro;
+					cacheData.danyuanId = curJieAndDanyuan.danyuan.danyuanId;
+					cacheData.curDanyuanId = danyuanId;
+					cacheData.type = curJieAndDanyuan.danyuan.type;
 					cacheManager.set('contentInfo', cacheData);
 
 					uni.navigateTo({
-						url: `/pages/jisuantexun/lookShipin?jieId=${jieId}`
+						url: `/pages/chaojidanci/wordList/wordList?danyuanId=${danyuanId}&banbenId=${this.banbenId}`
 					})
 				} else {
 					return false;
@@ -299,30 +299,25 @@
 					// })
 					return;
 				}
-				let jieId = code === 'jixu' ? da.curJieId : da.jieId;
-				if (!jieId) {
+				let danyuanId = code === 'jixu' ? da.curDanyuanId : da.danyuanId;
+				if (!danyuanId) {
 					toast("无课程ID");
 					return;
 				}
-				this.saveAndNavigate(jieId, da, code);
+				this.saveAndNavigate(danyuanId, da, code);
 			},
-			handleClickDanyuan(jieId) {
+			handleClickDanyuan(danyuanId) {
 
-				if (!jieId) {
-					toast("jieId丢失")
+				if (!danyuanId) {
+					toast("danyuanId丢失")
 					return false
 				}
 				this.isShow = true;
 				setTimeout(() => {
 					// 更新为点击的动态单元Id [临时]
-					this.$refs.dyRef.handleShow(jieId)
+					this.$refs.dyRef.handleShow(danyuanId)
 				}, 100)
-			},
-			handleBack() {
-				uni.navigateTo({
-					url: `/pages/chanpinXuanze/banben?dengjiId=` + this.dengjiId
-				})
-			},
+			}
 		},
 
 		// 计算吸顶栏下方的偏移(确保内容不被遮挡)