mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 11:26:45 +08:00
Merge branch 'develop' into 'pre-dev'
# Conflicts: # src/components/NavLeft.vue
This commit is contained in:
72
src/api/confign.js
Normal file
72
src/api/confign.js
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
import {message} from "ant-design-vue";
|
||||
import axios from "axios";
|
||||
import router from "@/router";
|
||||
import Cookies from 'vue-cookies'
|
||||
// import { getCookie } from '../api/method'
|
||||
// const Qs = require("qs");
|
||||
|
||||
// axios.defaults.headers.post["Content-Type"] =
|
||||
// "application/x-www-form-urlencoded";
|
||||
// export const FILE_UPLOAD_URL = process.env.VUE_APP_BASE_API + '/file/upload'
|
||||
// export const BATCH_IMPORT_SCORE = process.env.VUE_APP_BASE_API + '/admin/offcourse/batchImportScore'
|
||||
axios.defaults.withCredentials = true;
|
||||
const http = axios.create({
|
||||
baseURL: '/userbasic',
|
||||
timeout: 1000 * 15,
|
||||
headers: {"Content-Type": "application/json",},
|
||||
});
|
||||
|
||||
http.interceptors.request.use(
|
||||
(config) => {
|
||||
const token = Cookies.get("token")
|
||||
if (token) {
|
||||
config.headers.token = token; //测试1111
|
||||
} else{
|
||||
message.error('未获取到登录信息,请先登录')
|
||||
return window.location.href='https://u-pre.boe.com/web/';
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(err) => {
|
||||
console.log("登陆前拦截", err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
);
|
||||
|
||||
http.interceptors.response.use(
|
||||
(response) => {
|
||||
// console.log('response', response)
|
||||
const {
|
||||
data: {code},
|
||||
} = response;
|
||||
if (code === 0 || code === 200) {
|
||||
return response.data?response.data:response;
|
||||
}
|
||||
if(code==500){
|
||||
return message.error('请求失败');
|
||||
}
|
||||
if(code==601){
|
||||
message.error('token过期请重新登陆');
|
||||
return window.location.href='https://u-pre.boe.com/web/';
|
||||
}
|
||||
if (code === 1000) {
|
||||
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: 'login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL)
|
||||
return Promise.reject(response);
|
||||
}
|
||||
// show && message.error(msg);
|
||||
// console.log("api %o", msg);
|
||||
// return Promise.reject(response);
|
||||
return response
|
||||
},
|
||||
function (error) {
|
||||
if (error.message == "timeout of 1ms exceeded") {
|
||||
message.destroy();
|
||||
message.error("请求超时");
|
||||
}
|
||||
console.log("api error %o", error);
|
||||
return message.error(error.message);
|
||||
}
|
||||
);
|
||||
|
||||
export default http;
|
||||
74
src/api/configz.js
Normal file
74
src/api/configz.js
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
import {message} from "ant-design-vue";
|
||||
import axios from "axios";
|
||||
import router from "@/router";
|
||||
import Cookies from 'vue-cookies'
|
||||
// import { getCookie } from '../api/method'
|
||||
// const Qs = require("qs");
|
||||
|
||||
// axios.defaults.headers.post["Content-Type"] =
|
||||
// "application/x-www-form-urlencoded";
|
||||
// export const FILE_UPLOAD_URL = process.env.VUE_APP_BASE_API + '/file/upload'
|
||||
// export const BATCH_IMPORT_SCORE = process.env.VUE_APP_BASE_API + '/admin/offcourse/batchImportScore'
|
||||
axios.defaults.withCredentials = true;
|
||||
const http = axios.create({
|
||||
baseURL: '/report',
|
||||
timeout: 1000 * 15,
|
||||
// headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: {"Content-Type": "application/json"},
|
||||
});
|
||||
|
||||
http.interceptors.request.use(
|
||||
(config) => {
|
||||
const token = Cookies.get("token")
|
||||
if (token) {
|
||||
config.headers.token = token; //测试1111
|
||||
} else{
|
||||
message.error('未获取到登录信息,请先登录')
|
||||
return window.location.href='https://u-pre.boe.com/web/';
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(err) => {
|
||||
console.log("登陆前拦截", err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
);
|
||||
|
||||
http.interceptors.response.use(
|
||||
(response) => {
|
||||
// console.log('response', response)
|
||||
const {
|
||||
data: {code},
|
||||
} = response;
|
||||
// console.log('code', response)
|
||||
if (code === 0 || code === 200) {
|
||||
return response.data?response.data:response;
|
||||
}
|
||||
if(code==500){
|
||||
return message.error('请求失败');
|
||||
}
|
||||
if(code==601){
|
||||
message.error('token过期请重新登陆');
|
||||
return window.location.href='https://u-pre.boe.com/web/';
|
||||
}
|
||||
if (code === 1000) {
|
||||
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: 'login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL)
|
||||
return Promise.reject(response);
|
||||
}
|
||||
// show && message.error(msg);
|
||||
// console.log("api %o", msg);
|
||||
// return Promise.reject(response);
|
||||
return response
|
||||
},
|
||||
function (error) {
|
||||
if (error.message == "timeout of 1ms exceeded") {
|
||||
message.destroy();
|
||||
message.error("请求超时");
|
||||
}
|
||||
console.log("api error %o", error);
|
||||
return message.error(error.message);
|
||||
}
|
||||
);
|
||||
|
||||
export default http;
|
||||
25
src/api/indexOvervoew.js
Normal file
25
src/api/indexOvervoew.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import http from "./configz";
|
||||
import https from './confign'
|
||||
// 导出案例接口
|
||||
// export const boeuCaseExport = (obj,options) => http.get('/boeu/case/export', { params: obj },options)
|
||||
|
||||
//概览页面考试列表请求接口
|
||||
export const boeuExamPageList = (obj) => http.post('/boeu/exam/pageList', obj)
|
||||
//概览页面案例列表请求接口
|
||||
export const boeuCasePageList = (obj) => http.post('/boeu/case/pageList', obj)
|
||||
// 请求组织接口
|
||||
export const userGetUserOrg = (obj) => https.post('/user/getUserOrg', obj)
|
||||
// 请求所属组织接口
|
||||
export const userInfo = (obj) => https.post('/user/info', obj)
|
||||
// 课程列表接口
|
||||
export const boeuCoursePageList = (obj) => http.post('/boeu/course/pageList', obj)
|
||||
// 授课列表
|
||||
export const boeuTeachingPageList = (obj) => http.post('/boeu/teaching/pageList', obj)
|
||||
// 学习路径图页面
|
||||
export const boeuRoterPageList = (obj) => http.post('/boeu/router/pageList', obj)
|
||||
// 项目列表
|
||||
export const boeuProjectPageList = (obj) => http.post('/boeu/project/pageList', obj)
|
||||
// 学习数据列表
|
||||
export const boeuStudyDataPageList = (obj) => http.post('/boeu/studyData/pageList', obj)
|
||||
// 概览页面 tab头数据
|
||||
export const boeuAllTotal = (obj) => http.get('/boeu/all/total', obj)
|
||||
Reference in New Issue
Block a user