wangguoyu 1 month ago
parent
commit
65e22b322d
3 changed files with 57 additions and 32 deletions
  1. 2 1
      App.vue
  2. 1 1
      pages/chanpinXuanze/components/shuxueList.vue
  3. 54 30
      pages/chanpinneirong/index.vue

+ 2 - 1
App.vue

@@ -17,6 +17,7 @@
 
 
 		// creat by wgy 0619  生命周期 钩子
 		// creat by wgy 0619  生命周期 钩子
 		onLaunch: function() {
 		onLaunch: function() {
+			// #ifdef APP-PLUS
 			// 有auth
 			// 有auth
 			if (cacheManager.get('auth')) {
 			if (cacheManager.get('auth')) {
 				banbenImpinfo({}).then(res => {
 				banbenImpinfo({}).then(res => {
@@ -53,7 +54,7 @@
 					}
 					}
 				});
 				});
 			}
 			}
-			// #ifdef APP-PLUS
+
 			// #endif
 			// #endif
 		},
 		},
 		onShow: function() {
 		onShow: function() {

+ 1 - 1
pages/chanpinXuanze/components/shuxueList.vue

@@ -32,7 +32,7 @@
 	})
 	})
 	
 	
 	// 选择产品等级
 	// 选择产品等级
-	function handleSelect(item) {
+	function handleSelect(item) {	
 		console.log('item', item)
 		console.log('item', item)
 		uni.redirectTo({
 		uni.redirectTo({
 			url: `/pages/chanpinXuanze/banben?dengjiId=${item.dengjiId}`
 			url: `/pages/chanpinXuanze/banben?dengjiId=${item.dengjiId}`

+ 54 - 30
pages/chanpinneirong/index.vue

@@ -12,7 +12,8 @@
 					<view>{{ danyuanInfo.danyuanName }}</view>
 					<view>{{ danyuanInfo.danyuanName }}</view>
 					<view>{{ danyuanInfo.danyuanIntro }}</view>
 					<view>{{ danyuanInfo.danyuanIntro }}</view>
 				</view>
 				</view>
-				<view class="arrow-icon right-icon" @click="next" :class="{ 'disabled': currentIndex == list.length - 1 }"> </view>
+				<view class="arrow-icon right-icon" @click="next"
+					:class="{ 'disabled': currentIndex == dagangList.length - 1 }"> </view>
 			</view>
 			</view>
 			<view class="xx-scroll-body">
 			<view class="xx-scroll-body">
 				<view class="xx-jd-box">
 				<view class="xx-jd-box">
@@ -25,15 +26,20 @@
 						<view class="jxxx-btn" @click="handlePlay(subjectDetail,'jixu')"></view>
 						<view class="jxxx-btn" @click="handlePlay(subjectDetail,'jixu')"></view>
 					</view>
 					</view>
 					<view class="jd-item-box">
 					<view class="jd-item-box">
-						<view class="jd-item-btn"><icon class="dydg-icon"></icon>单元大纲</view>
-						<view class="jd-item-btn"><icon class="dyml-icon"></icon>单元目录</view>
+						<view class="jd-item-btn">
+							<icon class="dydg-icon"></icon>单元大纲
+						</view>
+						<view class="jd-item-btn">
+							<icon class="dyml-icon"></icon>单元目录
+						</view>
 					</view>
 					</view>
-					
+
 				</view>
 				</view>
 				<view class="xx-item-list">
 				<view class="xx-item-list">
-					<view class="xx-item-box" v-for="section in dagangList" :key="section.jieId" >
-						<view class="xx-item-status" :class="section.wanchengFlag === 1 ? 'completed-status' : 'uncompleted-status'"> </view>
-						<img :src="section.cover"/>
+					<view class="xx-item-box" v-for="section in dagangList" :key="section.jieId">
+						<view class="xx-item-status"
+							:class="section.wanchengFlag === 1 ? 'completed-status' : 'uncompleted-status'"> </view>
+						<img :src="section.cover" />
 						<view class="xx-text-box">
 						<view class="xx-text-box">
 							<view>{{ section.jieName }}</view>
 							<view>{{ section.jieName }}</view>
 							<view>{{ section.jieIntro }}</view>
 							<view>{{ section.jieIntro }}</view>
@@ -42,12 +48,12 @@
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
-			
+
 		</view>
 		</view>
 		<!-- 底部占位 -->
 		<!-- 底部占位 -->
 		<view class="xx-next-btn">学习下一单元</view>
 		<view class="xx-next-btn">学习下一单元</view>
 		<view class="xx-xw-text">课程已学完</view>
 		<view class="xx-xw-text">课程已学完</view>
-		
+
 		<!-- <scroll-view scroll-y class="scroll-view" :scroll-top="scrollTop" @scroll="onScroll"> </scroll-view> -->
 		<!-- <scroll-view scroll-y class="scroll-view" :scroll-top="scrollTop" @scroll="onScroll"> </scroll-view> -->
 
 
 		<danyuanInfoVue ref="dyRef" v-if="isShow" @close="isShow= false"></danyuanInfoVue>
 		<danyuanInfoVue ref="dyRef" v-if="isShow" @close="isShow= false"></danyuanInfoVue>
@@ -70,8 +76,15 @@
 				currentUnitName: "",
 				currentUnitName: "",
 				isShow: true,
 				isShow: true,
 				currentIndex: 0,
 				currentIndex: 0,
-				danyuanInfo:{}
-			
+				danyuanInfo: {},
+				banbenId: '',
+				danyuanId: '',
+				typeId: '',
+				fontDanyuanId: '',
+				nextDanyuanId: ''
+
+
+
 			}
 			}
 		},
 		},
 		components: {
 		components: {
@@ -86,21 +99,47 @@
 			console.log('学习页面隐藏,保存滚动位置')
 			console.log('学习页面隐藏,保存滚动位置')
 		},
 		},
 
 
-		onLoad() {
-
+		onLoad(options) {
+			console.log('options', options);
+			this.typeId = options.typeId
+			this.danyuanId = options.danyuanId
+			this.banbenId = options.banbenId
 			this.loadDataFromApi()
 			this.loadDataFromApi()
 		},
 		},
 
 
 		methods: {
 		methods: {
 
 
+
+			loadDataFromApi() {
+				const req = {
+					banbenId: this.banbenId,
+					danyuanId: this.danyuanId
+				}
+				shuxueChanpinDanyuanInfo(req).then(res => {
+					this.danyuanInfo = res.data
+					this.fontDanyuanId = res.data.fontDanyuanId
+					this.nextDanyuanId = res.data.nextDanyuanId
+					this.dagangList = res.data.dagangList || []
+					// 初始化当前单元
+					// if (this.danyuanList.length > 0) {
+					// 	this.currentUnitName = this.danyuanList[0].danyuanName
+					// }
+				})
+			},
+
 			prev() {
 			prev() {
 				if (this.currentIndex > 0) {
 				if (this.currentIndex > 0) {
 					this.currentIndex--
 					this.currentIndex--
+					this.danyuanId = this.fontDanyuanId
+					this.loadDataFromApi()
 				}
 				}
+
 			},
 			},
 			next() {
 			next() {
-				if (this.currentIndex < this.list.length - 1) {
+				if (this.currentIndex < this.dagangList.length - 1) {
 					this.currentIndex++
 					this.currentIndex++
+					this.danyuanId = this.nextDanyuanId
+					this.loadDataFromApi()
 				}
 				}
 			},
 			},
 
 
@@ -132,21 +171,6 @@
 				}, 100)
 				}, 100)
 			},
 			},
 
 
-			loadDataFromApi() {
-				const req = {
-					banbenId: 7,
-					danyuanId:2
-				}
-				shuxueChanpinDanyuanInfo(req).then(res => {
-					this.danyuanInfo = res.data
-					this.dagangList = res.data.dagangList || []
-					// 初始化当前单元
-					// if (this.danyuanList.length > 0) {
-					// 	this.currentUnitName = this.danyuanList[0].danyuanName
-					// }
-				})
-			},
-
 
 
 
 
 
 
@@ -160,4 +184,4 @@
 			}
 			}
 		}
 		}
 	}
 	}
-</script>
+</script>