mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-06 17:36:45 +08:00
课程评分的调整,增加我的评分
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -162,8 +162,16 @@
|
||||
<view class="desrow">
|
||||
<view style="display: flex;">
|
||||
<text class="desrow-name">课程评分:</text>
|
||||
<u-rate v-if="scoreInfo.score>0" :count="5" activeColor="#F37101" :size="16" v-model="scoreInfo.score"></u-rate>
|
||||
<text class="score">{{toScore(scoreInfo.score)}}</text>
|
||||
<u-rate v-if="courseInfo.score>0" :count="5" activeColor="#F37101" :size="16" v-model="courseInfo.score"></u-rate>
|
||||
<text class="score">{{toScore(courseInfo.score)}}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="desrow" v-if="myScore>0">
|
||||
<view style="display: flex;">
|
||||
<text class="desrow-name">我的评分:</text>
|
||||
<u-rate :count="5" activeColor="#F37101" :size="16" v-model="myScore"></u-rate>
|
||||
<text class="score">{{toScore(myScore)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="totalContent>1" class="desrow">
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user