初始化项目

This commit is contained in:
2026-03-23 22:28:20 +08:00
parent 4ff69624cd
commit 8c66e12320
84 changed files with 989 additions and 60 deletions

View File

@@ -8,6 +8,7 @@ import { PageEnum } from '@jeesite/core/enums/pageEnum';
import { t } from '@jeesite/core/hooks/web/useI18n';
const modules = import.meta.glob('./modules/**/*.ts', { eager: true });
const bigScreenModules = import.meta.glob('../../layouts/screen/welcome/**/index.vue');
const routeModuleList: AppRouteModule[] = [];
@@ -47,60 +48,56 @@ const ModPwdRoute: AppRouteModule = {
},
};
function toPascalCase(value: string) {
return value
.split(/[-_/]+/)
.filter(Boolean)
.map((item) => item.charAt(0).toUpperCase() + item.slice(1))
.join('');
}
function createBigScreenChildren(): AppRouteRecordRaw[] {
return Object.entries(bigScreenModules)
.map(([filePath, component]) => {
const matched = filePath.match(/screen\/welcome(?:\/([^/]+))?\/index\.vue$/);
if (!matched) return null;
const segment = matched[1]?.toLowerCase() || 'welcome';
return {
path: segment,
name: `Screen${toPascalCase(segment)}`,
component,
meta: {
title: t('routes.screen.bigScreen'),
},
} as AppRouteRecordRaw;
})
.filter((route): route is AppRouteRecordRaw => !!route)
.sort((a, b) => {
if (a.path === 'welcome') return -1;
if (b.path === 'welcome') return 1;
return a.path.localeCompare(b.path);
});
}
const bigScreenChildren = createBigScreenChildren();
const BigScreenRoute: AppRouteRecordRaw = {
path: '/bigScreen',
name: 'BigScreen',
component: SCREEN_LAYOUT,
redirect: '/bigScreen/welcome',
redirect: `/bigScreen/${bigScreenChildren[0]?.path || 'welcome'}`,
meta: {
title: t('routes.screen.bigScreen'),
ignoreAuth: false,
},
children: [
{
path: 'welcome',
name: 'ScreenWelcome',
component: () => import('@jeesite/core/layouts/views/screen/welcome/index.vue'),
meta: {
title: t('routes.screen.bigScreen'),
},
},
{
path: 'home',
name: 'ScreenHome',
component: () => import('@jeesite/core/layouts/views/screen/welcome/Home/index.vue'),
meta: {
title: t('routes.screen.bigScreen'),
},
},
{
path: 'work',
name: 'ScreenWork',
component: () => import('@jeesite/core/layouts/views/screen/welcome/Work/index.vue'),
meta: {
title: t('routes.screen.bigScreen'),
},
},
{
path: 'erp',
name: 'ScreenErp',
component: () => import('@jeesite/core/layouts/views/screen/welcome/Erp/index.vue'),
meta: {
title: t('routes.screen.bigScreen'),
},
},
{
path: 'sys',
name: 'ScreenSys',
component: () => import('@jeesite/core/layouts/views/screen/welcome/Sys/index.vue'),
meta: {
title: t('routes.screen.bigScreen'),
},
},
...bigScreenChildren,
{
path: 'setting',
name: 'ScreenSetting',
component: () => import('@jeesite/core/layouts/views/screen/setting/index.vue'),
component: () => import('@jeesite/core/layouts/screen/setting/index.vue'),
meta: {
title: t('routes.screen.bigSetting'),
},
@@ -109,4 +106,12 @@ const BigScreenRoute: AppRouteRecordRaw = {
};
// Basic routing without permission
export const basicRoutes = [LoginRoute, ModPwdRoute, RootRoute, BigScreenRoute, ...mainOutRoutes, REDIRECT_ROUTE, PAGE_NOT_FOUND_ROUTE];
export const basicRoutes = [
LoginRoute,
ModPwdRoute,
RootRoute,
BigScreenRoute,
...mainOutRoutes,
REDIRECT_ROUTE,
PAGE_NOT_FOUND_ROUTE,
];