Skip to content

Commit

Permalink
优化头像默认显示
Browse files Browse the repository at this point in the history
  • Loading branch information
jxx committed Dec 14, 2019
1 parent 1e978f5 commit 47cf8f7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Vol.Vue/src/utilities/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) == "/") {
Expand Down
2 changes: 1 addition & 1 deletion Vol.Vue/src/views/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
13 changes: 11 additions & 2 deletions Vol.Vue/src/views/system/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@
</div>
</vol-form>
</div>
<VolBox :width="500" :height="260" :footer="false" :model.sync="modifyOptions.model" title="修改密码">
<VolBox
:width="500"
:height="260"
:footer="false"
:model.sync="modifyOptions.model"
title="修改密码"
>
<div style="padding:10px;20px;">
<VolForm ref="pwd" :formRules="modifyOptions.data" :formFileds="modifyOptions.fileds"></VolForm>
<Button type="info" size="large" icon="md-checkmark-circle" long @click="savePwd">保存</Button>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 47cf8f7

Please sign in to comment.