峰峰执法平台简易案件程序板块 pad端
zhangxiaoxu123
2023-01-11 539d1ce6b955d5d56b21d97590a2a684c400f64a
src/router/axios.js
@@ -21,7 +21,7 @@
NProgress.configure({
  showSpinner: false
})
let loadingInstance =null;
let loadingInstance = null;
// HTTPrequest拦截
axios.interceptors.request.use(config => {
  /*NProgress.start() // start progress bar
@@ -33,10 +33,10 @@
 });*/
  const TENANT_ID = getStore({ name: 'tenantId' })
  const isToken = (config.headers || {}).isToken === false
  const token = window.android.getAppToken()
  // const token = `dd271fdb-4b69-4eb3-a940-52d70232e56b`
  // const token = window.android.getAppToken()
  const token = `8d47d31b-2c41-47e6-9870-b7208447b9fe`
  if (token && !isToken) {
    config.headers['Authorization'] = 'bearer ' + token// token
    config.headers['Authorization'] = 'Bearer ' + token// token
  }
  if (TENANT_ID) {
    config.headers['TENANT-ID'] = TENANT_ID // 租户ID
@@ -47,14 +47,14 @@
    config.data = serialize(config.data)
    delete config.data.serialize
  }
  config.headers['VERSION'] = 'lmm'
  if (config.method === 'get'||config.params) {
  // config.headers['VERSION'] = 'GHX'
  if (config.method === 'get' || config.params) {
    config.paramsSerializer = function (params) {
      let p ={};
      for(let i in params){
        if(typeof params[i] == 'string' &&!params[i]){
      let p = {};
      for (let i in params) {
        if (typeof params[i] == 'string' && !params[i]) {
        }else{
        } else {
          p[i] = params[i]
        }
      }
@@ -73,27 +73,27 @@
  // loadingInstance.close();
  const status = Number(res.status) || 200
  const message = res.data.msg || errorCode[status] || errorCode['default']
 /* if (status === 401) {
    // Message({
    //   message: message,
    //   type: 'error'
    // })
  /*if (status === 401) {
    Message({
      message: message,
      type: 'error'
    })
    handleError(message)
    store.dispatch('FedLogOut').then(() => {
      router.push({ path: '/login' })
      router.push({ path: '/pad' })
    })
    return
  }*/
  // if (status !== 200 || res.data.code === 1) {
  //   // Message({
  //   //   message: message,
  //   //   type: 'error'
  //   // })
  //   // handleError(message)
  //   return handleError(message)
  //   // return Promise.reject(new Error(message))
  // }
  /*if (status !== 200 || res.data.code === 1) {
    Message({
      message: message,
      type: 'error'
    })
    handleError(message)
    return handleError(message)
    // return Promise.reject(new Error(message))
  }*/
  return res
}, error => {
  NProgress.done()