Commit 1d0fff29fd8f5e7704455218e85569f25a50484f

Authored by fengtao
1 parent f27623aa

fix:修改个人资料修改,再次点击进去数据没变问题

@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <!-- 公共组件-每个页面必须引入 --> 3 <!-- 公共组件-每个页面必须引入 -->
4 <public-module></public-module> 4 <public-module></public-module>
5 <view @click="upAvatar" class="u-flex set-main"> 5 <view @click="upAvatar" class="u-flex set-main">
6 - <view class="main-image"><image class="image" :src="avatar || '/static/logo.png'"></image></view> 6 + <view class="main-image"><image class="image" :src="avatar || '../../static/logo.png'"></image></view>
7 <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view> 7 <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view>
8 </view> 8 </view>
9 <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> 9 <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view>
@@ -46,8 +46,12 @@ @@ -46,8 +46,12 @@
46 </u--form> 46 </u--form>
47 </view> 47 </view>
48 <view class="basic-bottom u-flex"> 48 <view class="basic-bottom u-flex">
49 - <view class="item" v-if="info.data.isToken"><button class="submit" size="default" @click="clearAccountFunc" :style="{ background: InfoColor }">解绑</button></view>  
50 - <view class="item" style="margin-right: 60rpx;"><button class="submit" size="default" @click="onSubmitFunc" :style="{ background: PrimaryColor }">确认</button></view> 49 + <view class="item" v-if="info.data.isThirdLogin">
  50 + <button class="submit" size="default" @click="clearAccountFunc" :style="{ background: InfoColor }"><text class="un-bind-text">解绑</text></button>
  51 + </view>
  52 + <view class="item" style="margin-right: 60rpx;" :style="[{ position: info.data.isThirdLogin ? '' : 'relative' }, { right: info.data.isThirdLogin ? '' : '-158rpx' }]">
  53 + <button class="submit" size="default" @click="onSubmitFunc" :style="{ background: PrimaryColor }"><text class="un-bind-text">确认</text></button>
  54 + </view>
51 </view> 55 </view>
52 <!-- #ifdef MP --> 56 <!-- #ifdef MP -->
53 <view class="u-m-t-40"><text style="visibility: hidden;">#</text></view> 57 <view class="u-m-t-40"><text style="visibility: hidden;">#</text></view>
@@ -67,12 +71,14 @@ @@ -67,12 +71,14 @@
67 </template> 71 </template>
68 72
69 <script> 73 <script>
  74 +import { mapMutations } from 'vuex';
  75 +
70 export default { 76 export default {
71 data() { 77 data() {
72 return { 78 return {
73 showBind: false, 79 showBind: false,
74 PrimaryColor: '#377DFF', //主题色 80 PrimaryColor: '#377DFF', //主题色
75 - InfoColor: '#E3E4E5', //主题色 81 + InfoColor: '#00C9A7', //主题色
76 myInfoModel: { 82 myInfoModel: {
77 userInfo: { 83 userInfo: {
78 realName: '', 84 realName: '',
@@ -87,7 +93,8 @@ export default { @@ -87,7 +93,8 @@ export default {
87 avatar: '', 93 avatar: '',
88 id: '', 94 id: '',
89 info: {}, 95 info: {},
90 - openIds: '' 96 + openIds: '',
  97 + isUpdatePersonOrLoginInfo: false
91 }; 98 };
92 }, 99 },
93 onLoad(e) { 100 onLoad(e) {
@@ -99,7 +106,7 @@ export default { @@ -99,7 +106,7 @@ export default {
99 this.myInfoModel.userInfo.username = params.data.username; 106 this.myInfoModel.userInfo.username = params.data.username;
100 this.myInfoModel.userInfo.email = params.data.email; 107 this.myInfoModel.userInfo.email = params.data.email;
101 this.myInfoModel.userInfo.accountExpireTime = params.data.accountExpireTime; 108 this.myInfoModel.userInfo.accountExpireTime = params.data.accountExpireTime;
102 - this.avatar = params.data.avatar == undefined ? '../../static/avatar-test.png' : params.data.avatar; 109 + this.avatar = params.data.avatar == undefined ? '../../static/logo.png' : params.data.avatar;
103 this.id = params.data.userId; 110 this.id = params.data.userId;
104 } 111 }
105 }, 112 },
@@ -110,6 +117,7 @@ export default { @@ -110,6 +117,7 @@ export default {
110 } 117 }
111 }, 118 },
112 methods: { 119 methods: {
  120 + ...mapMutations(['setUserInfo']),
113 confrimBind(e) { 121 confrimBind(e) {
114 if (e) { 122 if (e) {
115 //解绑 123 //解绑
@@ -192,6 +200,7 @@ export default { @@ -192,6 +200,7 @@ export default {
192 .put('/yt/user/center', httpData) 200 .put('/yt/user/center', httpData)
193 .then(res => { 201 .then(res => {
194 if (res) { 202 if (res) {
  203 + this.setUserInfo(res);
195 uni.showToast({ 204 uni.showToast({
196 title: '更新个人资料成功~', 205 title: '更新个人资料成功~',
197 icon: 'none' 206 icon: 'none'