wx.request({
url:loginUrl,
data: JSON.stringify({
"userName": userName,
"password": userPassword
}),
method: "post",
success(res) {
console.log("调用成功时间"+Date.now())
console.log("调用成功时间"+new Date())
console.log(res)
if (res.data.code == 100) {
wx.showToast({
title: res.data.msg,
icon: 'none'
})
if (remeber) {
wx.setStorage({
key: "userName",
data: userName
})
wx.setStorage({
key: "userPassword",
data: userPassword
})
wx.setStorage({
key: "remeber",
data: remeber
})
} else {
wx.setStorage({
key: "userName",
data: ''
})
wx.setStorage({
key: "userPassword",
data: ""
})
wx.setStorage({
key: "remeber",
data: remeber
})
}
_this.setData({
loginData: res,
})
getApp().globalData.loginData = res;
if (getApp().globalData.loginData.data.code === 100) {
setTimeout(function () {
wx.switchTab({
url: '../index/index'
})
}, 2000) //延迟时间
}
} else {
wx.showToast({
title: res.data.msg,
icon: 'none'
})
}
},
fail(res) {
console.log("调用失败时间"+Date.now());
console.log("调用失败时间"+new Date())
wx.showToast({
title: res.errMsg,
icon: 'none'
})
console.log(res)
},
})
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
惜字如金啊,没看懂你想表达啥