报错:fail{"errno": 5, "errMsg": "request:fail fail:time out"}
login() {
uni.showLoading({
title: '加载中...'
});
uni.request({
url: getApp().globalData.resHttp + "api/Authorization/login",
method: "POST",
data: this.form,
timeout: 30000,
dataType: 'json',
success: (res) => {
console.log(res,"登录用户")
let userData = res.data.result;
if (res.data.code == "0") {
uni.setStorageSync('Token', "Bearer " + res.data.result.token);
uni.setStorageSync('userInfo', res.data.result);
uni.showToast({
title: '登录成功',
icon: 'success',
duration: 500,
success: (res) => {
setTimeout(() => {
uni.switchTab({
url: '/pages/main/index/index'
})
}, 500)
},
fail: (res) => {
console.log("微信用户登录",res,"fail")
},
});
} else {
uni.showToast({
title: res.data.msg,
icon: 'error',
duration: 1500
});
}
},
fail: (res) => {
console.log("login",res,"fail")
uni.showToast({
title: '连接服务器失败',
icon: 'error',
duration: 1500
});
},
complete: () => {
//uni.hideLoading();
}
});
},
解决了么? 我也遇到相同原因了