fix:调整端口和调整前端路由

pull/180/head
Layne Cai 4 years ago
parent 5d7bf376c2
commit 37e8b1a478

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9200
port: 12200
# Spring
spring:

@ -1,6 +1,6 @@
# Tomcat
server:
port: 8080
port: 12080
# Spring
spring:
@ -35,7 +35,7 @@ spring:
eager: true
transport:
# 控制台地址
dashboard: 127.0.0.1:8718
dashboard: 127.0.0.1:12718
# nacos配置持久化
datasource:
ds1:

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9300
port: 12300
# Spring
spring:

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9202
port: 12202
# Spring
spring:

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9203
port: 12203
# Spring
spring:

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9201
port: 12201
# Spring
spring:

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9100
port: 12100
# Spring
spring:

@ -6,3 +6,6 @@ VITE_APP_ENV = 'development'
# pinn个人管理系统/开发环境
VITE_APP_BASE_API = '/dev-api'
#路由守卫的虚拟目录
VITE_APP_BASE_DIR = '/dConsole'

@ -7,5 +7,8 @@ VITE_APP_ENV = 'production'
# pinn个人管理系统/生产环境
VITE_APP_BASE_API = '/prod-api'
#路由守卫的虚拟目录
VITE_APP_BASE_DIR = '/pConsole'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 16 KiB

@ -9,15 +9,16 @@ import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/auth-redirect', '/bind', '/register'];
const baseDir = import.meta.env.VITE_APP_BASE_DIR;
const whiteList = [baseDir+'/login', baseDir+'/auth-redirect', baseDir+'/bind', baseDir+'/register'];
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
if (to.path === baseDir+'/login') {
next({ path: baseDir+'/' })
NProgress.done()
} else {
if (store.getters.roles.length === 0) {
@ -37,7 +38,7 @@ router.beforeEach((to, from, next) => {
}).catch(err => {
store.dispatch('LogOut').then(() => {
ElMessage.error(err)
next({ path: '/' })
next({ path: baseDir+'/' })
})
})
} else {
@ -50,7 +51,7 @@ router.beforeEach((to, from, next) => {
// 在免登录白名单,直接进入
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
next( baseDir + `/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done()
}
}

@ -21,10 +21,12 @@ import Layout from '@/layout'
}
*/
const baseDir = import.meta.env.VITE_APP_BASE_DIR;
// 公共路由
export const constantRoutes = [
{
path: '/redirect',
path: baseDir+'/redirect',
component: Layout,
hidden: true,
children: [
@ -35,29 +37,29 @@ export const constantRoutes = [
]
},
{
path: '/login',
path: baseDir+'/login',
component: () => import('@/views/login'),
hidden: true
},
{
path: '/register',
path: baseDir+'/register',
component: () => import('@/views/register'),
hidden: true
},
{
path: "/:pathMatch(.*)*",
path: baseDir+"/:pathMatch(.*)*",
component: () => import('@/views/error/404'),
hidden: true
},
{
path: '/401',
path: baseDir+'/401',
component: () => import('@/views/error/401'),
hidden: true
},
{
path: '',
path: baseDir+'',
component: Layout,
redirect: '/index',
redirect: baseDir+'/index',
children: [
{
path: '/index',
@ -68,7 +70,7 @@ export const constantRoutes = [
]
},
{
path: '/user',
path: baseDir+'/user',
component: Layout,
hidden: true,
redirect: 'noredirect',
@ -82,7 +84,7 @@ export const constantRoutes = [
]
},
{
path: '/system/user-auth',
path: baseDir+'/system/user-auth',
component: Layout,
hidden: true,
children: [
@ -95,7 +97,7 @@ export const constantRoutes = [
]
},
{
path: '/system/role-auth',
path: baseDir+'/system/role-auth',
component: Layout,
hidden: true,
children: [
@ -108,7 +110,7 @@ export const constantRoutes = [
]
},
{
path: '/system/dict-data',
path: baseDir+'/system/dict-data',
component: Layout,
hidden: true,
children: [

@ -5,12 +5,12 @@ import createVitePlugins from './vite/plugins'
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd())
const { VITE_APP_ENV } = env
const { VITE_APP_ENV, VITE_APP_BASE_DIR } = env
return {
// 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
base: VITE_APP_ENV === 'production' ? '/' : '/',
base: VITE_APP_ENV === 'production' ? VITE_APP_BASE_DIR : VITE_APP_BASE_DIR,
plugins: createVitePlugins(env, command === 'build'),
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
@ -25,13 +25,13 @@ export default defineConfig(({ mode, command }) => {
},
// vite 相关配置
server: {
port: 80,
port: 12008,
host: true,
open: true,
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
target: 'http://localhost:8080',
target: 'http://localhost:12080',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
}

Loading…
Cancel
Save