wx.login调用失败,一直请求失败
发布于 6 年前 作者 mdong 4482 次浏览 来自 问答

_autoLogin: function(callback) {

var me = this;

console.log(‘小程序登录wx.login’)

// 调用登录接口

const login = function(index){

wx.login({

success: function (res) {

if (res.code) {

me._autLoginProcess(res.code, callback);

} else {

console.log(‘获取用户登录态失败!’ + res.errMsg)

}

}, fail: function (res) {

console.log(‘调用微信登录失败’,res)

index++;

if(index<3){

login(index);

}else{

wx.showModal({

title: ‘提示’,

content: ‘登录失败,请检查您的当前网络。’, //提示错误

confirmText: ‘确定’,

confirmColor: ‘#b8193f’,

showCancel: false,

complete: function (e) {

if (e.confirm) {

}

}

});

}

}

});

}

login(0)

},

调用login失败后我再重新调用三次还是失败,最后只能直接提示他网络不好,但是不是网络问题。有没有办法优化一下登录接口

2 回复

你好,调用失败打印的fail回调信息提示什么?

你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

回到顶部