成员设置
This commit is contained in:
@@ -567,7 +567,7 @@
|
|||||||
"path" : "pages/miniClass/addClass",
|
"path" : "pages/miniClass/addClass",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "添加课程"
|
"navigationBarTitleText" : "添加班级"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -597,6 +597,13 @@
|
|||||||
{
|
{
|
||||||
"navigationBarTitleText" : "用户的班级列表"
|
"navigationBarTitleText" : "用户的班级列表"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/miniClass/memberSet",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "设置班级管理员"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@@ -493,7 +493,7 @@
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
var yonghuIndex = this.pageList.findIndex(item => {
|
var yonghuIndex = this.pageList.findIndex(item => {
|
||||||
return item.name == '班级管理'
|
return item.name == '我的班级'
|
||||||
})
|
})
|
||||||
if (yonghuIndex > -1) {
|
if (yonghuIndex > -1) {
|
||||||
this.pageList.splice(yonghuIndex, 1)
|
this.pageList.splice(yonghuIndex, 1)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<z-nav-bar :title="getPageTitle"></z-nav-bar>
|
<z-nav-bar :title="`${pageType}班级`"></z-nav-bar>
|
||||||
<!-- 公共组件-每个页面必须引入 -->
|
<!-- 公共组件-每个页面必须引入 -->
|
||||||
|
|
||||||
<public-module></public-module>
|
<public-module></public-module>
|
||||||
@@ -89,6 +89,7 @@
|
|||||||
return {
|
return {
|
||||||
fileList1: [],
|
fileList1: [],
|
||||||
playData: {},
|
playData: {},
|
||||||
|
modeType:undefined, // 模型type
|
||||||
//手机号账号
|
//手机号账号
|
||||||
form: {
|
form: {
|
||||||
id:undefined, // 班级id
|
id:undefined, // 班级id
|
||||||
@@ -128,13 +129,18 @@
|
|||||||
//第一次加载
|
//第一次加载
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
console.log('收到的值', e);
|
console.log('收到的值', e);
|
||||||
this.pageType = e.type
|
// this.pageType = e.type
|
||||||
// this.form.type = e.type
|
this.form.type = e.type
|
||||||
|
this.modeType = e.type
|
||||||
this.getUserModel()
|
this.getUserModel()
|
||||||
if(e.classId && e.name == 'edit'){
|
|
||||||
this.form.id = e.classId
|
if(e.id){
|
||||||
|
|
||||||
|
this.pageType = '编辑'
|
||||||
|
this.form.id = e.id
|
||||||
this.getClassInfo()
|
this.getClassInfo()
|
||||||
}else{
|
}else{
|
||||||
|
this.pageType = '添加'
|
||||||
this.form.id = undefined
|
this.form.id = undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -144,19 +150,49 @@
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userInfo']),
|
...mapState(['userInfo']),
|
||||||
getPageTitle(){
|
// getPageTitle(){
|
||||||
if(this.form.id){
|
// if(this.form.id){
|
||||||
return "修改班级"
|
// return "修改班级"
|
||||||
}else{
|
// }else{
|
||||||
return "添加班级"
|
// return "添加班级"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
//方法
|
//方法
|
||||||
methods: {
|
methods: {
|
||||||
// 获取班级详情
|
// 获取班级详情
|
||||||
getClassInfo(){
|
getClassInfo(){
|
||||||
console.log('获取课程详情');
|
// console.log('获取课程详情');
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在加载'
|
||||||
|
})
|
||||||
|
$http.request({
|
||||||
|
url: "common/class/getClassInfo",
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data: {
|
||||||
|
"classId": this.form.id // 班类型 0小班 1联合班 2精英班
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
this.refresh = false
|
||||||
|
if (res.code == 0) {
|
||||||
|
this.form = res.result.class
|
||||||
|
this.form.modelId = res.result.classModel.id
|
||||||
|
}
|
||||||
|
console.log('this.form',this.form);
|
||||||
|
uni.hideLoading()
|
||||||
|
}).catch(e => {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.log(e, '数据报错')
|
||||||
|
// this.status = 3
|
||||||
|
uni.showToast({
|
||||||
|
title: `获取数据失败`,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getUserModel() {
|
getUserModel() {
|
||||||
console.log('获取用户的可添加模型列表');
|
console.log('获取用户的可添加模型列表');
|
||||||
@@ -165,7 +201,7 @@
|
|||||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
data: {
|
data: {
|
||||||
"userId": this.userInfo.id,
|
"userId": this.userInfo.id,
|
||||||
'type': this.pageType
|
'type': this.modeType
|
||||||
},
|
},
|
||||||
header: { //默认 无 说明:请求头
|
header: { //默认 无 说明:请求头
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -250,15 +286,18 @@
|
|||||||
// console.log('this.fileList1',_list);
|
// console.log('this.fileList1',_list);
|
||||||
this.form.icon = _list.join(',')
|
this.form.icon = _list.join(',')
|
||||||
}
|
}
|
||||||
|
var _url = ''
|
||||||
|
this.form.id ? _url = 'common/class/editClass' : _url = "common/class/addClass"
|
||||||
$http.request({
|
$http.request({
|
||||||
url: "common/class/addClass",
|
url: _url,
|
||||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
data: {
|
data: {
|
||||||
// ...this.form
|
// ...this.form
|
||||||
'id':this.form.id,
|
'id':this.form.id,
|
||||||
"modelId": this.form.modelId,
|
"modelId": this.form.id ? undefined : this.form.modelId,
|
||||||
"title": this.form.title,
|
"title": this.form.title,
|
||||||
"icon": this.form.icon,
|
"icon": this.form.icon,
|
||||||
|
"state": this.form.id ? this.form.state : undefined,
|
||||||
"content": this.form.content,
|
"content": this.form.content,
|
||||||
"number": Number(this.form.number)
|
"number": Number(this.form.number)
|
||||||
},
|
},
|
||||||
@@ -266,28 +305,21 @@
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// this.$http.post("common/class/addClass",{
|
|
||||||
// ...this.form
|
|
||||||
// })
|
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.showModal({
|
uni.showToast({
|
||||||
title: "提示",
|
title: "操作成功",
|
||||||
content: "创建成功!",
|
icon:'success'});
|
||||||
showCancel: false,
|
setTimeout(()=> {
|
||||||
success: (res) => {
|
|
||||||
this.fileList1 = []
|
this.fileList1 = []
|
||||||
// this.$nextTick(() => {
|
// this.$nextTick(() => {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
});
|
});
|
||||||
// })
|
},300)
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
// console.log('表单错误信息:', err);
|
// console.log('表单错误信息:', err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '创建失败',
|
title: '操作失败',
|
||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
<view class="mainContent" v-if="thisClass.id">
|
<view class="mainContent" v-if="thisClass.id">
|
||||||
<view class="className">
|
<view class="className">
|
||||||
<h3>{{thisClass.title}}</h3>
|
<h3>{{thisClass.title}}</h3>
|
||||||
<text class="kaiban" v-if="thisClass.state == '0' && isMonitor || thisClass.state == '0' && isDirector">开班</text>
|
<text class="kaiban" v-if="thisClass.state == '0' && isMonitor || thisClass.state == '0' && isDirector" @click="changeClassStatu('1')">开班</text>
|
||||||
<text class="jieban" v-if="thisClass.state == '1' && isMonitor || thisClass.state == '1' && isDirector">结班</text>
|
<text class="jieban" v-if="thisClass.state == '1' && isMonitor || thisClass.state == '1' && isDirector" @click="changeClassStatu('2')">结班</text>
|
||||||
<text class="tuichu" v-if="!isMonitor && !isDirector && isHave" @click="outClass">退出班级</text>
|
<text class="tuichu" v-if="!isMonitor && !isDirector && isHave" @click="outClass()">退出班级</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="otherItems flex_box">
|
<view class="otherItems flex_box">
|
||||||
<view><text class="ciyao">创建日期</text><text
|
<view><text class="ciyao">创建日期</text><text
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<text class="txt555" v-if="item.nickname != null && item.nickname != ''">
|
<text class="txt555" v-if="item.nickname != null && item.nickname != ''">
|
||||||
{{item.nickname}}
|
{{item.nickname}}
|
||||||
<template v-if="isDirector || isMonitor">
|
<template v-if="isDirector || isMonitor">
|
||||||
<text >({{item.tel}})</text> <text @click="removeStudent(item)">提出班级</text>
|
<text >({{item.tel}})</text> <text @click="outClass(item.id)" class="outBtn">踢出班级</text>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</text>
|
</text>
|
||||||
@@ -108,7 +108,22 @@
|
|||||||
<view></view>
|
<view></view>
|
||||||
<uni-section class="mb-10 nobg" title="提交的任务" type="line"></uni-section>
|
<uni-section class="mb-10 nobg" title="提交的任务" type="line"></uni-section>
|
||||||
<view class="submitRecode">
|
<view class="submitRecode">
|
||||||
|
<view class="newBox">
|
||||||
|
<view class="item ">
|
||||||
|
<view class="leve1 flex_box">
|
||||||
|
<view class="classmateImg">
|
||||||
|
<!-- <image v-if="item.avatar != null && item.avatar != ''" :src="item.avatar" mode="aspectFit"></image> -->
|
||||||
|
<image src="/static/icon/morenAvavter.png" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
<view class="userName flex_box">
|
||||||
|
<text>匿名用户</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="leve2">
|
||||||
|
我是内容
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 医案 -->
|
<!-- 医案 -->
|
||||||
@@ -125,6 +140,10 @@
|
|||||||
<view class="bottomBox" v-if="!isHave && !isDirector && !isMonitor">
|
<view class="bottomBox" v-if="!isHave && !isDirector && !isMonitor">
|
||||||
<button type="primary" @click="addClass">一键加入班级</button>
|
<button type="primary" @click="addClass">一键加入班级</button>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="bottomBox manBtnBox flex_box" v-if="isDirector || isMonitor">
|
||||||
|
<text class="edit" v-show="isDirector && thisClass.state == '0'" @click="onPageJump('/pages/miniClass/addClass',thisClass.id, classModel.type)">修改班级</text>
|
||||||
|
<text class="set" @click="onPageJump('/pages/miniClass/memberSet',thisClass.id)">管理人员设置</text>
|
||||||
|
</view>
|
||||||
<!-- 管理弹出 -->
|
<!-- 管理弹出 -->
|
||||||
<u-popup key="1" :show="showMan" :round="10" @close="closeManager">
|
<u-popup key="1" :show="showMan" :round="10" @close="closeManager">
|
||||||
|
|
||||||
@@ -250,6 +269,10 @@
|
|||||||
// this.isHave = true // 已加入
|
// this.isHave = true // 已加入
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.getClassInfo()
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getClassInfo()
|
this.getClassInfo()
|
||||||
},
|
},
|
||||||
@@ -276,9 +299,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 跳转
|
// 跳转
|
||||||
onPageJump(url,id) {
|
onPageJump(url,id,modeType) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `${url}?id=${id}`
|
url: `${url}?id=${id}&type=${modeType}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
tabClick(e) {
|
tabClick(e) {
|
||||||
@@ -357,9 +380,58 @@
|
|||||||
closeManager(){
|
closeManager(){
|
||||||
this.showMan = false
|
this.showMan = false
|
||||||
},
|
},
|
||||||
// 退出班级
|
// 改变班级状态
|
||||||
outClass(){
|
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
|
let that = this
|
||||||
|
var _useId = undefined
|
||||||
|
if(userId){
|
||||||
|
_useId = userId
|
||||||
|
}else{
|
||||||
|
_useId = this.userInfo.id
|
||||||
|
}
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '您即将退出当前班级,是否继续?',
|
content: '您即将退出当前班级,是否继续?',
|
||||||
@@ -371,6 +443,7 @@
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
"classId": that.classId ,
|
"classId": that.classId ,
|
||||||
|
"userId": _useId
|
||||||
},
|
},
|
||||||
header: { //默认 无 说明:请求头
|
header: { //默认 无 说明:请求头
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -404,10 +477,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 踢出班级
|
|
||||||
removeStudent(item){
|
|
||||||
|
|
||||||
},
|
|
||||||
getClassInfo() {
|
getClassInfo() {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在加载'
|
title: '正在加载'
|
||||||
@@ -481,6 +551,28 @@
|
|||||||
@import "@/style/mixin.scss";
|
@import "@/style/mixin.scss";
|
||||||
|
|
||||||
.flexbox{display: flex;}
|
.flexbox{display: flex;}
|
||||||
|
.manBtnBox{ justify-content: center;
|
||||||
|
text{width:30% ; font-size: 28rpx; padding: 20rpx 0; border-radius: 10rpx; display: block; margin: 0 20rpx; color:#fff;}
|
||||||
|
.edit{background-color: $themeColor;}
|
||||||
|
.set{background-color:#ffca7e ;}
|
||||||
|
|
||||||
|
}
|
||||||
|
.submitRecode{background-color: #fff; border-radius: 20rpx; padding: 20rpx;
|
||||||
|
.newBox{
|
||||||
|
.classmateImg{width:60rpx !important; height: 60rpx !important;
|
||||||
|
image{
|
||||||
|
width:60rpx !important; height: 60rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item{
|
||||||
|
box-shadow: none !important; border-bottom: 1px solid #eee; border-radius: 0 !important;
|
||||||
|
.leve1{align-items: center; border-bottom: 1px dashed #eee; padding-bottom: 20rpx; margin-bottom: 20rpx;
|
||||||
|
// .userName{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.nobg{background-color: transparent !important; }
|
.nobg{background-color: transparent !important; }
|
||||||
.bottomBox{position: fixed; padding: 20rpx 0; text-align: center; bottom: 100rpx; left: 0; z-index: 2; width: 100%; background-color: #fff;
|
.bottomBox{position: fixed; padding: 20rpx 0; text-align: center; bottom: 100rpx; left: 0; z-index: 2; width: 100%; background-color: #fff;
|
||||||
button{width: 80%; margin: 0 auto; border-radius: 40rpx; }
|
button{width: 80%; margin: 0 auto; border-radius: 40rpx; }
|
||||||
@@ -497,8 +589,9 @@
|
|||||||
.superVip{background-image: linear-gradient(-60deg, #965af0 0%, #fdf0ed 50%, #fdf0ed 100%);}
|
.superVip{background-image: linear-gradient(-60deg, #965af0 0%, #fdf0ed 50%, #fdf0ed 100%);}
|
||||||
.item{width: 100%; position: relative;
|
.item{width: 100%; position: relative;
|
||||||
.textItems{width: 100%; align-items: center;
|
.textItems{width: 100%; align-items: center;
|
||||||
|
.outBtn{padding: 6rpx 10rpx; display: inline-block; border-radius: 10rpx; color:$themeColor; border: 1px solid $themeColor; font-size: 26rpx;}
|
||||||
.txt555{font-size: 28rpx; color: #333; }
|
.txt555{font-size: 28rpx; color: #333; }
|
||||||
.userType{position: absolute; right: 30rpx; top: 30rpx; color: #fff;}
|
.userType{position: absolute; font-size: 26rpx; right: 30rpx; top: 8rpx; color: #fff;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
url: "common/class/joinClass",
|
url: "common/class/joinClass",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
"classId": this.classId ,
|
"classId": classId ,
|
||||||
},
|
},
|
||||||
header: { //默认 无 说明:请求头
|
header: { //默认 无 说明:请求头
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -182,7 +182,9 @@
|
|||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.getClassInfo()
|
uni.navigateTo({
|
||||||
|
url:`/pages/miniClass/classInfo?id=${classId}`
|
||||||
|
})
|
||||||
},200)
|
},200)
|
||||||
}
|
}
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
|
|||||||
444
pages/miniClass/memberSet.vue
Normal file
444
pages/miniClass/memberSet.vue
Normal file
@@ -0,0 +1,444 @@
|
|||||||
|
<template>
|
||||||
|
<view class="page">
|
||||||
|
成员设置
|
||||||
|
<z-nav-bar :title="`${pageType}班级`"></z-nav-bar>
|
||||||
|
<!-- 公共组件-每个页面必须引入 -->
|
||||||
|
|
||||||
|
<public-module></public-module>
|
||||||
|
<uni-forms :modelValue="form" :rules="rules" ref="form">
|
||||||
|
<view class="input_box " style="">
|
||||||
|
<uni-forms-item label="" name="modelId" label-width="0">
|
||||||
|
<view class="">
|
||||||
|
<text class="input_tit"><i>*</i>班级模型:</text>
|
||||||
|
</view>
|
||||||
|
<view class="in" style="flex: 1; border: none;">
|
||||||
|
<!-- {{modelLIst}} -->
|
||||||
|
<uni-data-select style="width: 100%;" v-model="form.modelId" placeholder="请选择班级的模型"
|
||||||
|
:localdata="modelLIst"></uni-data-select>
|
||||||
|
</view>
|
||||||
|
</uni-forms-item>
|
||||||
|
</view>
|
||||||
|
<view class="input_box">
|
||||||
|
<uni-forms-item label="" name="title" label-width="0">
|
||||||
|
<text class="input_tit"><i>*</i>班级名称:</text>
|
||||||
|
<view class="in">
|
||||||
|
<input placeholder-style="font-size:26rpx" type="text" v-model="form.title"
|
||||||
|
placeholder="请输入班级名称" />
|
||||||
|
</view>
|
||||||
|
</uni-forms-item>
|
||||||
|
</view>
|
||||||
|
<view class="input_box">
|
||||||
|
<text class="input_tit">班级封面:</text>
|
||||||
|
<view class="in" style="border: none;" @click="checkPermision">
|
||||||
|
<u-upload :fileList="fileList1" @afterRead="addPic" @delete="deletePic" :maxCount="1" width="100"
|
||||||
|
height="100" :previewFullImage="true">
|
||||||
|
</u-upload>
|
||||||
|
<!-- <text style="font-size: 24rpx; color: #999;">可上传4张问题截图</text> -->
|
||||||
|
</view>
|
||||||
|
<!-- <input type="password" maxlength="8" v-model="confirmPassword" placeholder="请确认密码" /> -->
|
||||||
|
</view>
|
||||||
|
<view class="input_box">
|
||||||
|
<uni-forms-item label="" name="number" label-width="0">
|
||||||
|
<text class="input_tit"><i>*</i>目标人数:</text>
|
||||||
|
<view class="in">
|
||||||
|
<input type="number" @input="relationInput" placeholder-style="font-size:26rpx"
|
||||||
|
v-model="form.number" placeholder="请输入学员目标人数" />
|
||||||
|
</view>
|
||||||
|
<!-- <text v-show="relationError" style="font-size: 24rpx; color: red; margin-top: 10rpx;">请填写订单编号</text> -->
|
||||||
|
<!-- <text v-show="relationErrorPattern"
|
||||||
|
style="font-size: 24rpx; color: red; margin-top: 10rpx;">订单编号格式错误</text> -->
|
||||||
|
</uni-forms-item>
|
||||||
|
</view>
|
||||||
|
<view class="input_box">
|
||||||
|
<uni-forms-item label="" name="content" label-width="0">
|
||||||
|
<text class="input_tit">
|
||||||
|
<!-- <i>*</i> -->
|
||||||
|
班级简介:</text>
|
||||||
|
<view class="in">
|
||||||
|
<view class="uni-textarea">
|
||||||
|
<textarea placeholder-style="font-size:26rpx" v-model="form.content" maxlength="600"
|
||||||
|
placeholder="请输入您的班级简介600字以内" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-forms-item>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="input_box">
|
||||||
|
<uni-forms-item label="" name="contactInformation" label-width="0">
|
||||||
|
<text class="input_tit"><i>*</i>联系电话:</text>
|
||||||
|
<view class="in">
|
||||||
|
<input type="number" placeholder-style="font-size:26rpx" @input="telInput"
|
||||||
|
v-model="form.contactInformation" placeholder="请输入与您联系的手机号" />
|
||||||
|
</view>
|
||||||
|
<text v-show="telError" style="font-size: 24rpx; color: red; margin-top: 10rpx;">手机号格式错误</text>
|
||||||
|
</uni-forms-item>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
</uni-forms>
|
||||||
|
<view class="btn_box"><button @click="onSubmit">提 交</button></view>
|
||||||
|
<z-navigation></z-navigation>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import $http from '@/config/requestConfig.js';
|
||||||
|
import permission from "@/js_sdk/wa-permission/permission.js"
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapMutations
|
||||||
|
} from 'vuex';
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fileList1: [],
|
||||||
|
playData: {},
|
||||||
|
modeType:undefined, // 模型type
|
||||||
|
//手机号账号
|
||||||
|
form: {
|
||||||
|
id:undefined, // 班级id
|
||||||
|
modelId:undefined,
|
||||||
|
title: '', // 账号
|
||||||
|
content: '', // 描述
|
||||||
|
icon: '', //封面
|
||||||
|
number: '', // 联系电话
|
||||||
|
},
|
||||||
|
telError: false,
|
||||||
|
// relationError: false,
|
||||||
|
// relationErrorPattern: false,
|
||||||
|
rules: {
|
||||||
|
title: {
|
||||||
|
rules: [{
|
||||||
|
required: true,
|
||||||
|
errorMessage: '请输入班级名称',
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
number: {
|
||||||
|
rules: [{
|
||||||
|
required: true,
|
||||||
|
errorMessage: '请输入学员目标人数',
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pageType: '',
|
||||||
|
modelLIst: [
|
||||||
|
// { value: 0, text: "请选择" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
//第一次加载
|
||||||
|
onLoad(e) {
|
||||||
|
console.log('收到的值', e);
|
||||||
|
// this.pageType = e.type
|
||||||
|
this.form.type = e.type
|
||||||
|
this.modeType = e.type
|
||||||
|
this.getUserModel()
|
||||||
|
|
||||||
|
if(e.id){
|
||||||
|
|
||||||
|
this.pageType = '编辑'
|
||||||
|
this.form.id = e.id
|
||||||
|
this.getClassInfo()
|
||||||
|
}else{
|
||||||
|
this.pageType = '添加'
|
||||||
|
this.form.id = undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//页面显示
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['userInfo']),
|
||||||
|
// getPageTitle(){
|
||||||
|
// if(this.form.id){
|
||||||
|
// return "修改班级"
|
||||||
|
// }else{
|
||||||
|
// return "添加班级"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
//方法
|
||||||
|
methods: {
|
||||||
|
// 获取班级详情
|
||||||
|
getClassInfo(){
|
||||||
|
// console.log('获取课程详情');
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在加载'
|
||||||
|
})
|
||||||
|
$http.request({
|
||||||
|
url: "common/class/getClassInfo",
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data: {
|
||||||
|
"classId": this.form.id // 班类型 0小班 1联合班 2精英班
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
this.refresh = false
|
||||||
|
if (res.code == 0) {
|
||||||
|
this.form = res.result.class
|
||||||
|
this.form.modelId = res.result.classModel.id
|
||||||
|
}
|
||||||
|
console.log('this.form',this.form);
|
||||||
|
uni.hideLoading()
|
||||||
|
}).catch(e => {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.log(e, '数据报错')
|
||||||
|
// this.status = 3
|
||||||
|
uni.showToast({
|
||||||
|
title: `获取数据失败`,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getUserModel() {
|
||||||
|
console.log('获取用户的可添加模型列表');
|
||||||
|
$http.request({
|
||||||
|
url: "common/class/getClassModelByUserid",
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data: {
|
||||||
|
"userId": this.userInfo.id,
|
||||||
|
'type': this.modeType
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if(res && res.code == 0){
|
||||||
|
res.classModelList.forEach(item => {
|
||||||
|
item.value = item.id
|
||||||
|
item.text = item.title
|
||||||
|
})
|
||||||
|
console.log('处理后的', res.classModelList);
|
||||||
|
this.modelLIst = res.classModelList
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
// console.log('表单错误信息:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '数据获取失败',
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
relationInput(e) {
|
||||||
|
// this.relationError = false
|
||||||
|
// this.relationErrorPattern = false
|
||||||
|
},
|
||||||
|
telInput(e) {
|
||||||
|
// console.log('键盘输入',e);
|
||||||
|
this.telError = false
|
||||||
|
},
|
||||||
|
async checkPermision() {
|
||||||
|
var result = await permission.premissionCheck("CAMERA_EXTERNAL_STORAGE")
|
||||||
|
if (result != 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addPic(e) {
|
||||||
|
console.log("添加图片");
|
||||||
|
let that = this;
|
||||||
|
// for (var i = 0; i < e.file.length; i++) {
|
||||||
|
// console.log(i,e.file[i].url)
|
||||||
|
// uni.uploadFile({
|
||||||
|
// url: this.$baseUrl + "oss/fileoss", //仅为示例,非真实的接口地址
|
||||||
|
// filePath: tempFilePaths[0],
|
||||||
|
// name: 'file',
|
||||||
|
// formData: {
|
||||||
|
// 'user': 'test'
|
||||||
|
// },
|
||||||
|
// success: (uploadFileRes) => {
|
||||||
|
// console.log(uploadFileRes.data);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// return
|
||||||
|
uni.uploadFile({
|
||||||
|
url: this.$baseUrl + "oss/fileoss",
|
||||||
|
filePath: e.file.url,
|
||||||
|
//files:e.file,
|
||||||
|
name: "file",
|
||||||
|
formData: {},
|
||||||
|
success: (res) => {
|
||||||
|
// console.log("that.uploadPicLIst", res);
|
||||||
|
that.fileList1.push({
|
||||||
|
url: JSON.parse(res.data).url,
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log(that.fileList1, "that.uploadPicLIst");
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
console.log("上传失败", error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
deletePic(event) {
|
||||||
|
this.fileList1.splice(event.index, 1)
|
||||||
|
},
|
||||||
|
onSubmit() {
|
||||||
|
this.$refs.form.validate().then(res => {
|
||||||
|
if (this.fileList1.length > 0) {
|
||||||
|
let _list = this.fileList1
|
||||||
|
_list = _list.map(item => item.url)
|
||||||
|
// console.log('this.fileList1',_list);
|
||||||
|
this.form.icon = _list.join(',')
|
||||||
|
}
|
||||||
|
var _url = ''
|
||||||
|
this.form.id ? _url = 'common/class/editClass' : _url = "common/class/addClass"
|
||||||
|
$http.request({
|
||||||
|
url: _url,
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data: {
|
||||||
|
// ...this.form
|
||||||
|
'id':this.form.id,
|
||||||
|
"modelId": this.form.id ? undefined : this.form.modelId,
|
||||||
|
"title": this.form.title,
|
||||||
|
"icon": this.form.icon,
|
||||||
|
"state": this.form.id ? this.form.state : undefined,
|
||||||
|
"content": this.form.content,
|
||||||
|
"number": Number(this.form.number)
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "操作成功",
|
||||||
|
icon:'success'});
|
||||||
|
setTimeout(()=> {
|
||||||
|
this.fileList1 = []
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
},300)
|
||||||
|
}).catch(e => {
|
||||||
|
// console.log('表单错误信息:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作失败',
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('表单错误信息:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '页面有未填写的内容哦',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//页面隐藏
|
||||||
|
onHide() {},
|
||||||
|
//页面卸载
|
||||||
|
onUnload() {},
|
||||||
|
//页面下来刷新
|
||||||
|
onPullDownRefresh() {},
|
||||||
|
//页面上拉触底
|
||||||
|
onReachBottom() {},
|
||||||
|
//用户点击分享
|
||||||
|
onShareAppMessage(e) {
|
||||||
|
return this.wxShare();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import '@/style/mixin.scss';
|
||||||
|
|
||||||
|
::v-deep .uni-forms-item {
|
||||||
|
margin-bottom: 26rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input_tit {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
padding: 0 65rpx;
|
||||||
|
min-height: 100vh;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
padding: 30rpx 0 40rpx 0;
|
||||||
|
font-size: 40rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input_box {
|
||||||
|
display: block;
|
||||||
|
// justify-content: space-between;
|
||||||
|
// overflow: hidden;
|
||||||
|
// height: 100rpx;
|
||||||
|
padding-top: 10rpx;
|
||||||
|
|
||||||
|
// border-bottom: 1rpx solid #eeeeee;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: red;
|
||||||
|
padding-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.in {
|
||||||
|
border: 1rpx solid #eeeeee;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 8rpx;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 30rpx;
|
||||||
|
width: 180rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
|
||||||
|
flex: 1;
|
||||||
|
height: 50rpx;
|
||||||
|
// line-height: 70rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
height: 78rpx;
|
||||||
|
line-height: 78rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: $themeColor;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_box {
|
||||||
|
margin-top: 70rpx;
|
||||||
|
padding-bottom: 20rpx;
|
||||||
|
|
||||||
|
button {
|
||||||
|
font-size: 32rpx;
|
||||||
|
@include theme('btn_bg') color: #fff;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.protocol {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
|
||||||
|
text {
|
||||||
|
color: $themeColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
<view class="" style="width: 60%; text-align: center;">
|
<view class="" style="width: 60%; text-align: center;">
|
||||||
<button type="primary" @click="pupShow = true">新开一个班级</button>
|
<button type="primary" @click="pupShow = true">新开一个班级</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@@ -202,9 +201,14 @@
|
|||||||
goCreateClass(){
|
goCreateClass(){
|
||||||
console.log('this.addType',this.addType);
|
console.log('this.addType',this.addType);
|
||||||
if(this.addType != undefined){
|
if(this.addType != undefined){
|
||||||
|
this.pupShow = false
|
||||||
|
this.addType = undefined
|
||||||
|
setTimeout(()=> {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:`/pages/miniClass/addClass?type=${this.addType}&name=add`
|
url:`/pages/miniClass/addClass?type=${this.addType}`
|
||||||
})
|
})
|
||||||
|
},300)
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'请选择班级的类型',
|
title:'请选择班级的类型',
|
||||||
@@ -346,7 +350,7 @@
|
|||||||
}
|
}
|
||||||
.curseSet{margin-right: 20rpx; font-size: 28rpx; display: flex; align-items: center;}
|
.curseSet{margin-right: 20rpx; font-size: 28rpx; display: flex; align-items: center;}
|
||||||
.fixed {
|
.fixed {
|
||||||
position: fixed;
|
position: fixed; top: 120rpx;
|
||||||
z-index: 1; width: 100%; background-color: #fff;
|
z-index: 1; width: 100%; background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user