Browse Source

修改推荐课程和题库的接口

xuqiaoying 3 năm trước cách đây
mục cha
commit
4588e4d664
1 tập tin đã thay đổi với 32 bổ sung33 xóa
  1. 32 33
      pages/index/index.vue

+ 32 - 33
pages/index/index.vue

@@ -256,9 +256,7 @@ export default {
 				}
 			],
 			total1: 0,
-			showStatus1: 0,
 			total2: 0,
-			showStatus2: 0,
 			list1: [],
 			list2: [],
 			isLogin:false,
@@ -306,10 +304,9 @@ export default {
 	onShow() {
 		this.getInfo() // 判断有没有关注公众号		
 		this.isClickOff() //关注公众号,每天最多显示1次;当天学员关闭弹窗后,无需再显示
-		console.log('this.$store.state.scene', this.$store.state.scene)
 		uni.removeStorageSync('goPath')
 		this.courseList();
-		this.bankList();
+		// this.bankList();
 		if (uni.getStorageSync('updateHome')){
 			this.init()
 			uni.removeStorageSync('updateHome'); //消费首页刷新事件
@@ -342,7 +339,6 @@ export default {
 		...mapGetters(['dictObj','userInfo', 'hideBuyState']),
 		opacitys() {
 			const value = [1011,1017,1025,1047,1124].includes(this.$store.state.scene) && this.isLogin && (this.isFollow != 1) && this.curClose ? 1 : 0
-			console.log('this.opacity::', value)
 			return value
 		},
 	},
@@ -354,7 +350,6 @@ export default {
 				if(res.data.code == 200){
 					this.$store.state.userInfo = res.data.data
 					this.isFollow = res.data.data.userFollowWx // 不是1就是没关注
-					console.log('有没有关注', this.isFollow, this.isFollow != 1)
 				}
 			})
 		},
@@ -513,38 +508,42 @@ export default {
 		},
 		//课程
 		courseList() {
-			var param = this.paramList[0];
+			// var param = this.paramList[0];
 			// /app/common/goods/list
-			// this.$http({
-			// 	url: '/app/common/activity/recommend/list',
-			// 	method: 'get',
-			// 	data: {
-			// 		platform: 1,
-			// 		status: 1,
-			// 	},
-			// 	noToken: true
-			// }).then((res) => {
-			// 	console.log('s---->', res)
+			this.$http({
+				url: '/app/common/activity/recommend/list',
+				method: 'get',
+				data: {
+					platform: 1,
+					status: 1
+				},
+				noToken: true
+			}).then((res) => {
+				if (res.data.code == 200) {
+					let goodsList1 = []; //推荐视频商品
+          			let goodsList2 = []; //推荐题库商品
+					res.data.rows.forEach((item) => {
+						if (item.type === 1) {
+							goodsList1 = goodsList1.concat(item.goodsList)
+						}
+						if (item.type === 2) {
+							goodsList2 = goodsList2.concat(item.goodsList)
+						}
+					});
+					this.list1 = goodsList1.sort((a, b) => a.sort - b.sort);
+					this.list2 = goodsList2.sort((a, b) => a.sort - b.sort);
+					console.log(this.list1, this.list2)
+				}
+			})
+			// this.$api.goodsList(param).then(res => {
 			// 	if (res.data.code == 200) {
-			// 		this.list1 = res.data.rows && (res.data.rows[0].goodsList || [])
-			// 		this.list1 = this.list1.sort((a, b) => a.sort - b.sort)
-          	// 		// this.goodsList2 = goodsList2.sort((a, b) => a.sort - b.sort);
-			// 		this.total1 = res.data.rows[0].goodsList.length
-			// 		if (this.list1.length === this.total1) {
+			// 		this.list1 = res.data.rows || []
+			// 		this.total1 = res.data.total
+			// 		if (this.list1.length === res.data.total) {
 			// 			this.showStatus1 = true
 			// 		}
 			// 	}
-			// })
-			this.$api.goodsList(param).then(res => {
-				if (res.data.code == 200) {
-					this.list1 = res.data.rows || []
-					this.total1 = res.data.total
-					if (this.list1.length === res.data.total) {
-						this.showStatus1 = true
-					}
-				}
-				
-			});
+			// });
 		},
 		//题库
 		bankList() {