Merge branch 'zcwyMaster' into 'dev0731'

修改课程权限控制

See merge request !20
This commit is contained in:
joshen
2023-11-23 11:50:43 +08:00
3 changed files with 61 additions and 18 deletions

View File

@@ -43,7 +43,9 @@ const pageList = function(query) {
const detail = function(id) { const detail = function(id) {
return ajax.get('/xboe/m/course/portal/detail?id=' + id); return ajax.get('/xboe/m/course/portal/detail?id=' + id);
} }
const detailPost = function(data) {
return ajax.post(`/xboe/m/course/portal/detail`,data);
}
/** /**
* 人气排行榜 * 人气排行榜
* @param {Object} data * @param {Object} data
@@ -96,5 +98,6 @@ export default {
ranking, ranking,
scorelist, scorelist,
recommendList, recommendList,
getTeacherByCourseIDs getTeacherByCourseIDs,
detailPost
} }

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

View File

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