mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
fix: 初次打开时路由跳转为 /home/index 问题解决
This commit is contained in:
parent
322513c71f
commit
e2c6da3f9e
@ -40,10 +40,10 @@ type daemonJsonItem struct {
|
|||||||
|
|
||||||
func (u *DockerService) LoadDockerStatus() string {
|
func (u *DockerService) LoadDockerStatus() string {
|
||||||
status := constant.StatusRunning
|
status := constant.StatusRunning
|
||||||
// stdout, err := cmd.Exec("systemctl is-active docker")
|
stdout, err := cmd.Exec("systemctl is-active docker")
|
||||||
// if string(stdout) != "active\n" || err != nil {
|
if string(stdout) != "active\n" || err != nil {
|
||||||
// status = constant.Stopped
|
status = constant.Stopped
|
||||||
// }
|
}
|
||||||
|
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ export const checkStatus = (status: number): void => {
|
|||||||
MsgError(i18n.global.t('commons.res.notFound'));
|
MsgError(i18n.global.t('commons.res.notFound'));
|
||||||
break;
|
break;
|
||||||
case 403:
|
case 403:
|
||||||
router.replace({ path: '/login' });
|
router.replace({ path: '/' });
|
||||||
MsgError(i18n.global.t('commons.res.forbidden'));
|
MsgError(i18n.global.t('commons.res.forbidden'));
|
||||||
break;
|
break;
|
||||||
case 500:
|
case 500:
|
||||||
|
@ -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: '/login',
|
path: '/',
|
||||||
});
|
});
|
||||||
return Promise.reject(data);
|
return Promise.reject(data);
|
||||||
}
|
}
|
||||||
if (data.code == ResultEnum.UNSAFETY) {
|
if (data.code == ResultEnum.UNSAFETY) {
|
||||||
router.replace({
|
router.replace({
|
||||||
path: '/login',
|
path: '/',
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ? 全局不动配置项 只做导出不做修改
|
// ? 全局不动配置项 只做导出不做修改
|
||||||
|
|
||||||
// * 首页地址(默认)
|
// * 首页地址(默认)
|
||||||
export const HOME_URL: string = '/home/index';
|
export const HOME_URL: string = '/home';
|
||||||
|
@ -17,7 +17,7 @@ router.beforeEach((to, from, next) => {
|
|||||||
const globalStore = GlobalStore();
|
const globalStore = GlobalStore();
|
||||||
if (!globalStore.isLogin) {
|
if (!globalStore.isLogin) {
|
||||||
next({
|
next({
|
||||||
path: '/login',
|
path: '/',
|
||||||
});
|
});
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
return;
|
return;
|
||||||
|
@ -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: '/',
|
path: '/home',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/home/index',
|
redirect: '/home',
|
||||||
meta: {
|
meta: {
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
title: 'menu.home',
|
title: 'menu.home',
|
||||||
@ -14,7 +14,7 @@ const homeRouter: RouteRecordRaw = {
|
|||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/home/index',
|
path: '/home',
|
||||||
name: 'home',
|
name: 'home',
|
||||||
component: () => import('@/views/home/index.vue'),
|
component: () => import('@/views/home/index.vue'),
|
||||||
},
|
},
|
||||||
@ -55,7 +55,7 @@ menuList.unshift(homeRouter);
|
|||||||
export const routes: RouteRecordRaw[] = [
|
export const routes: RouteRecordRaw[] = [
|
||||||
homeRouter,
|
homeRouter,
|
||||||
{
|
{
|
||||||
path: '/login/:code?',
|
path: '/',
|
||||||
name: 'login',
|
name: 'login',
|
||||||
props: true,
|
props: true,
|
||||||
component: () => import('@/views/login/index.vue'),
|
component: () => import('@/views/login/index.vue'),
|
||||||
|
@ -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 = ['/login', '/error'];
|
const whiteList = ['/', '/error'];
|
||||||
|
|
||||||
export const MenuStore = defineStore({
|
export const MenuStore = defineStore({
|
||||||
id: 'MenuState',
|
id: 'MenuState',
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
:buttons="[
|
:buttons="[
|
||||||
{
|
{
|
||||||
label: i18n.global.t('menu.home'),
|
label: i18n.global.t('menu.home'),
|
||||||
path: '/home/index',
|
path: '/home',
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
|
@ -231,7 +231,7 @@ const onSavePort = async (formEl: FormInstance | undefined, key: string, val: an
|
|||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
let href = window.location.href;
|
let href = window.location.href;
|
||||||
let ip = href.split('//')[1].split(':')[0];
|
let ip = href.split('//')[1].split(':')[0];
|
||||||
window.open(`${href.split('//')[0]}//${ip}:${val}/login`, '_self');
|
window.open(`${href.split('//')[0]}//${ip}:${val}/`, '_self');
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user