| | |
| | | const token = uni.getStorageSync('token');
|
| | | // const URL = 'http://47.76.147.249:8080/rsf-server/pda' + url;
|
| | | // const URL = 'http://test.zoneyung.net:8080/rsf-server/pda' + url;
|
| | | const URL = 'http://127.0.0.1:8080/rsf-server/pda' + url;
|
| | | const URL = 'http://127.0.0.1:8085/rsf-server/pda' + url;
|
| | | uni.request({
|
| | | url: URL,
|
| | | data: postData,
|
| | |
| | | },
|
| | | method: method, //'GET','POST'
|
| | | dataType: 'json',
|
| | | timeout: 30000, // 30秒超时
|
| | | success: (res) => {
|
| | | !hideLoading && uni.hideLoading()
|
| | | resolve(res.data)
|
| | |
|
| | | },
|
| | | fail: (res) => {
|
| | | // !hideLoading && toast("网络不给力,请稍后再试~")
|
| | | //wx.hideLoading()
|
| | | !hideLoading && uni.hideLoading()
|
| | | // 判断是否为超时错误
|
| | | const isTimeout = res.errMsg && (res.errMsg.includes('timeout') || res.errMsg.includes('超时'))
|
| | | uni.showToast({
|
| | | title: isTimeout ? '网络请求超时,请检查网络连接' : '网络请求失败,请稍后重试',
|
| | | icon: 'none',
|
| | | duration: 3000
|
| | | })
|
| | | reject(res)
|
| | | }
|
| | | })
|