king
2021-01-22 c7df5603e14b98d6f80da425fab31d30574ca417
src/api/index.js
@@ -46,7 +46,6 @@
  } else if (config.url.includes('Upload') || config.url.includes('doupload') || config.url.includes('dopreload')) {
    config.headers = { 'Content-Type': 'multipart/form-data' }
  } else if (config.method === 'post') {
    // config.headers.token = sessionStorage.getItem('TOKEN') || ''
    config.data = JSON.stringify(config.data)
  }
@@ -90,7 +89,7 @@
      duration: 15
    })
  }
  return Promise.reject(error)
  return Promise.reject(error.response)
})
class Api {
@@ -121,12 +120,24 @@
   * @param {Object} param 查询及提交参数
   */
  directRequest (url, method, param) {
    let params = { method: 'post' }
    let _url = url
    return axios({
      url: url,
      method: method,
      params: param
    })
    if (method === 'get' && param) {
      let keys = Object.keys(param).map(key => `${key}=${param[key]}`)
      keys = keys.join('&')
      if (keys) {
        _url = _url + '?' + keys
      }
    } else if (method === 'post' && param) {
      params.data = param
    }
    _url = window.btoa(_url)
    params.url = '/trans/redirect?rd=' + _url + '&method=' + method
    return axios(params)
  }
  /**