mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-07 01:46:44 +08:00
提交修改
This commit is contained in:
@@ -474,25 +474,25 @@ export default {
|
||||
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
|
||||
if(regPos.test(name)){
|
||||
apiUser.getByLoginName(name).then(rs=>{
|
||||
if(rs.status==200){
|
||||
//因为根据工号查询,只会是一个人,所有会有null情况,而json会返回空字符串
|
||||
if(rs.result!=''){
|
||||
this.shareInfo.users=[rs.result];
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '查无此用户',
|
||||
icon: 'none'
|
||||
});
|
||||
// this.$refs.interactToast.show({message:"查无此用户",type:'warning'});
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: rs.message,
|
||||
icon: 'none'
|
||||
});
|
||||
// this.$refs.interactToast.show({message:rs.message,type:'warning'});
|
||||
}
|
||||
})
|
||||
if(rs.status==200){
|
||||
//因为根据工号查询,只会是一个人,所有会有null情况,而json会返回空字符串
|
||||
if(rs.result!=''){
|
||||
this.shareInfo.users=[rs.result];
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '查无此用户',
|
||||
icon: 'none'
|
||||
});
|
||||
// this.$refs.interactToast.show({message:"查无此用户",type:'warning'});
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: rs.message,
|
||||
icon: 'none'
|
||||
});
|
||||
// this.$refs.interactToast.show({message:rs.message,type:'warning'});
|
||||
}
|
||||
})
|
||||
}else{
|
||||
apiUser.findByName(name).then(rs=>{
|
||||
if(rs.status==200){
|
||||
|
||||
147
components/interact-share/interact-share.vue
Normal file
147
components/interact-share/interact-share.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<!--分享窗口-->
|
||||
<u-popup :show="show" @close="closeShare" @open="openShare" mode="right">
|
||||
<view style="padding: 10px 20px;line-height: 60upx;">
|
||||
<view style="padding: 10upx;">请输入要分享给人的姓名</view>
|
||||
<view style="padding: 10upx;">
|
||||
<u--input placeholder="请输入人员姓名" border="surround" v-model="keyword"></u--input>
|
||||
</view>
|
||||
<view style="padding-top:20upx;">
|
||||
<u-button @click="findUsers()" type="primary" text="查询"></u-button>
|
||||
</view>
|
||||
<view style="padding-top: 50upx;">
|
||||
<!--查询内容列表-->
|
||||
<view style="line-height: 60upx;" v-for="(su,suidx) in users" :key="suidx" @click="confirmShare(su)">{{suidx+1}}, {{su.name}} ({{su.code}})</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiShares from '@/api/modules/shares.js'
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
props: {
|
||||
data:{
|
||||
type:Object,
|
||||
default(){
|
||||
return{
|
||||
id:'',
|
||||
type:1,
|
||||
}
|
||||
}
|
||||
},
|
||||
type:{
|
||||
type:Number,
|
||||
default:0 //默认是课程
|
||||
},
|
||||
|
||||
},
|
||||
computed:{
|
||||
...mapGetters(['userInfo']),
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
show:false,
|
||||
keyword:'',
|
||||
users:[],
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
openShare(){
|
||||
this.show=true;
|
||||
},
|
||||
findUsers(){
|
||||
this.users=[];
|
||||
if(!this.keyword){
|
||||
return this.$refs.messager.show({message:'请输入工号或姓名',type:'warning'});
|
||||
}
|
||||
var name=this.keyword;
|
||||
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
|
||||
let $this=this;
|
||||
if(regPos.test(name)){
|
||||
apiUser.getByLoginName(name).then(rs=>{
|
||||
if(rs.status==200){
|
||||
//因为根据工号查询,只会是一个人,所有会有null情况,而json会返回空字符串
|
||||
if(rs.result!=''){
|
||||
$this.users=[rs.result];
|
||||
}else{
|
||||
$this.$refs.messager.show({message:"无此用户",type:'warning'});
|
||||
}
|
||||
}else{
|
||||
//uni.showToast({ title: rs.message, icon: 'none' });
|
||||
this.$refs.messager.show({message:rs.message,type:'warning'});
|
||||
}
|
||||
})
|
||||
}else{
|
||||
apiUser.findByName(name).then(rs=>{
|
||||
if(rs.status==200){
|
||||
if(rs.result.length==0){
|
||||
//uni.showToast({title: rs.message,icon: 'none'});
|
||||
this.$refs.messager.show({message:rs.message,type:'error'});
|
||||
}else{
|
||||
this.shareInfo.users=rs.result;
|
||||
}
|
||||
}else{
|
||||
//uni.showToast({ title: rs.message, icon: 'none' });
|
||||
this.$refs.messager.show({message:rs.message,type:'error'});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
closeShare(){
|
||||
this.show=false;
|
||||
},
|
||||
confirmShare(u){
|
||||
let conType;
|
||||
if(this.type == 1) {
|
||||
conType = this.data.type;
|
||||
}
|
||||
let postData={
|
||||
objType:this.type,
|
||||
objId:this.data.id,
|
||||
content:'',
|
||||
isRead:false,
|
||||
toAid:u.aid,
|
||||
toAname:u.name,
|
||||
conType:conType,
|
||||
}
|
||||
if(this.userInfo.aid==postData.toAid){
|
||||
//uni.showToast({title: '不能分享给自己', icon: 'none' });
|
||||
this.$refs.messager.show({message:'不能分享给自己',type:'error'});
|
||||
}
|
||||
apiShares.save(postData).then(rs=>{
|
||||
if(rs.status==200){
|
||||
if(rs.result){
|
||||
this.shareInfo.show=false;
|
||||
this.$refs.messager.show({message:'分享成功',type:'success'});
|
||||
this.$emit("share-success", rs.result);
|
||||
if(this.type!=3){
|
||||
if(this.type==1){
|
||||
//发送消息
|
||||
//this.messageSave(this.data.id,this.data.name,this.userInfo.name,u.name,u.aid,'分享给我的');
|
||||
}else{
|
||||
//this.messageSave(this.data.id,this.data.title,this.userInfo.name,u.name,u.aid,'分享给我的');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//uni.showToast({title: '分享失败,您不能将同一资源多次分享给同一个人',icon: 'none'});
|
||||
this.$refs.messager.show({message:'分享失败,您不能将同一资源多次分享给同一个人',type:'warning'});
|
||||
}
|
||||
}else{
|
||||
// this.$message({message:'分享失败',type:'success'});
|
||||
this.$refs.interactToast.show({message:'分享处理失败',type:'error'});
|
||||
console.log(rs.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -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