export default fetch = (url, data = {}, method, headers, timeout) => {
return new Promise((resolve, reject) => {
wx.getStorage({
key: 'baseUrl',
success: (res) => {
//发送请求
wx.request({
url: `${res.data}${url}`,
data: data,
method: method,
header: headers,
timeout: timeout,
success: res => {
resolve(res)
let warning = res.data.HttpMessage
if (warning == '身份验证失败,拒绝访问') {
wx.hideLoading();
wx.showModal({
title: '提示',
content: '身份验证失败,是否重新登录?',
confirmText: "确认",
cancelText: "取消",
success: (res) => {
if (res.confirm) {
wx.redirectTo({
url: 'pages/logs/logs'
});
} else if (res.cancel) {
}
}
});
}
},
fail: (err) => {
reject(err);
console.log(err)
},
complete: (res) => {
// wx.hideLoading()
}
})
}
})
})
}
不支持吗,开发正常,最近又有更新吗,上线就不行了
可以提供appid和复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)?
已找到问题,粗心大意,删除剩6个页面(5个tabBar和一个登录页面)然后上传体验版发现依然报错,接着改fetch名称,6个页面和封装的方法“fetch”都重新命名依然同样错误,然后编辑器全局搜索fetch发现封装接口那里导出了一个没声明的fetch,解决,感谢各位大佬,是小程序让大家走到一起,谢谢小时光