From 8740a449423f6817e15922a0746550bf25636165 Mon Sep 17 00:00:00 2001 From: yujintao Date: Thu, 12 Sep 2019 14:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/news/news-add-or-update.vue | 8 ++++---- src/views/modules/news/news-publish.vue | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/views/modules/news/news-add-or-update.vue b/src/views/modules/news/news-add-or-update.vue index 2ca45086..365e99d1 100644 --- a/src/views/modules/news/news-add-or-update.vue +++ b/src/views/modules/news/news-add-or-update.vue @@ -328,17 +328,17 @@ export default { }, // 上传图片 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 }, diff --git a/src/views/modules/news/news-publish.vue b/src/views/modules/news/news-publish.vue index 839d4c5c..a173c988 100644 --- a/src/views/modules/news/news-publish.vue +++ b/src/views/modules/news/news-publish.vue @@ -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 }