mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-08 18:36:47 +08:00
课程评分的调整,增加我的评分
This commit is contained in:
@@ -16,7 +16,16 @@ const has=function(id){
|
|||||||
return ajax.get(`/xboe/m/grade/has?courseId=${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{
|
export default{
|
||||||
grade,
|
grade,
|
||||||
has
|
has,
|
||||||
|
score
|
||||||
}
|
}
|
||||||
@@ -162,8 +162,16 @@
|
|||||||
<view class="desrow">
|
<view class="desrow">
|
||||||
<view style="display: flex;">
|
<view style="display: flex;">
|
||||||
<text class="desrow-name">课程评分:</text>
|
<text class="desrow-name">课程评分:</text>
|
||||||
<u-rate v-if="scoreInfo.score>0" :count="5" activeColor="#F37101" :size="16" v-model="scoreInfo.score"></u-rate>
|
<u-rate v-if="courseInfo.score>0" :count="5" activeColor="#F37101" :size="16" v-model="courseInfo.score"></u-rate>
|
||||||
<text class="score">{{toScore(scoreInfo.score)}}</text>
|
<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>
|
</view>
|
||||||
<view v-if="totalContent>1" class="desrow">
|
<view v-if="totalContent>1" class="desrow">
|
||||||
@@ -411,19 +419,19 @@
|
|||||||
courseId:'',//当前课程的id
|
courseId:'',//当前课程的id
|
||||||
studyId: '',//当前学习的id
|
studyId: '',//当前学习的id
|
||||||
initContentId:'',//初始化的内容id
|
initContentId:'',//初始化的内容id
|
||||||
courseInfo:{id:'',name:''},//课程信息
|
courseInfo:{id:'',name:'',score:0},//课程信息
|
||||||
teachers:[],//课程老师列表
|
teachers:[],//课程老师列表
|
||||||
recommendCourses:[],//推荐课程列表
|
recommendCourses:[],//推荐课程列表
|
||||||
catalogShow:false,//是否显示目录
|
catalogShow:false,//是否显示目录
|
||||||
totalContent:0,//课程内容数量
|
totalContent:0,//课程内容数量
|
||||||
hasSection:false,//是否有目录
|
hasSection:false,//是否有目录
|
||||||
tabIndex:1,//显示的tab内容
|
tabIndex:1,//显示的tab内容
|
||||||
scoreInfo:{dlgShow:false, score:5, has:false},//评分控制项
|
scoreInfo:{dlgShow:false, score:0, has:false},//评分控制项
|
||||||
isPraise:false,//是否已点赞
|
isPraise:false,//是否已点赞
|
||||||
isTrample:false,//是否已踩
|
isTrample:false,//是否已踩
|
||||||
isFavorite:false,//是否已收藏
|
isFavorite:false,//是否已收藏
|
||||||
isFollow:false,//是否已关注
|
isFollow:false,//是否已关注
|
||||||
|
myScore:0,//我的评分,如果是0表未评分
|
||||||
toScore:toScore,
|
toScore:toScore,
|
||||||
formatUserNumber:formatUserNumber,
|
formatUserNumber:formatUserNumber,
|
||||||
getConType:getContentType,
|
getConType:getContentType,
|
||||||
@@ -525,6 +533,7 @@
|
|||||||
this.loadSysTypes();
|
this.loadSysTypes();
|
||||||
this.loadReCourses();//加载推荐课程
|
this.loadReCourses();//加载推荐课程
|
||||||
this.loadIsData();//加载关注,收藏,评价等信息
|
this.loadIsData();//加载关注,收藏,评价等信息
|
||||||
|
this.loadMyScore();
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow(){
|
||||||
uni.setNavigationBarTitle({ title:'\u200E' })
|
uni.setNavigationBarTitle({ title:'\u200E' })
|
||||||
@@ -562,6 +571,14 @@
|
|||||||
window.clearTimeout(this.handleTimeout);
|
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(){
|
loadDetail(){
|
||||||
let $this=this;
|
let $this=this;
|
||||||
uni.showLoading({title:'加载中...'})
|
uni.showLoading({title:'加载中...'})
|
||||||
@@ -583,7 +600,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this.courseInfo=rs.result.course;
|
$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) {
|
if(rs.result.teachers && rs.result.teachers.length > 0) {
|
||||||
let userIds = [];
|
let userIds = [];
|
||||||
@@ -777,11 +794,11 @@
|
|||||||
this.isFavorite=false;
|
this.isFavorite=false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
apiCourseGrade.has(this.courseId).then(rs=>{
|
// apiCourseGrade.has(this.courseId).then(rs=>{
|
||||||
if(rs.status==200 && rs.result){
|
// if(rs.status==200 && rs.result){
|
||||||
this.scoreInfo.has=true;
|
// this.scoreInfo.has=true;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
apiPraises.has(1,this.courseId).then(rs=>{
|
apiPraises.has(1,this.courseId).then(rs=>{
|
||||||
if(rs.status==200 && rs.result){
|
if(rs.status==200 && rs.result){
|
||||||
this.isPraise=true;
|
this.isPraise=true;
|
||||||
@@ -920,6 +937,12 @@
|
|||||||
if(rs.status==200){
|
if(rs.status==200){
|
||||||
this.scoreInfo.dlgShow=false;
|
this.scoreInfo.dlgShow=false;
|
||||||
this.scoreInfo.has=true;
|
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'});
|
this.$refs.messager.show({message:'评分成功,谢谢您的评分',type:'success'});
|
||||||
//发送评分事件
|
//发送评分事件
|
||||||
let event = {
|
let event = {
|
||||||
|
|||||||
Reference in New Issue
Block a user