Browse Source

修复绑定手机号的问题

master
gaoxs 5 years ago
parent
commit
2171e9f7bd
  1. 22
      pages/user/PersonalData/index.vue
  2. 19
      pages/user/User/index.vue
  3. 1
      utils/index.js
  4. 1
      utils/request.js

22
pages/user/PersonalData/index.vue

@ -171,17 +171,17 @@ export default {
getUserInfo: function() { getUserInfo: function() {
let that = this; let that = this;
getUser().then(res => { getUser().then(res => {
let switchUserInfo = res.data.switchUserInfo; // let switchUserInfo = res.data.switchUserInfo;
for (let i = 0; i < switchUserInfo.length; i++) { // for (let i = 0; i < switchUserInfo.length; i++) {
if (switchUserInfo[i].uid == that.userInfo.uid) that.userIndex = i; // if (switchUserInfo[i].uid == that.userInfo.uid) that.userIndex = i;
if ( // if (
!that.isWeixin && // !that.isWeixin &&
switchUserInfo[i].user_type != "h5" && // switchUserInfo[i].user_type != "h5" &&
switchUserInfo[i].phone === "" // switchUserInfo[i].phone === ""
) // )
switchUserInfo.splice(i, 1); // switchUserInfo.splice(i, 1);
} // }
that.$set(this, "switchUserInfo", switchUserInfo); // that.$set(this, "switchUserInfo", switchUserInfo);
}); });
}, },
imageuploaded(res) { imageuploaded(res) {

19
pages/user/User/index.vue

@ -220,6 +220,7 @@ export default {
this.$yrouter.push("/pages/user/PersonalData/index"); this.$yrouter.push("/pages/user/PersonalData/index");
}, },
getPhoneNumber: function(e) { getPhoneNumber: function(e) {
let thit=this
// //
if (e.mp.detail.errMsg == "getPhoneNumber:ok") { if (e.mp.detail.errMsg == "getPhoneNumber:ok") {
uni.showLoading({ uni.showLoading({
@ -239,7 +240,9 @@ export default {
iv: e.mp.detail.iv iv: e.mp.detail.iv
}) })
.then(res => { .then(res => {
this.User(); console.log(res);
// this.User();
thit.$store.dispatch("USERINFO", true);
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -248,15 +251,27 @@ export default {
}); });
}) })
.catch(error => { .catch(error => {
uni.hideLoading();
thit.$store.dispatch("USERINFO", true);
console.log(error);
uni.showToast({ uni.showToast({
title: error.msg || error.response.data.msg, title:
error.msg ||
error.response.data.msg ||
error.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
}); });
},
fail() {
reject("绑定失败");
} }
}); });
} }
},
fail() {
reject("获取环境服务商失败");
} }
}); });
} else { } else {

1
utils/index.js

@ -208,6 +208,7 @@ export const login = (option) => {
resolve(data) resolve(data)
uni.hideLoading(); uni.hideLoading();
store.commit("LOGIN", data.token, dayjs(data.expires_time)); store.commit("LOGIN", data.token, dayjs(data.expires_time));
store.dispatch('USERINFO', true)
console.log(store) console.log(store)
handleGetUserInfo() handleGetUserInfo()

1
utils/request.js

@ -57,6 +57,7 @@ function baseRequest(options) {
}).then(res => { }).then(res => {
const data = res.data || {}; const data = res.data || {};
if (res.status !== 200) { if (res.status !== 200) {
return Promise.reject({ msg: "请求失败", res, data }); return Promise.reject({ msg: "请求失败", res, data });
} }
if ([410000, 410001, 410002].indexOf(data.status) !== -1) { if ([410000, 410001, 410002].indexOf(data.status) !== -1) {

Loading…
Cancel
Save