暂存
This commit is contained in:
@@ -5,9 +5,10 @@
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
|
||||
<public-module></public-module>
|
||||
<uni-forms :modelValue="form" :rules="rules" ref="form">
|
||||
<uni-forms :modelValue="form" :rules="rules" ref="form" v-if="roleCode.length > 0">
|
||||
<view class="input_box " style="">
|
||||
<uni-forms-item label="" name="monitor" label-width="0">
|
||||
<uni-forms-item label="" name="monitor" label-width="0"
|
||||
v-show="roleCode.includes('66')">
|
||||
<view class="">
|
||||
<text class="input_tit"><i>*</i>班长:</text>
|
||||
</view>
|
||||
@@ -26,9 +27,11 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="" name="dmonitor" label-width="0">
|
||||
<uni-forms-item label="" name="dmonitor" label-width="0" v-show="roleCode.includes('1') || roleCode.includes('66')">
|
||||
<view class="">
|
||||
<text class="input_tit"><i>*</i>副班长:</text>
|
||||
<text class="input_tit">
|
||||
<!-- <i>*</i> -->
|
||||
副班长:</text>
|
||||
</view>
|
||||
<view class="addBtnBox">
|
||||
<view class="item" v-if="memeberRefsh">
|
||||
@@ -45,9 +48,11 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="" name="learner" label-width="0">
|
||||
<uni-forms-item label="" name="learner" label-width="0" >
|
||||
<view class="">
|
||||
<text class="input_tit"><i>*</i>学习委员:</text>
|
||||
<text class="input_tit">
|
||||
<!-- <i>*</i> -->
|
||||
学习委员:</text>
|
||||
</view>
|
||||
<view class="addBtnBox">
|
||||
<view class="item" v-if="memeberRefsh">
|
||||
@@ -64,9 +69,11 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="" name="scorer" label-width="0">
|
||||
<uni-forms-item label="" name="scorer" label-width="0" >
|
||||
<view class="">
|
||||
<text class="input_tit"><i>*</i>评分员:</text>
|
||||
<text class="input_tit">
|
||||
<!-- <i>*</i> -->
|
||||
评分员:</text>
|
||||
</view>
|
||||
<view class="addBtnBox">
|
||||
<!-- {{setDefaultAddItem}} -->
|
||||
@@ -84,9 +91,11 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="" name="counter" label-width="0">
|
||||
<uni-forms-item label="" name="counter" label-width="0" >
|
||||
<view class="">
|
||||
<text class="input_tit"><i>*</i>记分员:</text>
|
||||
<text class="input_tit">
|
||||
<!-- <i>*</i> -->
|
||||
记分员:</text>
|
||||
</view>
|
||||
<view class="addBtnBox">
|
||||
<view class="item" v-if="memeberRefsh">
|
||||
@@ -171,35 +180,29 @@
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
dmonitor: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请设置副班长人员',
|
||||
}
|
||||
}
|
||||
// ,
|
||||
// dmonitor: {
|
||||
// rules: [{
|
||||
// required: true,
|
||||
// errorMessage: '请设置副班长人员',
|
||||
// }
|
||||
|
||||
]
|
||||
},
|
||||
learner: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请设置学习委员人员',
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
// ]
|
||||
// }
|
||||
},
|
||||
pageType: '',
|
||||
modelLIst: [
|
||||
// { value: 0, text: "请选择" },
|
||||
],
|
||||
roleCode:''
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
console.log('收到的值', e);
|
||||
// this.getUserModel()
|
||||
|
||||
this.roleCode = e.roleCode
|
||||
if (e.id) {
|
||||
this.form.classId = e.id
|
||||
this.getClassInfo()
|
||||
@@ -434,34 +437,18 @@
|
||||
},
|
||||
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
|
||||
let that = this;
|
||||
uni.uploadFile({
|
||||
url: this.$baseUrl + "oss/fileoss",
|
||||
filePath: e.file.url,
|
||||
//files:e.file,
|
||||
name: "file",
|
||||
formData: {},
|
||||
success: (res) => {
|
||||
// console.log("that.uploadPicLIst", res);
|
||||
success: (res) => {
|
||||
that.fileList1.push({
|
||||
url: JSON.parse(res.data).url,
|
||||
});
|
||||
|
||||
// console.log(that.fileList1, "that.uploadPicLIst");
|
||||
|
||||
},
|
||||
fail: (error) => {
|
||||
console.log("上传失败", error);
|
||||
@@ -473,58 +460,72 @@
|
||||
this.fileList1.splice(event.index, 1)
|
||||
},
|
||||
onSubmit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
console.log('form',this.form);
|
||||
if(!this.form.monitor){
|
||||
uni.showToast({
|
||||
title: '请添加班长人选',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
// if(!this.form.dmonitor){
|
||||
// uni.showToast({
|
||||
// title: '请添加副班长人选',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
// this.$refs.form.validate().then(res => {
|
||||
var newScorer = [...this.form.scorer]
|
||||
var newCounter = [...this.form.counter]
|
||||
console.log('this.form.scorer',this.form.scorer);
|
||||
var newCounter = [...this.form.counter]
|
||||
if(!this.form.scorer[0] && !this.form.scorer[1]){
|
||||
uni.showToast({
|
||||
title:'请至少设置一名评分员',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
newScorer = [0,0]
|
||||
}else{
|
||||
if(this.form.scorer[0].id == this.form.scorer[1].id){
|
||||
console.log('newScorer',newScorer);
|
||||
this.form.scorer.forEach((item, index) => {
|
||||
console.log('item',item);
|
||||
if(!item || item == null){
|
||||
console.log('进来了');
|
||||
newScorer[index] = {
|
||||
id:0
|
||||
}
|
||||
}
|
||||
})
|
||||
// console.log('删除后的newScorer',newScorer);
|
||||
if(newScorer[0].id == newScorer[1].id){
|
||||
uni.showToast({
|
||||
title:'两名评分员不能是同一人',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.form.scorer.forEach((item, index) => {
|
||||
if(!item){
|
||||
newScorer.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
newScorer = newScorer.map(item => {
|
||||
return item.id
|
||||
})
|
||||
console.log('删除后的newScorer',newScorer);
|
||||
// console.log('删除后的newScorer',newScorer);
|
||||
}
|
||||
|
||||
if(!this.form.counter[0] && !this.form.counter[1]){
|
||||
uni.showToast({
|
||||
title:'请至少设置一名记分员',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
newCounter = [0,0]
|
||||
}else{
|
||||
if(this.form.counter[0].id == this.form.counter[1].id){
|
||||
this.form.counter.forEach((item, index) => {
|
||||
if(!item || item == null){
|
||||
newCounter[index] = {id:0}
|
||||
// newCounter.splice(index, 1)
|
||||
}
|
||||
})
|
||||
if(newCounter[0].id == newCounter[1].id){
|
||||
uni.showToast({
|
||||
title:'两名记分员不能是同一人',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.form.counter.forEach((item, index) => {
|
||||
if(!item){
|
||||
newCounter.splice(index, 1)
|
||||
}
|
||||
})
|
||||
|
||||
newCounter = newCounter.map(item => {
|
||||
return item.id
|
||||
})
|
||||
console.log('删除后的newCounter',newCounter);
|
||||
// console.log('删除后的newCounter',newCounter);
|
||||
}
|
||||
|
||||
var _url = 'common/class/setUserRole'
|
||||
@@ -535,8 +536,8 @@
|
||||
data: {
|
||||
"classId": this.form.classId,
|
||||
"monitor": this.form.monitor.id+'', //班长
|
||||
"dmonitor": this.form.dmonitor.id+'', //2班长
|
||||
"learner": this.form.learner.id+'', //学习委员
|
||||
"dmonitor": this.form.dmonitor ? this.form.dmonitor.id+'' : '0', //2班长
|
||||
"learner": this.form.learner ? this.form.learner.id+'' : '0', //学习委员
|
||||
"scorer": newScorer.join(','), //评分员
|
||||
"counter": newCounter.join(',') //记分员
|
||||
},
|
||||
@@ -548,14 +549,12 @@
|
||||
uni.showToast({
|
||||
title: "操作成功",
|
||||
icon: 'success'
|
||||
});
|
||||
setTimeout(() => {
|
||||
// this.fileList1 = []
|
||||
// this.$nextTick(() => {
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}, 300)
|
||||
}, 1000)
|
||||
}).catch(e => {
|
||||
// console.log('表单错误信息:', err);
|
||||
uni.showToast({
|
||||
@@ -563,13 +562,13 @@
|
||||
icon: 'error'
|
||||
})
|
||||
});
|
||||
}).catch(err => {
|
||||
console.log('表单错误信息:', err);
|
||||
uni.showToast({
|
||||
title: '页面有未填写的内容哦',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
// }).catch(err => {
|
||||
// console.log('表单错误信息:', err);
|
||||
// uni.showToast({
|
||||
// title: '页面有未填写的内容哦',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// })
|
||||
}
|
||||
},
|
||||
//页面隐藏
|
||||
|
||||
Reference in New Issue
Block a user