|
|
|
@ -352,17 +352,17 @@ export default { |
|
|
|
}) |
|
|
|
}, 1000, { 'leading': true, 'trailing': false }), |
|
|
|
handleAvatarSuccess (res, file) { |
|
|
|
this.dataForm.newsImageUrl = URL.createObjectURL(file.raw) |
|
|
|
this.dataForm.newsImageUrl = res.data.url |
|
|
|
}, |
|
|
|
beforeAvatarUpload (file) { |
|
|
|
const isJPG = file.type === 'image/jpeg' || file.type === 'png' |
|
|
|
const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png') |
|
|
|
const isLt2M = file.size / 1024 / 1024 < 0.5 |
|
|
|
|
|
|
|
if (!isJPG) { |
|
|
|
this.$message.error('上传头像图片只能是 JPG/PNG 格式!') |
|
|
|
this.$message.error('上传图片只能是 JPG/PNG 格式!') |
|
|
|
} |
|
|
|
if (!isLt2M) { |
|
|
|
this.$message.error('上传头像图片大小不能超过 500KB!') |
|
|
|
this.$message.error('上传图片大小不能超过 500KB!') |
|
|
|
} |
|
|
|
return isJPG && isLt2M |
|
|
|
} |
|
|
|
|