Commit 59f29e86 authored by Mac's avatar Mac

1

parent 5ac19883
...@@ -307,9 +307,14 @@ ...@@ -307,9 +307,14 @@
this.lists[index].error = false; this.lists[index].error = false;
this.uploading = true; this.uploading = true;
// 创建上传对象 // 创建上传对象
uni.compressImage({
src: this.lists[index].url,
quality: 80,
success: res => {
console.log(res.tempFilePath)
const task = uni.uploadFile({ const task = uni.uploadFile({
url: this.action, url: this.action,
filePath: this.lists[index].url, filePath: res.tempFilePath,
name: this.name, name: this.name,
formData: this.formData, formData: this.formData,
header: this.header, header: this.header,
...@@ -340,6 +345,9 @@ ...@@ -340,6 +345,9 @@
this.$emit('on-progress', res, index, this.lists); this.$emit('on-progress', res, index, this.lists);
} }
}); });
}
})
}, },
// 上传失败 // 上传失败
uploadError(index, err) { uploadError(index, err) {
......
...@@ -418,6 +418,7 @@ ...@@ -418,6 +418,7 @@
}, },
uploadSuccessHandler(data, index, lists) { uploadSuccessHandler(data, index, lists) {
let r = JSON.parse(data); let r = JSON.parse(data);
console.log(r)
this.addMsg.FileList.push(r.data); this.addMsg.FileList.push(r.data);
}, },
onRemove1(index) { onRemove1(index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment