request报错 request protocol must be http or https ?
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");
}
})
});