This commit is contained in:
Ggysh-7
2022-11-25 22:00:04 +08:00
48 changed files with 3937 additions and 1756 deletions

View File

@@ -2,11 +2,12 @@
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-21 14:32:52
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-11-23 09:59:26
* @LastEditTime: 2022-11-25 17:33:03
* @FilePath: /fe-manage/src/api/config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import axios from "axios";
// import { getCookie } from '../api/method'
// const Qs = require("qs");
// axios.defaults.headers.post["Content-Type"] =
@@ -24,15 +25,16 @@ const http = axios.create({
http.interceptors.request.use(
(config) => {
const token = localStorage.getItem("token");
// const token = getCookie('token')
// console.log('token', token)
if (token) {
// config.headers.token = token;
config.headers.token = token; //测试1111
} else {
console.log("当前请求页面无token,请执行操作!!!");
// 此处测试默认配置token
// config.headers.token = "123456";
config.headers.token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NjkzODQwMTIsImV4cCI6MTY2OTM5MTIxMiwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjAxNTU1M0RELTQ0NUUtNjlENC0zNTFGLUREOUExQTU2NDIwRSIsInVJZCI6Ijk2NTM0MTk5OTY0MzIzNDMwNCIsInBlcm1pc3Npb24iOiIifQ==.654058829fa6a65bf1477f6fc78cc6009304be484c9c49c0944147930c341f6c"
config.headers.token = "123456";
// config.headers.token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NjkzMDA4MDksImV4cCI6MTY2OTMwODAwOSwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.bb3e0e031513761003d5c3bfeaf16e364bdf8fe7bc4cf691a05a74dc454afbfb";
}
return config;
},
@@ -44,12 +46,15 @@ http.interceptors.request.use(
http.interceptors.response.use(
(response) => {
// console.log('response', response)
const {
data: { code, msg },
} = response;
// console.log('code', code)
if (code === 0 || code === 200) {
return response;
} else {
// window.open("https://u-pre.boe.com/web/", '_self');
console.log("api %o", msg);
}
return response;