diff --git a/pages/miniClass/classInfo.vue b/pages/miniClass/classInfo.vue index abc5011..d6f277c 100644 --- a/pages/miniClass/classInfo.vue +++ b/pages/miniClass/classInfo.vue @@ -5,148 +5,154 @@ -

{{thisClass.title}}

- 开班 - 结班 +

{{thisClass.title}}

+ 开班 + 结班 退出班级
- - 创建日期{{thisClass.createTime.substring(0,10)}} - - 班级类型 - 普通小班 - 联合班 - 精英班 - - 班级人数{{thisClass.number}}人 - 管理成员点击查看 - - + + 创建日期{{thisClass.createTime.substring(0,10)}} + + 班级类型 + 普通小班 + 联合班 + 精英班 + + 班级人数{{thisClass.number}}人 + 管理成员点击查看 + + 教学目标/班级简介 - + - - - - - - - - - - - - - - - - {{item.title}} - - - - + + + + + - - - - - - - 班内问答 - - - - - + + + + + + + + {{item.title}} + + + + + + + + + + + + 班内问答 + + + + + - - - - + + + + + + + + {{item.nickname}} + + + + + 匿名用户 + + 超级VIP用户 + 医学VIP用户 + 国学VIP用户 + + - - - {{item.nickname}} - - - - - 匿名用户 - - 超级VIP用户 - 医学VIP用户 - 国学VIP用户 - - - - - - - - - - {{item.name}} + + + + + + {{item.name}} + - - - - - - - - - - - + + + + + + + + + + + + + + 匿名用户 + - - 匿名用户 + + 我是内容 - - 我是内容 - - - - - - - - - + + + + + + + + + + - - - - - 修改班级 - 管理人员设置 + + 管理人员设置 + - +

班内管理人员

@@ -207,24 +213,25 @@ return { thisClass: {}, students: [], - tabId:'0', + tabId: '0', curTagIndex: 0, scrollable: false, tabList: [{ - name: '班内课程', - id: '0' - }, - // { - // name: '班内讨论', - // id: '1' - // }, - { - name: '班内学员', - id: '2' - }, { - name: '班内提交', - id: '3' - }], + name: '班内课程', + id: '0' + }, + // { + // name: '班内讨论', + // id: '1' + // }, + { + name: '班内学员', + id: '2' + }, { + name: '班内提交', + id: '3' + } + ], admins: { list: [], monitor: {}, @@ -241,33 +248,35 @@ // backgroundColor: '#258feb' }, - classModel:{}, + classModel: {}, courses: [], classId: undefined, refresh: true, - userMes:{}, - isMonitor:false, // 是管理者 - isDirector:false, // 是主任 - isHave:false, - showMan:false, - tijiaoTitleList:[ - {name:'班内任务', id:'0'}, - {name:'医案', id:'1'}, - {name:'心得', id:'2'}, + userMes: {}, + isMonitor: false, // 是管理者 + isDirector: false, // 是主任 + isHave: false, + showMan: false, + tijiaoTitleList: [{ + name: '班内任务', + id: '0' + }, + { + name: '医案', + id: '1' + }, + { + name: '心得', + id: '2' + }, ], - tijiaoTitleId:'0' + tijiaoTitleId: '0' } }, onLoad(e) { uni.hideTabBar(); this.classId = e.id this.getUserInfo() - - // if(e.have == 'isNotHave'){ - // this.isHave = false // 未加入 - // }else if(e.have == 'have'){ - // this.isHave = true // 已加入 - // } }, onPullDownRefresh() { this.getClassInfo() @@ -280,391 +289,543 @@ ...mapState(["userInfo"]), }, methods: { - titleClick(item){ - this.tijiaoTitleId = item.id - }, - 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' - }) - }); - } - }, - // 跳转 - onPageJump(url,id,modeType) { - uni.navigateTo({ - url: `${url}?id=${id}&type=${modeType}` - }); - }, - tabClick(e) { - console.log('e', e); - this.tabId = e.id - }, - formatRichText(html) { - if(html == ''){ - return - } - //控制图片大小 - let newContent = html.replace(/]*>/gi, function (match, capture) { - match = match - .replace(/style="[^"]+"/gi, "") - .replace(/style='[^']+'/gi, ""); - match = match - .replace(/width="[^"]+"/gi, "") - .replace(/width='[^']+'/gi, ""); - match = match - .replace(/height="[^"]+"/gi, "") - .replace(/height='[^']+'/gi, ""); - return match; - }); - newContent = newContent.replace( - /style="[^"]+"/gi, - function (match, capture) { - match = match - .replace(/width:[^;]+;/gi, "max-width:100%;") - .replace(/width:[^;]+;/gi, "max-width:100%;"); - return match; - } - ); - newContent = newContent.replace(/]*\/>/gi, ""); - newContent = newContent.replace( - /\ { - if (res.code == 0) { - this.isHave = true - uni.showToast({ - title: `加入成功!`, - icon: 'success' - }) - setTimeout(()=>{ - this.getClassInfo() - },200) - } - }).catch(e => { - console.log(e, '数据报错') - // this.status = 3 - uni.showToast({ - title: `加入失败`, - icon: 'error' - }) - }); - }, - // 显示班级成员 - seeManager(){ - this.showMan = true - }, - closeManager(){ - this.showMan = false - }, - // 改变班级状态 - changeClassStatu(statusCode){ - if(statusCode == '1'){ - // console.log('this.admins',this.admins); - if(this.admins.list.length == 0){ - uni.showToast({ - title:'请先完成管理人员的设置', - icon: 'none' - }) - return - } - } - $http.request({ - url: "common/class/editClass", - method: "POST", - data: { - "id": this.thisClass.id, - "title": this.thisClass.title, - "state": statusCode, //小班状态0待开班1已开班2完成 - "icon": this.thisClass.icon, - "content": this.thisClass.content, - }, - header: { //默认 无 说明:请求头 - 'Content-Type': 'application/json' - }, - }) - .then(res => { - if (res.code == 0) { - that.isHave = true - uni.showToast({ - title: `操作成功`, - icon: 'success' - }) - } - }).catch(e => { - console.log(e, '数据报错') - // this.status = 3 - uni.showToast({ - title: e.msg, - icon: 'error' - }) - }); - }, - // 退出班级 // 踢出班级 - outClass(userId){ - let that = this - var _useId = undefined - if(userId){ - _useId = userId - }else{ - _useId = this.userInfo.id - } + delClass() { + var that = this uni.showModal({ - title: '提示', - content: '您即将退出当前班级,是否继续?', - success: function (res) { - if (res.confirm) { - // console.log('用户点击确定'); - $http.request({ - url: "common/class/quitClass", - method: "POST", - data: { - "classId": that.classId , - "userId": _useId - }, - header: { //默认 无 说明:请求头 - 'Content-Type': 'application/json' - }, - }) - .then(res => { - if (res.code == 0) { - that.isHave = true + title: '提示', + content: '您正在执行删除班级操作,是否继续?', + success: function(res) { + if (res.confirm) { + $http.request({ + url: "common/class/joinClass", + method: "POST", + data: { + "classId": that.thisClass.id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then((res) => { uni.showToast({ - title: `退出成功!`, + title: '删除成功', icon: 'success' }) - setTimeout(()=>{ + setTimeout(() => { uni.navigateTo({ - url:'/pages/miniClass/myClassList' + url: '/pages/miniClass/miniClassMan' }) - },200) - } - }).catch(e => { - console.log(e, '数据报错') - // this.status = 3 - uni.showToast({ - title: `退出失败`, - icon: 'error' - }) - }); - } else if (res.cancel) { - console.log('用户点击取消'); + }, 500) + }).catch(e => { + uni.showToast({ + title: '删除失败', + icon: 'error' + }) + }); + }} + }) + }, + titleClick(item) { + this.tijiaoTitleId = item.id + }, + 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' + }) + }); + } + }, + // 跳转 + onPageJump(url, id, modeType) { + uni.navigateTo({ + url: `${url}?id=${id}&type=${modeType}` + }); + }, + tabClick(e) { + console.log('e', e); + this.tabId = e.id + }, + formatRichText(html) { + if (html == '') { return } - } - }); - }, - - getClassInfo() { - uni.showLoading({ - title: '正在加载' - }) - $http.request({ - url: "common/class/getClassInfo", - method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 - data: { - "classId": this.classId // 班类型 0小班 1联合班 2精英班 - }, - header: { //默认 无 说明:请求头 - 'Content-Type': 'application/json' - }, - }) - .then(res => { - this.refresh = false - if (res.code == 0) { - this.isHave = res.result.isJoin - this.thisClass = res.result.class - this.admins.list = res.result.admins - this.admins.monitor = {} - this.admins.dmonitor = {} - this.admins.learner = {} - this.admins.scorer = [] - this.admins.counter = [] - if (res.result.admins.length > 0) { - res.result.admins.forEach(item => { - if (item.role == '1') { - this.admins.monitor = item - } - if (item.role == '2') { - this.admins.dmonitor = item - } - if (item.role == '3') { - this.admins.learner = item - } - if (item.role == '4') { - // console.log('this.admins.counter',this.admins.counter); - this.admins.scorer.push(item) - } - if (item.role == '5') { - // console.log('this.admins.counter',this.admins.counter); - this.admins.counter.push(item) - } - - }) + //控制图片大小 + let newContent = html.replace(/]*>/gi, function(match, capture) { + match = match + .replace(/style="[^"]+"/gi, "") + .replace(/style='[^']+'/gi, ""); + match = match + .replace(/width="[^"]+"/gi, "") + .replace(/width='[^']+'/gi, ""); + match = match + .replace(/height="[^"]+"/gi, "") + .replace(/height='[^']+'/gi, ""); + return match; + }); + newContent = newContent.replace( + /style="[^"]+"/gi, + function(match, capture) { + match = match + .replace(/width:[^;]+;/gi, "max-width:100%;") + .replace(/width:[^;]+;/gi, "max-width:100%;"); + return match; + } + ); + newContent = newContent.replace(/]*\/>/gi, ""); + newContent = newContent.replace( + /\ { + if (res.code == 0) { + this.isHave = true + uni.showToast({ + title: `加入成功!`, + icon: 'success' + }) + setTimeout(() => { + this.getClassInfo() + }, 200) + } + }).catch(e => { + console.log(e, '数据报错') + // this.status = 3 + uni.showToast({ + title: `加入失败`, + icon: 'error' + }) + }); + }, + // 显示班级成员 + seeManager() { + this.showMan = true + }, + closeManager() { + this.showMan = false + }, + // 改变班级状态 + changeClassStatu(statusCode) { + if (statusCode == '1') { + // console.log('this.admins',this.admins); + if (this.admins.list.length == 0) { + uni.showToast({ + title: '请先完成管理人员的设置', + icon: 'none' + }) + return } - - this.classModel = res.result.classModel - this.courses = res.result.courses - this.students = res.result.students - this.refresh = true - } - uni.hideLoading() - }).catch(e => { - uni.hideLoading() - console.log(e, '数据报错') - // this.status = 3 - uni.showToast({ - title: `获取数据失败`, - icon: 'error' + $http.request({ + url: "common/class/editClass", + method: "POST", + data: { + "id": this.thisClass.id, + "title": this.thisClass.title, + "state": statusCode, //小班状态0待开班1已开班2完成 + "icon": this.thisClass.icon, + "content": this.thisClass.content, + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + that.isHave = true + uni.showToast({ + title: `操作成功`, + icon: 'success' + }) + } + }).catch(e => { + console.log(e, '数据报错') + // this.status = 3 + uni.showToast({ + title: e.msg, + icon: 'error' + }) + }); + }, + // 退出班级 // 踢出班级 + outClass(userId) { + let that = this + var _useId = undefined + if (userId) { + _useId = userId + } else { + _useId = this.userInfo.id + } + uni.showModal({ + title: '提示', + content: '您即将退出当前班级,是否继续?', + success: function(res) { + if (res.confirm) { + // console.log('用户点击确定'); + $http.request({ + url: "common/class/quitClass", + method: "POST", + data: { + "classId": that.classId, + "userId": _useId + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + that.isHave = true + uni.showToast({ + title: `退出成功!`, + icon: 'success' + }) + setTimeout(() => { + uni.navigateTo({ + url: '/pages/miniClass/myClassList' + }) + }, 200) + } + }).catch(e => { + console.log(e, '数据报错') + // this.status = 3 + uni.showToast({ + title: `退出失败`, + icon: 'error' + }) + }); + } else if (res.cancel) { + console.log('用户点击取消'); + return + } + } + }); + }, + + getClassInfo() { + uni.showLoading({ + title: '正在加载' }) - }); + $http.request({ + url: "common/class/getClassInfo", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data: { + "classId": this.classId // 班类型 0小班 1联合班 2精英班 + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + this.refresh = false + if (res.code == 0) { + this.isHave = res.result.isJoin + this.thisClass = res.result.class + this.admins.list = res.result.admins + this.admins.monitor = {} + this.admins.dmonitor = {} + this.admins.learner = {} + this.admins.scorer = [] + this.admins.counter = [] + if (res.result.admins.length > 0) { + res.result.admins.forEach(item => { + if (item.role == '1') { + this.admins.monitor = item + } + if (item.role == '2') { + this.admins.dmonitor = item + } + if (item.role == '3') { + this.admins.learner = item + } + if (item.role == '4') { + // console.log('this.admins.counter',this.admins.counter); + this.admins.scorer.push(item) + } + if (item.role == '5') { + // console.log('this.admins.counter',this.admins.counter); + this.admins.counter.push(item) + } + + }) + } + + this.classModel = res.result.classModel + this.courses = res.result.courses + this.students = res.result.students + this.refresh = true + + } + uni.hideLoading() + }).catch(e => { + uni.hideLoading() + console.log(e, '数据报错') + // this.status = 3 + uni.showToast({ + title: `获取数据失败`, + icon: 'error' + }) + }); + } } } - } \ No newline at end of file diff --git a/pages/miniClass/miniClassMan.vue b/pages/miniClass/miniClassMan.vue index da03839..d3fd530 100644 --- a/pages/miniClass/miniClassMan.vue +++ b/pages/miniClass/miniClassMan.vue @@ -6,7 +6,8 @@ - + + @@ -132,6 +133,9 @@ status: 3, // 0 不显示, 1 加载中,2 加载全部完成,3 暂无数据 page: 1, flag: true, // 函数是否执行完 + userMes: undefined, + isMonitor :undefined, + isDirector :undefined, }; }, @@ -145,6 +149,7 @@ this.pageTitle = e.title this.pid = e.pid console.log(e, '传入分类id') + this.getUserInfo() this.getData() // this.getCateList(this.tagId) }, @@ -185,6 +190,21 @@ }, //方法 methods: { + 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(){ @@ -350,8 +370,8 @@ } .curseSet{margin-right: 20rpx; font-size: 28rpx; display: flex; align-items: center;} .fixed { - position: fixed; top: 120rpx; - z-index: 1; width: 100%; background-color: #fff; + // position: fixed; top: 120rpx; + // z-index: 1; width: 100%; background-color: #fff; } .newBox {