Commit 6a53136d by 郑艺斌

修复上传BUG

parent f37cbcdb
Showing with 24 additions and 4 deletions
...@@ -270,7 +270,8 @@ export default { ...@@ -270,7 +270,8 @@ export default {
orgId: "", orgId: "",
projectId: "", projectId: "",
}, },
projectList: [] projectList: [],
imgTypeArr: ["image/png", "image/jpg", "image/jpeg"],//上传图片类型限制
}; };
}, },
computed: { computed: {
...@@ -317,11 +318,30 @@ export default { ...@@ -317,11 +318,30 @@ export default {
}, },
async handleBeforeUpload (res) { async handleBeforeUpload (res) {
// return this.checkImageWH(res, 64, 64) // return this.checkImageWH(res, 64, 64)
let that = this
// 控制文件上传格式
var imgType = this.imgTypeArr.indexOf(res.type) !== -1
if (!imgType) {
this.$Message.warning({
content: '文件 ' + res.name + ' 格式不正确, 请选择jpg或png.',
duration: 5
});
return false
}
}, },
handleSuccess (res, file) { handleSuccess (res, file) {
this.seriesImage = res.responseResult console.log(res, '999');
file.url = res.responseResult if (res.statusCode == 200) {
this.uploadList.push(file) this.seriesImage = res.responseResult
file.url = res.responseResult
this.uploadList.push(file)
} else {
this.$Message.warning({
content: '图片格式异常,仅支持jpg、png图片上传!',
duration: 5
});
}
}, },
checkImageWH (file, width, height) { checkImageWH (file, width, height) {
let self = this; let self = this;
......
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 sign in to comment