@duxweb/dvha-template 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +71 -0
  2. package/bin/index.js +250 -0
  3. package/package.json +50 -0
  4. package/template/base/App.vue +13 -0
  5. package/template/base/README.md +154 -0
  6. package/template/base/index.html +13 -0
  7. package/template/base/main.ts +64 -0
  8. package/template/base/package.json +28 -0
  9. package/template/base/tsconfig.json +37 -0
  10. package/template/base/typings.d.ts +16 -0
  11. package/template/base/uno.config.ts +22 -0
  12. package/template/base/vite-env.d.ts +1 -0
  13. package/template/base/vite.config.ts +34 -0
  14. package/template/ui-configs/base/pages/404.vue +63 -0
  15. package/template/ui-configs/base/pages/home.vue +77 -0
  16. package/template/ui-configs/base/pages/layout.vue +79 -0
  17. package/template/ui-configs/base/pages/login.vue +161 -0
  18. package/template/ui-configs/base/pages/menu.vue +32 -0
  19. package/template/ui-configs/base.json +22 -0
  20. package/template/ui-configs/elementui/pages/404.vue +63 -0
  21. package/template/ui-configs/elementui/pages/home.vue +77 -0
  22. package/template/ui-configs/elementui/pages/layout.vue +79 -0
  23. package/template/ui-configs/elementui/pages/login.vue +123 -0
  24. package/template/ui-configs/elementui/pages/menu.vue +32 -0
  25. package/template/ui-configs/elementui.json +27 -0
  26. package/template/ui-configs/naiveui/pages/404.vue +63 -0
  27. package/template/ui-configs/naiveui/pages/home.vue +77 -0
  28. package/template/ui-configs/naiveui/pages/layout.vue +79 -0
  29. package/template/ui-configs/naiveui/pages/login.vue +146 -0
  30. package/template/ui-configs/naiveui/pages/menu.vue +32 -0
  31. package/template/ui-configs/naiveui.json +26 -0
@@ -0,0 +1,22 @@
1
+ import { defineConfig, presetIcons, presetWind3 } from 'unocss'
2
+ import icons from '@iconify-json/tabler/icons.json'
3
+
4
+ const generateSafeList = () => {
5
+ return Object.keys(icons.icons).flatMap((item) => {
6
+ return `i-tabler:${item}`
7
+ })
8
+ };
9
+
10
+ const safeList = generateSafeList()
11
+
12
+ export default defineConfig({
13
+ presets: [
14
+ presetWind3(),
15
+ presetIcons({
16
+ collections: {
17
+ tabler: () => import('@iconify-json/tabler/icons.json').then(i => i.default),
18
+ },
19
+ }),
20
+ ],
21
+ safelist: safeList,
22
+ })
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,34 @@
1
+ import { resolve } from 'node:path'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import VueJsx from '@vitejs/plugin-vue-jsx'
4
+ import UnoCSS from 'unocss/vite'
5
+ import { defineConfig } from 'vite'
6
+
7
+ export default defineConfig({
8
+ plugins: [
9
+ vue(),
10
+ VueJsx(),
11
+ UnoCSS(),
12
+ ],
13
+ build: {
14
+ rollupOptions: {
15
+ input: {
16
+ index: resolve(__dirname, 'index.html'),
17
+ },
18
+ output: {
19
+ entryFileNames: 'js/[name]-[hash].js',
20
+ chunkFileNames: 'js/[name]-[hash].js',
21
+ manualChunks(id) {
22
+ if (id.includes('node_modules')) {
23
+ return id
24
+ .toString()
25
+ .split('node_modules/')[1]
26
+ .split('/')[0]
27
+ .toString()
28
+ }
29
+ },
30
+ },
31
+ },
32
+ outDir: resolve(__dirname, 'dist'),
33
+ },
34
+ })
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div class="min-h-screen bg-gray-50 flex items-center justify-center p-4">
3
+ <div class="max-w-md w-full text-center">
4
+ <!-- 404 图标 -->
5
+ <div class="mb-8">
6
+ <div class="text-8xl font-bold text-gray-300 mb-4">404</div>
7
+ <div class="i-tabler:face-sad text-6xl text-gray-400 mx-auto"></div>
8
+ </div>
9
+
10
+ <!-- 错误信息 -->
11
+ <div class="mb-8">
12
+ <h1 class="text-2xl font-bold text-gray-900 mb-2">页面不存在</h1>
13
+ <p class="text-gray-600">抱歉,您访问的页面无法找到</p>
14
+ </div>
15
+
16
+ <!-- 操作按钮 -->
17
+ <div class="space-y-3 mb-8">
18
+ <button
19
+ @click="goHome"
20
+ class="w-full flex items-center justify-center px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 font-medium"
21
+ >
22
+ <div class="i-tabler:home mr-2"></div>
23
+ 返回首页
24
+ </button>
25
+
26
+ <button
27
+ @click="goBack"
28
+ class="w-full flex items-center justify-center px-6 py-3 border text-gray-700 rounded-lg hover:bg-gray-50 font-medium"
29
+ >
30
+ <div class="i-tabler:arrow-left mr-2"></div>
31
+ 返回上页
32
+ </button>
33
+ </div>
34
+
35
+ <!-- 底部信息 -->
36
+ <p class="text-xs text-gray-400">
37
+ 错误代码: {{ errorCode }} | {{ currentTime }}
38
+ </p>
39
+ </div>
40
+ </div>
41
+ </template>
42
+
43
+ <script setup lang="ts">
44
+ import { ref, computed } from 'vue'
45
+
46
+ const errorCode = ref('ERR_404_NOT_FOUND')
47
+
48
+ const currentTime = computed(() => {
49
+ return new Date().toLocaleString('zh-CN')
50
+ })
51
+
52
+ const goHome = () => {
53
+ window.location.href = '/'
54
+ }
55
+
56
+ const goBack = () => {
57
+ if (window.history.length > 1) {
58
+ window.history.back()
59
+ } else {
60
+ goHome()
61
+ }
62
+ }
63
+ </script>
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="p-6">
3
+ <!-- 欢迎区域 -->
4
+ <div class="bg-white rounded-lg shadow-sm border p-8 mb-8">
5
+ <div class="text-center">
6
+ <div class="i-tabler:home text-5xl text-blue-600 mx-auto mb-4"></div>
7
+ <h1 class="text-3xl font-bold text-gray-900 mb-4">欢迎使用 DVHA</h1>
8
+ <p class="text-gray-600 max-w-2xl mx-auto">
9
+ 基于 Vue 3 + UnoCSS + @duxweb/dvha-core 构建的现代化管理系统
10
+ </p>
11
+ </div>
12
+ </div>
13
+
14
+ <!-- @duxweb/dvha-core 特点展示 -->
15
+ <div class="mb-8">
16
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
17
+ <div class="bg-white rounded-lg shadow-sm border p-6">
18
+ <div class="i-tabler:brand-vue text-3xl text-green-600 mb-4"></div>
19
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">Vue 3 支持</h3>
20
+ <p class="text-gray-600 text-sm">基于最新的 Vue 3 Composition API,提供现代化的开发体验</p>
21
+ </div>
22
+
23
+ <div class="bg-white rounded-lg shadow-sm border p-6">
24
+ <div class="i-tabler:brand-typescript text-3xl text-blue-600 mb-4"></div>
25
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">TypeScript</h3>
26
+ <p class="text-gray-600 text-sm">完整的 TypeScript 支持,提供类型安全和更好的开发体验</p>
27
+ </div>
28
+
29
+ <div class="bg-white rounded-lg shadow-sm border p-6">
30
+ <div class="i-tabler:layout-dashboard text-3xl text-purple-600 mb-4"></div>
31
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">多管理端</h3>
32
+ <p class="text-gray-600 text-sm">支持多个独立的管理端,每个管理端可以有不同的配置</p>
33
+ </div>
34
+
35
+ <div class="bg-white rounded-lg shadow-sm border p-6">
36
+ <div class="i-tabler:database text-3xl text-orange-600 mb-4"></div>
37
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">数据提供者</h3>
38
+ <p class="text-gray-600 text-sm">灵活的数据提供者模式,支持各种 API 和数据源</p>
39
+ </div>
40
+
41
+ <div class="bg-white rounded-lg shadow-sm border p-6">
42
+ <div class="i-tabler:shield-check text-3xl text-red-600 mb-4"></div>
43
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">认证系统</h3>
44
+ <p class="text-gray-600 text-sm">内置完整的认证和权限管理系统,支持多种认证方式</p>
45
+ </div>
46
+
47
+ <div class="bg-white rounded-lg shadow-sm border p-6">
48
+ <div class="i-tabler:route text-3xl text-indigo-600 mb-4"></div>
49
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">路由管理</h3>
50
+ <p class="text-gray-600 text-sm">智能的路由和菜单管理,支持动态路由和权限控制</p>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <!-- 开始使用 -->
56
+ <div class="bg-gradient-to-r from-blue-50 to-indigo-50 rounded-lg border p-8 text-center">
57
+ <h3 class="text-xl font-bold text-gray-900 mb-4">开始构建您的管理系统</h3>
58
+ <p class="text-gray-600 mb-6">@duxweb/dvha-core 为您提供了构建现代化管理系统所需的所有工具</p>
59
+ <div class="flex justify-center space-x-4">
60
+ <a href="https://github.com/duxweb/dux-vue" target="_blank"
61
+ class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-sm font-medium">
62
+ <div class="i-tabler:brand-github mr-2"></div>
63
+ 查看源码
64
+ </a>
65
+ <a href="#" class="inline-flex items-center px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 text-sm font-medium">
66
+ <div class="i-tabler:book mr-2"></div>
67
+ 查看文档
68
+ </a>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </template>
73
+
74
+ <script setup lang="ts">
75
+ // 首页逻辑
76
+ console.log('首页已加载')
77
+ </script>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <div class="min-h-screen bg-gray-50 flex flex-col">
3
+ <!-- 头部 -->
4
+ <header class="bg-white shadow-sm border-b fixed w-full top-0 z-50">
5
+ <div class="flex items-center justify-between h-16 px-4">
6
+ <div class="flex items-center">
7
+ <button @click="toggleSidebar" class="p-2 rounded hover:bg-gray-100 lg:hidden">
8
+ <div class="i-tabler:menu-2 text-xl"></div>
9
+ </button>
10
+ <div class="flex items-center ml-4 lg:ml-0">
11
+ <div class="i-tabler:brand-vue text-2xl text-blue-600 mr-3"></div>
12
+ <h1 class="text-xl font-bold">{{ manage.config?.title || 'Dux Admin' }}</h1>
13
+ </div>
14
+ </div>
15
+
16
+ <!-- 用户菜单 -->
17
+ <div class="relative">
18
+ <button @click="showUserMenu = !showUserMenu" class="flex items-center p-2 rounded hover:bg-gray-100">
19
+ <div class="i-tabler:user-circle text-xl mr-2"></div>
20
+ <span class="hidden md:block text-sm font-medium">{{ getUserName() }}</span>
21
+ <div class="i-tabler:chevron-down text-sm ml-1 hidden md:block"></div>
22
+ </button>
23
+
24
+ <div v-if="showUserMenu" class="absolute right-0 mt-2 w-40 bg-white rounded-md shadow-lg border z-50">
25
+ <div class="py-1">
26
+ <button @click="handleLogout" class="flex items-center w-full px-4 py-2 text-sm hover:bg-gray-100">
27
+ <div class="i-tabler:logout mr-3"></div>
28
+ 退出登录
29
+ </button>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </header>
35
+
36
+ <div class="flex pt-16 flex-1">
37
+ <!-- 侧边栏 -->
38
+ <Sidebar :sidebar-open="sidebarOpen" />
39
+
40
+ <!-- 遮罩层 -->
41
+ <div v-if="sidebarOpen" @click="toggleSidebar" class="fixed inset-0 z-30 bg-black bg-opacity-50 lg:hidden"></div>
42
+
43
+ <!-- 主内容 -->
44
+ <main class="flex-1">
45
+ <RouterView />
46
+ </main>
47
+ </div>
48
+ </div>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { ref, onMounted, onUnmounted } from 'vue'
53
+ import { useManage, useGetAuth, useLogout } from '@duxweb/dvha-core'
54
+ import Sidebar from './menu.vue'
55
+
56
+ const manage = useManage()
57
+ const user = useGetAuth()
58
+
59
+ const { mutate: logout } = useLogout({
60
+ onSuccess: () => console.log('退出成功'),
61
+ onError: (error) => console.error('退出失败:', error)
62
+ })
63
+
64
+ const sidebarOpen = ref(false)
65
+ const showUserMenu = ref(false)
66
+
67
+ const getUserName = () => user?.info?.name || user?.info?.username || 'Admin'
68
+ const toggleSidebar = () => sidebarOpen.value = !sidebarOpen.value
69
+ const handleLogout = () => logout()
70
+
71
+ const closeDropdowns = (event: Event) => {
72
+ if (!(event.target as HTMLElement).closest('.relative')) {
73
+ showUserMenu.value = false
74
+ }
75
+ }
76
+
77
+ onMounted(() => document.addEventListener('click', closeDropdowns))
78
+ onUnmounted(() => document.removeEventListener('click', closeDropdowns))
79
+ </script>
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <div class="min-h-screen bg-gray-100 flex items-center justify-center p-4">
3
+ <div class="w-full max-w-md">
4
+ <!-- 登录卡片 -->
5
+ <div class="bg-white rounded-lg shadow-sm border p-8">
6
+ <!-- 标题区域 -->
7
+ <div class="text-center mb-8">
8
+ <div class="i-tabler:shield-check text-4xl text-blue-600 mx-auto mb-4"></div>
9
+ <h1 class="text-2xl font-bold text-gray-900 mb-2">系统登录</h1>
10
+ <p class="text-gray-500 text-sm">欢迎使用管理系统,请登录</p>
11
+ </div>
12
+
13
+ <!-- 登录表单 -->
14
+ <form @submit.prevent="handleLogin" class="space-y-4">
15
+ <!-- 用户名 -->
16
+ <div>
17
+ <div class="relative">
18
+ <div class="absolute inset-y-0 left-0 pl-3 flex items-center">
19
+ <div class="i-tabler:user text-gray-400"></div>
20
+ </div>
21
+ <input
22
+ v-model="form.username"
23
+ type="text"
24
+ placeholder="请输入用户名"
25
+ class="w-full pl-10 pr-3 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
26
+ :class="{'border-red-300': errors.username}"
27
+ />
28
+ </div>
29
+ <p v-if="errors.username" class="mt-1 text-sm text-red-600">{{ errors.username }}</p>
30
+ </div>
31
+
32
+ <!-- 密码 -->
33
+ <div>
34
+ <div class="relative">
35
+ <div class="absolute inset-y-0 left-0 pl-3 flex items-center">
36
+ <div class="i-tabler:lock text-gray-400"></div>
37
+ </div>
38
+ <input
39
+ v-model="form.password"
40
+ :type="showPassword ? 'text' : 'password'"
41
+ placeholder="请输入密码"
42
+ class="w-full pl-10 pr-12 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
43
+ :class="{'border-red-300': errors.password}"
44
+ />
45
+ <button
46
+ type="button"
47
+ @click="showPassword = !showPassword"
48
+ class="absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600"
49
+ >
50
+ <div :class="showPassword ? 'i-tabler:eye-off' : 'i-tabler:eye'"></div>
51
+ </button>
52
+ </div>
53
+ <p v-if="errors.password" class="mt-1 text-sm text-red-600">{{ errors.password }}</p>
54
+ </div>
55
+
56
+ <!-- 记住我和忘记密码 -->
57
+ <div class="flex items-center justify-between">
58
+ <label class="flex items-center">
59
+ <input v-model="form.remember" type="checkbox" class="h-4 w-4 text-blue-600 rounded border-gray-300" />
60
+ <span class="ml-2 text-sm text-gray-600">记住我</span>
61
+ </label>
62
+ <a href="#" class="text-sm text-blue-600 hover:text-blue-500">忘记密码?</a>
63
+ </div>
64
+
65
+ <!-- 登录按钮 -->
66
+ <button
67
+ type="submit"
68
+ :disabled="loading"
69
+ class="w-full bg-blue-600 text-white py-3 rounded-lg font-medium hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
70
+ >
71
+ <span v-if="loading" class="flex items-center justify-center">
72
+ <div class="i-tabler:loader-2 animate-spin mr-2"></div>
73
+ 登录中...
74
+ </span>
75
+ <span v-else>登录</span>
76
+ </button>
77
+ </form>
78
+
79
+ <!-- 注册提示 -->
80
+ <div class="mt-6 text-center">
81
+ <span class="text-sm text-gray-500">还没有账号?</span>
82
+ <a href="#" class="text-sm text-blue-600 hover:text-blue-500 font-medium ml-1">立即注册</a>
83
+ </div>
84
+ </div>
85
+
86
+ <!-- 版权信息 -->
87
+ <p class="mt-6 text-center text-xs text-gray-400">
88
+ © 2024 Dux Template. All rights reserved.
89
+ </p>
90
+ </div>
91
+ </div>
92
+ </template>
93
+
94
+ <script setup lang="ts">
95
+ import { ref, reactive } from 'vue'
96
+ import { useLogin } from '@duxweb/dvha-core'
97
+
98
+ const showPassword = ref(false)
99
+
100
+ const form = reactive({
101
+ username: '',
102
+ password: '',
103
+ remember: false
104
+ })
105
+
106
+ const errors = reactive({
107
+ username: '',
108
+ password: ''
109
+ })
110
+
111
+ const { mutate: login, isLoading: loading } = useLogin({
112
+ onSuccess: () => console.log('登录成功'),
113
+ onError: (error) => {
114
+ console.error('登录失败:', error)
115
+ if (error?.message) {
116
+ if (error.message.includes('用户名') || error.message.includes('username')) {
117
+ errors.username = error.message
118
+ } else if (error.message.includes('密码') || error.message.includes('password')) {
119
+ errors.password = error.message
120
+ } else {
121
+ errors.password = error.message
122
+ }
123
+ } else {
124
+ errors.password = '登录失败,请检查用户名和密码'
125
+ }
126
+ }
127
+ })
128
+
129
+ const validateForm = () => {
130
+ errors.username = ''
131
+ errors.password = ''
132
+
133
+ let isValid = true
134
+
135
+ if (!form.username.trim()) {
136
+ errors.username = '请输入用户名'
137
+ isValid = false
138
+ }
139
+
140
+ if (!form.password.trim()) {
141
+ errors.password = '请输入密码'
142
+ isValid = false
143
+ }
144
+
145
+ return isValid
146
+ }
147
+
148
+ const handleLogin = async () => {
149
+ if (!validateForm()) return
150
+
151
+ try {
152
+ await login({
153
+ username: form.username,
154
+ password: form.password,
155
+ remember: form.remember
156
+ })
157
+ } catch (error) {
158
+ console.error('登录过程中发生错误:', error)
159
+ }
160
+ }
161
+ </script>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <aside
3
+ :class="sidebarOpen ? 'translate-x-0' : '-translate-x-full'"
4
+ class="fixed inset-y-0 left-0 z-40 w-64 bg-white shadow-lg border-r pt-16 transition-transform lg:translate-x-0 lg:static lg:inset-0"
5
+ >
6
+ <div class="h-full overflow-y-auto p-4">
7
+ <nav class="space-y-2">
8
+ <router-link
9
+ v-for="menu in menuList"
10
+ :key="menu.name"
11
+ :to="menu.path"
12
+ class="flex items-center px-3 py-2 text-sm font-medium rounded-md"
13
+ :class="active === menu.name ? 'text-blue-600 bg-blue-50' : 'text-gray-600 hover:text-gray-900 hover:bg-gray-50'"
14
+ >
15
+ <div :class="[menu.icon, 'mr-3']"></div>
16
+ {{ menu.label }}
17
+ </router-link>
18
+ </nav>
19
+ </div>
20
+ </aside>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ import { useMenu } from '@duxweb/dvha-core'
25
+
26
+ defineProps<{
27
+ sidebarOpen: boolean
28
+ }>()
29
+
30
+ const { data: menuList,active } = useMenu()
31
+
32
+ </script>
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "base",
3
+ "display": "Vue 3 + Vite + UnoCSS",
4
+ "description": "基础的 Vue 3 项目模板",
5
+ "dependencies": {
6
+ "@duxweb/dvha-core": "latest",
7
+ "@iconify-json/tabler": "^1.2.18",
8
+ "@unocss/preset-icons": "^66.1.2",
9
+ "@vueuse/core": "^13.2.0",
10
+ "@vueuse/integrations": "^13.2.0",
11
+ "axios": "^1.9.0",
12
+ "lodash-es": "^4.17.21",
13
+ "unocss": "^66.1.2",
14
+ "@unocss/reset": "^66.1.2"
15
+ },
16
+ "devDependencies": {},
17
+ "imports": [
18
+ "import '@unocss/reset/tailwind.css'",
19
+ "import 'virtual:uno.css'"
20
+ ],
21
+ "appUse": []
22
+ }
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div class="min-h-screen bg-gray-50 flex items-center justify-center p-4">
3
+ <div class="max-w-md w-full text-center">
4
+ <!-- 404 图标 -->
5
+ <div class="mb-8">
6
+ <div class="text-8xl font-bold text-gray-300 mb-4">404</div>
7
+ <div class="i-tabler:face-sad text-6xl text-gray-400 mx-auto"></div>
8
+ </div>
9
+
10
+ <!-- 错误信息 -->
11
+ <div class="mb-8">
12
+ <h1 class="text-2xl font-bold text-gray-900 mb-2">页面不存在</h1>
13
+ <p class="text-gray-600">抱歉,您访问的页面无法找到</p>
14
+ </div>
15
+
16
+ <!-- 操作按钮 -->
17
+ <div class="space-y-3 mb-8">
18
+ <button
19
+ @click="goHome"
20
+ class="w-full flex items-center justify-center px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 font-medium"
21
+ >
22
+ <div class="i-tabler:home mr-2"></div>
23
+ 返回首页
24
+ </button>
25
+
26
+ <button
27
+ @click="goBack"
28
+ class="w-full flex items-center justify-center px-6 py-3 border text-gray-700 rounded-lg hover:bg-gray-50 font-medium"
29
+ >
30
+ <div class="i-tabler:arrow-left mr-2"></div>
31
+ 返回上页
32
+ </button>
33
+ </div>
34
+
35
+ <!-- 底部信息 -->
36
+ <p class="text-xs text-gray-400">
37
+ 错误代码: {{ errorCode }} | {{ currentTime }}
38
+ </p>
39
+ </div>
40
+ </div>
41
+ </template>
42
+
43
+ <script setup lang="ts">
44
+ import { ref, computed } from 'vue'
45
+
46
+ const errorCode = ref('ERR_404_NOT_FOUND')
47
+
48
+ const currentTime = computed(() => {
49
+ return new Date().toLocaleString('zh-CN')
50
+ })
51
+
52
+ const goHome = () => {
53
+ window.location.href = '/'
54
+ }
55
+
56
+ const goBack = () => {
57
+ if (window.history.length > 1) {
58
+ window.history.back()
59
+ } else {
60
+ goHome()
61
+ }
62
+ }
63
+ </script>
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="p-6">
3
+ <!-- 欢迎区域 -->
4
+ <div class="bg-white rounded-lg shadow-sm border p-8 mb-8">
5
+ <div class="text-center">
6
+ <div class="i-tabler:home text-5xl text-blue-600 mx-auto mb-4"></div>
7
+ <h1 class="text-3xl font-bold text-gray-900 mb-4">欢迎使用 DVHA</h1>
8
+ <p class="text-gray-600 max-w-2xl mx-auto">
9
+ 基于 Vue 3 + UnoCSS + @duxweb/dvha-core 构建的现代化管理系统
10
+ </p>
11
+ </div>
12
+ </div>
13
+
14
+ <!-- @duxweb/dvha-core 特点展示 -->
15
+ <div class="mb-8">
16
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
17
+ <div class="bg-white rounded-lg shadow-sm border p-6">
18
+ <div class="i-tabler:brand-vue text-3xl text-green-600 mb-4"></div>
19
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">Vue 3 支持</h3>
20
+ <p class="text-gray-600 text-sm">基于最新的 Vue 3 Composition API,提供现代化的开发体验</p>
21
+ </div>
22
+
23
+ <div class="bg-white rounded-lg shadow-sm border p-6">
24
+ <div class="i-tabler:brand-typescript text-3xl text-blue-600 mb-4"></div>
25
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">TypeScript</h3>
26
+ <p class="text-gray-600 text-sm">完整的 TypeScript 支持,提供类型安全和更好的开发体验</p>
27
+ </div>
28
+
29
+ <div class="bg-white rounded-lg shadow-sm border p-6">
30
+ <div class="i-tabler:layout-dashboard text-3xl text-purple-600 mb-4"></div>
31
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">多管理端</h3>
32
+ <p class="text-gray-600 text-sm">支持多个独立的管理端,每个管理端可以有不同的配置</p>
33
+ </div>
34
+
35
+ <div class="bg-white rounded-lg shadow-sm border p-6">
36
+ <div class="i-tabler:database text-3xl text-orange-600 mb-4"></div>
37
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">数据提供者</h3>
38
+ <p class="text-gray-600 text-sm">灵活的数据提供者模式,支持各种 API 和数据源</p>
39
+ </div>
40
+
41
+ <div class="bg-white rounded-lg shadow-sm border p-6">
42
+ <div class="i-tabler:shield-check text-3xl text-red-600 mb-4"></div>
43
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">认证系统</h3>
44
+ <p class="text-gray-600 text-sm">内置完整的认证和权限管理系统,支持多种认证方式</p>
45
+ </div>
46
+
47
+ <div class="bg-white rounded-lg shadow-sm border p-6">
48
+ <div class="i-tabler:route text-3xl text-indigo-600 mb-4"></div>
49
+ <h3 class="text-lg font-semibold text-gray-900 mb-2">路由管理</h3>
50
+ <p class="text-gray-600 text-sm">智能的路由和菜单管理,支持动态路由和权限控制</p>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <!-- 开始使用 -->
56
+ <div class="bg-gradient-to-r from-blue-50 to-indigo-50 rounded-lg border p-8 text-center">
57
+ <h3 class="text-xl font-bold text-gray-900 mb-4">开始构建您的管理系统</h3>
58
+ <p class="text-gray-600 mb-6">@duxweb/dvha-core 为您提供了构建现代化管理系统所需的所有工具</p>
59
+ <div class="flex justify-center space-x-4">
60
+ <a href="https://github.com/duxweb/dux-vue" target="_blank"
61
+ class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-sm font-medium">
62
+ <div class="i-tabler:brand-github mr-2"></div>
63
+ 查看源码
64
+ </a>
65
+ <a href="#" class="inline-flex items-center px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 text-sm font-medium">
66
+ <div class="i-tabler:book mr-2"></div>
67
+ 查看文档
68
+ </a>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </template>
73
+
74
+ <script setup lang="ts">
75
+ // 首页逻辑
76
+ console.log('首页已加载')
77
+ </script>