前端初始化
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
PUBLIC_KEY: `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKwvimHNGEiyV5L73llAeTv8O/3c9KLZLjNDpzNVOvzowk1MJySdSh6BiZPFXGLJ49Rrp/0U1L68ZCvC2Zv07YYTrr7Bd8o8lKB9HlUqcJo/seIHrLCLl2ePuLn+NYtIM4xxbbvAOdy5Ep/QbK4aWz8G7vsx8pctijLksYKNBQyQIDAQAB`,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import {fileType} from "./fileType";
|
||||
|
||||
export const downloadFile = (res) => {
|
||||
let file_name = decodeURI(res.headers["content-disposition"]).split('=').pop();
|
||||
let file_type = file_name.split('.').pop();
|
||||
let blobData = new Blob([res.data], {type: fileType[file_type]});
|
||||
let downloadUrl = window.URL.createObjectURL(blobData);
|
||||
let anchor = document.createElement("a");
|
||||
anchor.href = downloadUrl;
|
||||
anchor.download = file_name;
|
||||
anchor.click();
|
||||
window.URL.revokeObjectURL(blobData);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export const fileType = {
|
||||
pdf: 'application/pdf',
|
||||
xls: 'application/vnd.ms-excel',
|
||||
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
doc: 'application/msword',
|
||||
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
ppt: 'application/vnd.ms-powerpoint',
|
||||
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
png: 'image/png',
|
||||
jpg: 'image/jpeg',
|
||||
rar: 'application/x-rar',
|
||||
zip: 'application/zip',
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
export const BASE_URL = {
|
||||
// LOGIN_URL : "http://192.168.144.29:9090/cas/login?service=http://192.168.144.22:9966/login?loginType=1",
|
||||
// LOGOUT_URL : "http://192.168.144.29:9090/cas/logout?service=http://192.168.144.22:9966/login?loginType=1",
|
||||
|
||||
//内部测试
|
||||
// BASE_CHANGAN:'http://192.168.144.29:9090/cas',
|
||||
BASE_LOCAL:'http://127.0.0.1:8080',
|
||||
BASE_LOCAL_IMG:'http://127.0.0.1:8080',
|
||||
|
||||
// //企业测试
|
||||
// BASE_CHANGAN:'https://caddmuat.changan.com.cn/cas',
|
||||
// BASE_LOCAL:'https://caddmuat.changan.com.cn/mi',
|
||||
// BASE_LOCAL_IMG:'https://caddmuat.changan.com.cn',
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import Quill from "quill";
|
||||
|
||||
let Parchment = Quill.import("parchment");
|
||||
|
||||
class lineHeightAttributor extends Parchment.Attributor.Style {
|
||||
}
|
||||
|
||||
const lineHeightStyle = new lineHeightAttributor("lineHeight", "line-height", {
|
||||
scope: Parchment.Scope.INLINE,
|
||||
whitelist: ["initial", "1", "1.5", "1.75", "2", "3", "4"]
|
||||
});
|
||||
|
||||
export {lineHeightStyle};
|
||||
@@ -0,0 +1,128 @@
|
||||
[
|
||||
{
|
||||
"id": "37SSNVGSP9",
|
||||
"parentId": "AVL9YSB7ZF",
|
||||
"label": "菜单管理",
|
||||
"href": "/system/menu",
|
||||
"icon": "/api/home/pic//20211208163844522.png"
|
||||
},
|
||||
{
|
||||
"id": "6F46UACEMG",
|
||||
"parentId": "SBME88VTUD",
|
||||
"label": "整体市场价格分析",
|
||||
"href": "overall",
|
||||
"icon": "/api/home/pic//20211209090648732.png"
|
||||
},
|
||||
{
|
||||
"id": "KF8L94BZC4",
|
||||
"parentId": "8SJZZFCZJS",
|
||||
"label": "车型量价查询",
|
||||
"href": "/models/modelsquery",
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"id": "PNK5Z3REGN",
|
||||
"parentId": "6F46UACEMG",
|
||||
"label": "价格趋势",
|
||||
"href": "/overall/opricetrend",
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"id": "UZHN9Z835U",
|
||||
"parentId": "XBFBR7UADZ",
|
||||
"label": "报告列表",
|
||||
"href": "/report/list",
|
||||
"icon": "/api/home/pic//20211209090610575.png"
|
||||
},
|
||||
{
|
||||
"id": "XBFBR7UADZ",
|
||||
"parentId": "6f6fafb4a7",
|
||||
"label": "报告板块",
|
||||
"href": "/report/list",
|
||||
"icon": "/api/home/pic//20211116142717856.png"
|
||||
},
|
||||
{
|
||||
"id": "8SJZZFCZJS",
|
||||
"parentId": "SBME88VTUD",
|
||||
"label": "车型市场价格分析",
|
||||
"href": "models",
|
||||
"icon": "/api/home/pic//20211209090657836.png"
|
||||
},
|
||||
{
|
||||
"id": "A5DMDVJFHF",
|
||||
"parentId": "AVL9YSB7ZF",
|
||||
"label": "角色管理",
|
||||
"href": "/system/role",
|
||||
"icon": "/api/home/pic//20211117143545387.png"
|
||||
},
|
||||
{
|
||||
"id": "ASPYP4MLJZ",
|
||||
"parentId": "XBFBR7UADZ",
|
||||
"label": "报告管理",
|
||||
"href": "/report/manager",
|
||||
"icon": "/api/home/pic//20211209090620133.png"
|
||||
},
|
||||
{
|
||||
"id": "AVL9YSB7ZF",
|
||||
"parentId": "6f6fafb4a7",
|
||||
"label": "系统管理",
|
||||
"href": "/system/menu",
|
||||
"icon": "/api/home/pic//20211117143522174.png"
|
||||
},
|
||||
{
|
||||
"id": "JM54MJCN3X",
|
||||
"parentId": "6F46UACEMG",
|
||||
"label": "分价格段市占率",
|
||||
"href": "/overall/occupancy",
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"id": "KTBEN9KFFW",
|
||||
"parentId": "8SJZZFCZJS",
|
||||
"label": "价格趋势",
|
||||
"href": "/models/mpricetrend",
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"id": "5AFTKUQ2Q5",
|
||||
"parentId": "8SJZZFCZJS",
|
||||
"label": "车型对比分析",
|
||||
"href": "/models/contrast",
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"id": "CC5ZS54PPK",
|
||||
"parentId": "AVL9YSB7ZF",
|
||||
"label": "用户管理",
|
||||
"href": "/system/user",
|
||||
"icon": "/api/home/pic//20211116145901232.png"
|
||||
},
|
||||
{
|
||||
"id": "KFP3AXHFP9",
|
||||
"parentId": "6F46UACEMG",
|
||||
"label": "细分市场竞争格局",
|
||||
"href": "/overall/marketpattern",
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"id": "SBME88VTUD",
|
||||
"parentId": "6f6fafb4a7",
|
||||
"label": "价格板块",
|
||||
"href": "/overall/opricetrend",
|
||||
"icon": "/api/home/pic//20211116153747821.png"
|
||||
},
|
||||
{
|
||||
"id": "2EDDH5GWZJ",
|
||||
"parentId": "8SJZZFCZJS",
|
||||
"label": "车型竞争格局",
|
||||
"href": "/models/modelspattern",
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"id": "6f6fafb4a7",
|
||||
"parentId": "0",
|
||||
"label": "顶级菜单",
|
||||
"href": null,
|
||||
"icon": null
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,104 @@
|
||||
import axios from 'axios';
|
||||
import {Message, Loading} from 'element-ui';
|
||||
import store from '../store';
|
||||
import router from "../router";
|
||||
import {BASE_URL} from "../utils/http";
|
||||
|
||||
// 记录请求个数、加载
|
||||
let count = 0, loading = null;
|
||||
|
||||
// axios实例化
|
||||
const instance = axios.create({
|
||||
baseURL: '/library',
|
||||
// timeout: 60000,
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache',
|
||||
'Pragma': 'no-cache'
|
||||
}
|
||||
});
|
||||
// 添加请求拦截器
|
||||
instance.interceptors.request.use(function (config) {
|
||||
// 在发送请求之前做些什么
|
||||
loading = Loading.service(null);
|
||||
count++;
|
||||
store.commit('saveIsLoading', true);
|
||||
return config;
|
||||
}, function (error) {
|
||||
// 对请求错误做些什么
|
||||
count--;
|
||||
if (count < 1) {
|
||||
loading.close();
|
||||
store.commit('saveIsLoading', false);
|
||||
}
|
||||
Message.error(error);
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
// 添加响应拦截器
|
||||
instance.interceptors.response.use(function (response) {
|
||||
// 对响应数据做点什么
|
||||
count--;
|
||||
if (count < 1) {
|
||||
loading.close();
|
||||
store.commit('saveIsLoading', false);
|
||||
}
|
||||
|
||||
// 登录超时
|
||||
if (response.data.respCode === '401') {
|
||||
store.commit('saveUserInfo', null);
|
||||
router.push('/login');
|
||||
Message.error('登录超时过期');
|
||||
// var url = 'http://192.168.144.22:9966/login?loginType=1'
|
||||
// // var url = 'http://10.64.23.30:7766/home'
|
||||
//
|
||||
// return window.open('http://192.168.144.29:9090/cas/login?service='+url, '_self');
|
||||
// return window.open('https://caddmuat.changan.com.cn/cas/login?service='+url, '_self');
|
||||
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
|
||||
}
|
||||
|
||||
// 请求成功
|
||||
if (response.status === 200) {
|
||||
if (response.data.respCode === "0") {
|
||||
return response.data;
|
||||
} else if (response.data.respCode === "-1") {
|
||||
Message.error(response.data.message);
|
||||
return Promise.reject(response);
|
||||
} else {
|
||||
return response;
|
||||
}
|
||||
} else { // 请求失败
|
||||
Message.error(response.data.message);
|
||||
return Promise.reject(response);
|
||||
}
|
||||
|
||||
}, function (error) {
|
||||
// 对响应错误做点什么
|
||||
count--;
|
||||
if (count < 1) {
|
||||
loading.close();
|
||||
store.commit('saveIsLoading', false);
|
||||
}
|
||||
|
||||
// 登录过期
|
||||
if (error.response.status === 401) {
|
||||
store.commit('saveUserInfo', null);
|
||||
router.push('/login');
|
||||
Message.error('登录超时过期');
|
||||
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
|
||||
// var url = 'http://192.168.144.22:9966/login?loginType=1'
|
||||
// // var url = 'http://10.64.23.30:7766/home'
|
||||
//
|
||||
// return window.open('http://192.168.144.29:9090/cas/login?service='+url, '_self');
|
||||
// // return window.open('https://caddmuat.changan.com.cn/cas/login?service='+url, '_self');
|
||||
}
|
||||
|
||||
// 判断超时
|
||||
if (error.code === "ECONNABORTED" && error.message.indexOf('timeout') !== -1 && !error.config._retry) {
|
||||
Message.error(error.message);
|
||||
} else {
|
||||
Message.error(error.message);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
export {instance, loading};
|
||||
+6444
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user