diff --git a/pages/index/index.vue b/pages/index/index.vue index ee9695e..bde797f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -114,8 +114,8 @@ --> - 最热 - 最新 + 最热 + 最新 @@ -198,7 +198,8 @@ courseList:[],//课程列表数据 articleList: [],//文章列表数据 qaList: [],//问答列表数据 - tabIndex: 1, + tabIndex: 1,//文章最新,最热的切换 + qaTabIndex:1,//问答最新/最热的切换 conType: 0, loadStatus: 'more', pageSize:20,//统一每页多少条 @@ -401,7 +402,7 @@ isResolve:'', status:1 }; - if(this.tabIndex==0){ + if(this.qaTabIndex==0){ queryObj.orderField='id'; }else{ queryObj.orderField='answers'; @@ -464,11 +465,18 @@ type:'' } query.type=this.dataFilter.courseParams.type; - if(this.tabIndex==0){ - query.orderField='id'; - }else{ + // if(this.tabIndex==0){ + // query.orderField='publishTime'; + // }else{ + // query.orderField='studys'; + // } + // 2022-11 课程无最新,最热区分,推荐就 是最热,列表就是最新 + if(this.conType==0){ query.orderField='studys'; + }else if(this.conType==1){ + query.orderField='publishTime'; } + if(this.dataFilter.courseParams.scenes){ query.scenes=this.dataFilter.courseParams.scenes; } @@ -566,6 +574,9 @@ }, changeList(){ this.dataName='list'+this.tabIndex+this.conType; + if(this.conType == 4){ + this.dataName='list'+this.qaTabIndex+this.conType; + } let curData=this.dataList[this.dataName]; if(curData.list.length==0){ if(this.conType== 1) {// 课程 @@ -594,6 +605,11 @@ this.noPageList= true,//判断接口是否还有数据 this.noDataList= true,//判断接口是否还有数据 this.changeList(); }, + clickQaTab(idx) { + this.qaTabIndex = idx; + this.noPageList= true,//判断接口是否还有数据 this.noDataList= true,//判断接口是否还有数据 + this.changeList(); + }, changeConType(item) { this.dataFilter.courseParams = {}; this.conType = item.type;