return new Promise((reslove, reject) => {
if (uni.getStorageSync('locale')) {
header['Cb-lang'] = uni.getStorageSync('locale')
}
let api =httpUrl + '/api/' + url
console.log(api,method || 'GET',header)
uni.request({
url: api,
method: method || 'GET',
header: header,
data: data || {},
timeout:120000,
success: (res) => {
if (noVerify)
reslove(res.data, res)
else if (res.data.status == 200)
reslove(res.data, res)
else if ([110002, 110003, 110004].indexOf(res.data.status) !== -1) {
toLogin()
reject(res.data)
} else if (res.data.status == 100103) {
uni.showModal({
title: i18n.t(`提示`),
content: res.data.msg,
showCancel: false,
confirmText: i18n.t(`我知道了`)
})
} else
reject(res.data.msg || i18n.t(`系统错误`))
},
fail: (msg) => {
let data = {
mag: i18n.t(`请求失败`),
status: 1 //1没网
}
console.log(msg,"fail")
}
})
})
开发工具不校验域名模式正常,
校验域名,后台服务器域名配置了也不管用报错:request:fail url not in domain list
测试版上报错:request protocol must be http or https
是否是你的URL访问路径多了一个空格哦
实际上你 的api地址前面那部分是什么
console.log(api,method || 'GET',header);