主要问题是清了缓存也不弹,也不报错,然而没有经过过授权这一步,弹用户授权页面不出授权开关。整个就卡在这了
const userLogIn = (cb) => {
var count = 2;
var userInfo = {};
var err;
var done = () => {
count–;
if (count != 0) {
return;
}
cb(err, userInfo);
};
wx.login({
success: (res) => {
if (res.code) {
userInfo.jsCode = res.code;
done();
return;
}
err = “USER LOGIN ERROR”;
done();
}
});
wx.getSetting({
success: (res) => {
if (res.authSetting[‘scope.userInfo’]) {
wx.getUserInfo({
success: (res) => {
for (var i in res.userInfo) {
userInfo[i] = res.userInfo[i];
}
done();
}
});
return;
}
wx.authorize({
scope: “scope.userInfo”,
success: (e) => {
console.log(e);
},
fail: (e) => {
console.log(e);
error(“请同意授权才能查看您的会员卡哦^_^”, () => {
wx.openSetting({
success: (res) => {
}
});
});
}
});
err = “USER SCOPE ERROR”;
done();
}
});
};