var checkurl = "";
var params = "";
if(type == 'phone'){
checkurl = checkPhoneUrl;
params = {
"phone":value
}
}
if(type == 'mail'){
checkurl = checkMailUrl;
params = {
"mail":value
}
}
Utils.getAuthUrl().then(res => {
var data = res.data.data;
console.log(data)
console.log(params)
wx.request({
url: checkurl+data,
dataType: JSON,
// data: params,
// header: headerParam,
success: function(res){
console.log(res.data)
},
fail: function(err){
console.log(err.errMsg)
}
})
})
}
当 url 为 checkurl + data 时 ,request:fail invalid url
当我把url直接写在上边的时候 就没有错误
url不能写死 , 请问应该怎么解决,
检查一下代码逻辑,感觉你的checkurl是空导致的,也就是type既不是‘phone’也不是‘mail’