upload file
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
:custom-btn="true"
|
||||
:max-count="count"
|
||||
:auto-upload="false"
|
||||
:action="action"
|
||||
:header="header"
|
||||
:form-data="formData"
|
||||
>
|
||||
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
|
||||
<img src="../static/mine/27.png" />
|
||||
@@ -20,32 +23,36 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
action: $u.http.baseUrl + 'Upload/uploadfile',
|
||||
action: this.$u.http.config.baseUrl + '/Upload/uploadfile',
|
||||
count: 4, // 最大图片数量
|
||||
text: '',
|
||||
imageList: []
|
||||
imageList: [],
|
||||
header: {
|
||||
"authorization": 'Bearer' + " " + uni.getStorageSync('token')
|
||||
},
|
||||
formData: {
|
||||
name: '',
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
console.log(this.action);
|
||||
console.log(this.imageList);
|
||||
|
||||
// this.$refs.uUpload.upload();
|
||||
this.$refs.uUpload.upload();
|
||||
let promise = [];
|
||||
this.imageList.forEach(url => {
|
||||
// this.uploadImage(url);
|
||||
})
|
||||
Promise.all(promise).then(() => {
|
||||
// Promise.all(promise).then(() => {
|
||||
|
||||
})
|
||||
// })
|
||||
},
|
||||
async uploadImage(file) {
|
||||
this.$u.api.uploadfile({
|
||||
file: file,
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {}
|
||||
})
|
||||
async beforeUpload(index, list) {
|
||||
console.log(index, list);
|
||||
|
||||
// let data = await this.$u.post('url');
|
||||
// return true; // 或者根据逻辑返回false
|
||||
},
|
||||
writeFeedback() {
|
||||
this.$u.api.writeFeedback({
|
||||
|
||||
Reference in New Issue
Block a user