mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-25 03:29:13 +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 {
|
||||
status := constant.StatusRunning
|
||||
// stdout, err := cmd.Exec("systemctl is-active docker")
|
||||
// if string(stdout) != "active\n" || err != nil {
|
||||
// status = constant.Stopped
|
||||
// }
|
||||
stdout, err := cmd.Exec("systemctl is-active docker")
|
||||
if string(stdout) != "active\n" || err != nil {
|
||||
status = constant.Stopped
|
||||
}
|
||||
|
||||
return status
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export const checkStatus = (status: number): void => {
|
||||
MsgError(i18n.global.t('commons.res.notFound'));
|
||||
break;
|
||||
case 403:
|
||||
router.replace({ path: '/login' });
|
||||
router.replace({ path: '/' });
|
||||
MsgError(i18n.global.t('commons.res.forbidden'));
|
||||
break;
|
||||
case 500:
|
||||
|
@ -44,13 +44,13 @@ class RequestHttp {
|
||||
}
|
||||
if (data.code == ResultEnum.OVERDUE || data.code == ResultEnum.FORBIDDEN) {
|
||||
router.replace({
|
||||
path: '/login',
|
||||
path: '/',
|
||||
});
|
||||
return Promise.reject(data);
|
||||
}
|
||||
if (data.code == ResultEnum.UNSAFETY) {
|
||||
router.replace({
|
||||
path: '/login',
|
||||
path: '/',
|
||||
});
|
||||
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();
|
||||
if (!globalStore.isLogin) {
|
||||
next({
|
||||
path: '/login',
|
||||
path: '/',
|
||||
});
|
||||
NProgress.done();
|
||||
return;
|
||||
|
@ -4,9 +4,9 @@ import { Layout } from '@/routers/constant';
|
||||
const modules = import.meta.globEager('./modules/*.ts');
|
||||
|
||||
const homeRouter: RouteRecordRaw = {
|
||||
path: '/',
|
||||
path: '/home',
|
||||
component: Layout,
|
||||
redirect: '/home/index',
|
||||
redirect: '/home',
|
||||
meta: {
|
||||
keepAlive: true,
|
||||
title: 'menu.home',
|
||||
@ -14,7 +14,7 @@ const homeRouter: RouteRecordRaw = {
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/home/index',
|
||||
path: '/home',
|
||||
name: 'home',
|
||||
component: () => import('@/views/home/index.vue'),
|
||||
},
|
||||
@ -55,7 +55,7 @@ menuList.unshift(homeRouter);
|
||||
export const routes: RouteRecordRaw[] = [
|
||||
homeRouter,
|
||||
{
|
||||
path: '/login/:code?',
|
||||
path: '/',
|
||||
name: 'login',
|
||||
props: true,
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
|
@ -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 = ['/login', '/error'];
|
||||
const whiteList = ['/', '/error'];
|
||||
|
||||
export const MenuStore = defineStore({
|
||||
id: 'MenuState',
|
||||
|
@ -4,7 +4,7 @@
|
||||
:buttons="[
|
||||
{
|
||||
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'));
|
||||
let href = window.location.href;
|
||||
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(() => {
|
||||
loading.value = false;
|
||||
|
Loading…
Reference in New Issue
Block a user