From c9c1b6a7bd34e8247a5fbd887b2e56302fb0558a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E8=BE=89?= <814457906@qq.com> Date: Fri, 30 Dec 2022 14:01:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/stationAvatar/index.vue | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/views/system/stationAvatar/index.vue b/src/views/system/stationAvatar/index.vue index 19235f7..185d0d5 100644 --- a/src/views/system/stationAvatar/index.vue +++ b/src/views/system/stationAvatar/index.vue @@ -217,19 +217,23 @@ export default { // 上传图片 uploadImg() { let formData = new FormData(); - formData.append("file", this.previews.data); - formData.append("type", this.types); - updateNurseStationHeads(formData).then((response) => { - this.options.img = baseurl + response.imgUrl; - this.$emit("imgUrl", response.imgUrl); - console.log(this.items); - console.log(this.types); - if (this.types == "attributePitureUrl") { - this.items.attributePitureUrl = response.imgUrl; - this.$emit("item", JSON.stringify(this.items)); - } + if (this.previews.data) { + formData.append("file", this.previews.data); + formData.append("type", this.types); + updateNurseStationHeads(formData).then((response) => { + this.options.img = baseurl + response.imgUrl; + this.$emit("imgUrl", response.imgUrl); + console.log(this.items); + console.log(this.types); + if (this.types == "attributePitureUrl") { + this.items.attributePitureUrl = response.imgUrl; + this.$emit("item", JSON.stringify(this.items)); + } + this.openimg = false; + }); + } else { this.openimg = false; - }); + } }, // 实时预览 realTime(data) {