wx.request({
login:“登录中。。。”,
url: util.link + “/api/UserExist111/get1”,
data: {
phone: user,
password: pwd
},
header: {
‘content-type’: ‘application/json’ // 默认值
},
success: function (res) {
if (res.data.result == “error”) {
wx.showToast({
title: ‘手机号或密码错误’,
image: ‘/images/warn.png’,
duration: 1500,
mask: true
})
return false;
}
else{
try {
wx.setStorageSync(‘user’, user);
wx.setStorageSync(‘pwd’, pwd);
} catch (e) {
wx.showToast({
title: ‘网络错误,稍后重试’,
image: ‘/images/warn.png’,
duration: 1500,
mask: true
})
return false;
}
wx.showToast({
title: ‘登录成功’,
icon: ‘success’,
duration: 1500,
mask: true
})
wx.navigateBack();
}
},
fail:function(res){
wx.showToast({
title: ‘网络错误,稍后重试’,
image: ‘/images/warn.png’,
duration: 1500,
mask: true
})
return false;
}
})
我的url中/api/UserExist111/get1根本就是错误的,但是还是会走wx.navigateBack(),不走fail,什么情况,大神指导。