This commit is contained in:
@fawn-nine
2024-08-12 16:07:24 +08:00
parent 7c7c96f630
commit 28067d851d
13 changed files with 478 additions and 324 deletions

View File

@@ -52,6 +52,14 @@
</view>
<!-- <input type="password" maxlength="8" v-model="confirmPassword" placeholder="请确认密码" /> -->
</view>
<view class="input_box">
<text class="input_tit">群二维码:</text>
<view class="in" style="border: none;" @click="checkPermision">
<u-upload :fileList="fileList2" @afterRead="addPic2" @delete="deletePic2" :maxCount="1" width="100"
height="100" :previewFullImage="true">
</u-upload>
</view>
</view>
<view class="input_box">
<uni-forms-item label="" name="number" label-width="0">
<text class="input_tit"><i>*</i>目标人数:</text>
@@ -90,6 +98,7 @@
data() {
return {
fileList1: [],
fileList2:[],
playData: {},
modeType:undefined, // 模型type
//手机号账号
@@ -100,6 +109,7 @@
content: '', // 描述
icon: '', //封面
number: '', // 联系电话
qrcode:'' // 群二维码
},
telError: false,
range:[
@@ -150,6 +160,10 @@
//页面显示
onShow() {
},
beforeDestroy() {
this.fileList1 = []
this.fileList2 = []
},
onPullDownRefresh(){
uni.stopPullDownRefresh()
@@ -191,6 +205,9 @@
if(this.form.icon != ''){
this.fileList1.push({url:this.form.icon})
}
if(this.form.qrcode != ''){
this.fileList2.push({url:this.form.qrcode})
}
this.form.modelId = res.result.classModel.id
}
console.log('this.form',res.result);
@@ -251,21 +268,7 @@
},
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,
@@ -289,6 +292,32 @@
deletePic(event) {
this.fileList1.splice(event.index, 1)
},
addPic2(e) {
console.log("添加图片");
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);
that.fileList2.push({
url: JSON.parse(res.data).url,
});
// console.log(that.fileList1, "that.uploadPicLIst");
},
fail: (error) => {
console.log("上传失败", error);
},
});
// }
},
deletePic2(event) {
this.fileList2.splice(event.index, 1)
},
onSubmit() {
this.$refs.form.validate().then(res => {
if (this.fileList1.length > 0) {
@@ -297,6 +326,12 @@
// console.log('this.fileList1',_list);
this.form.icon = _list.join(',')
}
if (this.fileList2.length > 0) {
let _list = this.fileList2
_list = _list.map(item => item.url)
// console.log('this.fileList1',_list);
this.form.qrcode = _list.join(',')
}
if(this.form.number <= 0){
uni.showToast({
title: '目标人数必须大于0个人',
@@ -317,7 +352,8 @@
"icon": this.form.icon,
"state": this.form.id ? this.form.state : undefined,
"content": this.form.content,
"number": Number(this.form.number)
"number": Number(this.form.number),
"qrcode": this.form.qrcode
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -329,6 +365,7 @@
icon:'success'});
setTimeout(()=> {
this.fileList1 = []
this.fileList2 = []
uni.navigateTo({
url:'/pages/miniClass/miniClassMan'
})
@@ -336,7 +373,7 @@
// uni.navigateBack({
// delta: 1
// });
},300)
},1000)
}).catch(e => {
// console.log('表单错误信息:', err);
uni.showToast({