mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-19 00:45:54 +08:00
feat: 更新用户信息获取逻辑
- 在personMsg.vue中添加onShow生命周期钩子,重新获取用户信息并更新表单数据 - 在bindMobile.vue中绑定手机成功后,获取最新用户信息并更新缓存 - 调整绑定手机按钮的样式以改善用户体验
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
{{form.mobile}}
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="submit" @click="navigateTo(form.username)">绑定手机号码</view>
|
||||
<view class="submit" style="text-align: left;" @click="navigateTo(form.username)">绑定手机号码</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
@@ -59,8 +59,8 @@ export default {
|
||||
region: storage.getUserInfo().region || [], //地址
|
||||
sex: storage.getUserInfo().sex, //性别
|
||||
___path: storage.getUserInfo().region,
|
||||
mobile: storage.getUserInfo().mobile,
|
||||
username: storage.getUserInfo().username,
|
||||
mobile: storage.getUserInfo().mobile,
|
||||
username: storage.getUserInfo().username,
|
||||
},
|
||||
birthday: storage.getUserInfo().birthday || "", //生日
|
||||
photo: [
|
||||
@@ -183,6 +183,24 @@ export default {
|
||||
* 加载数据
|
||||
*/
|
||||
onLoad() {},
|
||||
|
||||
/**
|
||||
* 页面显示时执行
|
||||
*/
|
||||
onShow() {
|
||||
// 从缓存中重新获取用户信息
|
||||
const userInfo = storage.getUserInfo();
|
||||
// 更新表单数据
|
||||
this.form.nickName = userInfo.nickName || "";
|
||||
this.form.birthday = userInfo.birthday || "";
|
||||
this.form.face = userInfo.face || "/static/missing-face.png";
|
||||
this.form.region = userInfo.region || [];
|
||||
this.form.sex = userInfo.sex;
|
||||
this.form.___path = userInfo.region;
|
||||
this.form.mobile = userInfo.mobile;
|
||||
this.form.username = userInfo.username;
|
||||
this.birthday = userInfo.birthday || "";
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@@ -201,6 +219,7 @@ page{
|
||||
margin: 0 auto;
|
||||
color: $main-color;
|
||||
border-radius: 100px;
|
||||
|
||||
}
|
||||
.head {
|
||||
height: 260rpx;
|
||||
|
||||
Reference in New Issue
Block a user