|
|
|
|
@ -247,26 +247,36 @@ var getToken = function (fn) {
|
|
|
|
|
* @param {Object} fn 登录成功后的回调
|
|
|
|
|
*/
|
|
|
|
|
function loginSuccess (result, fn) {
|
|
|
|
|
// 保存登陆信息
|
|
|
|
|
wx.setStorageSync('loginResult', result)
|
|
|
|
|
// 保存成功登录标识,token过期判断
|
|
|
|
|
wx.setStorageSync('hadLogin', true)
|
|
|
|
|
// 没有获取到用户昵称,说明服务器没有保存用户的昵称,也就是用户授权的信息并没有传到服务器
|
|
|
|
|
// if (!result.pic) {
|
|
|
|
|
// updateUserInfo();
|
|
|
|
|
// }
|
|
|
|
|
if (!result.enabled) {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
showCancel: false,
|
|
|
|
|
title: "提示",
|
|
|
|
|
content: "您已被禁用,不能购买,请联系客服",
|
|
|
|
|
cancelText: "取消",
|
|
|
|
|
confirmText: "确定"
|
|
|
|
|
confirmText: "确定",
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
wx.switchTab({
|
|
|
|
|
url: '/pages/index/index'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
wx.setStorageSync('token', '');
|
|
|
|
|
} else {
|
|
|
|
|
wx.setStorageSync('token', 'bearer' + result.access_token); //把token存入缓存,请求接口数据时要用
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保存登陆信息
|
|
|
|
|
wx.setStorageSync('loginResult', result)
|
|
|
|
|
// 保存成功登录标识,token过期判断
|
|
|
|
|
wx.setStorageSync('hadLogin', true)
|
|
|
|
|
// 没有获取到用户昵称,说明服务器没有保存用户的昵称,也就是用户授权的信息并没有传到服务器
|
|
|
|
|
// if (!result.pic) {
|
|
|
|
|
// updateUserInfo();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
wx.setStorageSync('token', 'bearer' + result.access_token); //把token存入缓存,请求接口数据时要用
|
|
|
|
|
|
|
|
|
|
if (result.userId) {
|
|
|
|
|
wx.setStorageSync('hadBindUser', true);
|
|
|
|
|
getCartCount()
|
|
|
|
|
|