fix:前端端口修改

This commit is contained in:
zhangzq
2025-06-25 10:37:30 +08:00
parent 30cc7f94fb
commit a39ac4e6f3
7 changed files with 12 additions and 38 deletions

View File

@@ -5,16 +5,15 @@ import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // getToken from cookie
import { buildMenus } from '@/views/system/menu/menu'
import { filterAsyncRouter } from '@/store/modules/permission'
import i18n from '@/i18n'
NProgress.configure({ showSpinner: false })// NProgress Configuration
const whiteList = ['/login', '/expand']// no redirect whitelist
const whiteList = ['/login']// no redirect whitelist
router.beforeEach((to, from, next) => {
if (to.meta.title) {
// document.title = to.meta.title + ' - ' + Config.title
document.title = i18n.t(to.meta.title)
document.title = to.meta.title
}
NProgress.start()
if (getToken()) {
@@ -59,7 +58,8 @@ export const loadMenus = (next, to) => {
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由
store.dispatch('GenerateRoutes', rewriteRoutes).then(() => {
router.addRoutes(rewriteRoutes) // 动态添加可访问路由表
next({ ...to, replace: true })
})

View File

@@ -21,6 +21,7 @@ service.interceptors.request.use(
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
config.headers['Content-Type'] = 'application/json'
config.headers['Accept-Language'] = window.localStorage.getItem('lang')
return config
},
error => {