漏洞问题修复

This commit is contained in:
BianLzhaoMin 2024-10-08 13:32:24 +08:00
parent 6065429c25
commit be300522e2
6 changed files with 1899 additions and 1460 deletions

2
env/.env.production vendored
View File

@ -5,7 +5,7 @@ VITE_BUILD_MODE = 'prod'
# 线上环境接口地址
# VITE_API_URL = 'https://production.com'
# 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'
# 百度地图key
VITE_AK = "cClgLBaLgGUdQDilX9dGvieL"

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
import axios from 'axios'
import NProgress from 'nprogress'
import { useStore } from 'store/main'
import { ElMessage } from 'element-plus'
const store = useStore()
// const CancelToken = axios.CancelToken
// const source = CancelToken.source()
@ -15,8 +16,12 @@ const service = axios.create({
service.interceptors.request.use(
(config) => {
config.headers['Authorization'] = store.token
return config
const jdCloud = JSON.parse(localStorage.getItem('jdcloud')).token
if (jdCloud) {
config.headers['Authorization'] = jdCloud
}
return config
},
(error) => {
return error
@ -25,10 +30,22 @@ service.interceptors.request.use(
// 响应拦截
service.interceptors.response.use(
(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) => {
console.log('error-异常', error)
}
)

View File

@ -3,6 +3,7 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css'
import locale from 'element-plus/dist/locale/zh-cn.mjs'
import App from './App.vue'
@ -13,7 +14,7 @@ import highcharts from 'highcharts';
import highcharts3d from 'highcharts/highcharts-3d';
// 调用3d图表
highcharts3d(highcharts);
const app = createApp(App)
app.use(createPinia())

View File

@ -1,51 +1,70 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import { ElMessage } from 'element-plus'
import test from './module/test'
import myInfo from './module/myInfo'
const routes: Array<RouteRecordRaw> = [
{
path: '/echarts',
name: 'echartsScreen',
meta: {
title: '',
icon: '',
},
component: () => import('views/echarts/index.vue'),
},{
path: '/',
name: 'index',
redirect:"/screen/sharePlatform",
meta: {
title: '',
icon: '',
},
component: () => import('views/Index.vue'),
children:[]
},
{
path: '/screen/sharePlatform',
name: 'sharePlatform',
meta: {
title: '',
icon: '',
},
component: () => import('views/screen/sharePlatform.vue'),
},
{
path: '/login',
name: 'login',
meta: {
title: '',
icon: '',
},
component: () => import('views/login/index.vue'),
}
{
path: '/echarts',
name: 'echartsScreen',
meta: {
title: '',
icon: '',
},
component: () => import('views/echarts/index.vue'),
}, {
path: '/',
name: 'index',
redirect: "/screen/sharePlatform",
meta: {
title: '',
icon: '',
},
component: () => import('views/Index.vue'),
children: []
},
{
path: '/screen/sharePlatform',
name: 'sharePlatform',
meta: {
title: '',
icon: '',
},
component: () => import('views/screen/sharePlatform.vue'),
},
{
path: '/login',
name: 'login',
meta: {
title: '',
icon: '',
},
component: () => import('views/login/index.vue'),
}
]
const router = createRouter({
// 路由模式
history: createWebHashHistory(),
routes
// 路由模式
history: createWebHashHistory(),
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

View File

@ -2,7 +2,7 @@ export const useStore = defineStore('main', {
state: () => {
return {
loadingFlag: false, //loading控制,
token: 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjVkNjVlMDI1LWVlY2MtNDBiOS1hNGNjLTQ3OTc4ZDQwMzExMiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.npryPWEmJwBaGgfyZ-oQW8oDxDzitAf8v5XUvsokRvu6f1vSOGTer89C9GJ-ER2bZuvO9iAOYCieDV4INVQCvA'
token: ''
}
},
getters: {},