|
@@ -113,6 +113,16 @@
|
|
|
</template>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
+ <view class="filters">
|
|
|
+ <scroll-view class="scroll_view_H" scroll-x="true" >
|
|
|
+ <!-- v-if="tabNum == 0" -->
|
|
|
+ <template >
|
|
|
+ <view v-for="(item, index) in subjectList" :key="index" class="filter_item" @click="changeSub(item.id, index)">
|
|
|
+ <view class="name" :class="{nactive: subIndex == index}">{{ item.subjectName }}</view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
<view class="course-list" v-show="tabCurrent==0">
|
|
|
<template v-if="list1.length">
|
|
|
<!-- hover-class="none" -->
|
|
@@ -286,6 +296,9 @@ export default {
|
|
|
bankIndex: 0,
|
|
|
courseId: '',
|
|
|
bankId: '',
|
|
|
+ subjectList: [],
|
|
|
+ subIndex: 0,
|
|
|
+ courSubjectId: '',
|
|
|
};
|
|
|
},
|
|
|
async onLoad(option) {
|
|
@@ -371,28 +384,30 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
async onPullDownRefresh() {
|
|
|
+ console.log('下拉this.courseId:', this.courseId)
|
|
|
if (this.tabNum == 0) {
|
|
|
this.list1 = []
|
|
|
this.paramList[0].pageNum = 1
|
|
|
- this.list1 = await this.getGoodsList(this.courseId, 0)
|
|
|
+ this.list1 = await this.getGoodsList(this.courseId, 0, this.courSubjectId)
|
|
|
} else {
|
|
|
this.list2 = []
|
|
|
this.paramList[1].pageNum = 1
|
|
|
- this.list2 = await this.getGoodsList(this.bankId, 1)
|
|
|
+ this.list2 = await this.getGoodsList(this.bankId, 1, this.courSubjectId)
|
|
|
}
|
|
|
},
|
|
|
async onReachBottom() {
|
|
|
+ console.log('加载this.courseId:', this.courseId, this.list1.length, this.paramList[0].total)
|
|
|
if (this.tabNum == 0) {
|
|
|
if (this.list1.length < this.paramList[0].total) {
|
|
|
this.paramList[0].pageNum++
|
|
|
- let list1 = await this.getGoodsList(this.courseId, 0)
|
|
|
+ let list1 = await this.getGoodsList(this.courseId, 0, this.courSubjectId)
|
|
|
this.list1.push(...list1)
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
if (this.list2.length < this.paramList[1].total) {
|
|
|
this.paramList[1].pageNum++
|
|
|
- let list2 = await this.getGoodsList(this.bankId, 1)
|
|
|
+ let list2 = await this.getGoodsList(this.bankId, 1, this.courSubjectId)
|
|
|
this.list1.push(...list2)
|
|
|
}
|
|
|
}
|
|
@@ -587,7 +602,7 @@ export default {
|
|
|
this.courseId = recommendId
|
|
|
this.paramList[0].pageNum = 1
|
|
|
this.list1 = []
|
|
|
- let list1 = await this.getGoodsList(recommendId, 0)
|
|
|
+ let list1 = await this.getGoodsList(recommendId, 0, this.courSubjectId)
|
|
|
this.list1.push(...list1)
|
|
|
},
|
|
|
async changebank(recommendId, index) {
|
|
@@ -595,9 +610,25 @@ export default {
|
|
|
this.bankId = recommendId
|
|
|
this.paramList[1].pageNum = 1
|
|
|
this.list2 = []
|
|
|
- let list2 = await this.getGoodsList(recommendId, 1)
|
|
|
+ let list2 = await this.getGoodsList(recommendId, 1, this.courSubjectId)
|
|
|
this.list2.push(...list2)
|
|
|
},
|
|
|
+ async changeSub(subjectId, index) {
|
|
|
+ console.log('subjectId, index:', subjectId, index, 'this.courseId:', this.courseId, 'this.bankId:', this.bankId)
|
|
|
+ this.subIndex = index
|
|
|
+ this.courSubjectId = subjectId
|
|
|
+ this.paramList[this.tabNum].pageNum = 1
|
|
|
+ if (this.tabNum == 0) {
|
|
|
+ this.list1 = []
|
|
|
+ let list1 = await this.getGoodsList(this.courseId, 0, subjectId)
|
|
|
+ this.list1.push(...list1)
|
|
|
+ } else {
|
|
|
+ this.list2 = []
|
|
|
+ let list2 = await this.getGoodsList(this.bankId, 1, subjectId)
|
|
|
+ this.list2.push(...list2)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
//课程
|
|
|
courseLists() {
|
|
|
// var param = this.paramList[0];
|
|
@@ -629,32 +660,47 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
if (this.courseName.length) {
|
|
|
- let courseId = this.courseId ? this.courseId : this.courseName[0].recommendId
|
|
|
- this.courseId = this.courseName[0].recommendId
|
|
|
- let list1 = await this.getGoodsList(courseId, 0)
|
|
|
+ let courseId = ''
|
|
|
+ if (this.courseId) {
|
|
|
+ courseId = this.courseId
|
|
|
+ } else {
|
|
|
+ courseId = this.courseName[0].recommendId
|
|
|
+ this.courseId = this.courseName[0].recommendId
|
|
|
+ }
|
|
|
+ console.log('courseId:', courseId)
|
|
|
+ this.getSubjectList(courseId)
|
|
|
+ let list1 = await this.getGoodsList(courseId, 0, '')
|
|
|
this.list1.push(...list1)
|
|
|
}
|
|
|
|
|
|
if (this.bankName.length) {
|
|
|
- let bankId = this.bankId ? this.bankId : this.bankName[0].recommendId
|
|
|
- this.bankId = this.bankName[0].recommendId
|
|
|
- let list2 = await this.getGoodsList(bankId, 1)
|
|
|
+ let bankId = ''
|
|
|
+ if (this.bankId) {
|
|
|
+ bankId = this.bankId
|
|
|
+ } else {
|
|
|
+ bankId = this.bankName[0].recommendId
|
|
|
+ this.bankId = this.bankName[0].recommendId
|
|
|
+ }
|
|
|
+ let list2 = await this.getGoodsList(bankId, 1, '')
|
|
|
this.list2.push(...list2)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getGoodsList(recommendId, num) {
|
|
|
+ getGoodsList(recommendId, num, subjectId) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- this.$http({
|
|
|
+ let params = {
|
|
|
+ pageNum: this.paramList[num].pageNum,
|
|
|
+ pageSize: this.paramList[num].pageSize,
|
|
|
+ recommendId: recommendId
|
|
|
+ }
|
|
|
+ subjectId && (params.subjectId = subjectId)
|
|
|
+ console.log('params:', params)
|
|
|
+ this.$http({
|
|
|
url: `/app/common/activity/recommend/goodsList`,
|
|
|
method: 'get',
|
|
|
- data: {
|
|
|
- pageNum: this.paramList[num].pageNum,
|
|
|
- pageSize: this.paramList[num].pageSize,
|
|
|
- recommendId: recommendId
|
|
|
- },
|
|
|
+ data: params,
|
|
|
noToken: true
|
|
|
}).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
@@ -665,6 +711,22 @@ export default {
|
|
|
})
|
|
|
|
|
|
},
|
|
|
+ getSubjectList(recommendId) {
|
|
|
+ this.$http({
|
|
|
+ url: `/app/common/activity/recommend/subjectList`,
|
|
|
+ method: 'get',
|
|
|
+ data: {
|
|
|
+ recommendId: recommendId
|
|
|
+ },
|
|
|
+ noToken: true
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ let data = res.data.data || []
|
|
|
+ this.subjectList = [{ id: '', subjectName: '全部'}, ...data]
|
|
|
+ console.log('this.subjectList:', this.subjectList)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* @param {Object} item
|
|
|
* 跳转课程详情
|
|
@@ -810,6 +872,8 @@ export default {
|
|
|
tab(e) {
|
|
|
this.tabCurrent = e;
|
|
|
this.tabNum = e
|
|
|
+ let recommendId = e == 0 ? this.courseId : this.bankId
|
|
|
+ this.getSubjectList(recommendId)
|
|
|
},
|
|
|
updateHomePlan() {
|
|
|
this.$refs.home.init();
|