1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

fix: 登录页、首页路由调整

This commit is contained in:
ssongliu 2023-03-06 09:26:57 +08:00
parent decb4bb16b
commit c45a19f1e5
15 changed files with 46 additions and 18 deletions

View File

@ -11,7 +11,7 @@ export const checkStatus = (status: number, msg: string): void => {
MsgError(msg ? msg : i18n.global.t('commons.res.notFound')); MsgError(msg ? msg : i18n.global.t('commons.res.notFound'));
break; break;
case 403: case 403:
router.replace({ path: '/' }); router.replace({ path: '/login' });
MsgError(msg ? msg : i18n.global.t('commons.res.forbidden')); MsgError(msg ? msg : i18n.global.t('commons.res.forbidden'));
break; break;
case 500: case 500:

View File

@ -44,13 +44,13 @@ class RequestHttp {
} }
if (data.code == ResultEnum.OVERDUE || data.code == ResultEnum.FORBIDDEN) { if (data.code == ResultEnum.OVERDUE || data.code == ResultEnum.FORBIDDEN) {
router.replace({ router.replace({
path: '/', path: '/login',
}); });
return Promise.reject(data); return Promise.reject(data);
} }
if (data.code == ResultEnum.UNSAFETY) { if (data.code == ResultEnum.UNSAFETY) {
router.replace({ router.replace({
path: '/', path: '/login',
}); });
return data; return data;
} }

View File

@ -1,4 +1,4 @@
// ? 全局不动配置项 只做导出不做修改 // ? 全局不动配置项 只做导出不做修改
// * 首页地址(默认) // * 首页地址(默认)
export const HOME_URL: string = '/home'; export const HOME_URL: string = '/';

View File

@ -17,7 +17,7 @@ router.beforeEach((to, from, next) => {
const globalStore = GlobalStore(); const globalStore = GlobalStore();
if (!globalStore.isLogin) { if (!globalStore.isLogin) {
next({ next({
path: '/', path: '/login',
}); });
NProgress.done(); NProgress.done();
return; return;

View File

@ -25,6 +25,7 @@ const appStoreRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/apps', activeMenu: '/apps',
requiresAuth: false,
}, },
}, },
{ {
@ -35,6 +36,7 @@ const appStoreRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/apps', activeMenu: '/apps',
requiresAuth: false,
}, },
}, },
{ {
@ -45,6 +47,7 @@ const appStoreRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/apps', activeMenu: '/apps',
requiresAuth: false,
}, },
}, },
{ {
@ -55,6 +58,7 @@ const appStoreRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/apps', activeMenu: '/apps',
requiresAuth: false,
}, },
}, },
], ],

View File

@ -25,6 +25,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -35,6 +36,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -44,6 +46,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -53,6 +56,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -62,6 +66,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -71,6 +76,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -80,6 +86,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -89,6 +96,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
{ {
@ -98,6 +106,7 @@ const containerRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/containers', activeMenu: '/containers',
requiresAuth: false,
}, },
}, },
], ],

View File

@ -14,7 +14,9 @@ const cronRouter = {
path: '/cronjobs', path: '/cronjobs',
name: 'Cronjob', name: 'Cronjob',
component: () => import('@/views/cronjob/index.vue'), component: () => import('@/views/cronjob/index.vue'),
meta: {}, meta: {
requiresAuth: false,
},
}, },
], ],
}; };

View File

@ -24,6 +24,7 @@ const databaseRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/databases', activeMenu: '/databases',
requiresAuth: false,
}, },
}, },
{ {
@ -33,6 +34,7 @@ const databaseRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/databases', activeMenu: '/databases',
requiresAuth: false,
}, },
}, },
], ],

View File

@ -17,6 +17,7 @@ const hostRouter = {
component: () => import('@/views/host/file-management/index.vue'), component: () => import('@/views/host/file-management/index.vue'),
meta: { meta: {
title: 'menu.files', title: 'menu.files',
requiresAuth: false,
}, },
}, },
{ {
@ -25,6 +26,7 @@ const hostRouter = {
component: () => import('@/views/host/monitor/index.vue'), component: () => import('@/views/host/monitor/index.vue'),
meta: { meta: {
title: 'menu.monitor', title: 'menu.monitor',
requiresAuth: false,
}, },
}, },
{ {
@ -34,6 +36,7 @@ const hostRouter = {
meta: { meta: {
title: 'menu.terminal', title: 'menu.terminal',
keepAlive: true, keepAlive: true,
requiresAuth: false,
}, },
}, },
], ],

View File

@ -24,6 +24,7 @@ const logsRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/logs', activeMenu: '/logs',
requiresAuth: false,
}, },
}, },
{ {
@ -33,6 +34,7 @@ const logsRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/logs', activeMenu: '/logs',
requiresAuth: false,
}, },
}, },
{ {
@ -42,6 +44,7 @@ const logsRouter = {
hidden: true, hidden: true,
meta: { meta: {
activeMenu: '/logs', activeMenu: '/logs',
requiresAuth: false,
}, },
}, },
], ],

View File

@ -16,6 +16,7 @@ const webSiteRouter = {
component: () => import('@/views/website/website/index.vue'), component: () => import('@/views/website/website/index.vue'),
meta: { meta: {
title: 'menu.website', title: 'menu.website',
requiresAuth: false,
}, },
}, },
{ {
@ -26,6 +27,7 @@ const webSiteRouter = {
props: true, props: true,
meta: { meta: {
activeMenu: '/websites', activeMenu: '/websites',
requiresAuth: false,
}, },
}, },
{ {
@ -34,6 +36,7 @@ const webSiteRouter = {
component: () => import('@/views/website/ssl/index.vue'), component: () => import('@/views/website/ssl/index.vue'),
meta: { meta: {
title: 'menu.ssl', title: 'menu.ssl',
requiresAuth: false,
}, },
}, },
], ],

View File

@ -4,9 +4,9 @@ import { Layout } from '@/routers/constant';
const modules = import.meta.globEager('./modules/*.ts'); const modules = import.meta.globEager('./modules/*.ts');
const homeRouter: RouteRecordRaw = { const homeRouter: RouteRecordRaw = {
path: '/home', path: '/',
component: Layout, component: Layout,
redirect: '/home', redirect: '/',
meta: { meta: {
keepAlive: true, keepAlive: true,
title: 'menu.home', title: 'menu.home',
@ -14,9 +14,12 @@ const homeRouter: RouteRecordRaw = {
}, },
children: [ children: [
{ {
path: '/home', path: '/',
name: 'home', name: 'home',
component: () => import('@/views/home/index.vue'), component: () => import('@/views/home/index.vue'),
meta: {
requiresAuth: true,
},
}, },
], ],
}; };
@ -55,7 +58,7 @@ menuList.unshift(homeRouter);
export const routes: RouteRecordRaw[] = [ export const routes: RouteRecordRaw[] = [
homeRouter, homeRouter,
{ {
path: '/', path: '/login',
name: 'login', name: 'login',
props: true, props: true,
component: () => import('@/views/login/index.vue'), component: () => import('@/views/login/index.vue'),

View File

@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
import { MenuState } from '../interface'; import { MenuState } from '../interface';
import piniaPersistConfig from '@/config/pinia-persist'; import piniaPersistConfig from '@/config/pinia-persist';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
const whiteList = ['/', '/error']; const whiteList = ['/login', '/error'];
export const MenuStore = defineStore({ export const MenuStore = defineStore({
id: 'MenuState', id: 'MenuState',

View File

@ -4,7 +4,7 @@
:buttons="[ :buttons="[
{ {
label: i18n.global.t('menu.home'), label: i18n.global.t('menu.home'),
path: '/home', path: '/',
}, },
]" ]"
/> />

View File

@ -43,17 +43,16 @@
@search="search" @search="search"
> >
<el-table-column type="selection" :selectable="selectable" fix /> <el-table-column type="selection" :selectable="selectable" fix />
<el-table-column :label="$t('commons.table.name')" prop="name" fix> <el-table-column :label="$t('terminal.ip')" prop="addr" fix />
<el-table-column :label="$t('terminal.user')" show-overflow-tooltip prop="user" />
<el-table-column :label="$t('terminal.port')" prop="port" />
<el-table-column :label="$t('commons.table.group')" show-overflow-tooltip prop="groupBelong" />
<el-table-column :label="$t('commons.table.title')" show-overflow-tooltip prop="name">
<template #default="{ row }"> <template #default="{ row }">
<span v-if="row.addr === '127.0.0.1'">{{ $t('terminal.localhost') }}</span> <span v-if="row.addr === '127.0.0.1'">{{ $t('terminal.localhost') }}</span>
<span v-else>{{ row.name }}</span> <span v-else>{{ row.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.group')" show-overflow-tooltip prop="groupBelong" />
<el-table-column :label="$t('terminal.ip')">
<template #default="{ row }">{{ row.addr }}:{{ row.port }}</template>
</el-table-column>
<el-table-column :label="$t('terminal.user')" show-overflow-tooltip prop="user" />
<el-table-column <el-table-column
:label="$t('commons.table.description')" :label="$t('commons.table.description')"
show-overflow-tooltip show-overflow-tooltip