{"remainingRequest":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/thread-loader/dist/cjs.js!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/babel-loader/lib/index.js!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/utils/request.js","dependencies":[{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/utils/request.js","mtime":1720690881863},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/babel.config.js","mtime":1701742078504},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/thread-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/babel-loader/lib/index.js","mtime":456789000000}],"contextDependencies":[],"result":["// +----------------------------------------------------------------------\n// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权\n// +----------------------------------------------------------------------\n// | Author: CRMEB Team <admin@crmeb.com>\n// +----------------------------------------------------------------------\n\nimport axios from 'axios';\nimport { MessageBox, Message } from 'element-ui';\nimport store from '@/store';\nimport { getToken } from '@/utils/auth';\nimport SettingMer from '@/utils/settingMer';\nvar service = axios.create({\n  baseURL: process.env.VUE_APP_BASE_API + '/api',\n  timeout: 60000 // 过期时间\n});\n\n// request interceptor\nservice.interceptors.request.use(function (config) {\n  // 发送请求之前做的\n  var token = !store.getters.token ? sessionStorage.getItem('token') : store.getters.token;\n  var mer_token = localStorage.getItem('mer_token');\n  if (token) {\n    config.headers['Authori-zation'] = token;\n  }\n  if (mer_token) {\n    config.headers['Authori-zation'] = mer_token;\n  }\n  if (/get/i.test(config.method)) {\n    config.params = config.params || {};\n    config.params.temp = Date.parse(new Date()) / 1000;\n  }\n  return config;\n}, function (error) {\n  return Promise.reject(error);\n});\n\n// response interceptor\nservice.interceptors.response.use(function (response) {\n  var res = response.data;\n  // if the custom code is not 20000, it is judged as an error.\n  if (res.code === 401) {\n    // to re-login\n    Message.error('无效的会话，或者登录已过期，请重新登录。');\n    if (window.location.pathname !== '/login') location.href = '/login';\n    window.localStorage.clear();\n  } else if (res.code === 403) {\n    Message.error('没有权限访问。');\n  }\n  if (res.code && res.code !== 200 && res.code !== 401) {\n    Message({\n      message: res.message || 'Error',\n      type: 'error',\n      duration: 5 * 1000\n    });\n    return Promise.reject(res.message);\n  } else {\n    // 上传使用\n    if (response.headers['content-type'] === 'application/vnd.ms-excel;charset=UTF-8') {\n      var filename = decodeURIComponent(response.headers['content-disposition'].split('=')[1]);\n      localStorage.setItem('filename', filename);\n      return res;\n    }\n    return res.data;\n  }\n}, function (error) {\n  Message({\n    message: error.message,\n    type: 'error',\n    duration: 5 * 1000\n  });\n  return Promise.reject(error);\n});\nexport default service;",null]}