优化install安装流程
This commit is contained in:
@@ -7,6 +7,7 @@ import { loading } from '/@/utils/loading'
|
||||
import langAutoLoadMap from '/@/lang/autoload'
|
||||
import { mergeMessage } from '/@/lang/index'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
import { useAdminInfo } from '/@/stores/adminInfo'
|
||||
import { isAdminApp } from '/@/utils/common'
|
||||
import { uniq } from 'lodash-es'
|
||||
|
||||
@@ -16,6 +17,17 @@ const router = createRouter({
|
||||
})
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
// 后台路由鉴权:未登录时访问 /admin 或 /admin/*(除 /admin/login)则跳转登录页
|
||||
const isAdminRoute = to.path === adminBaseRoutePath || to.path.startsWith(adminBaseRoutePath + '/')
|
||||
const isAdminLogin = to.path === adminBaseRoutePath + '/login'
|
||||
if (isAdminRoute && !isAdminLogin) {
|
||||
const adminInfo = useAdminInfo()
|
||||
if (!adminInfo.token) {
|
||||
next({ name: 'adminLogin' })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
NProgress.start()
|
||||
if (!window.existLoading) {
|
||||
|
||||
@@ -27,10 +27,11 @@ const viteConfig = ({ mode }: ConfigEnv): UserConfig => {
|
||||
server: {
|
||||
port: parseInt(VITE_PORT),
|
||||
open: VITE_OPEN != 'false',
|
||||
// 开发时把 /api、/admin 代理到 webman,避免跨域
|
||||
// 开发时把 /api、/admin、/install 代理到 webman,避免跨域
|
||||
proxy: {
|
||||
'/api': { target: 'http://localhost:8787', changeOrigin: true },
|
||||
'/admin': { target: 'http://localhost:8787', changeOrigin: true },
|
||||
'/install': { target: 'http://localhost:8787', changeOrigin: true },
|
||||
},
|
||||
},
|
||||
build: {
|
||||
|
||||
Reference in New Issue
Block a user