mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-09 02:46:46 +08:00
提交修改
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
</view>
|
||||
<view class="desrow">
|
||||
<view>
|
||||
<text class="desrow-name">讲师:</text><text>李玉冰</text><text>(显示事件)</text>
|
||||
<text class="desrow-name">讲师:</text><text>李玉冰</text><text>(显示事业)</text>
|
||||
</view>
|
||||
<view style="color: #387DF7;;">+关注</view>
|
||||
</view>
|
||||
@@ -80,18 +80,18 @@
|
||||
</view>
|
||||
<!--交互-->
|
||||
<view class="cinfo-btns">
|
||||
<view class="cinfo-btn">
|
||||
<view class="cinfo-btn" @click="openScore()">
|
||||
<view><image src="/static/images/course/c_comment.png" style="width: 80upx;height: 80upx;"></image> </view>
|
||||
<view>评价</view>
|
||||
</view>
|
||||
<view class="cinfo-btn">
|
||||
<view class="cinfo-btn" @click="addFavorite()">
|
||||
<view>
|
||||
<image src="/static/images/course/c_favorite.png" style="width: 80upx;height: 80upx;">
|
||||
<!-- <image src="/static/images/course/c_favorite_2.png" style="width: 80upx;height: 80upx;"> -->
|
||||
<image v-if="isFavorite" src="/static/images/course/c_favorite_2.png" style="width: 80upx;height: 80upx;">
|
||||
<image v-else src="/static/images/course/c_favorite.png" style="width: 80upx;height: 80upx;">
|
||||
</view>
|
||||
<view>收藏</view>
|
||||
</view>
|
||||
<view class="cinfo-btn">
|
||||
<view class="cinfo-btn" @click="openShare()">
|
||||
<view>
|
||||
<image src="/static/images/course/c_share.png" style="width: 80upx;height: 80upx;">
|
||||
</view>
|
||||
@@ -102,7 +102,7 @@
|
||||
<!--评论-->
|
||||
<view v-if="tabIndex==2" class="pinglun">
|
||||
<comments ref="comments" v-if="courseId && courseId!=''" :objType="1" :objId="courseId"></comments>
|
||||
<interact-fixed :type="1" :data="courseInfo" :users="teachers" :praises="false" :comments="false" @comment-success="refreshComments" @share-success="shareSuccess"></interact-fixed>
|
||||
<interact-fixed ref="fiexdbar" :type="1" :data="courseInfo" :users="teachers" :praises="false" :comments="false" @comment-success="refreshComments" @share-success="shareSuccess"></interact-fixed>
|
||||
</view>
|
||||
</view>
|
||||
<!--全部目录-->
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
</view>
|
||||
<!--推荐课程-->
|
||||
<view style="padding: 30upx;background-color: #fff;">
|
||||
<view v-if="tabIndex==1" style="padding: 30upx;background-color: #fff;">
|
||||
<view style="color: #333333; font-size: 32upx;font-weight: 600;padding-bottom: 20upx;">课程推荐</view>
|
||||
<course-list :items="recommendCourses"></course-list>
|
||||
</view>
|
||||
@@ -162,12 +162,11 @@
|
||||
<text v-else>暂无</text>
|
||||
</view>
|
||||
<!-- </view> -->
|
||||
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- 评分,赞和踩 -->
|
||||
<u-popup :show="scoreInfo.dlgShow" mode="top" @close="closeScore" @open="openScore">
|
||||
<view style="text-align: center;padding: 50upx;">
|
||||
<u-popup :show="scoreInfo.dlgShow" mode="center" @close="closeScore" @open="openScore">
|
||||
<view style="text-align: center;padding: 50upx 100upx;">
|
||||
<view style="text-align: center;">给课程打分</view>
|
||||
<view style="padding-top: 100upx;display: flex;justify-content: center;">
|
||||
<u-rate :count="5" :size="25" v-model="scoreInfo.score"></u-rate>
|
||||
@@ -190,6 +189,7 @@
|
||||
import apiResOwner from '@/api/modules/resowner.js'
|
||||
import apiPraises from "@/api/modules/praises.js";
|
||||
import apiTrample from "@/api/modules/trample.js";
|
||||
import apiFavorites from '@/api/modules/favorites.js'
|
||||
import {getContentType} from "@/utils/tools.js";
|
||||
import studyUtil from '@/utils/study.js';
|
||||
import {toScore} from '@/utils/tools.js';
|
||||
@@ -197,6 +197,7 @@
|
||||
export default {
|
||||
data(){
|
||||
return{
|
||||
loading:false,//加载中
|
||||
courseId:'',//当前课程的id
|
||||
studyId: '',//当前学习的id
|
||||
initContentId:'',//初始化的内容id
|
||||
@@ -204,7 +205,14 @@
|
||||
teachers:[],//课程老师列表
|
||||
recommendCourses:[],//推荐课程列表
|
||||
catalogShow:false,//是否显示目录
|
||||
catalogNum:1,//一个目录时不显示,两个时显示占满,三个时类似UI一样的显示了
|
||||
tabIndex:1,//显示的tab内容
|
||||
scoreInfo:{dlgShow:false, score:5, has:false},//评分控制项
|
||||
isPraise:false,//是否已点赞
|
||||
isTrample:false,//是否已踩
|
||||
isFavorite:false,//是否已收藏
|
||||
isFollow:false,//是否已关注
|
||||
|
||||
|
||||
isPlaying:false,
|
||||
onplay:false,
|
||||
@@ -236,15 +244,7 @@
|
||||
speedListShow:false,
|
||||
speedList:["2.0", "1.5", "1.25", "1.0", "0.75", "0.5"],
|
||||
videoSpeed: 1.0, // 当前倍速:
|
||||
tabIndex:0,
|
||||
catalogShow:false,//是否显示目录
|
||||
scoreInfo:{
|
||||
dlgShow:false,
|
||||
score:5,
|
||||
has:false,
|
||||
},
|
||||
isPraise:false,
|
||||
isTrample:false,
|
||||
|
||||
interactRuning:false,
|
||||
scrollInfo:{
|
||||
scrollLeft: 0,
|
||||
@@ -311,8 +311,9 @@
|
||||
}
|
||||
this.courseId=options.id;
|
||||
this.courseInfo.id=options.id;
|
||||
this.loadDetail();
|
||||
this.loadReCourses();
|
||||
this.loadDetail();//加载课程数据
|
||||
this.loadReCourses();//加载推荐课程
|
||||
this.loadIsData();//加载关注,收藏,评价等信息
|
||||
},
|
||||
onShow(){
|
||||
uni.setNavigationBarTitle({ title:'\u200E' })
|
||||
@@ -530,6 +531,31 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
loadIsData(){
|
||||
//加载是否关注,是否收藏,是否评价等
|
||||
apiFavorites.has(1,this.courseId).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
this.isFavorite=true;
|
||||
}else{
|
||||
this.isFavorite=false;
|
||||
}
|
||||
})
|
||||
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;
|
||||
}
|
||||
});
|
||||
apiTrample.has(this.courseId).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
this.isTrample=true;
|
||||
}
|
||||
});
|
||||
},
|
||||
changeTab(idx){
|
||||
this.tabIndex=idx;
|
||||
},
|
||||
@@ -540,7 +566,162 @@
|
||||
closeAllCatalog(){
|
||||
this.catalogShow=false;
|
||||
//定位目录
|
||||
}
|
||||
},
|
||||
openScore(){
|
||||
//显示评分弹窗
|
||||
if(this.scoreInfo.has){
|
||||
this.$refs.messager.show({message:'您已评过分',type:'error'});
|
||||
return;
|
||||
}
|
||||
this.scoreInfo.dlgShow=true;
|
||||
},
|
||||
closeScore(){
|
||||
this.scoreInfo.dlgShow=false;
|
||||
},
|
||||
addScore(){
|
||||
if(this.scoreInfo.has){
|
||||
this.$refs.messager.show({message:'您已评过分',type:'error'});
|
||||
this.scoreInfo.dlgShow=false;
|
||||
return;
|
||||
}
|
||||
let postData={
|
||||
courseId:this.courseInfo.id,
|
||||
studyId:this.studyId,
|
||||
score:this.scoreInfo.score
|
||||
}
|
||||
if(this.scoreInfo.score>0){
|
||||
apiCourseGrade.grade(postData).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.scoreInfo.dlgShow=false;
|
||||
this.scoreInfo.has=true;
|
||||
this.$refs.messager.show({message:'评分成功,谢谢您的评分',type:'success'});
|
||||
}else{
|
||||
this.$refs.messager.show({message:'评分分处理失败,请稍后再试',type:'error'});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
openShare(){
|
||||
//console.log(this.$refs.fiexdbar,'this.$refs.fiexdbar');
|
||||
//因为开始是v-if控制的,所以这里获取不到,必须显示时才会获取到,所以需要单独的弄一个分享组件
|
||||
this.$refs.fiexdbar.addShare();
|
||||
},
|
||||
shareSuccess(rs){
|
||||
this.$refs.messager.show({message:'分享成功',type:'success'});
|
||||
},
|
||||
addFavorite(){
|
||||
if(this.loading){
|
||||
return;
|
||||
}
|
||||
this.loading=true;
|
||||
uni.showLoading({title:'处理中...'})
|
||||
//需要判断是否已点赞,已点赞的不再加
|
||||
let postData={
|
||||
objType:1,
|
||||
objId:this.courseId,
|
||||
title:this.courseInfo.name,
|
||||
}
|
||||
if(this.isFavorite) {// 已经收藏,再次点击取消收藏
|
||||
apiFavorites.remove(1,this.courseId).then(res=>{
|
||||
this.loading=false;
|
||||
if(res.status==200){
|
||||
this.isFavorite=false;
|
||||
this.$refs.messager.show({message:'已取消收藏',type:'success'});
|
||||
}else{
|
||||
console.log('取消收藏失败:'+res.message);
|
||||
}
|
||||
uni.hideLoading();
|
||||
})
|
||||
} else {
|
||||
apiFavorites.save(postData).then(res=>{
|
||||
this.loading=false;
|
||||
if(res.status==200 && res.result){
|
||||
this.isFavorite=true;
|
||||
this.$refs.messager.show({message:'已加入收藏',type:'success'});
|
||||
//发送消息
|
||||
//this.messageSave(this.data.id,this.data.name,this.userInfo.name,this.data.sysCreateBy,this.data.sysCreateAid,'收藏了我发布的');
|
||||
}else{
|
||||
this.$refs.messager.show({message:'收藏失败',type:'error'});
|
||||
console.log('加入收藏失败:'+res.message);
|
||||
}
|
||||
uni.hideLoading();
|
||||
})
|
||||
}
|
||||
},
|
||||
praiseContent(){
|
||||
//赞和踩只能是一个
|
||||
if(this.isTrample){
|
||||
this.$refs.messager.show({message:'已踩不能赞了',type:'error'});
|
||||
return;
|
||||
}
|
||||
let postData={
|
||||
objType:1,
|
||||
objId:this.courseInfo.id,
|
||||
title:this.courseInfo.name
|
||||
}
|
||||
if(this.interactRuning){
|
||||
return;
|
||||
}
|
||||
this.interactRuning=true;
|
||||
if(this.isPraise){
|
||||
apiPraises.remove(1,this.courseInfo.id).then(rs=>{
|
||||
this.interactRuning=false;
|
||||
if(rs.status==200){
|
||||
this.$refs.messager.show({message:'已取消点赞',type:'success'});
|
||||
this.isPraise=false;
|
||||
this.courseInfo.praises--;
|
||||
}else{
|
||||
this.$refs.messager.show({message:'取消点赞失败,请稍后再试',type:'success'});
|
||||
}
|
||||
})
|
||||
}else{
|
||||
apiPraises.save(postData).then(rs=>{
|
||||
this.interactRuning=false;
|
||||
if(rs.status==200){
|
||||
this.$refs.messager.show({message:'点赞成功',type:'success'});
|
||||
this.isPraise=true;
|
||||
this.courseInfo.praises++;
|
||||
}else{
|
||||
this.$refs.messager.show({message:'点赞失败,请稍后再试',type:'success'});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
treadContent(){
|
||||
//赞和踩只能是一个
|
||||
if(this.isPraise){
|
||||
this.$refs.messager.show({message:'已赞不能踩了',type:'error'});
|
||||
return;
|
||||
}
|
||||
if(this.interactRuning){
|
||||
return;
|
||||
}
|
||||
this.interactRuning=true;
|
||||
if(this.isTrample){
|
||||
//取消
|
||||
apiTrample.remove(this.courseInfo.id).then(rs=>{
|
||||
this.interactRuning=false;
|
||||
if(rs.status==200){
|
||||
this.$refs.messager.show({message:'已取消踩',type:'success'});
|
||||
this.isTrample=false;
|
||||
this.courseInfo.trampleCount--;
|
||||
}else{
|
||||
this.$refs.messager.show({message:'取消踩失败,请稍后再试',type:'error'});
|
||||
}
|
||||
})
|
||||
}else{
|
||||
apiTrample.trample(this.courseInfo.id).then(rs=>{
|
||||
this.interactRuning=false;
|
||||
if(rs.status==200){
|
||||
this.$refs.messager.show({message:'已踩',type:'success'});
|
||||
this.isTrample=true;
|
||||
this.courseInfo.trampleCount++;
|
||||
}else{
|
||||
this.$refs.messager.show({message:'踩失败,请稍后再试',type:'error'});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user