漏洞问题修复
This commit is contained in:
parent
6065429c25
commit
be300522e2
|
|
@ -5,7 +5,7 @@ VITE_BUILD_MODE = 'prod'
|
||||||
# 线上环境接口地址
|
# 线上环境接口地址
|
||||||
# VITE_API_URL = 'https://production.com'
|
# VITE_API_URL = 'https://production.com'
|
||||||
# VITE_API_URL = 'https://test-rental.zhgkxt.com/proxy'
|
# VITE_API_URL = 'https://test-rental.zhgkxt.com/proxy'
|
||||||
VITE_API_URL = 'https://z.csgmall.com.cn/proxy'
|
VITE_API_URL = 'https://test-rental.zhgkxt.com/proxy'
|
||||||
# VITE_API_URL = 'http://localhost:8080/proxy'
|
# VITE_API_URL = 'http://localhost:8080/proxy'
|
||||||
# 百度地图key
|
# 百度地图key
|
||||||
VITE_AK = "cClgLBaLgGUdQDilX9dGvieL"
|
VITE_AK = "cClgLBaLgGUdQDilX9dGvieL"
|
||||||
|
|
|
||||||
3226
pnpm-lock.yaml
3226
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -3,6 +3,7 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import NProgress from 'nprogress'
|
import NProgress from 'nprogress'
|
||||||
import { useStore } from 'store/main'
|
import { useStore } from 'store/main'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
// const CancelToken = axios.CancelToken
|
// const CancelToken = axios.CancelToken
|
||||||
// const source = CancelToken.source()
|
// const source = CancelToken.source()
|
||||||
|
|
@ -15,8 +16,12 @@ const service = axios.create({
|
||||||
|
|
||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
config.headers['Authorization'] = store.token
|
const jdCloud = JSON.parse(localStorage.getItem('jdcloud')).token
|
||||||
return config
|
if (jdCloud) {
|
||||||
|
config.headers['Authorization'] = jdCloud
|
||||||
|
}
|
||||||
|
|
||||||
|
return config
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
return error
|
return error
|
||||||
|
|
@ -25,10 +30,22 @@ service.interceptors.request.use(
|
||||||
// 响应拦截
|
// 响应拦截
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
(res) => {
|
(res) => {
|
||||||
return res.data
|
const code = res.data.code || 200
|
||||||
|
if (code === 401) {
|
||||||
|
ElMessage({
|
||||||
|
showClose: false,
|
||||||
|
message: '登录状态已过期请重新登录',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
window.location.href = 'https://test-rental.zhgkxt.com/mall-view/'
|
||||||
|
} else {
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|
||||||
console.log('error-异常', error)
|
console.log('error-异常', error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import ElementPlus from 'element-plus';
|
import ElementPlus from 'element-plus';
|
||||||
|
import 'element-plus/dist/index.css'
|
||||||
import locale from 'element-plus/dist/locale/zh-cn.mjs'
|
import locale from 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
|
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
|
@ -13,7 +14,7 @@ import highcharts from 'highcharts';
|
||||||
import highcharts3d from 'highcharts/highcharts-3d';
|
import highcharts3d from 'highcharts/highcharts-3d';
|
||||||
// 调用3d图表
|
// 调用3d图表
|
||||||
highcharts3d(highcharts);
|
highcharts3d(highcharts);
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
app.use(createPinia())
|
app.use(createPinia())
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,70 @@
|
||||||
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
|
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
import test from './module/test'
|
import test from './module/test'
|
||||||
import myInfo from './module/myInfo'
|
import myInfo from './module/myInfo'
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/echarts',
|
path: '/echarts',
|
||||||
name: 'echartsScreen',
|
name: 'echartsScreen',
|
||||||
meta: {
|
meta: {
|
||||||
title: '',
|
title: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
},
|
},
|
||||||
component: () => import('views/echarts/index.vue'),
|
component: () => import('views/echarts/index.vue'),
|
||||||
},{
|
}, {
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'index',
|
name: 'index',
|
||||||
redirect:"/screen/sharePlatform",
|
redirect: "/screen/sharePlatform",
|
||||||
meta: {
|
meta: {
|
||||||
title: '',
|
title: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
},
|
},
|
||||||
component: () => import('views/Index.vue'),
|
component: () => import('views/Index.vue'),
|
||||||
children:[]
|
children: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/screen/sharePlatform',
|
path: '/screen/sharePlatform',
|
||||||
name: 'sharePlatform',
|
name: 'sharePlatform',
|
||||||
meta: {
|
meta: {
|
||||||
title: '',
|
title: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
},
|
},
|
||||||
component: () => import('views/screen/sharePlatform.vue'),
|
component: () => import('views/screen/sharePlatform.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
name: 'login',
|
name: 'login',
|
||||||
meta: {
|
meta: {
|
||||||
title: '',
|
title: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
},
|
},
|
||||||
component: () => import('views/login/index.vue'),
|
component: () => import('views/login/index.vue'),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
// 路由模式
|
// 路由模式
|
||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes
|
routes
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
|
const jdCloud = JSON.parse(localStorage.getItem('jdcloud')).token
|
||||||
|
|
||||||
|
// console.log('jdCloud', jdCloud)
|
||||||
|
if (jdCloud) {
|
||||||
|
next()
|
||||||
|
} else {
|
||||||
|
ElMessage({
|
||||||
|
showClose: false,
|
||||||
|
message: '当前未登录,请登录..',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = 'https://test-rental.zhgkxt.com/mall-view/'
|
||||||
|
}, 1500)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
export default router
|
export default router
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ export const useStore = defineStore('main', {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
loadingFlag: false, //loading控制,
|
loadingFlag: false, //loading控制,
|
||||||
token: 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjVkNjVlMDI1LWVlY2MtNDBiOS1hNGNjLTQ3OTc4ZDQwMzExMiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.npryPWEmJwBaGgfyZ-oQW8oDxDzitAf8v5XUvsokRvu6f1vSOGTer89C9GJ-ER2bZuvO9iAOYCieDV4INVQCvA'
|
token: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue