king
2022-07-06 be22457344d6d3fc079de2a4f0a1e06e4c0f85c3
src/api/index.js
@@ -66,16 +66,22 @@
    return Promise.resolve(response.data)
  }
}, (error) => {
  if (error && error.response) {
    notification.error({
      className: 'notification-custom-error',
      bottom: 0,
      message: '状态码-' + error.response.status + ',请联系管理员',
      placement: 'bottomRight',
      duration: 15
    })
  let response = error.response
  if (response) {
    if (!response.data || !response.data.errors) { // 过滤旷视报错信息
      notification.error({
        className: 'notification-custom-error',
        bottom: 0,
        message: '状态码-' + response.status + ',请联系管理员',
        placement: 'bottomRight',
        duration: 15
      })
    }
    return Promise.reject(response)
  } else {
    return Promise.reject()
  }
  return Promise.reject(error.response)
})
class Api {
@@ -102,6 +108,29 @@
  }
  /**
   * @description 微信业务请求
   */
  wxRequest (url, method, param) {
    let _url = window.GLOB.location + ':8080/' + window.GLOB.service + url
    if (process.env.NODE_ENV === 'production') {
      _url = document.location.origin + ':8080/' + window.GLOB.service + url
    }
    if (param) {
      return axios({
        url: _url,
        method,
        data: param
      })
    } else {
      return axios({
        url: _url,
        method
      })
    }
  }
  /**
   * @description 直接请求
   * @param {Object} param 查询及提交参数
   */