From 47cf8f73ab89e66d191faf5bf5bb3b35ddea32ab Mon Sep 17 00:00:00 2001 From: jxx <283591387@qq.com.com> Date: Sat, 14 Dec 2019 11:17:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=B4=E5=83=8F=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Vol.Vue/src/utilities/common.js | 9 +++++++++ Vol.Vue/src/views/Index.vue | 2 +- Vol.Vue/src/views/system/UserInfo.vue | 13 +++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Vol.Vue/src/utilities/common.js b/Vol.Vue/src/utilities/common.js index f2ea80630..a61f92805 100644 --- a/Vol.Vue/src/utilities/common.js +++ b/Vol.Vue/src/utilities/common.js @@ -45,6 +45,15 @@ let base = { } return url.indexOf(ip.replace('https://', '').replace('http://', '')) >= 0 }, + getImgSrc(src, httpUrl) { + if (this.isUrl(src)) { + return src; + } + if (httpUrl) { + return httpUrl + src; + } + return src; + }, priviewImg(src, httpUrl) { //图片预览,目前只支持单图片预览 if (src && !this.isUrl(src) && httpUrl) { if (src.substr(0, 1) == "/" && httpUrl.substr(httpUrl.length - 1, 1) == "/") { diff --git a/Vol.Vue/src/views/Index.vue b/Vol.Vue/src/views/Index.vue index e6192934b..3f6fd70b2 100644 --- a/Vol.Vue/src/views/Index.vue +++ b/Vol.Vue/src/views/Index.vue @@ -98,7 +98,7 @@ export default { created() { let userInfo = this.$store.getters.getUserInfo(); this.userName = userInfo.userName; - this.userImg = userInfo.img; + this.userImg =this.base.getImgSrc(userInfo.img,this.http.ipAddress); $vueIndex = this; this.showTime(); setInterval(function() { diff --git a/Vol.Vue/src/views/system/UserInfo.vue b/Vol.Vue/src/views/system/UserInfo.vue index 64ae19a90..5a53f9ed2 100644 --- a/Vol.Vue/src/views/system/UserInfo.vue +++ b/Vol.Vue/src/views/system/UserInfo.vue @@ -69,7 +69,13 @@ - +
@@ -134,7 +140,10 @@ export default { x.data.createDate = (x.data.createDate || "").replace("T", " "); x.data.gender = x.data.gender + ""; this.$refs.form.reset(x.data); - this.userInfo.img = x.data.headImageUrl; + this.userInfo.img = this.base.getImgSrc( + x.data.headImageUrl, + this.http.ipAddress + ); this.userInfo.createDate = x.data.createDate; this.userInfo.userName = x.data.userTrueName; this.userInfo.phoneNo = x.data.phoneNo;