From 55e117b2c2fcb14cb0591fe33a8396d9b075a0f5 Mon Sep 17 00:00:00 2001 From: nisen Date: Wed, 9 Aug 2023 18:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85studyIndex?= =?UTF-8?q?=E5=92=8Cdetail=E4=BC=A0=E9=80=92=E7=94=A8=E6=88=B7=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=8F=97=E4=BC=97id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/coursePortal.js | 16 +++++++++++++++- src/api/modules/courseStudy.js | 16 +++++++++++++++- src/views/portal/course/Detail.vue | 12 +++++++++++- src/views/study/coursenew.vue | 11 ++++++++++- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/api/modules/coursePortal.js b/src/api/modules/coursePortal.js index 32d50bd2..43aafa8f 100644 --- a/src/api/modules/coursePortal.js +++ b/src/api/modules/coursePortal.js @@ -43,6 +43,19 @@ const pageList = function(query) { const detail = function(id,preview,course=false) { return ajax.get(`/xboe/m/course/portal/detail?id=${id}&preview=${preview}&course=${course}`); } +/** + * 课程的详细信息 + * @param {object} data + * { + * id:课程id, + * preview, + * course, + * audiences:登录用户所有受众id + * } + */ +const detailPost = function(data) { + return ajax.post(`/xboe/m/course/portal/detail`,data); +} /** * 人气排行榜 @@ -98,5 +111,6 @@ export default { getTeacherByCourseIDs, studyCounts, courseSearch, - detailStudy + detailStudy, + detailPost } diff --git a/src/api/modules/courseStudy.js b/src/api/modules/courseStudy.js index 43150506..11c7847b 100644 --- a/src/api/modules/courseStudy.js +++ b/src/api/modules/courseStudy.js @@ -69,6 +69,19 @@ const countSignup = function(courseId) { const studyIndex = function(courseId) { return ajax.get('/xboe/school/study/course/studyIndex?cid='+courseId+'&addView=true'); } +/** + * + * @param {object} data + * { + * cid:课程id, + * addView, + * audiences:登录用户所有受众id + * } + * @returns + */ +const studyIndexPost = function(data) { + return ajax.post('/xboe/school/study/course/studyIndex',data); +} /** * 课程学习,根据课程id来获取, @@ -414,5 +427,6 @@ export default { findByIds, deleteSignUp, ids, - followIds + followIds, + studyIndexPost } diff --git a/src/views/portal/course/Detail.vue b/src/views/portal/course/Detail.vue index 0a284846..0b5a3dd1 100644 --- a/src/views/portal/course/Detail.vue +++ b/src/views/portal/course/Detail.vue @@ -155,6 +155,7 @@ export default { }, data() { return { + audiences:'', cutOrgNamePath, userAvatarText, getType, @@ -180,6 +181,10 @@ export default { }; }, mounted() { + // 增加的用户受众id + let localKey = "user_" + this.userInfo.sysId + "_gids"; + let hasIds = sessionStorage.getItem(localKey); + this.audiences = hasIds ?? '' let id = this.$route.query.id; this.courseInfo.id=id; this.$watermark.set(this.userInfo.name+this.userInfo.loginName); @@ -188,7 +193,12 @@ export default { let $this=this; //页面只支取一次,所以先直接写在这里面 - apiCoursePortal.detail(id,false,true).then(rs=>{ + apiCoursePortal.detailPost({ + id, + preview:false, + course:true, + audiences:this.audiences + }).then(rs=>{ if(rs.status==200){ if(!rs.result.course.enabled || rs.result.course.deleted){ diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index ea7dd297..a2a48b0c 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -320,6 +320,7 @@ }, data() { return { + audiences:'', isCrowd:false, cutOrgNamePath, scormUrl:'',//当前播放的scormUrl @@ -396,6 +397,10 @@ } }, mounted() { + // 增加的用户受众id + let localKey = "user_" + this.userInfo.sysId + "_gids"; + let hasIds = sessionStorage.getItem(localKey); + this.audiences = hasIds ?? '' this.$watermark.set(this.userInfo.name + this.userInfo.loginName); this.courseId = this.$route.query.id; this.initContentId = this.$route.query.contentId; @@ -1141,7 +1146,11 @@ // 获取数据信息 loadData() { let $this=this; - apiStudy.studyIndex(this.courseId).then(rs => { + apiStudy.studyIndexPost({ + cid: this.courseId, + addView:true, + audiences:this.audiences + }).then(rs => { if (rs.status == 200) { if(rs.result.contents.length==0){ $this.$message.error('课程内容已删除或课程已不再使用');