common/request.js
@@ -26,14 +26,21 @@ }, 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) } })