#
zhou zhou
5 小时以前 8d3ebc610d048289f8ca4d8bc86ac11208a60fef
common/request.js
@@ -15,8 +15,12 @@
   return new Promise((resolve, reject) => {
      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://test.zoneyung.net:8080/rsf-server/pda' + url;
      let baseUrl = uni.getStorageSync('baseUrl');
      if (!baseUrl) {
         baseUrl = 'http://127.0.0.1:8085/rsf-server/pda';
      }
      const URL = baseUrl+'/pda' + url;
      uni.request({
         url: URL,
         data: postData,
@@ -26,14 +30,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)
         }
      })