forked from zhurui/management
1 line
8.6 KiB
JSON
1 line
8.6 KiB
JSON
{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\request.js","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\request.js","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _defineProperty from \"C:\\\\Users\\\\27446\\\\Desktop\\\\up\\\\front\\\\dkha-web-sz-main\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport axios from 'axios';\nimport Cookies from 'js-cookie';\nimport router from '@/router';\nimport qs from 'qs';\nimport { clearLoginInfo } from '@/utils';\nimport isPlainObject from 'lodash/isPlainObject';\nimport store from '@/store';\nimport { Message } from 'element-ui';\nvar http = axios.create({\n baseURL: window.SITE_CONFIG['apiURL'],\n timeout: 1000 * 180,\n withCredentials: true\n});\n/**\n * 请求拦截\n */\n\nhttp.interceptors.request.use(function (config) {\n config.headers['Accept-Language'] = Cookies.get('language') || 'zh-CN';\n\n if (config.url !== '/auth/oauth/token') {\n config.headers['Authorization'] = 'Bearer ' + Cookies.get('access_token') || '';\n } // 默认参数\n\n\n var defaults = {}; // 防止缓存,GET请求默认带_t参数\n\n if (config.method === 'get') {\n config.params = _objectSpread({}, config.params, {}, {\n '_t': new Date().getTime()\n });\n }\n\n if (isPlainObject(config.params)) {\n config.params = _objectSpread({}, defaults, {}, config.params);\n }\n\n if (isPlainObject(config.data)) {\n config.data = _objectSpread({}, defaults, {}, config.data);\n\n if (/^application\\/x-www-form-urlencoded/.test(config.headers['content-type'])) {\n config.data = qs.stringify(config.data);\n }\n }\n\n return config;\n}, function (error) {\n return Promise.reject(error);\n});\n/**\n * 响应拦截\n */\n\nhttp.interceptors.response.use(function (response) {\n if (response.data.code === 401 || response.data.code === 10001) {\n clearLoginInfo();\n router.replace({\n name: 'login'\n });\n return Promise.reject(response.data.msg);\n }\n\n return response;\n}, function (error) {\n if (error.request.status === 0 && error.response === undefined && store.state.user.id) {\n // 加入 store.state.user.id 避免多个请求 重复提示\n clearLoginInfo();\n Message.warning('系统升级中,请稍后重试!');\n router.replace({\n name: 'login'\n });\n }\n\n return Promise.reject(error);\n});\nexport default http;",{"version":3,"sources":["C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\request.js"],"names":["axios","Cookies","router","qs","clearLoginInfo","isPlainObject","store","Message","http","create","baseURL","window","SITE_CONFIG","timeout","withCredentials","interceptors","request","use","config","headers","get","url","defaults","method","params","Date","getTime","data","test","stringify","error","Promise","reject","response","code","replace","name","msg","status","undefined","state","user","id","warning"],"mappings":";;;;;;;;;;AA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Af,CAAP;AACH,CAfD;AAiBA,eAAetB,IAAf","sourcesContent":["import axios from 'axios'\nimport Cookies from 'js-cookie'\nimport router from '@/router'\nimport qs from 'qs'\nimport { clearLoginInfo } from '@/utils'\nimport isPlainObject from 'lodash/isPlainObject'\nimport store from '@/store'\nimport { Message } from 'element-ui'\n\nconst http = axios.create({\n baseURL: window.SITE_CONFIG['apiURL'],\n timeout: 1000 * 180,\n withCredentials: true\n})\n\n/**\n * 请求拦截\n */\nhttp.interceptors.request.use(config => {\n config.headers['Accept-Language'] = Cookies.get('language') || 'zh-CN'\n if (config.url !== '/auth/oauth/token') {\n config.headers['Authorization'] = 'Bearer ' + Cookies.get('access_token') || ''\n }\n // 默认参数\n var defaults = {}\n // 防止缓存,GET请求默认带_t参数\n if (config.method === 'get') {\n config.params = {\n ...config.params,\n ... { '_t': new Date().getTime() }\n }\n }\n if (isPlainObject(config.params)) {\n config.params = {\n ...defaults,\n ...config.params\n }\n }\n if (isPlainObject(config.data)) {\n config.data = {\n ...defaults,\n ...config.data\n }\n if (/^application\\/x-www-form-urlencoded/.test(config.headers['content-type'])) {\n config.data = qs.stringify(config.data)\n }\n }\n return config\n}, error => {\n return Promise.reject(error)\n})\n\n/**\n * 响应拦截\n */\nhttp.interceptors.response.use(response => {\n if (response.data.code === 401 || response.data.code === 10001) {\n clearLoginInfo()\n router.replace({ name: 'login' })\n return Promise.reject(response.data.msg)\n }\n return response\n}, error => {\n if (error.request.status === 0 && error.response === undefined && store.state.user.id) {\n // 加入 store.state.user.id 避免多个请求 重复提示\n clearLoginInfo()\n Message.warning('系统升级中,请稍后重试!')\n router.replace({ name: 'login' })\n }\n return Promise.reject(error)\n})\n\nexport default http"]}]} |