|
|
// 导出一个封装好的异步请求
|
|
|
export const request = (params) => {
|
|
|
|
|
|
wx.showNavigationBarLoading()
|
|
|
const baseUrl = "https://car.goorcar.com/"
|
|
|
return new Promise((resolve, reject) => {
|
|
|
let header = {
|
|
|
// 'XX-Device-Type': 'wxapp',
|
|
|
'token': wx.getStorageSync("token") || ''
|
|
|
}
|
|
|
header = Object.assign(header)
|
...
|
...
|
@@ -21,24 +19,9 @@ export const request = (params) => { |
|
|
} else {
|
|
|
reject(res.data)
|
|
|
}
|
|
|
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
reject(err)
|
|
|
wx.showNavigationBarLoading()
|
|
|
|
|
|
// wx.hideLoading();
|
|
|
// wx.showModal({
|
|
|
// title: '提示',
|
|
|
// showCancel: false,
|
|
|
// content: '请求超时,请重新进入',
|
|
|
// // success: function () {
|
|
|
// // wx.redirectTo({
|
|
|
// // url: '../scan/scan'
|
|
|
// // })
|
|
|
// // }
|
|
|
// })
|
|
|
|
|
|
},
|
|
|
complete: function () {
|
|
|
wx.hideNavigationBarLoading()
|
...
|
...
|
@@ -46,5 +29,4 @@ export const request = (params) => { |
|
|
|
|
|
})
|
|
|
})
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|