1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +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'));
break;
case 403:
router.replace({ path: '/' });
router.replace({ path: '/login' });
MsgError(msg ? msg : i18n.global.t('commons.res.forbidden'));
break;
case 500:

View File

@ -44,13 +44,13 @@ class RequestHttp {
}
if (data.code == ResultEnum.OVERDUE || data.code == ResultEnum.FORBIDDEN) {
router.replace({
path: '/',
path: '/login',
});
return Promise.reject(data);
}
if (data.code == ResultEnum.UNSAFETY) {
router.replace({
path: '/',
path: '/login',
});
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();
if (!globalStore.isLogin) {
next({
path: '/',
path: '/login',
});
NProgress.done();
return;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,17 +43,16 @@
@search="search"
>
<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 }">
<span v-if="row.addr === '127.0.0.1'">{{ $t('terminal.localhost') }}</span>
<span v-else>{{ row.name }}</span>
</template>
</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
:label="$t('commons.table.description')"
show-overflow-tooltip