mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
improve: 移动端上传
This commit is contained in:
parent
80101af87c
commit
fac9b3fa85
@ -69,22 +69,38 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
handleRemove(file) {
|
||||
console.log(file);
|
||||
let index = this.imgList.findIndex((e) => {
|
||||
e.url == file.url;
|
||||
});
|
||||
this.imgList.splice(index, 1);
|
||||
this.$nextTick((e) => {
|
||||
this.imgList.map((e) => {
|
||||
this.allSize += e.size;
|
||||
});
|
||||
});
|
||||
},
|
||||
uploadItem(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('uploadToken', this.token);
|
||||
scanUpload(formData).then((res) => {
|
||||
if (res.status == 200) {
|
||||
resolve();
|
||||
} else {
|
||||
this.$message({
|
||||
message: '上传失败',
|
||||
type: 'error',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
});
|
||||
scanUpload(formData)
|
||||
.then((res) => {
|
||||
if (res.status == 200) {
|
||||
resolve();
|
||||
} else {
|
||||
this.$message({
|
||||
message: '上传失败',
|
||||
type: 'error',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$Message.error(err.msg);
|
||||
});
|
||||
});
|
||||
},
|
||||
fileChange(file, fileList) {
|
||||
@ -122,6 +138,11 @@ export default {
|
||||
line-height: 113px;
|
||||
overflow: inherit;
|
||||
}
|
||||
/deep/ .el-upload-list--picture-card .el-upload-list__item img {
|
||||
width: 111px;
|
||||
height: 111px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.btndel {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user