diff --git a/api/modules/coursePortal.js b/api/modules/coursePortal.js index d6f9d40..21f7bd3 100644 --- a/api/modules/coursePortal.js +++ b/api/modules/coursePortal.js @@ -43,7 +43,9 @@ const pageList = function(query) { const detail = function(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 @@ -96,5 +98,6 @@ export default { ranking, scorelist, recommendList, - getTeacherByCourseIDs + getTeacherByCourseIDs, + detailPost } diff --git a/pages/resource/courseDetail.vue b/pages/resource/courseDetail.vue index 9407c4f..1e7386f 100644 --- a/pages/resource/courseDetail.vue +++ b/pages/resource/courseDetail.vue @@ -156,15 +156,17 @@ - - - - {{studyName}} - - - - {{studyName}} - + @@ -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() { diff --git a/pages/resource/search.vue b/pages/resource/search.vue index 9473a26..d3d098b 100644 --- a/pages/resource/search.vue +++ b/pages/resource/search.vue @@ -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;