Authored by QC-L

修复注册不成功的问题 review by 黄敬囿

... ... @@ -74,18 +74,20 @@ export const getPhoneNumber = async (e) => {
let userInfo = wx.getStorageSync('userInfo');
userInfo = Object.assign(userInfo, newUserInfo);
await setStorageWithValueForKey('userInfo', userInfo);
await setStorageWithValueForKey('sessionkey', result.session_key);
await setStorageValueForKey('userInfo', userInfo);
await setStorageValueForKey('sessionkey', bindResult.session_key);
app.globalData.userInfo = userInfo;
event.emit('wechat-login-success');
setTimeout(() => {
event.emit('wechat-login-success');
}, 1000);
event.emit('user-login-success', newUserInfo);
wx.showToast({
icon: 'none',
title: '手机号授权成功!\r\n为享受更多权益,已为您注册有货会员!',
duration: 3000
});
} else if (bindResult && bindResult.is_register === 2) {
} else if (bindResult && (bindResult.is_register === 2 || bindResult.is_register === 3 || bindResult.is_register === 4)) {
const newUserInfo = {
is_bind: bindResult.is_bind,
mobile: bindResult.profile,
... ... @@ -98,8 +100,8 @@ export const getPhoneNumber = async (e) => {
let userInfo = wx.getStorageSync('userInfo');
userInfo = Object.assign(userInfo, newUserInfo);
await setStorageWithValueForKey('userInfo', userInfo);
await setStorageWithValueForKey('sessionkey', result.session_key);
await setStorageValueForKey('userInfo', userInfo);
await setStorageValueForKey('sessionkey', bindResult.session_key);
app.globalData.userInfo = userInfo;
event.emit('wechat-login-success');
... ...
... ... @@ -162,7 +162,7 @@ Page(Object.assign({
});
})
} else {
this._getReleaseData();
this._loadReleaseData();
}
},
... ... @@ -295,6 +295,34 @@ Page(Object.assign({
data = res.data;
}
this.setData({
[key]: data,
[keyPage]: 1
})
if (data.length === 0) {
this.setData({
footText: '暂无更多内容'
})
}
});
},
_loadReleaseData(my_page) {
if (!this.data.isLogin) {
return;
}
let type = 1;
let my_zero_list = this.data.my_zero_list;
let page = my_zero_list[type].page;
let oldData = my_zero_list[type].data;
let key = `my_zero_list[${type}].data`;
let keyPage = `my_zero_list[${type}].page`;
console.log('执行了');
this.service.getMyList({ type, page }).then(res => {
let data = []
if (res && res.code === 200) {
data = res.data;
}
this.setData({
[key]: oldData.concat(data),
[keyPage]: ++page
})
... ...