This commit is contained in:
zhaofang
2022-07-21 19:08:03 +08:00
parent e220e99408
commit 4f89bc863f
5 changed files with 2614 additions and 237 deletions

View File

@@ -3,7 +3,7 @@
<u-toast ref="messager"></u-toast>
<!--页面头部-->
<view class="top" style="padding-top: 6px;">
<view class="top-bar">
<view class="top-bar">
<view style="position: relative" @click="toMessage()" >
<view v-if="msgNum>0" style="position: absolute;top:12px;right: 16px;z-index: 999;">
<u-badge :isDot="true" :offset="[30,30]" type="error"></u-badge>
@@ -83,28 +83,21 @@
</view>
<view class="con-au">
<view v-if="c.type==10 || c.type==20" class="item-author" style="display: flex;">
<!-- <author v-if="c.authorInfo" :showInfo="true" :data="c.authorInfo"></author> -->
<text style="font-size: 28upx; color: #666666;">{{c.teachersName}}</text>
<text style="font-size: 28upx; color: #666666;">{{c.teacher}}</text>
</view>
<view v-else style="font-size: 28upx; color: #666666;padding-top: 10upx;">
<!-- <text>发布时间</text><text>{{c.sysCreateTime}}</text> -->
</view>
<!-- <view v-if="c.score==0" class="stu-f">未评分</view> -->
</view>
<view class="statuy-ren">
<view class="">
<text style="color: #FF8E00;">
{{c.studys}}
{{c.studies}}
</text>
人学习
</view>
<view class="statuy-score">
<text >{{converToScore(c.score)}}</text>
</view>
</view>
</view>
@@ -480,42 +473,15 @@
scenes:'',
type:''
}
let oldPageIndex = 0;
if(this.dataFilter.courseParams.type == undefined && this.dataFilter.courseParams.cateName == undefined) {
oldPageIndex = curData.pageIndex-3;
}
else {
oldPageIndex = curData.pageIndex;
}
let oldParams={type:'',page:oldPageIndex,size:10,cateName:this.dataFilter.courseParams.cateName,sort:''};//老数据的查询条件
let courseType=this.dataFilter.courseParams.type;
query.type=this.dataFilter.courseParams.type;
if(this.tabIndex==0){
query.orderField='id';
oldParams.sort = 'new';
}else{
query.orderField='studys';
oldParams.sort = 'hot';
}
if(courseType){
query.type=courseType;
if(courseType==10){
oldParams.type='weike';
}else if(courseType==20){
oldParams.type='online-course';
}else if(courseType==30){
//query.type=courseType;
oldParams.type='face-course';
}else if(courseType==40){
//query.type=courseType;
oldParams.type='project';
}else{
//oldParams.type=courseType;
}
if(this.dataFilter.courseParams.scenes){
query.scenes=this.dataFilter.courseParams.scenes;
}
// if(this.dataFilter.courseParams.scenes){
// query.scenes=this.dataFilter.courseParams.scenes;
// }
if(this.dataFilter.courseParams.sysType1){
query.sysType1=this.dataFilter.courseParams.sysType1;
}
@@ -525,111 +491,20 @@
if(this.dataFilter.courseParams.sysType3){
query.sysType3=this.dataFilter.courseParams.sysType3;
}
if(curData.pageIndex > this.totalPages) {
this.noDataList = true;
oldParams.page=curData.pageIndex-this.totalPages;
}else{
if(this.totalPages<3){
this.noDataList = false;
}
}
// if(oldParams.page < 1) {
// this.noDataList = false;
// } else {
// this.noDataList = true;
// }
//从新课程库中取10条从老库中取10条 keyword:this.course.keyword
if(courseType == 30 || courseType == 40) {
this.noPageList = false;
}
uni.showLoading({title:'加载中...'});
if(courseType!=10){
this.noDataList && await apiBoeCourse.courseList(oldParams).then(res=>{
setTimeout(function(){ uni.hideLoading() },100);
if(res.status==200 && res.result.dataList.length > 0){
let list = this.filterConversion(res.result.dataList);
list.forEach(item=>{
// curData.list.push(item);
data.push(item);
});
// this.courseList=curData.list;
} else {
this.noDataList = false;
}
})
}
this.noPageList && await apiCoursePortal.pageList(query).then(res=>{
setTimeout(function(){ uni.hideLoading() },100);
if(res.status==200 && res.result.list.length>0){
this.totalPages = res.result.totalPages;
let courseIds=[];
res.result.list.forEach(item=>{
item.authorInfo={avatar:'',name:'',code:'',sex:null};
item.teachersName = '';
item.teachersId = '';
// curData.list.push(item);
// data.push(item);
courseIds.push(item.id);
if(item.isTop) {
isTopList.push(item);
} else {
data.push(item);
}
});
this.loadCouserTeacher(res.result.list,courseIds);
}else{
this.noPageList = false;
}
})
if(this.tabIndex==0) {//最新
// curData.list.sort(this.pcompare("publishTime",false))
data.sort(this.pcompare("publishTime",false))
}
if(this.tabIndex==1) {//最热
// curData.list.sort(this.pcompare("studys",false))
data.sort(this.pcompare("studys",false))
}
// curData.list.sort(this.pcompare("sysCreateTime",false));
curData.list.push(...isTopList,...data);
this.courseList=curData.list;
if(this.noPageList || this.noDataList) {
await apiCoursePortal.courseSearch(query).then(res=>{
setTimeout(function(){ uni.hideLoading() },100);
if(res.status==200 && res.result.list.length>0){
curData.list.push(...res.result.list);
this.loadStatus='more';
} else if(!this.noPageList && !this.noDataList) {
}else{
this.loadStatus='noMore';
}
})
this.courseList=curData.list;
},
pcompare(prop,rev) {
if(rev === undefined) {
rev = 1;
}else {
rev = rev?1:-1;
}
return function(obj1,obj2) {
let val1 = obj1[prop],val2 = obj2[prop];
return val1 < val2 ? rev*(-1):rev*1;
}
},
filterConversion(data) {
let list = [];
data.forEach((item,index)=>{
list.push({
coverImg: item.cover[0].url,
name: item.title,
type: item.type,
id: item.id,
studys:Number(item.enrollSuccess),//学习人数
score: item.score,
avatar: '',
code: '',
sex:null,
sysCreateTime:item.releaseDate,//用于记录时间,
sysCreateBy:'',
})
})
return list;
},
//拿到文章数据列表方法
findArticleData(){
//console.log('查询文章');