This commit is contained in:
@fawn-nine
2024-08-22 16:56:55 +08:00
parent d549954559
commit a1c8108fa3
13 changed files with 940 additions and 386 deletions

View File

@@ -19,63 +19,90 @@
<view class="welComeText">
<text> 班内职务{{getRoleName}} </text>
</view>
<view class="pingfenBox" >
<!-- 作业批改 -->
<class-infoWork-blank :thisClass="thisClass" :roleCode="roleCode"></class-infoWork-blank>
</view>
<view class="otherItems flex_box">
<view><text class="ciyao">创建日期</text><text
class="mainTxt">{{thisClass.createTime.substring(0,10)}}</text>
</view>
<view><text class="ciyao">班级类型</text>
<text class="mainTxt" v-if="classModel.type == '0'">普通小班</text>
<text class="mainTxt" v-if="classModel.type == '1'">联合班</text>
<text class="mainTxt" v-if="classModel.type == '2'">精英班</text>
</view>
<!-- <view @click="onPageJump('/pages/miniClass/studentsInClass', thisClass.id, roleCode)">
<text class="ciyao">学员人数</text>
<view class="mainTxt flex_box">
<text class="">{{students.length}}/{{thisClass.number}} </text>
<uni-icons type="eye" size="20" color="#333"></uni-icons>
</view>
</view> -->
<view><text class="ciyao">管理成员</text><text class="mainTxt" @click="seeManager">点击查看</text></view>
</view>
<!-- <view class="banjiJianjie" v-html="thisClass.content"></view> -->
<view class="pingfenBox">
<view class="waitOpen" v-if="thisClass.state == '0'">
<text>等待开班</text>
</view>
<class-infoWork-blank v-else :thisClass="thisClass" :roleCode="roleCode"></class-infoWork-blank>
</view>
<view class="mainBox">
<!-- 课程列表 -->
<uni-section class="mb-10 nobg" title="班内课程" type="line"></uni-section>
<view class="newBox" v-show="courses.length > 0">
<view class="item flexbox" v-for="(item, index) in courses" :key="index"
@click="onPageJump('/pages/course/courseDetail',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer">
<image :src="item.image" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="txt555">
{{item.title}}
</view>
<view class="jianjie" v-html="item.content"></view>
</view>
<view class="">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="tabClick" :current="curTagIndex"
:activeStyle="activeStyle" :scrollable="scrollable" :list="tabList"
itemStyle="padding-left:10rpx; background-color:#fff; padding-right: 10rpx; height: 50px; font-size:26rpx"></u-tabs>
</view>
<!-- 学员列表 -->
<view class="" v-if="tabId == '2'">
<view class="classMateBox" v-show="students.length> 0 ">
<uni-section class="mb-10 nobg xueyuanTitle" title="班内学员" type="line" sub-title="">
{{students.length}} 名学员</uni-section>
<view class="newBox">
<view :class="['item','flexbox',
item.student.vip == '1' ? 'superVip' : '',
item.student.vip == '2' ? 'wumenVip' : '',
item.student.vip == '3' ? 'zmVip' : '',
thisStudent.student && thisStudent.student.id == item.student.id ? 'cur' : ''
]" v-for="(item, index) in students" :key="index" @click="clickStudent(item)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="classmateImg">
<image v-if="item.student.avatar != null && item.student.avatar != ''"
:src="item.student.avatar" mode="aspectFit"></image>
<image v-else src="/static/icon/morenAvavter.png" mode="aspectFit"></image>
</view>
<view :class="['textItems','flex_box']">
<text class="txt555"
v-if="item.student.nickname != null && item.student.nickname != ''">
{{item.student.nickname}}
<template>
<text>{{item.student.tel}}</text>
</template>
</text>
<text class="txt555" v-else>
匿名用户
</text>
<text @click.stop="outClass(item.student.id)" class="outBtn">踢出班级</text>
<!-- <text class="userType" v-if="item.student.vip == '1'">超级VIP用户</text>
<text class="userType" v-if="item.student.vip == '2' ">医学VIP用户</text>
<text class="userType" v-if="item.student.vip == '3' ">国学VIP用户</text> -->
</view>
</view>
</view>
</view>
<view class="" v-if="classModel.days > 0" style="text-align: center; color: #999; font-size: 28rpx;">
教学时长{{classModel.days}}
<view class="" v-show="students.length == 0">
<u-divider text="暂无学员加入"></u-divider>
</view>
</view>
<view class="" v-show="courses.length == 0">
<u-divider text="暂无课程"></u-divider>
<view class="" v-if="tabId == '0'">
<view class="otherItems flex_box">
<view><text class="ciyao">创建日期</text><text
class="mainTxt">{{thisClass.createTime.substring(0,10)}}</text>
</view>
<view><text class="ciyao">班级类型</text>
<text class="mainTxt" v-if="classModel.type == '0'">普通小班</text>
<text class="mainTxt" v-if="classModel.type == '1'">联合班</text>
<text class="mainTxt" v-if="classModel.type == '2'">精英班</text>
</view>
<!-- <view @click="onPageJump('/pages/miniClass/studentsInClass', thisClass.id, roleCode)">
<text class="ciyao">学员人数</text>
<view class="mainTxt flex_box">
<text class="">{{students.length}}/{{thisClass.number}} </text>
<uni-icons type="eye" size="20" color="#333"></uni-icons>
</view>
</view> -->
<!-- <view><text class="ciyao">管理成员</text><text class="mainTxt" @click="seeManager">点击查看</text></view> -->
</view>
<uni-section class="mb-10 nobg" title="教学目标/班级简介" type="line"></uni-section>
<rich-text class="banjiJianjie" :nodes="formatRichText(thisClass.content)"></rich-text>
<view class="qrcode" v-if="thisClass.qrcode != ''">
<uni-section class="mb-10 nobg" title="群二维码" type="line"></uni-section>
<image :src="thisClass.qrcode" mode="widthFix" @click="previewImage(thisClass.qrcode)"></image>
</view>
</view>
<!-- <uni-section class="mb-10 nobg" title="教学目标/班级简介" type="line"></uni-section>
<rich-text class="banjiJianjie" :nodes="formatRichText(thisClass.content)"></rich-text>
<view class="qrcode" v-if="thisClass.qrcode != ''">
<uni-section class="mb-10 nobg" title="群二维码" type="line"></uni-section>
<image :src="thisClass.qrcode" mode="widthFix" @click="previewImage(thisClass.qrcode)"></image>
</view> -->
</view>
</view>
@@ -117,7 +144,7 @@
</template>
<text v-else>暂未设置</text>
</view>
<view class="item arryItem"><text class="adminName">评分员</text>
<view class="item arryItem"><text class="adminName">评分员</text>
<template v-if="admins.scorer.length > 0">
<view class="arryItemSub" v-for="(item,index) in admins.scorer" :key="index">
<template v-if="item.user != null">
@@ -130,6 +157,26 @@
</view>
</view>
</u-popup>
<u-popup key="2" v-if="showStudentBlank" :show="showStudentBlank" :round="10" @close="closePup" ref="">
<view class="upopBox" style="">
<h3 style="margin-bottom: 20rpx;">
{{thisStudent.student.nickname != null && thisStudent.student.nickname != '' ? thisStudent.student.nickname : "匿名用户"}}
</h3>
<view class="item">
<text><b>身份信息</b></text>
<text v-if="thisStudent.student.vip == '0'">普通用户</text>
<text v-if="thisStudent.student.vip == '1'">超级VIP</text>
<text v-if="thisStudent.student.vip == '2'">医学VIP</text>
<text v-if="thisStudent.student.vip == '3'">国学VIP</text>
</view>
<view class="item">
<text><b>电话</b>{{thisStudent.student.tel}}</text>
</view>
<view class="item">
<b>课程购买情况</b><br />{{thisStudent.buyState}}
</view>
</view>
</u-popup>
<!-- <view class="fabBox">
<uni-fab ref="fab" :pattern="pattern" :content="fabContent" :horizontal="horizontal" :vertical="vertical"
:direction="direction" @trigger="fabTrigger" @fabClick="fabClick" />
@@ -172,21 +219,23 @@
thisClass: {},
students: [],
tabId: '0',
tabId: '2',
curTagIndex: 0,
scrollable: false,
tabList: [{
name: '班内课程',
name: '班内学员',
id: '2'
},
{
name: '班级情况',
id: '0'
},
// {
// name: '班内讨论',
// id: '1'
// },
{
name: '班内学员',
id: '2'
},
// {
// name: '班内提交',
// id: '3'
@@ -234,25 +283,28 @@
taskList: [], // 任务列表
taskHaveMore: false, // 是否还有更多
roleCode: [], // 角色数组
interval:null,
interval: null,
homeWorkList: [],
thisStudent: {},
showStudentBlank: false,
}
},
onLoad(e) {
uni.hideTabBar();
this.classId = e.id
this.interval = setInterval(() => {
if(this.thisClass.id){
if (this.thisClass.id) {
uni.showLoading({
title:'加载中'
title: '加载中'
})
this.getUserInfo()
clearInterval(this.interval)
console.log('定时清了吗');
}
},500)
},
this.getUserInfo()
clearInterval(this.interval)
console.log('定时清了吗');
}
}, 500)
},
onPullDownRefresh() {
this.getClassInfo()
uni.stopPullDownRefresh()
@@ -260,35 +312,29 @@
beforeDestroy() {
clearInterval(this.interval)
},
// onBackPress() {
// if (this.$refs.fab.isShow) {
// this.$refs.fab.close()
// return true
// }
// return false
// },
async onShow() {
onShow() {
this.getClassInfo()
// this.roleCode = await this.getRealRole()
},
components: {
// musicPlay
classInfoWorkBlank,
classInfoWorkBlank,
},
computed: {
...mapState(["userInfo"]),
getRoleName() {
getRoleName() {
console.log('执行一次');
var _roleName = ''
// var _code = ''
this.roleCode.forEach(item => {
switch (item) {
case '主任':
_roleName += '主任';
_roleName += ' 主任';
break;
case '副主任':
_roleName += '副主任';
_roleName += ' 副主任';
break;
case '0':
_roleName += ' 学员';
@@ -329,68 +375,70 @@
}
},
methods: {
goAddHomeWork(type){
uni.navigateTo({
url: `/pages/miniClass/addHomeWork?classId=${this.thisClass.id}&type=${type}`
})
closePup() {
this.showStudentBlank = false
},
goXindeList(url){
clickTask(item) {
uni.navigateTo({
url:`${url}?classId=${this.thisClass.id}&type=2&roleCode=${this.roleCode}`
url: `/pages/miniClass/taskDetailForMan?id=${item.id}&roleCode=${this.roleCode}&type=0&classState=${this.thisClass.state}`
})
},
goAddHomeWork(type) {
uni.navigateTo({
url: `/pages/miniClass/addHomeWork?classId=${this.thisClass.id}&type=${type}`
})
},
goXindeList(url) {
uni.navigateTo({
url: `${url}?classId=${this.thisClass.id}&type=2&roleCode=${this.roleCode}`
})
},
// 获取真实的身份信息
getRealRole() {
console.log('this.thisClass.id', this.thisClass.id);
$http.request({
url: "common/class/getUserRole",
method: "POST",
data: {
"classId": this.thisClass.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then((res) => {
uni.hideLoading()
console.log('res获取身份信息',this.thisClass.id, res);
// var _list = []
// if (res.result.length > 0) {
// _list = res.result
// _list = _list.map(item => {
// return item.role
// })
// console.log('——list', res.result)
// }
this.roleCode = res.result
}).catch(e => {
uni.hideLoading()
this.roleCode = []
uni.showToast({
title: '获取身份信息失败',
icon: 'error'
})
});
},
getRealRole() {
console.log('this.thisClass.id', this.thisClass.id);
$http.request({
url: "common/class/getUserRole",
method: "POST",
data: {
"classId": this.thisClass.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then((res) => {
uni.hideLoading()
console.log('res获取身份信息', this.thisClass.id, res);
this.roleCode = res.result
}).catch(e => {
uni.hideLoading()
this.roleCode = []
uni.showToast({
title: '获取身份信息失败',
icon: 'error'
})
});
},
goPingfen(url, classId, type) {
uni.navigateTo({
url: `${url}?classId=${classId}&type=${type}&roleCode=${this.roleCode}`
})
},
goSikaoList(url,id){
goSikaoList(url, id) {
uni.navigateTo({
url:`${url}?classId=${id}&roleCode=${this.roleCode}`
url: `${url}?classId=${id}&roleCode=${this.roleCode}`
})
},
// 点击作业或者医案,进入详细介绍
clickTask() {
},
delClass() {
if (this.students.length > 0) {
uni.showToast({
title: '已经有学员加入,不可删除班级',
icon: 'none'
})
return
}
var that = this
uni.showModal({
title: '提示',
@@ -428,7 +476,7 @@
})
},
previewImage(url) {
console.log(url);
console.log(url);
uni.previewImage({
urls: [url],
// longPressActions: {
@@ -472,7 +520,12 @@
icon: 'error'
})
});
},
},
clickStudent(item) {
console.log('item', item);
this.thisStudent = item
this.showStudentBlank = true
},
getUserInfo() {
// 获取个人信息
if (this.userInfo.id != undefined) {
@@ -481,15 +534,8 @@
this.userMes = res.result;
this.isMonitor = res.isMonitor
this.isDirector = res.isDirector
// if (this.isDirector) {
// this.roleCode.push('66')
// }
// if (this.isMonitor) {
// console.log('确定具体的职位是什么');
this.getRealRole()
// } else {
this.getRealRole()
// }
}).catch(e => {
uni.hideLoading()
uni.showToast({
@@ -499,7 +545,7 @@
});
}
},
goSetAdmin(url){
goSetAdmin(url) {
uni.navigateTo({
url: `${url}?id=${this.thisClass.id}&roleCode=${this.roleCode}`
});
@@ -584,18 +630,68 @@
})
}, 200)
},
// 获取固定作业的数量
async getHomeWorkLength() {
var list = []
await $http.request({
url: "common/class/getClassTaskList",
method: "POST",
data: {
"limit": 100,
"page": 1,
"classId": this.thisClass.id,
"type": "0", //类型 0班内任务1医案2心得
"title": ""
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
}
}).then((res) => {
// console.log('班内作业的输俩个',res);
if (res.code == 0) {
list = res.page.records
}
}).catch(e => {
list = []
console.log('e', e);
})
return list
},
// 改变班级状态
changeClassStatu(statusCode) {
// var mm = 0
// mm = await this.getHomeWorkLength()
let that = this
if (statusCode == '1') {
console.log('this.admins',this.admins);
if (this.admins.list.length == 0) {
console.log('this.admins', this.admins);
if (this.homeWorkList.length == 0) {
uni.showToast({
title: '请先完成管理人员的设置',
icon: 'none'
title: '开班前请发布班内作业,开班后将不可添加和更改',
icon: 'none',
duration: 3000
})
return
}
if (this.students.length < this.thisClass.number) {
uni.showModal({
title: "提示",
content: '班内成员还没有招满,确定开班操作吗?',
success(res) {
if (res.confirm) {
that.opClass(statusCode)
} else {
return
}
},
})
}
} else {
that.opClass(statusCode)
}
},
// 班级操作
opClass(statusCode) {
$http.request({
url: "common/class/editClass",
method: "POST",
@@ -624,11 +720,6 @@
}
}).catch(e => {
console.log(e, '数据报错')
// this.status = 3
// uni.showToast({
// title: e.msg,
// icon: 'error'
// })
});
},
taskEdit(item) {
@@ -668,20 +759,18 @@
if (res.code == 0) {
that.isHave = true
uni.showToast({
title: `退出成功!`,
title: `操作成功!`,
icon: 'success'
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/miniClass/myClassList'
})
this.getClassInfo()
}, 200)
}
}).catch(e => {
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title: `退出失败`,
title: `操作失败`,
icon: 'error'
})
});
@@ -697,7 +786,7 @@
url: `/pages/miniClass/classCaskList?id=${this.thisClass.id}&type=${this.tijiaoTitleId}`
})
},
getClassInfo() {
async getClassInfo() {
uni.showLoading({
title: '正在加载'
})
@@ -711,8 +800,8 @@
'Content-Type': 'application/json'
},
})
.then(res => {
console.log('res--------',this.classId,res,);
.then(async res => {
console.log('res--------', this.classId, res, );
this.refresh = false
if (res.code == 0) {
this.isHave = res.result.isJoin
@@ -749,8 +838,12 @@
this.classModel = res.result.classModel
this.courses = res.result.courses
this.students = res.result.students
this.refresh = true
this.refresh = true
if (this.thisClass.state == 0) {
this.homeWorkList = await this.getHomeWorkLength()
}
}
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
@@ -769,13 +862,25 @@
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.upopBox {
padding: 40rpx;
max-height: 80vh;
overflow-y: scroll;
color: #666;
.item {
padding: 10rpx 0;
border-bottom: 1px solid #eee;
}
}
.flexbox {
display: flex;
}
.welComeText {
font-size: 28rpx;
padding:20rpx 0;
font-size: 28rpx;
padding: 20rpx 0;
color: #e58d44;
}
@@ -815,11 +920,16 @@
color: #fff;
padding: 20rpx 0;
border-radius: 6rpx;
text{padding-top: 0 !important;}
text {
padding-top: 0 !important;
}
}
.item:last-child{
.item:last-child {
margin-right: 0 !important;
}
.delClass {
background-color: #ffa4a6;
}
@@ -904,12 +1014,16 @@
// }
}
.qrcode{width:100%;
image{
width: 200rpx;height: 200rpx;
.qrcode {
width: 100%;
image {
width: 200rpx;
height: 200rpx;
}
}
.manBtnBox {
justify-content: center;
@@ -946,7 +1060,14 @@
color: $themeColor;
}
}
.waitOpen {
height: 100rpx;
justify-content: center;
display: flex;
align-items: center;
}
.submitRecode {
// padding: 20rpx;
@@ -988,6 +1109,18 @@
background-color: transparent !important;
}
::v-deep .xueyuanTitle {
.uni-section-header {
float: left;
}
.uni-section-content {
float: right;
margin-top: 20rpx;
font-size: 26rpx;
}
}
.bottomBox {
border-top: 1px solid #eee;
position: fixed;
@@ -1017,14 +1150,33 @@
.classMateBox {
.zmVip {
background-image: linear-gradient(-60deg, #53966a 0%, #e1feef 50%, #e1feef 100%);
.outBtn {
color: #fff !important;
border: 1px solid #fff !important;
}
}
.wumenVip {
background-image: linear-gradient(-60deg, #578df0 0%, #f1f4fd 50%, #f1f4fd 100%);
.outBtn {
color: #fff !important;
border: 1px solid #fff !important;
}
}
.superVip {
background-image: linear-gradient(-60deg, #965af0 0%, #fdf0ed 50%, #fdf0ed 100%);
.outBtn {
color: #fff !important;
border: 1px solid #fff !important;
}
}
.newBox {
flex-wrap: wrap;
}
.item {
@@ -1034,6 +1186,7 @@
.textItems {
width: 100%;
align-items: center;
justify-content: space-between;
.outBtn {
padding: 6rpx 10rpx;
@@ -1042,6 +1195,7 @@
color: $themeColor;
border: 1px solid $themeColor;
font-size: 26rpx;
margin-left: 10rpx;
}
.txt555 {
@@ -1057,18 +1211,23 @@
color: #fff;
}
}
}
.item.cur {
border: 2px solid #55aa00;
}
}
.classmateImg {
width: 80rpx;
margin-right: 40rpx;
height: 80rpx;
width: 60rpx;
margin-right: 20rpx;
height: 60rpx;
border-radius: 100rpx;
image {
width: 80rpx;
height: 80rpx;
width: 60rpx;
height: 60rpx;
}
}
@@ -1084,6 +1243,10 @@
// background-color: #f4f7ff;
}
u-divider {
font-size: 24rpx;
}
.newBox {
.item {