update
This commit is contained in:
@@ -143,22 +143,28 @@ export const uploadFile = ({count}) => {
|
||||
uni.chooseImage({
|
||||
count: count,
|
||||
success: ({tempFilePaths}) => {
|
||||
const file = tempFilePaths[0];
|
||||
uni.uploadFile({
|
||||
url: BASEURL + '/upload/upload',
|
||||
filePath: file,
|
||||
name: "file",
|
||||
header: {
|
||||
token: UserStore.token
|
||||
},
|
||||
success: ({data}) => {
|
||||
resolve(JSON.parse(data));
|
||||
},
|
||||
fail: (err) => {
|
||||
showToast(err.errMsg);
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
const all = tempFilePaths.map(v => new Promise((res, rej) => {
|
||||
uni.uploadFile({
|
||||
url: BASEURL + '/upload/upload',
|
||||
filePath: v,
|
||||
name: "file",
|
||||
header: {
|
||||
token: UserStore.token
|
||||
},
|
||||
success: ({data}) => {
|
||||
res(JSON.parse(data).data);
|
||||
},
|
||||
fail: (err) => {
|
||||
showToast(err.errMsg);
|
||||
rej(err);
|
||||
}
|
||||
});
|
||||
}));
|
||||
Promise.all(all).then((res) => {
|
||||
resolve(res);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
showToast(err.errMsg);
|
||||
|
||||
Reference in New Issue
Block a user