修改课程权限控制

This commit is contained in:
zhangsir
2023-11-23 11:47:24 +08:00
parent 93dd3519a9
commit 8f9b596a84
3 changed files with 61 additions and 18 deletions

View File

@@ -156,15 +156,17 @@
<!--底部-->
<interact-fixed v-if="courseInfo.id != ''" ref="fiexdbar" :type="1" :users="teachers" :data="courseInfo" :comments="isComments" @handle-comment="handleComment" @comment-success="refreshComments" :praises="false">
<view class="" v-if="tabIndex !== 2">
<view v-if="studyId == ''">
<!-- 立即报名 -->
<!-- btn-default -->
<view class="btn btn-active" @click="submitSignup()">{{studyName}}</view>
</view>
<!--评论-->
<view v-else>
<view class="btn btn-active" @click="toStudy()">{{studyName}}</view>
</view>
<template v-if="isCrowd">
<view v-if="studyId == ''">
<!-- 立即报名 -->
<!-- btn-default -->
<view class="btn btn-active" @click="submitSignup()">{{studyName}}</view>
</view>
<!--评论-->
<view v-else>
<view class="btn btn-active" @click="toStudy()">{{studyName}}</view>
</view>
</template>
</view>
</interact-fixed>
@@ -179,6 +181,8 @@
import apiResOwner from '@/api/modules/resowner.js';
import apiPraises from '@/api/modules/praises.js';
import apiTrample from '@/api/modules/trample.js';
import apiUserbasic from '@/api/boe/userbasic.js'
import { mapGetters } from 'vuex'
import {
getContentType,
toScore
@@ -186,6 +190,8 @@
export default {
data() {
return {
isCrowd:false, //根据受众展示不展示
audiences:'',
isComments:true,
courseId: '',
studyId: '',
@@ -232,10 +238,20 @@
title: '未指定课程'
});
} else {
this.loadDetail(this.courseId);
if(this.audiences.length==0){
apiUserbasic.getInAudienceIds(this.userInfo.aid).then(rs=>{
this.audiences = rs.join(",");
this.loadDetail(this.courseId);
});
}else{
console.log(rs.message)
}
}
},
computed: {
...mapGetters(['userInfo']),
catalogTree() {
let treeList = [];
let $this = this;
@@ -287,7 +303,13 @@
uni.showLoading({
title: '加载中...'
});
apiCoursePortal.detail(id).then(rs => {
apiCoursePortal.detailPost({id,audiences:this.audiences}).then(rs => {
if(!rs.result.isCrowd){
setTimeout(function() {
uni.hideLoading();
}, 100);
}
this.isCrowd = rs.result.isCrowd
setTimeout(function() {
uni.hideLoading();
}, 100);
@@ -374,7 +396,7 @@
}
//需要判断此内容是否已学习完成,如果已学习完成,不需要再请不说了
}else{
this.submitSignup();//直接报名
// this.submitSignup();//直接报名
}
} else {
this.$message.error(res.message);
@@ -422,6 +444,9 @@
// });
this.studyId = res.result.studyId; //设置学习id
this.tabIndex = 1;
uni.navigateTo({
url: '/pages/study/courseStudy?id=' + this.courseInfo.id
});
} else {
this.$refs.messager.show({
message: res.message,
@@ -452,8 +477,11 @@
}
},
toStudy() {
// uni.navigateTo({
// url: '/pages/study/onlineCourse?id=' + this.courseInfo.id + '&studyId=' + this.studyId
// });
uni.navigateTo({
url: '/pages/study/onlineCourse?id=' + this.courseInfo.id + '&studyId=' + this.studyId
url: '/pages/study/courseStudy?id=' + this.courseInfo.id
});
},
toTestList() {

View File

@@ -280,6 +280,8 @@
import apiUserbasic from '@/api/boe/userbasic.js'
import apiUserGroup from "@/api/modules/usergroup.js";
import { mapGetters } from 'vuex'
import apiCourseStudy from '@/api/modules/courseStudy.js';
import cellGroup from '../../uni_modules/uview-ui/libs/config/props/cellGroup'
export default{
data(){
return{
@@ -346,7 +348,6 @@
if(options.keyword){
this.wordSearch(options.keyword);
}
});
}else{
if(options.keyword){
@@ -747,7 +748,7 @@
});
},
toCoursePage(coure){
console.log(coure,'coure')
if(!coure.source){
uni.navigateTo({
url: '/pages/study/courseStudy?id=' + coure.id
@@ -760,8 +761,19 @@
});
}else if (coure.source==2){
uni.navigateTo({
url: '/pages/study/courseStudy?id=' + coure.id
url: '/pages/resource/courseDetail?id=' + coure.id
})
apiCourseStudy.hasSignup(coure.id).then(rs => {
if (rs.status == 200) {
uni.navigateTo({
url: '/pages/study/courseStudy?id=' + coure.id
})
} else {
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + coure.id
})
}
})
}else if (coure.source==3){
let params=encodeURIComponent('courseId='+coure.id);
let mapi=this.$config.manageApiBaseUrl;