fix: 初次打开时路由跳转为 /home/index 问题解决

This commit is contained in:
ssongliu 2023-02-17 17:12:24 +08:00 committed by ssongliu
parent 322513c71f
commit e2c6da3f9e
9 changed files with 16 additions and 16 deletions

View File

@ -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
}

View File

@ -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:

View File

@ -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;
}

View File

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

View File

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

View File

@ -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'),

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 = ['/login', '/error'];
const whiteList = ['/', '/error'];
export const MenuStore = defineStore({
id: 'MenuState',

View File

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

View File

@ -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;