mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-07 18:06:46 +08:00
-- bug
This commit is contained in:
1
.env
1
.env
@@ -1,6 +1,7 @@
|
||||
VITE_BASE=/manage
|
||||
VITE_BASE_API=/
|
||||
VITE_PROXY_URL=http://111.231.196.214:30001/
|
||||
VITE_LOGIN_URL=https://u-pre.boe.com/web
|
||||
|
||||
|
||||
VITE_BOE_ONLINE_CLASS_URL=https://u-pre.boe.com/pc/course/studyindex?id=
|
||||
|
||||
1
.env.boe
1
.env.boe
@@ -1,6 +1,7 @@
|
||||
VITE_BASE=/fe-student
|
||||
VITE_BASE_API=/manageApi
|
||||
|
||||
|
||||
VITE_BOE_ONLINE_CLASS_URL=https://u-pre.boe.com/pc/course/studyindex?id=
|
||||
VITE_BOE_CASS_DETAIL_URL=https://u-pre.boe.com/pc/case/detail?id=
|
||||
VITE_BOE_TEST_DETAIL_URL=https://u-pre.boe.com/web/quizsummary?detailId=
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
VITE_BASE=/fe-student-release
|
||||
VITE_BASE_API=/manageApi-release
|
||||
VITE_LOGIN_URL=https://u.boe.com/web
|
||||
|
||||
|
||||
VITE_BOE_ONLINE_CLASS_URL=https://u.boe.com/pc-release/course/studyindex?id=
|
||||
VITE_BOE_CASS_DETAIL_URL=https://u.boe.com/pc-release/case/detail?id=
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
* @FilePath: /fe-manage/src/api/config.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import { message } from "ant-design-vue";
|
||||
import {message} from "ant-design-vue";
|
||||
import axios from "axios";
|
||||
import router from "@/router";
|
||||
// import { getCookie } from '../api/method'
|
||||
// const Qs = require("qs");
|
||||
|
||||
@@ -16,61 +17,60 @@ import axios from "axios";
|
||||
|
||||
axios.defaults.withCredentials = true;
|
||||
const http = axios.create({
|
||||
baseURL: process.env.VITE_BASE_API,
|
||||
timeout: 1000 * 15,
|
||||
// headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: { "Content-Type": "application/json" },
|
||||
baseURL: process.env.VITE_BASE_API,
|
||||
timeout: 1000 * 15,
|
||||
// headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: {"Content-Type": "application/json"},
|
||||
});
|
||||
|
||||
http.interceptors.request.use(
|
||||
(config) => {
|
||||
// console.log("config", config);
|
||||
// const token = localStorage.getItem("token");
|
||||
// // const token = getCookie('token')
|
||||
// // console.log('token', token)
|
||||
// if (token) {
|
||||
// config.headers.token = token; //测试1111
|
||||
// } else {
|
||||
// console.log("当前请求页面无token,请执行操作!!!");
|
||||
(config) => {
|
||||
// console.log("config", config);
|
||||
// const token = localStorage.getItem("token");
|
||||
// // const token = getCookie('token')
|
||||
// // console.log('token', token)
|
||||
// if (token) {
|
||||
// config.headers.token = token; //测试1111
|
||||
// } else {
|
||||
// console.log("当前请求页面无token,请执行操作!!!");
|
||||
|
||||
// // 此处测试默认配置token
|
||||
// config.headers.token =
|
||||
// "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzAxNTMxMDMsImV4cCI6MTY3MDE2MDMwMywiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.c937b2d3a59cbab2136fdde55fd38f06bdff041212aab0fa6741bc4be41e28a7";
|
||||
// // }
|
||||
return config;
|
||||
},
|
||||
(err) => {
|
||||
console.log("登陆前拦截", err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
// // 此处测试默认配置token
|
||||
// config.headers.token =
|
||||
// "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzAxNTMxMDMsImV4cCI6MTY3MDE2MDMwMywiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.c937b2d3a59cbab2136fdde55fd38f06bdff041212aab0fa6741bc4be41e28a7";
|
||||
// // }
|
||||
return config;
|
||||
},
|
||||
(err) => {
|
||||
console.log("登陆前拦截", err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
);
|
||||
|
||||
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 {
|
||||
if (code === 1000) {
|
||||
window.open("https://u-pre.boe.com/web/", '_self');
|
||||
// window.open("http://111.231.196.214:12013/manage/login", '_self');
|
||||
}
|
||||
console.log("api %o", msg);
|
||||
(response) => {
|
||||
// console.log('response', response)
|
||||
const {
|
||||
data: {code, msg},
|
||||
} = response;
|
||||
// console.log('code', code)
|
||||
if (code === 0 || code === 200) {
|
||||
return response;
|
||||
} else {
|
||||
if (code === 1000) {
|
||||
process.env.NODE_ENV === 'development' ? router.push({path: 'login'}) : (window.location.href = process.env.VITE_LOGIN_URL)
|
||||
}
|
||||
console.log("api %o", msg);
|
||||
}
|
||||
return response;
|
||||
},
|
||||
function (error) {
|
||||
if (error.message == "timeout of 1ms exceeded") {
|
||||
message.destroy();
|
||||
message.error("请求超时");
|
||||
}
|
||||
console.log("api error %o", error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
return response;
|
||||
},
|
||||
function (error) {
|
||||
if (error.message == "timeout of 1ms exceeded") {
|
||||
message.destroy();
|
||||
message.error("请求超时");
|
||||
}
|
||||
console.log("api error %o", error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
export default http;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
const {defineConfig} = require("@vue/cli-service");
|
||||
|
||||
module.exports = defineConfig({
|
||||
publicPath: process.env.VITE_BASE,
|
||||
publicPath: "/manage",
|
||||
// transpileDependencies: true,
|
||||
devServer: {
|
||||
port: 8080,
|
||||
|
||||
Reference in New Issue
Block a user