我真机调试测试,写了一个wx.request()方法,访问后台服务,后台服务日志打印也正常,但是前台就是进不去success,fail.complete也进不去,不知道怎么回事,求大神解答()
getPushStatus: function (transid) {//获取推流服务实时状态
let that = this;
var text = '';
wx.request({
url: 'https://demo.i2safe.net:9443/front-mid/get.status.do',
method: 'POST',
data: {
trans_id:transid
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
fail(res){
console.log("错误:"+res);
},
success(res){
console.log(res)
if(res.data.status === '60000'){
text = '图像采集成功'
clearInterval(that.data.timer);
that.pusher.stop();
wx.redirectTo({
url: '../common/tipclose?error=false&transid=' + that.transid,
})
}else{
if (res.data.status === '60100'){
text = '发现多个人脸'
} else if (res.data.status === '60101'){
text = '没有检测到人脸'
} else if (res.data.status === '60200') {
text = '人脸下部越界'
} else if (res.data.status === '60201') {
text = '人脸上部越界'
} else if (res.data.status === '60202') {
text = '人脸左侧越界'
} else if (res.data.status === '60203') {
text = '人脸右侧越界'
} else if (res.data.status === '60204') {
text = '人脸太小100*100'
} else if (res.data.status === '60300') {
text = '图像不清晰'
} else if (res.data.status === '60400') {
text = '未知错误'
} else if (res.data.status === '60500') {//返回码等于60500的时候,直接进去关闭页面,并且给到参数false
text = '人脸未取到';
clearInterval(that.data.timer);
that.pusher.stop();
wx.redirectTo({
url: '../common/tipclose?error=true&transid='+that.transid,
})
} else if (res.data.status === '60600') {//返回码等于60500的时候,直接进去关闭页面,并且给到参数false
text = '人脸获取到并发给中控';
clearInterval(that.data.timer);
that.pusher.stop();
wx.redirectTo({
url: '../common/tipclose?error=true&transid='+that.transid,
})
}
}
that.setData({
statusText:text
})
},
complete(res){
console.log(res)
}
})
},
以上是源码,访问地址没有问题,每次跳到request里,但是就是进不去回调。
这是后台日志返回的参数,json字符串,也没有问题,可是进不去success,无法提取出来,前后台都没有报错
麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
接口 500 错误,小程序访问这个接口的时候,看下network