mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-09 10:56:47 +08:00
提交
This commit is contained in:
@@ -72,8 +72,12 @@ const scorelist=function(num){
|
|||||||
const getTeacherByCourseIDs = function(ids){
|
const getTeacherByCourseIDs = function(ids){
|
||||||
return ajax.postJson('/xboe/m/course/portal/query-teacher', ids);
|
return ajax.postJson('/xboe/m/course/portal/query-teacher', ids);
|
||||||
}
|
}
|
||||||
|
const courseSearch=function(query){
|
||||||
|
return ajax.post('/xboe/m/course/fulltext/search',query);
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
courseSearch,
|
||||||
list,
|
list,
|
||||||
pageList,
|
pageList,
|
||||||
detail,
|
detail,
|
||||||
|
|||||||
1338
pages/index/index(1).vue
Normal file
1338
pages/index/index(1).vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
|||||||
<u-toast ref="messager"></u-toast>
|
<u-toast ref="messager"></u-toast>
|
||||||
<!--页面头部-->
|
<!--页面头部-->
|
||||||
<view class="top" style="padding-top: 6px;">
|
<view class="top" style="padding-top: 6px;">
|
||||||
<view class="top-bar">
|
<view class="top-bar">
|
||||||
<view style="position: relative" @click="toMessage()" >
|
<view style="position: relative" @click="toMessage()" >
|
||||||
<view v-if="msgNum>0" style="position: absolute;top:12px;right: 16px;z-index: 999;">
|
<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>
|
<u-badge :isDot="true" :offset="[30,30]" type="error"></u-badge>
|
||||||
@@ -83,28 +83,21 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="con-au">
|
<view class="con-au">
|
||||||
<view v-if="c.type==10 || c.type==20" class="item-author" style="display: flex;">
|
<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.teacher}}</text>
|
||||||
<text style="font-size: 28upx; color: #666666;">{{c.teachersName}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view v-else style="font-size: 28upx; color: #666666;padding-top: 10upx;">
|
<view v-else style="font-size: 28upx; color: #666666;padding-top: 10upx;">
|
||||||
<!-- <text>发布时间:</text><text>{{c.sysCreateTime}}</text> -->
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <view v-if="c.score==0" class="stu-f">未评分</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="statuy-ren">
|
<view class="statuy-ren">
|
||||||
<view class="">
|
<view class="">
|
||||||
<text style="color: #FF8E00;">
|
<text style="color: #FF8E00;">
|
||||||
|
{{c.studies}}
|
||||||
{{c.studys}}
|
|
||||||
</text>
|
</text>
|
||||||
人学习
|
人学习
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="statuy-score">
|
<view class="statuy-score">
|
||||||
<text >{{converToScore(c.score)}}分</text>
|
<text >{{converToScore(c.score)}}分</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@@ -480,42 +473,15 @@
|
|||||||
scenes:'',
|
scenes:'',
|
||||||
type:''
|
type:''
|
||||||
}
|
}
|
||||||
let oldPageIndex = 0;
|
query.type=this.dataFilter.courseParams.type;
|
||||||
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;
|
|
||||||
if(this.tabIndex==0){
|
if(this.tabIndex==0){
|
||||||
query.orderField='id';
|
query.orderField='id';
|
||||||
oldParams.sort = 'new';
|
|
||||||
}else{
|
}else{
|
||||||
query.orderField='studys';
|
query.orderField='studys';
|
||||||
oldParams.sort = 'hot';
|
|
||||||
}
|
}
|
||||||
if(courseType){
|
if(this.dataFilter.courseParams.scenes){
|
||||||
query.type=courseType;
|
query.scenes=this.dataFilter.courseParams.scenes;
|
||||||
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.sysType1){
|
if(this.dataFilter.courseParams.sysType1){
|
||||||
query.sysType1=this.dataFilter.courseParams.sysType1;
|
query.sysType1=this.dataFilter.courseParams.sysType1;
|
||||||
}
|
}
|
||||||
@@ -525,111 +491,20 @@
|
|||||||
if(this.dataFilter.courseParams.sysType3){
|
if(this.dataFilter.courseParams.sysType3){
|
||||||
query.sysType3=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
|
//从新课程库中取10条,从老库中取10条 keyword:this.course.keyword
|
||||||
if(courseType == 30 || courseType == 40) {
|
|
||||||
this.noPageList = false;
|
|
||||||
}
|
|
||||||
uni.showLoading({title:'加载中...'});
|
uni.showLoading({title:'加载中...'});
|
||||||
if(courseType!=10){
|
await apiCoursePortal.courseSearch(query).then(res=>{
|
||||||
this.noDataList && await apiBoeCourse.courseList(oldParams).then(res=>{
|
setTimeout(function(){ uni.hideLoading() },100);
|
||||||
setTimeout(function(){ uni.hideLoading() },100);
|
if(res.status==200 && res.result.list.length>0){
|
||||||
if(res.status==200 && res.result.dataList.length > 0){
|
curData.list.push(...res.result.list);
|
||||||
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) {
|
|
||||||
this.loadStatus='more';
|
this.loadStatus='more';
|
||||||
} else if(!this.noPageList && !this.noDataList) {
|
}else{
|
||||||
this.loadStatus='noMore';
|
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(){
|
findArticleData(){
|
||||||
//console.log('查询文章');
|
//console.log('查询文章');
|
||||||
|
|||||||
1249
pages/resource/search(1).vue
Normal file
1249
pages/resource/search(1).vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -85,14 +85,14 @@
|
|||||||
<view class="con-au">
|
<view class="con-au">
|
||||||
<view v-if="c.type==10 || c.type==20" class="item-author" style="display: flex;">
|
<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> -->
|
<!-- <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>
|
||||||
<view v-else style="font-size: 24upx; color: #666666;padding-top: 10upx;">
|
<view v-else style="font-size: 24upx; color: #666666;padding-top: 10upx;">
|
||||||
<!-- <text>发布时间:</text><text>{{c.showTime}}</text> -->
|
<!-- <text>发布时间:</text><text>{{c.showTime}}</text> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="statuy-ren">
|
<view class="statuy-ren">
|
||||||
<text><text class="statuy-num">{{c.studys}}</text>人学习</text>
|
<text><text class="statuy-num">{{c.studies}}</text>人学习</text>
|
||||||
<view v-if="c.score" class="stu-f">{{converToScore(c.score)}}分</view>
|
<view v-if="c.score" class="stu-f">{{converToScore(c.score)}}分</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -526,112 +526,23 @@
|
|||||||
},
|
},
|
||||||
async loadCourseData(){
|
async loadCourseData(){
|
||||||
uni.showLoading({title:'加载中...'});
|
uni.showLoading({title:'加载中...'});
|
||||||
this.course.params.keyword=this.keyword;
|
this.course.params.keyword=this.keyword;
|
||||||
//查询课程
|
|
||||||
let $this=this;
|
|
||||||
let dataList = [];
|
|
||||||
//查询课程
|
//查询课程
|
||||||
this.noPageList = false;
|
|
||||||
let $this=this;
|
let $this=this;
|
||||||
this.noPageList && await apiCoursePortal.pageList(this.course.params).then(rs=>{
|
|
||||||
setTimeout(function(){ uni.hideLoading();},100);
|
|
||||||
let dataList = [];
|
let dataList = [];
|
||||||
if(rs.status==200){
|
await apiCoursePortal.courseSearch(this.course.params).then(rs=>{
|
||||||
|
|
||||||
//let userIds=[];
|
|
||||||
let courseIds=[];
|
|
||||||
rs.result.list.forEach(item=>{
|
|
||||||
item.name = this.$keywordActiveShow(item.name,this.course.params.keyword);
|
|
||||||
item.authorInfo={avatar:'',code:'',name:'',sex: null
|
|
||||||
}
|
|
||||||
$this.course.list.push(item);
|
|
||||||
dataList.push(item);
|
|
||||||
item.teachersName = '';
|
|
||||||
item.teachersId = '';
|
|
||||||
//userIds.push(item.sysCreateAid)
|
|
||||||
courseIds.push(item.id);
|
|
||||||
})
|
|
||||||
|
|
||||||
if(rs.result.list.length == 0) {
|
|
||||||
this.noPageList = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(function(){ uni.hideLoading();},100);
|
setTimeout(function(){ uni.hideLoading();},100);
|
||||||
// this.course.loadStatus='noMore';
|
if(rs.status==200){
|
||||||
// }
|
let courseIds=[];
|
||||||
|
this.course.list.push(...rs.result.list);
|
||||||
|
this.course.count=rs.result.count;
|
||||||
|
if(rs.result.list.length == 0) {
|
||||||
this.course.loadStatus='noMore';
|
this.course.loadStatus='noMore';
|
||||||
} else {
|
} else {
|
||||||
this.course.loadStatus='more'
|
this.course.loadStatus='more'
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.$refs.messager.show({message:rs.message,type:'error'});
|
this.$refs.messager.show({message:rs.message,type:'error'});
|
||||||
}
|
|
||||||
}).catch(err=>{
|
|
||||||
setTimeout(function(){ uni.hideLoading();},100);
|
|
||||||
})
|
|
||||||
//从新课程库中取10条,从老库中取10条 keyword:this.course.keyword
|
|
||||||
let oldParams={type:'',page:$this.course.params.pageIndex,size:10,keyword:$this.course.params.keyword,cateName:$this.course.params.cateName,sort:''}
|
|
||||||
if($this.course.params.type==20){
|
|
||||||
oldParams.type='online-course';
|
|
||||||
}else if($this.course.params.type==30){
|
|
||||||
oldParams.type='face-course';
|
|
||||||
}else if($this.course.params.type==40){
|
|
||||||
oldParams.type='project';
|
|
||||||
}
|
|
||||||
if($this.course.params.orderField == 'id') {//最新
|
|
||||||
oldParams.sort = 'new';
|
|
||||||
}
|
|
||||||
if($this.course.params.orderField == 'studys') {//最热
|
|
||||||
oldParams.sort = 'hot';
|
|
||||||
}
|
|
||||||
uni.showLoading({title:'加载中...'});
|
|
||||||
this.noDataList && await apiBoeCourse.courseList(oldParams).then(res=>{
|
|
||||||
setTimeout(function(){ uni.hideLoading() },100);
|
|
||||||
if(res.status==200){
|
|
||||||
if(res.result.dataList.length == 0) {
|
|
||||||
this.noDataList = false;
|
|
||||||
}
|
|
||||||
let list = this.filterConversion(res.result.dataList);
|
|
||||||
this.course.list.push(...list);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if($this.course.params.orderField == 'id') {//最新
|
|
||||||
this.course.list.sort(this.pcompare("publishTime",false))
|
|
||||||
}
|
|
||||||
if($this.course.params.orderField == 'studys') {//最热
|
|
||||||
this.course.list.sort(this.pcompare("studys",false))
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.noPageList || this.noDataList) {
|
|
||||||
this.course.loadStatus='more'
|
|
||||||
} else if(!this.noPageList && !this.noDataList) {
|
|
||||||
this.course.loadStatus='noMore';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
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: '',
|
|
||||||
ucode: '',
|
|
||||||
showTime:item.releaseDate,//用于记录时间,
|
|
||||||
}
|
}
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
setTimeout(function(){ uni.hideLoading();},100);
|
setTimeout(function(){ uni.hideLoading();},100);
|
||||||
|
|||||||
Reference in New Issue
Block a user