order
This commit is contained in:
@@ -5,11 +5,13 @@
|
||||
<u-upload
|
||||
ref="uUpload"
|
||||
:custom-btn="true"
|
||||
:max-count="count"
|
||||
:auto-upload="false"
|
||||
:max-count="count"
|
||||
:action="action"
|
||||
:auto-upload="false"
|
||||
:header="header"
|
||||
:form-data="formData"
|
||||
:name="name"
|
||||
@on-uploaded="setImageList"
|
||||
>
|
||||
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
|
||||
<img src="../static/mine/27.png" />
|
||||
@@ -17,6 +19,7 @@
|
||||
</u-upload>
|
||||
</view>
|
||||
<view class="write-btn" @click="submit">发表意见</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@@ -26,40 +29,51 @@ export default {
|
||||
action: this.$u.http.config.baseUrl + '/Upload/uploadfile',
|
||||
count: 4, // 最大图片数量
|
||||
text: '',
|
||||
imageList: [],
|
||||
header: {
|
||||
"authorization": 'Bearer' + " " + uni.getStorageSync('token')
|
||||
},
|
||||
name: 'common', // 与formData name 一样
|
||||
formData: {
|
||||
name: '',
|
||||
}
|
||||
name: 'common', // 其他图片
|
||||
},
|
||||
imageList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
console.log(this.action);
|
||||
console.log(this.imageList);
|
||||
this.$refs.uUpload.upload();
|
||||
let promise = [];
|
||||
this.imageList.forEach(url => {
|
||||
// this.uploadImage(url);
|
||||
})
|
||||
// Promise.all(promise).then(() => {
|
||||
|
||||
// })
|
||||
},
|
||||
async beforeUpload(index, list) {
|
||||
console.log(index, list);
|
||||
|
||||
// let data = await this.$u.post('url');
|
||||
// return true; // 或者根据逻辑返回false
|
||||
setImageList(lists) {
|
||||
// console.log(lists);
|
||||
let imageList = [];
|
||||
lists.forEach(res => {
|
||||
if(res.response.errCode == 0) imageList.push(res.response.data.file_name);
|
||||
})
|
||||
// console.log(imageList);
|
||||
this.imageList = imageList;
|
||||
this.writeFeedback();
|
||||
},
|
||||
verifyContent() {
|
||||
if(this.$u.test.isEmpty(this.text)) {
|
||||
this.$u.toast('内容不可为空');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
writeFeedback() {
|
||||
if(!this.verifyContent()) return false;
|
||||
this.$u.api.writeFeedback({
|
||||
fb_content: this.text,
|
||||
fb_images: '',
|
||||
fb_images: this.imageList,
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {}
|
||||
if(res.errCode == 0) {
|
||||
this.$u.route({
|
||||
type: "redirect",
|
||||
url: '/pageE/more/Complaints',
|
||||
})
|
||||
} else {
|
||||
this.$u.toast(res.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user