king
2020-07-09 89ee68c59cdcaa4b7fa0178be42d58bec651ee73
src/api/index.js
@@ -13,7 +13,7 @@
  config.method = 'post'
  if (config.url.includes('LoginAndRedirect') || config.url.includes('getjsonresult')) {
    config.data = qs.stringify(config.data)
  } else if (config.url.includes('Upload')) {
  } else if (config.url.includes('Upload') || config.url.includes('doupload') || config.url.includes('dopreload')) {
    config.headers = { 'Content-Type': 'multipart/form-data' }
  } else {
    // config.headers.token = sessionStorage.getItem('TOKEN') || ''
@@ -54,9 +54,8 @@
class Api {
  constructor() {
    let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : ''
    if (process.env.NODE_ENV === 'production') {
      axios.defaults.baseURL = document.location.origin + '/' + service
      axios.defaults.baseURL = document.location.origin + '/' + window.GLOB.service
    } else {
      // axios.defaults.baseURL = 'http://127.0.0.1:8888'
    }
@@ -83,7 +82,7 @@
      // func: 'webapi_login',
      UserName: username,
      Password: password,
      systemType: options.systemType,
      systemType: options.sysType,
      Type: 'X'
    }
@@ -92,8 +91,8 @@
    if (isCloud) {
      param.debug = 'Y'
      if (options.cloudLoginApi) {
        param.rduri = options.cloudLoginApi
      if (options.cloudServiceApi) {
        param.rduri = options.cloudServiceApi.replace(/\/webapi(.*)/, '/webapi/dologon')
      }
    } else if (!isCloud && window.GLOB.mainSystemApi) {
      param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon')
@@ -144,7 +143,7 @@
    param.t = new Date().getTime()
    return axios({
      url: '/webapi/dostars',
      url: `/webapi/dostars${param.func ? '/' + param.func : ''}`,
      data: param
    })
  }
@@ -184,7 +183,7 @@
    param.t = new Date().getTime()
    return axios({
      url: '/webapi/dostars',
      url: `/webapi/dostars${param.func ? '/' + param.func : ''}`,
      data: param
    })
  }
@@ -215,7 +214,7 @@
    param.t = new Date().getTime()
    return axios({
      url: '/webapi/dostars',
      url: `/webapi/dostars${param.func ? '/' + param.func : ''}`,
      data: param
    })
  }
@@ -269,7 +268,7 @@
      return new Promise(resolve => {
        axios({
          url: '/webapi/dostars',
          url: `/webapi/dostars${param.func ? '/' + param.func : ''}`,
          data: param
        }).then(res => {
          if (res.status) {
@@ -313,7 +312,7 @@
    param.t = new Date().getTime()
    return axios({
      url: '/webapi/dostars',
      url: `/webapi/dostars${param.func ? '/' + param.func : ''}`,
      data: param
    })
  }
@@ -429,6 +428,36 @@
  }
  /**
   * @description 大文件上传
   */
  getLargeFileUpload (param) {
    return axios({
      url: '/webapi/doupload',
      data: param
    })
  }
  /**
   * @description 查询文件是否已上传
   */
  getFilePreUpload (param) {
    return axios({
      url: '/webapi/dopreload',
      data: param
    })
  }
  /**
   * @description 获取微信支付二维码
   */
  getWxNativePay (param) {
    return axios({
      url: '/wxpay/wxNativePay',
      data: param
    })
  }
  /**
   * @description 文件上传
   */
  getFileUpload (param) {