返回成功判断的 几种状态

< view class= "tell"> < input class= "num" type= "number" placeholder= "请输入您的电话免费回电" value= '{{userNum}}' bindblur= 'userNumInput' / >
< view >< button class= "mfhb" bindtap= 'bindInput'>免费回拨 button > view >
view >
userNumInput: function (e) {
console.log(e.detail.value)
this.setData({
userNum: e.detail.value
})
},

bindInput: function () {
var userNum = this.data.userNum;
console.log(userNum)
wx.request({
url: 'http://weixin.4000428110.com/index.php/Admin0/Index/storage_phone', //此处是电话接口连接
data:{
userNum:userNum,
},
success: function (res) {
console.log(res)
if (res.data.status == 200) {
console.log( "成功")
wx.showToast({
title: '提交成功',
icon: 'succes',
duration: 1000,
mask: true
});
}
if (res.data.status == 201) {
console.log( "存在")
wx.showToast({
title: '号码存在',
icon: 'succes',
duration: 1000,
mask: true
});
}
else if (res.data.status == 202) {
console.log( "失败")
wx.showToast({
title: '提交失败',
icon: 'succes',
duration: 1000,
mask: true
});
}
}
})
},

你可能感兴趣的:(返回成功判断的 几种状态)