king
2022-07-08 4313d9ccea6534b1da71baa1bf499f045d3c1f0b
src/api/index.js
@@ -29,7 +29,7 @@
axios.interceptors.request.use((config) => {
  if (config.url.includes('LoginAndRedirect') || config.url.includes('getjsonresult') || config.url.includes('wxNativePay')) {
    config.data = qs.stringify(config.data)
  } else if (config.url.includes('Upload') || config.url.includes('doupload') || config.url.includes('dopreload')) {
  } else if (config.url.includes('doupload') || config.url.includes('dopreload')) {
    config.headers = { 'Content-Type': 'multipart/form-data' }
  } else if (config.method === 'post' && config.data) {
    config.data = JSON.stringify(config.data)
@@ -111,9 +111,32 @@
   * @description 微信业务请求
   */
  wxRequest (url, method, param) {
    let _url = window.GLOB.location + ':8080/' + window.GLOB.service + url
    let _url = document.location.origin + '/' + window.GLOB.service + url
    if (process.env.NODE_ENV !== 'production') {
      _url = document.location.origin + '/' + url
    }
    if (param) {
      return axios({
        url: _url,
        method,
        data: param
      })
    }
    return axios({
      url: _url,
      method
    })
  }
  /**
   * @description 微信业务请求
   */
  wxNginxRequest (url, method, param) {
    let _url = window.GLOB.location + ':8080/' + url
    if (process.env.NODE_ENV === 'production') {
      _url = document.location.origin + ':8080/' + window.GLOB.service + url
      _url = document.location.origin + ':8080/' + url
    }
    
    if (param) {
@@ -122,12 +145,12 @@
        method,
        data: param
      })
    } else {
      return axios({
        url: _url,
        method
      })
    }
    return axios({
      url: _url,
      method
    })
  }
  /**
@@ -895,8 +918,13 @@
   * @description 获取微信支付二维码
   */
  getWxNativePay (param) {
    let _url = document.location.origin + '/' + window.GLOB.service + 'wxpay/wxNativePay'
    if (process.env.NODE_ENV !== 'production') {
      _url = document.location.origin + '/wxpay/wxNativePay'
    }
    return axios({
      url: '/wxpay/wxNativePay',
      url: _url,
      method: 'post',
      data: param
    })