From c6808cc8bf162676a115f57d4a740f5b71039911 Mon Sep 17 00:00:00 2001 From: daihh Date: Fri, 25 Nov 2022 23:10:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=84=E5=88=86=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=88=91=E7=9A=84?= =?UTF-8?q?=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/modules/courseGrade.js | 11 ++++++++- pages/study/courseStudy.vue | 45 ++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/api/modules/courseGrade.js b/api/modules/courseGrade.js index 08e683f..cfdc76e 100644 --- a/api/modules/courseGrade.js +++ b/api/modules/courseGrade.js @@ -16,7 +16,16 @@ const has=function(id){ return ajax.get(`/xboe/m/grade/has?courseId=${id}`); } +/** + * courseId,aid + * aid不传默认当前账户 + */ +const score=function (query){ + return ajax.post('/xboe/m/grade/score',query); +} + export default{ grade, - has + has, + score } \ No newline at end of file diff --git a/pages/study/courseStudy.vue b/pages/study/courseStudy.vue index 9b947fd..97e0a94 100644 --- a/pages/study/courseStudy.vue +++ b/pages/study/courseStudy.vue @@ -162,8 +162,16 @@ 课程评分: - - {{toScore(scoreInfo.score)}} + + {{toScore(courseInfo.score)}} + + + + + + 我的评分: + + {{toScore(myScore)}} @@ -411,19 +419,19 @@ courseId:'',//当前课程的id studyId: '',//当前学习的id initContentId:'',//初始化的内容id - courseInfo:{id:'',name:''},//课程信息 + courseInfo:{id:'',name:'',score:0},//课程信息 teachers:[],//课程老师列表 recommendCourses:[],//推荐课程列表 catalogShow:false,//是否显示目录 totalContent:0,//课程内容数量 hasSection:false,//是否有目录 tabIndex:1,//显示的tab内容 - scoreInfo:{dlgShow:false, score:5, has:false},//评分控制项 + scoreInfo:{dlgShow:false, score:0, has:false},//评分控制项 isPraise:false,//是否已点赞 isTrample:false,//是否已踩 isFavorite:false,//是否已收藏 isFollow:false,//是否已关注 - + myScore:0,//我的评分,如果是0表未评分 toScore:toScore, formatUserNumber:formatUserNumber, getConType:getContentType, @@ -525,6 +533,7 @@ this.loadSysTypes(); this.loadReCourses();//加载推荐课程 this.loadIsData();//加载关注,收藏,评价等信息 + this.loadMyScore(); }, onShow(){ uni.setNavigationBarTitle({ title:'\u200E' }) @@ -562,6 +571,14 @@ window.clearTimeout(this.handleTimeout); } }, + loadMyScore(){ + apiCourseGrade.score({courseId:this.courseId}).then(rs=>{ + if(rs.status==200){ + this.myScore=rs.result.scores; + this.scoreInfo.has=true; + } + }) + }, loadDetail(){ let $this=this; uni.showLoading({title:'加载中...'}) @@ -583,7 +600,7 @@ return; } $this.courseInfo=rs.result.course; - $this.scoreInfo.score=rs.result.course.score; + //$this.scoreInfo.score=rs.result.course.score; //处理老师数据 if(rs.result.teachers && rs.result.teachers.length > 0) { let userIds = []; @@ -777,11 +794,11 @@ this.isFavorite=false; } }) - apiCourseGrade.has(this.courseId).then(rs=>{ - if(rs.status==200 && rs.result){ - this.scoreInfo.has=true; - } - }); + // apiCourseGrade.has(this.courseId).then(rs=>{ + // if(rs.status==200 && rs.result){ + // this.scoreInfo.has=true; + // } + // }); apiPraises.has(1,this.courseId).then(rs=>{ if(rs.status==200 && rs.result){ this.isPraise=true; @@ -920,6 +937,12 @@ if(rs.status==200){ this.scoreInfo.dlgShow=false; this.scoreInfo.has=true; + if(this.courseInfo.score==0){ + this.courseInfo.score=postData.score; + } + if(this.myScore==0){ + this.myScore=postData.score; + } this.$refs.messager.show({message:'评分成功,谢谢您的评分',type:'success'}); //发送评分事件 let event = {