成员设置
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<z-nav-bar :title="getPageTitle"></z-nav-bar>
|
||||
<z-nav-bar :title="`${pageType}班级`"></z-nav-bar>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
|
||||
<public-module></public-module>
|
||||
@@ -89,6 +89,7 @@
|
||||
return {
|
||||
fileList1: [],
|
||||
playData: {},
|
||||
modeType:undefined, // 模型type
|
||||
//手机号账号
|
||||
form: {
|
||||
id:undefined, // 班级id
|
||||
@@ -128,13 +129,18 @@
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
console.log('收到的值', e);
|
||||
this.pageType = e.type
|
||||
// this.form.type = e.type
|
||||
// this.pageType = e.type
|
||||
this.form.type = e.type
|
||||
this.modeType = e.type
|
||||
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()
|
||||
}else{
|
||||
this.pageType = '添加'
|
||||
this.form.id = undefined
|
||||
}
|
||||
},
|
||||
@@ -144,19 +150,49 @@
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
getPageTitle(){
|
||||
if(this.form.id){
|
||||
return "修改班级"
|
||||
}else{
|
||||
return "添加班级"
|
||||
}
|
||||
}
|
||||
// getPageTitle(){
|
||||
// if(this.form.id){
|
||||
// return "修改班级"
|
||||
// }else{
|
||||
// return "添加班级"
|
||||
// }
|
||||
// }
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
// 获取班级详情
|
||||
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() {
|
||||
console.log('获取用户的可添加模型列表');
|
||||
@@ -165,7 +201,7 @@
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
"userId": this.userInfo.id,
|
||||
'type': this.pageType
|
||||
'type': this.modeType
|
||||
},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
@@ -250,44 +286,40 @@
|
||||
// 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: "common/class/addClass",
|
||||
url: _url,
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
// ...this.form
|
||||
'id':this.form.id,
|
||||
"modelId": this.form.modelId,
|
||||
"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'
|
||||
},
|
||||
})
|
||||
// this.$http.post("common/class/addClass",{
|
||||
// ...this.form
|
||||
// })
|
||||
})
|
||||
.then(res => {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "创建成功!",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
this.fileList1 = []
|
||||
// this.$nextTick(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
// })
|
||||
|
||||
}
|
||||
});
|
||||
uni.showToast({
|
||||
title: "操作成功",
|
||||
icon:'success'});
|
||||
setTimeout(()=> {
|
||||
this.fileList1 = []
|
||||
// this.$nextTick(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},300)
|
||||
}).catch(e => {
|
||||
// console.log('表单错误信息:', err);
|
||||
uni.showToast({
|
||||
title: '创建失败',
|
||||
title: '操作失败',
|
||||
icon: 'error'
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user