大屏项目初始化

This commit is contained in:
2026-03-07 19:08:40 +08:00
parent b7bfdfd2bc
commit a052721622
22 changed files with 1203 additions and 85 deletions

View File

@@ -3,10 +3,46 @@ import Login from '@/views/Login.vue'
import Page404 from '@/views/error/404.vue'
import Layout from '@/components/Layout/index.vue'
import Dashboard from '@/views/desktop/index.vue'
import bigScreen from '@/views/screen/index.vue'
import BigScreen from '@/views/screen/index.vue'
import BigScreenWork from '@/views/screen/Work/index.vue'
import { useUserStore } from '@/stores/user'
import { ElMessage } from 'element-plus'
const bigScreenModules = import.meta.glob('../views/screen/**/{index,list}.vue', {
eager: false,
import: 'default'
})
const generateBigScreenRoutes = () => {
const routes = []
Object.entries(bigScreenModules).forEach(([filePath, module]) => {
if (filePath === '../views/screen/index.vue') return;
const routePath = filePath
.replace('../views', '')
.replace('.vue', '')
.toLowerCase();
const finalPath = routePath;
const routeName = finalPath
.split('/')
.filter(Boolean)
.map(seg => seg.charAt(0).toUpperCase() + seg.slice(1))
.join('')
|| 'SystemRoleIndex';
routes.push({
path: finalPath,
name: routeName,
component: module,
meta: { requiresAuth: true }
})
})
return routes
}
const modules = import.meta.glob('../views/**/{index,list}.vue', {
eager: false,
import: 'default'
@@ -18,10 +54,10 @@ const generateRoutes = () => {
Object.entries(modules).forEach(([filePath, module]) => {
const excludePaths = [
'views/Login.vue',
'views/desktop/index.vue',
'views/error/',
'views/desktop/index.vue',
'views/error/',
'views/screen/',
]
]
if (excludePaths.some(path => filePath.includes(path))) {
return
}
@@ -40,7 +76,8 @@ const generateRoutes = () => {
routes.push({
path: routePath,
name: routeName || 'SystemRoleIndex',
component: module
component: module,
meta: { requiresAuth: true }
})
})
@@ -56,9 +93,22 @@ const routes = [
},
{
path: '/bigScreen',
name: 'bigScreen',
component: bigScreen,
meta: { requiresAuth: true }
name: 'BigScreen',
component: BigScreen,
meta: { requiresAuth: true },
children: [
{
path: '/bigScreenWork',
name: 'BigScreenWork',
component: BigScreenWork
},
...generateBigScreenRoutes(),
{
path: '/:pathMatch(.*)*',
name: 'BigScreen404',
component: Page404
}
]
},
{
path: '/',