Browse Source

修改密码

undefined
xubinxcode 4 years ago
parent
commit
b4a24accdf
1 changed files with 22 additions and 22 deletions
  1. +22
    -22
      addons/unishop/uniapp/uni-shop/pages/userinfo/userinfo.vue

+ 22
- 22
addons/unishop/uniapp/uni-shop/pages/userinfo/userinfo.vue View File

@@ -19,7 +19,7 @@
</view>
<view class="yt-list-cell">
<view class="cell-tit clamp">登陆密码
<input v-if="mobile" disabled="true" class="input" type="text" v-model="mobile" />
<input v-if="password" disabled="true" class="input" type="text" v-model="password" />
<!-- <button v-else class="input" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权获取微信绑定的手机号码</button> -->
</view>
</view>
@@ -31,8 +31,8 @@
</view>
</view>
<view class="yt-list-cell">
<view class="cell-tit clamp">手机号
<input v-if="mobile" disabled="true" class="input" type="text" v-model="mobile" />
<view class="cell-tit clamp">登陆密
<input class="input" type="text" v-model="password" />
</view>
</view>
<!-- #endif -->
@@ -53,7 +53,7 @@
data() {
return {
username: '',
mobile: '',
password: '',
avatar: ''
};
},
@@ -62,7 +62,7 @@
},
onLoad() {
this.username = this.userInfo.username;
this.mobile = this.userInfo.mobile;
this.password = '';
this.avatar = this.userInfo.avatar ? this.userInfo.avatar : '';
},
methods: {
@@ -73,35 +73,35 @@
getUserInfo(e) {
this.username = e.detail.userInfo.nickName;
},
async getPhoneNumber(e) {
let data = await this.$api.request('/user/decryptData', 'POST', {
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
});
if (data) {
this.mobile = data.phoneNumber;
}
},
// async getPhoneNumber(e) {
// let data = await this.$api.request('/user/decryptData', 'POST', {
// encryptedData: e.detail.encryptedData,
// iv: e.detail.iv
// });
// if (data) {
// this.password = data.phoneNumber;
// }
// },
async submit() {
if (this.username == '') {
this.$api.msg('用户名称不能为空');
return;
}
if (this.username == this.userInfo.username &&
this.mobile == this.userInfo.mobile &&
this.avatar == this.userInfo.avatar) {
this.$api.msg('已修改');
return;
}
// if (this.username == this.userInfo.username &&
// this.password == this.userInfo.password &&
// this.avatar == this.userInfo.avatar) {
// this.$api.msg('已修改');
// return;
// }
let data = await this.$api.request('/user/edit', 'POST', {
username: this.username,
mobile: this.mobile,
password: this.password,
avatar: this.avatar
});
if (data) {
let userInfo = this.userInfo;
userInfo.username = this.username;
userInfo.mobile = this.mobile;
// userInfo.password = this.password;
userInfo.avatar = this.avatar;
this.setUserInfo(userInfo);
}


Loading…
Cancel
Save