Commit 702fadd0 authored by fwz's avatar fwz

设置默认头像、用户信息清空

parent 1abe6ab9
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
<div class="ps__title"></div> <div class="ps__title"></div>
<div class="ps__info"> <div class="ps__info">
<div class="info__cover"> <div class="info__cover">
<image :src="avatar" /> <image v-if="avatar" :src="avatar" />
<image v-else src="@/static/my/my2.png" />
</div> </div>
<div> <div>
<div class="info__name">{{userInfo.nickName}}</div> <div class="info__name">{{userInfo.nickName}}</div>
...@@ -111,7 +112,7 @@ export default { ...@@ -111,7 +112,7 @@ export default {
} }
], ],
//用户信息 //用户信息
userInfo: {}, userInfo: {nickName:'默认昵称'},
//头像 //头像
avatar: '', avatar: '',
} }
...@@ -163,7 +164,10 @@ export default { ...@@ -163,7 +164,10 @@ export default {
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.userInfo = res.data.data this.userInfo = res.data.data
this.avatar = this.http.baseUrl + this.userInfo.avatar if(this.userInfo.avatar){
this.avatar = this.http.baseUrl + this.userInfo.avatar
}
} }
}) })
}, },
......
...@@ -66,7 +66,7 @@ export default { ...@@ -66,7 +66,7 @@ export default {
disabled: true, //是否禁用 disabled: true, //是否禁用
rules: { rules: {
name: "mobile", //字段名 即提交给后端的字段 name: "mobile", //字段名 即提交给后端的字段
value: "12563996933", value: "",
verify: false, //是否开启校验 verify: false, //是否开启校验
errMess: "手机号未填写", //校验不通过的错误提示 errMess: "手机号未填写", //校验不通过的错误提示
}, },
...@@ -326,7 +326,9 @@ export default { ...@@ -326,7 +326,9 @@ export default {
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.userInfo = res.data.data this.userInfo = res.data.data
this.image = this.http.baseUrl + this.userInfo.avatar if(this.userInfo.avatar){
this.image = this.http.baseUrl + this.userInfo.avatar
}
this.formData.forEach(element => { this.formData.forEach(element => {
if (element.label === '手机号') { if (element.label === '手机号') {
element.rules.value = this.userInfo.mobile element.rules.value = this.userInfo.mobile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment