From 1179b63ae02a804de3e6dcfd9e266c8173129708 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Tue, 20 Aug 2024 17:38:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 14 + pages/course/chapterDetailAndorid.vue | 24 +- pages/course/courseDetail.vue | 2 +- pages/mine/mine/index.vue | 151 +++---- pages/miniClass/DirectorModalList.vue | 467 ++++++++++++++++++++++ pages/miniClass/MonitorClassList.vue | 102 +++-- pages/miniClass/addClass.vue | 2 +- pages/miniClass/classInfoMan.vue | 9 +- pages/miniClass/classList.vue | 59 ++- pages/miniClass/miniClassMan.vue | 552 +++++++++++++++++--------- pages/miniClass/myClassList.vue | 120 ++---- pages/miniClass/sikaoQuestionList.vue | 23 ++ 12 files changed, 1115 insertions(+), 410 deletions(-) create mode 100644 pages/miniClass/DirectorModalList.vue create mode 100644 pages/miniClass/sikaoQuestionList.vue diff --git a/pages.json b/pages.json index 1e2f21c..44cbdd3 100644 --- a/pages.json +++ b/pages.json @@ -674,6 +674,20 @@ { "navigationBarTitleText" : "管理员心得列表" } + }, + { + "path" : "pages/miniClass/sikaoQuestionList", + "style" : + { + "navigationBarTitleText" : "思考题列表" + } + }, + { + "path" : "pages/miniClass/DirectorModalList", + "style" : + { + "navigationBarTitleText" : "主任模型列表" + } } ], "globalStyle": { diff --git a/pages/course/chapterDetailAndorid.vue b/pages/course/chapterDetailAndorid.vue index 164003e..0f6fa95 100644 --- a/pages/course/chapterDetailAndorid.vue +++ b/pages/course/chapterDetailAndorid.vue @@ -71,7 +71,7 @@ 修改 - + @@ -80,6 +80,7 @@ + @@ -87,11 +88,11 @@ 加入小班学习后,即可发表您的见解, 更有相关领域的前辈为您解惑,帮助您更系统地学习本课程 - + - + 欢迎留下你的见解 @@ -167,6 +168,7 @@ }, data() { return { + isInClass:false, // 是否加入了班级 showEditBlank: false, answerForm: { relationId: undefined, @@ -243,7 +245,7 @@ show: false, playData: {}, - isInClass:false, // 是否加入了班级 + taiHuClassInfo: {}, searchValue: "", ordersTabs: [{ @@ -525,9 +527,9 @@ }); }); }, - goClassLIst(url, id,title){ + goClassLIst(url){ uni.navigateTo({ - url: `${url}?courseId=${this.options.id}&courseTitle=${this.options.navTitle}`, + url: `${url}?courseId=${this.options.courseId}&courseTitle=${this.options.navTitle}`, }); }, readOnlyChange() { @@ -788,7 +790,7 @@ url: '/common/class/getClassByCourseIdNoUser', method: "POST", data: { - "courseId": this.options.id, + "courseId": this.options.courseId, "state": "", //小班状态0待开班1已开班2完成 "type": "" // 班类型 0小班 1联合班 2精英班 }, @@ -797,13 +799,16 @@ }, }) .then(res => { + console.log('获取班级列表',res.result.length,this.options.courseId); if(res.code == 0){ if(res.result.length > 0){ - this.isInClass = false + this.isInClass = false }else{ this.isInClass = true + } } + console.log('获取班级列表++++++',this.isInClass); }).catch(e => { console.log('获取班级列表失败',e); }); @@ -1021,7 +1026,8 @@ padding: 20rpx; background-color: rgba(255, 255, 255, .6); text-align: center; - border-bottom: 1px solid #eee; + // border-bottom: 1px solid #eee; + .welc{ display: block; border-top: 1px solid #eee; margin-bottom: 20rpx; padding-top: 20rpx;} .lockView{display: none;} .btn { display: inline-block; diff --git a/pages/course/courseDetail.vue b/pages/course/courseDetail.vue index bbba9f1..8ad0ce2 100644 --- a/pages/course/courseDetail.vue +++ b/pages/course/courseDetail.vue @@ -676,7 +676,7 @@ v.isAudition == 1 && this.userMsg.vip == 0 && this.librayList[this.curIndex].isBuy == 0 ? noRecored = true : '' uni.navigateTo({ - url: `${_myurl}?navTitle=${this.pageTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&noRecored=${noRecored}`, + url: `${_myurl}?courseId=${this.course.id}&navTitle=${this.pageTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&noRecored=${noRecored}`, }); } else { this.$commonJS.showToast("请先购买课程"); diff --git a/pages/mine/mine/index.vue b/pages/mine/mine/index.vue index 96220e4..d21545b 100644 --- a/pages/mine/mine/index.vue +++ b/pages/mine/mine/index.vue @@ -252,6 +252,7 @@ style: "color:#fff;font-size:28rpx" }, ], + roleObj:{}, infoShow: false, // 显示电子书相关 showEbook: false, // 显示电子书相关 userMes: {}, @@ -323,6 +324,7 @@ onShow() { // console.log(this.userInfo, "11111111111111"); this.getData(); + this.getUserRole() // 隐藏原生的tabbar // uni.hideTabBar(); }, @@ -424,80 +426,91 @@ url: url, }); }, + // 获取用户的角色信息 + getUserRole(){ + this.$http.post("common/class/getRoleType").then((res) => { + console.log('用户角色信息',res); + this.roleObj = res.result + var zhurenIndex = this.pageList.findIndex(item => { + return item.name == '主任教学' + }) + if (zhurenIndex > -1) { + this.pageList.splice(zhurenIndex, 1) + } + var banzhangIndex = this.pageList.findIndex(item => { + return item.name == '班级管理' + }) + if (banzhangIndex > -1) { + this.pageList.splice(banzhangIndex, 1) + } + var yonghuIndex = this.pageList.findIndex(item => { + return item.name == '我的班级' + }) + if (yonghuIndex > -1) { + this.pageList.splice(yonghuIndex, 1) + } + if (this.roleObj.isDirector) { + var n = this.pageList.find(item => { + return item.name == '主任教学' + }) + console.log('主任找到了么', n); + if (!n) { + // this.directorShow = true : this.directorShow = false + var item = { + // { // 主任之外的人显示班级管理 + name: "主任教学", + url: "/pages/miniClass/DirectorModalList?type=mine", + type: "pageJump", + // }, + } + this.pageList.splice(3, 0, item); + } + } + // 是班长 + if (this.roleObj.isMonitor) { + var n = this.pageList.find(item => { + return item.name == '班级管理' + }) + console.log('班长n找到了么', n); + if (!n) { + var item = { + + name: "班级管理", + url: "/pages/miniClass/MonitorClassList?type=mine", + type: "pageJump", + + } + this.pageList.splice(3, 0, item); + } + } + // 是学员 + if(this.roleObj.isStudent){ + var n = this.pageList.find(item => { + return item.name == '我的班级' + }) + console.log('我的班级找到了么', n); + if (!n) { + var item = { + + name: "我的班级", + url: "/pages/miniClass/myClassList?type=mine", + type: "pageJump", + + } + this.pageList.splice(3, 0, item); + } + } + + }).catch(e => { + console.log('获取角色信息失败'); + }) + }, getData() { // 获取个人信息 if (this.userInfo.id != undefined) { this.$http.post("common/user/getUserInfo").then((res) => { this.userMes = res.result; - var zhurenIndex = this.pageList.findIndex(item => { - return item.name == '主任教学' - }) - if (zhurenIndex > -1) { - this.pageList.splice(zhurenIndex, 1) - } - var banzhangIndex = this.pageList.findIndex(item => { - return item.name == '班级管理' - }) - if (banzhangIndex > -1) { - this.pageList.splice(banzhangIndex, 1) - } - var yonghuIndex = this.pageList.findIndex(item => { - return item.name == '我的班级' - }) - if (yonghuIndex > -1) { - this.pageList.splice(yonghuIndex, 1) - } - if (res.isDirector) { - var n = this.pageList.find(item => { - return item.name == '主任教学' - }) - console.log('主任找到了么', n); - if (!n) { - // this.directorShow = true : this.directorShow = false - var item = { - // { // 主任之外的人显示班级管理 - name: "主任教学", - url: "/pages/miniClass/miniClassMan?type=mine", - type: "pageJump", - // }, - } - this.pageList.splice(3, 0, item); - } - } else{ - if (res.isMonitor) { - var n = this.pageList.find(item => { - return item.name == '班级管理' - }) - console.log('班长n找到了么', n); - if (!n) { - var item = { - // 主任之外的人显示班级管理 - name: "班级管理", - url: "/pages/miniClass/MonitorClassList?type=mine", - type: "pageJump", - - } - this.pageList.splice(3, 0, item); - } - } else { - if(!res.isMonitor && !res.isDirector){ - var n = this.pageList.find(item => { - return item.name == '我的班级' - }) - console.log('我的班级找到了么', n); - if (!n) { - var item = { - // 主任之外的人显示班级管理 - name: "我的班级", - url: "/pages/miniClass/myClassList?type=mine", - type: "pageJump", - - } - this.pageList.splice(3, 0, item); - } - } - } - } + }); } }, diff --git a/pages/miniClass/DirectorModalList.vue b/pages/miniClass/DirectorModalList.vue new file mode 100644 index 0000000..a5b55e7 --- /dev/null +++ b/pages/miniClass/DirectorModalList.vue @@ -0,0 +1,467 @@ + + + + \ No newline at end of file diff --git a/pages/miniClass/MonitorClassList.vue b/pages/miniClass/MonitorClassList.vue index eed33bd..ce7d0c4 100644 --- a/pages/miniClass/MonitorClassList.vue +++ b/pages/miniClass/MonitorClassList.vue @@ -22,7 +22,7 @@ + @click="onPageJump('/pages/miniClass/classList',item.id)"> @@ -35,7 +35,7 @@ 【普通班】 【联合班】 【精英班】 - + {{item.title}} @@ -58,7 +58,7 @@ + @click="onPageJump('/pages/miniClass/classList',item.id)"> @@ -71,7 +71,7 @@ 【普通班】 【联合班】 【精英班】 - + {{item.title}} @@ -98,7 +98,7 @@ + @click="onPageJump('/pages/miniClass/classList',item.id)"> @@ -111,7 +111,7 @@ 【普通班】 【联合班】 【精英班】 - + {{item.title}} @@ -256,8 +256,8 @@ console.log('下拉刷新') // this.status = 3 // this.page = 1 - this.classList = [] - this.getData() + // this.classList = [] + // this.getData() uni.stopPullDownRefresh() }, onReachBottom() { @@ -271,10 +271,13 @@ ...mapState(['userInfo']) }, //页面显示 - onShow() { + async onShow() { // 隐藏原生的tabbar // uni.hideTabBar(); - this.getLearingClassList() + this.classList = await this.getData('1','2') + this.learningClassList = await this.getData('1','1') + this.preClassList = await this.getData('1','0') + // this.getLearingClassList() }, components: { musicPlay @@ -303,6 +306,7 @@ url: "common/class/MyClassList", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data: { + "role": "1", "state": '0', //小班状态0待开班1已开班2完成 "type": '' // 班类型 0小班 1联合班 2精英班 }, @@ -341,6 +345,7 @@ url: "common/class/MyClassList", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data: { + "role": "1", "state": '1', //小班状态0待开班1已开班2完成 "type": '' // 班类型 0小班 1联合班 2精英班 }, @@ -399,22 +404,23 @@ // this.page = 1 // this.getData(this.subTabId); }, - getData(id) { - if (!this.flag) { - console.log('正在执行,未完成') - return - } - + async getData(role,state) { + // if (!this.flag) { + // console.log('正在执行,未完成') + // return + // } + var _list = [] this.status = 1 - this.flag = false + // this.flag = false uni.showLoading({ title: '正在加载' }) - $http.request({ + await $http.request({ url: "common/class/MyClassList", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data: { - "state": '2', //小班状态0待开班1已开班2完成 + "role": role, + "state": state, //小班状态0待开班1已开班2完成 "type": '' // 班类型 0小班 1联合班 2精英班 }, header: { //默认 无 说明:请求头 @@ -424,17 +430,19 @@ .then(res => { if (res.code == 0) { if (res.result.length > 0) { - this.classList = res.result - + // this.classList = res.result + _list = res.result } else { - this.classList = [] + // this.classList = [] + _list = [] } - this.flag = true + // this.flag = true } uni.hideLoading() }).catch(e => { + _list = [] uni.hideLoading() - this.flag = true + // this.flag = true console.log(e, '数据报错') // this.status = 3 uni.showToast({ @@ -442,15 +450,49 @@ icon: 'error' }) }); + return _list }, // 跳转 - onPageJump(url, id, have) { - // console.log('进来了',url,id); - uni.navigateTo({ - url: `${url}?id=${id}&have=${have}` - }); + async onPageJump(url, id, have) { + var isStudent = await this.getRealRole(id) + console.log('isStudent',isStudent); + if(isStudent){ + uni.navigateTo({ + url:`/pages/miniClass/classInfo?id=${id}` + }) + }else{ + uni.navigateTo({ + url: `${url}?id=${id}&have=${have}` + }); + } + }, + // 获取真实的身份信息 + async getRealRole(id) { + // console.log('this.thisClass.id', this.thisClass.id); + var _isStudent = undefined + await $http.request({ + url: "common/class/getUserRole", + method: "POST", + data: { + "classId": id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then((res) => { + uni.hideLoading() + // 如果单纯是学员的身份 + if(res.result.length == 1 && res.result[0].role == 0){ + console.log('只是学员身份'); + _isStudent = true + + }else{ + _isStudent = false + } + }) + return _isStudent }, - shuomingPage(url, id, pid) { uni.navigateTo({ url: `${url}?id=${id}&pid=${pid}` diff --git a/pages/miniClass/addClass.vue b/pages/miniClass/addClass.vue index c831849..20cbc26 100644 --- a/pages/miniClass/addClass.vue +++ b/pages/miniClass/addClass.vue @@ -145,7 +145,7 @@ onLoad(e) { console.log('收到的值', e); // this.pageType = e.type - // this.form.type = e.type + this.form.type = e.type // this.modeType = e.type if(e.id){ diff --git a/pages/miniClass/classInfoMan.vue b/pages/miniClass/classInfoMan.vue index ab6b33d..612b55c 100644 --- a/pages/miniClass/classInfoMan.vue +++ b/pages/miniClass/classInfoMan.vue @@ -23,7 +23,7 @@ - + @@ -73,7 +73,7 @@ 心得 - + @@ -429,6 +429,11 @@ url: `${url}?classId=${classId}&type=${type}&roleCode=${this.roleCode}` }) }, + goSikaoList(url,id){ + uni.navigateTo({ + url:`${url}?classId=${id}&roleCode=${this.roleCode}` + }) + }, // 点击作业或者医案,进入详细介绍 clickTask() { diff --git a/pages/miniClass/classList.vue b/pages/miniClass/classList.vue index 49186ab..d4a5d16 100644 --- a/pages/miniClass/classList.vue +++ b/pages/miniClass/classList.vue @@ -208,24 +208,11 @@ .then(res => { if (res.code == 0) { if (res.classEntityList.length > 0) { - this.courseList = res.classEntityList - // var list = res.classEntityList - // this.courseList = this.courseList.concat(list) - // if (res.courses.pages > this.page) { - // this.status = 0 - // } else { - // this.status = 2 - // } + this.courseList = res.classEntityList + }else{ this.courseList = [] - } - // else if (this.page > 1) { - // this.status = 2 // 加载完成 - - // } else { - // this.status = 3 // 暂无数据 - // } - // console.log('status', this.status) + } this.flag = true } uni.hideLoading() @@ -241,13 +228,45 @@ }); }, // 跳转 - onPageJump(url,id) { - // console.log('进来了',url,id); + async onPageJump(url,id) { + var isStudent = await this.getRealRole(id) + console.log('isStudent',isStudent); + if(isStudent){ + uni.navigateTo({ + url:`/pages/miniClass/classInfo?id=${id}` + }) + }else{ uni.navigateTo({ url: `${url}?id=${id}` - }); + });} }, - + // 获取真实的身份信息 + async getRealRole(id) { + // console.log('this.thisClass.id', this.thisClass.id); + var _isStudent = undefined + await $http.request({ + url: "common/class/getUserRole", + method: "POST", + data: { + "classId": id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then((res) => { + uni.hideLoading() + // 如果单纯是学员的身份 + if(res.result.length == 1 && res.result[0].role == 0){ + console.log('只是学员身份'); + _isStudent = true + + }else{ + _isStudent = false + } + }) + return _isStudent + }, shuomingPage(url,id,pid){ uni.navigateTo({ url: `${url}?id=${id}&pid=${pid}` diff --git a/pages/miniClass/miniClassMan.vue b/pages/miniClass/miniClassMan.vue index 429b8cb..aef3768 100644 --- a/pages/miniClass/miniClassMan.vue +++ b/pages/miniClass/miniClassMan.vue @@ -2,69 +2,151 @@ - - - - + - + - - + + 当前模型名称:{{modelTitle}} + + - - + {{item.title}} - - - - - - - - - - - - - {{item.title}} + + + + + + + + + + + + + + + + + + + {{item.title}} + + + + 目标学员人数:{{item.number}} 人 + + + + + 进入班级 + + - - 目标学员人数:{{item.number}} 人 - - - - - 进入班级 - - + - - - - - - - - + + + + + + + + + + + + + + + + + {{item.title}} + + + + 目标学员人数:{{item.number}} 人 + + + + + 进入班级 + + + + + + + + - - + + + + + + + + + + + + + + + + + {{item.title}} + + + + 目标学员人数:{{item.number}} 人 + + + + + 进入班级 + + + + + + + + + + + + + @@ -79,12 +161,27 @@ data() { return { playData: {}, - addType:undefined, // 小班类型 - + addType: undefined, // 小班类型 + range: [{ + value: '0', + text: "普通小班", + name: "普通小班" + }, + { + value: '1', + text: "联合班", + name: "普通小班" + }, + { + value: '2', + text: "精英班", + name: "普通小班" + }, + ], tagId: null, - pid:null, + pid: null, fixed: false, - pupShow:false, + pupShow: false, fatherTabId: null, subTabId: null, // bgiStyle: { @@ -103,33 +200,61 @@ // backgroundColor: '#258feb' }, - subList: [{title:'待开班',id:'0'},{title:'已开班',id:'1'},{title:'已结班',id:'2'}], + subList1: [{ + title: '进行中', + id: '0' + }, { + title: '已结班', + id: '2' + }], + subList: [{ + title: '待开班', + id: '0' + }, { + title: '已开班', + id: '1' + }, { + title: '已结班', + id: '2' + }], scrollable: false, pageTitle: '', - tabList: [ - {name:'普通小班', id:'0'},{name:'联合班', id:'1'},{name:'精英班',id:'2'}], + tabList: [{ + name: '普通小班', + id: '0' + }, { + name: '联合班', + id: '1' + }, { + name: '精英班', + id: '2' + }], curTagId: 0, - classList: [], + classList: [], // 已结班 + preClassList: [], // 待开班 + learningClassList: [], // 在学习的班级 status: 3, // 0 不显示, 1 加载中,2 加载全部完成,3 暂无数据 page: 1, flag: true, // 函数是否执行完 - userMes: undefined, - isMonitor :undefined, - isDirector :undefined, - + modelId:undefined, + modelType:undefined, + modelTitle:undefined, }; }, //第一次加载 onLoad(e) { // 隐藏原生的tabbar uni.hideTabBar(); - // this.tagId = e.id + this.modelId = e.id + this.modelType = e.type + this.modelTitle = e.title + // this.tagId = e.id + // this.curTagId = this.range[0].value this.subTabId = this.subList[0].id - this.pageTitle = e.title - this.pid = e.pid + // this.pageTitle = e.title + // this.pid = e.pid console.log(e, '传入分类id') - this.getUserInfo() - + // this.getData() // this.getCateList(this.tagId) }, onPageScroll(e) { @@ -145,8 +270,8 @@ console.log('下拉刷新') // this.status = 3 // this.page = 1 - this.classList = [] - this.getData() + // this.classList = [] + // this.getData() uni.stopPullDownRefresh() }, onReachBottom() { @@ -160,11 +285,13 @@ ...mapState(['userInfo']) }, //页面显示 - onShow() { - // this.addType = undefined - this.getData() + async onShow() { // 隐藏原生的tabbar // uni.hideTabBar(); + this.classList = await this.getData('2') + this.learningClassList = await this.getData('1') + this.preClassList = await this.getData('0') + // this.getLearingClassList() }, components: { musicPlay @@ -173,69 +300,65 @@ methods: { goAddClasss(){ uni.navigateTo({ - url:'/pages/miniClass/addClass' + url:`/pages/miniClass/addClass?type=${this.modelType}` }) }, - getUserInfo() { - // 获取个人信息 - if (this.userInfo.id != undefined) { - this.$http.post("common/user/getUserInfo").then((res) => { - this.userMes = res.result; - this.isMonitor = res.isMonitor - this.isDirector = res.isDirector - }).catch(e => { - uni.showToast({ - title: '获取用户信息失败', - icon: 'none' - }) - }); - } - }, - // 加入班级 - enterClass(){ - - }, - selectChange(e){ + selectChange(e) { console.log("e:", e); }, - closePup(){ + closePup() { this.pupShow = false }, surl(imageurl) { return `url(${imageurl})` + }, + + goCreateClass() { + console.log('this.addType', this.addType); + if (this.addType != undefined) { + uni.navigateTo({ + url: `/pages/miniClass/addClass?type=${this.addType}&name=add` + }) + } else { + uni.showToast({ + title: '请选择班级的类型', + icon: 'none' + }) + return + } }, - fatherClick(e) { console.log('点击', e) this.page = 1 // var item = e this.curTagId = e.id - this.subTabId = this.subList[0].id + this.subTabId = this.subList[0].id this.getData(this.subTabId); }, curseClick(item) { this.subTabId = item.id - this.classList = [] - this.page = 1 - this.getData(this.subTabId); + // this.classList = [] + // this.page = 1 + // this.getData(this.subTabId); }, - getData(id) { + async getData(state) { // if (!this.flag) { // console.log('正在执行,未完成') // return // } - + var _list = [] this.status = 1 - this.flag = false - // uni.showLoading({ - // title:'正在加载' - // }) - $http.request({ + // this.flag = false + uni.showLoading({ + title: '正在加载' + }) + await $http.request({ url: "common/class/getClassByDirectorid", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data: { - "state": this.subTabId, //小班状态0待开班1已开班2完成 - "type": this.curTagId // 班类型 0小班 1联合班 2精英班 + "modelId": this.modelId, + "state": state, //小班状态0待开班1已开班2完成 + "type": "" // 班类型 0小班 1联合班 2精英班 }, header: { //默认 无 说明:请求头 'Content-Type': 'application/json' @@ -244,47 +367,70 @@ .then(res => { if (res.code == 0) { if (res.classEntityList.length > 0) { - this.classList = res.classEntityList - // var list = res.classEntityList - // this.classList = this.classList.concat(list) - // if (res.courses.pages > this.page) { - // this.status = 0 - // } else { - // this.status = 2 - // } - }else{ - this.classList = [] - } - // else if (this.page > 1) { - // this.status = 2 // 加载完成 - - // } else { - // this.status = 3 // 暂无数据 - // } - // console.log('status', this.status) - this.flag = true + // this.classList = res.result + _list = res.classEntityList + } else { + // this.classList = [] + _list = [] + } + // this.flag = true } - // uni.hideLoading() + uni.hideLoading() }).catch(e => { - // uni.hideLoading() - this.flag = true + _list = [] + uni.hideLoading() + // this.flag = true console.log(e, '数据报错') // this.status = 3 uni.showToast({ - title:`获取数据失败`, - icon:'error' + title: `获取数据失败`, + icon: 'error' }) }); + return _list }, // 跳转 - onPageJump(url,id) { - // console.log('进来了',url,id); - uni.navigateTo({ - url: `${url}?id=${id}` - }); + async onPageJump(url, id, have) { + var isStudent = await this.getRealRole(id) + console.log('isStudent',isStudent); + if(isStudent){ + uni.navigateTo({ + url:`/pages/miniClass/classInfo?id=${id}` + }) + }else{ + uni.navigateTo({ + url: `${url}?id=${id}&have=${have}` + }); + } }, - - shuomingPage(url,id,pid){ + // 获取真实的身份信息 + async getRealRole(id) { + // console.log('this.thisClass.id', this.thisClass.id); + var _isStudent = undefined + await $http.request({ + url: "common/class/getUserRole", + method: "POST", + data: { + "classId": id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then((res) => { + uni.hideLoading() + // 如果单纯是学员的身份 + if(res.result.length == 1 && res.result[0].role == 0){ + console.log('只是学员身份'); + _isStudent = true + + }else{ + _isStudent = false + } + }) + return _isStudent + }, + shuomingPage(url, id, pid) { uni.navigateTo({ url: `${url}?id=${id}&pid=${pid}` }); @@ -294,31 +440,67 @@