Commit 6a53136d by 郑艺斌

修复上传BUG

parent f37cbcdb
Showing with 21 additions and 1 deletions
......@@ -270,7 +270,8 @@ export default {
orgId: "",
projectId: "",
},
projectList: []
projectList: [],
imgTypeArr: ["image/png", "image/jpg", "image/jpeg"],//上传图片类型限制
};
},
computed: {
......@@ -317,11 +318,30 @@ export default {
},
async handleBeforeUpload (res) {
// 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) {
console.log(res, '999');
if (res.statusCode == 200) {
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) {
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