有部分用户微信用code获取open的时候一直走 fail 返回:{"errMsg":"request:failnet::ERR CONNECTION RESET""errno":600001}
wx.login({
success: (succ) => {
console.log('login:'+succ.code)
if (succ.code) {
wx.request({
//url: getApp().globalData.baseUrl + 'api/Login3',
method: 'POST',
data: {
code: succ.code,
status: _this.data.scene
},
success: function (res) {
console.log(res, "++++++++++")
_this.setData({ _logining: false })
if (res.data.code == 200) {
wx.setStorageSync('token', res.data.data.token);
wx.setStorageSync('fid', res.data.data.user_id);
wx.setStorageSync('status', res.data.data.status);
_this.setData({
status: res.data.data.status
})
_this.onShow()
} else {
wx.showToast({
title: res.data.msg || '登录失败',
icon: 'none'
})
}
},
fail: function (err) {
console.error('Login请求失败:', err)
console.error('wx.login失败报错字符:', JSON.stringify(err))
_this.setData({ _logining: false })
wx.showToast({
title: '网络异常,请重试',
icon: 'none'
})
}
})
} else {
console.log('login中code获取失败:'+succ.code);
// _this.setData({ _logining: false })
}
},
fail: function (err) {
console.error('wx.login失败:', err)
_this.setData({ _logining: false })
wx.showToast({
title: '登录失败,正在重试...',
icon: 'none'
})
setTimeout(() => {
_this.login()
}, 1500)
}
})
