@lvetechs/create-app 1.0.4 → 1.0.6

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 (58) hide show
  1. package/package.json +1 -1
  2. package/templates/react/.env +3 -3
  3. package/templates/react/.env.development +3 -3
  4. package/templates/react/.env.production +3 -3
  5. package/templates/react/package.json +1 -1
  6. package/templates/react/pnpm-lock.yaml +5 -5
  7. package/templates/react/src/App.tsx +7 -1
  8. package/templates/react/src/api/notification.ts +43 -0
  9. package/templates/react/src/components/NotificationButton/index.tsx +219 -0
  10. package/templates/react/src/components/Toast/index.tsx +150 -0
  11. package/templates/react/src/hooks/useForm.ts +77 -0
  12. package/templates/react/src/layouts/DefaultLayout.tsx +2 -0
  13. package/templates/react/src/layouts/menuConfig.ts +3 -33
  14. package/templates/react/src/router/index.tsx +0 -39
  15. package/templates/react/src/stores/app.ts +141 -3
  16. package/templates/react/src/stores/notification.ts +146 -0
  17. package/templates/react/src/stores/permission.ts +173 -0
  18. package/templates/react/src/stores/user.ts +151 -4
  19. package/templates/react/src/views/home/index.tsx +167 -6
  20. package/templates/react/src/views/system/user/index.tsx +171 -5
  21. package/templates/vue/.env +2 -2
  22. package/templates/vue/.env.development +2 -2
  23. package/templates/vue/.env.production +2 -2
  24. package/templates/vue/pnpm-lock.yaml +3307 -3307
  25. package/templates/vue/src/App.vue +2 -0
  26. package/templates/vue/src/api/notification.ts +43 -0
  27. package/templates/vue/src/auto-imports.d.ts +5 -0
  28. package/templates/vue/src/components/NotificationButton/index.vue +242 -0
  29. package/templates/vue/src/components/Toast/index.vue +126 -0
  30. package/templates/vue/src/components.d.ts +2 -0
  31. package/templates/vue/src/layouts/DefaultLayout.vue +2 -0
  32. package/templates/vue/src/layouts/menuConfig.ts +3 -33
  33. package/templates/vue/src/router/index.ts +3 -88
  34. package/templates/vue/src/stores/app.ts +133 -2
  35. package/templates/vue/src/stores/notification.ts +189 -0
  36. package/templates/vue/src/stores/permission.ts +184 -0
  37. package/templates/vue/src/stores/user.ts +109 -2
  38. package/templates/vue/src/views/home/index.vue +7 -7
  39. package/templates/react/src/views/about/index.tsx +0 -40
  40. package/templates/react/src/views/login/index.tsx +0 -138
  41. package/templates/react/src/views/register/index.tsx +0 -143
  42. package/templates/react/src/views/result/fail.tsx +0 -39
  43. package/templates/react/src/views/result/success.tsx +0 -35
  44. package/templates/react/src/views/screen/index.tsx +0 -120
  45. package/templates/react/src/views/system/log/login.tsx +0 -51
  46. package/templates/react/src/views/system/log/operation.tsx +0 -47
  47. package/templates/react/src/views/system/menu/index.tsx +0 -62
  48. package/templates/react/src/views/system/role/index.tsx +0 -63
  49. package/templates/vue/src/views/about/index.vue +0 -67
  50. package/templates/vue/src/views/login/index.vue +0 -153
  51. package/templates/vue/src/views/register/index.vue +0 -169
  52. package/templates/vue/src/views/result/fail.vue +0 -92
  53. package/templates/vue/src/views/result/success.vue +0 -92
  54. package/templates/vue/src/views/screen/index.vue +0 -150
  55. package/templates/vue/src/views/system/log/login.vue +0 -51
  56. package/templates/vue/src/views/system/log/operation.vue +0 -47
  57. package/templates/vue/src/views/system/menu/index.vue +0 -58
  58. package/templates/vue/src/views/system/role/index.vue +0 -59
@@ -1,150 +0,0 @@
1
- <script setup lang="ts">
2
- import { useRouter } from 'vue-router'
3
-
4
- const router = useRouter()
5
- </script>
6
-
7
- <template>
8
- <div class="screen-page">
9
- <!-- 顶部标题栏 -->
10
- <header class="screen-header">
11
- <button class="back-btn" @click="router.push('/')">← 返回</button>
12
- <h1>数据大屏</h1>
13
- <span class="screen-time">{{ new Date().toLocaleString() }}</span>
14
- </header>
15
-
16
- <!-- 数据面板 -->
17
- <div class="screen-body">
18
- <div class="panel">
19
- <h3>总用户数</h3>
20
- <div class="panel-value">12,580</div>
21
- <p class="panel-desc">较昨日 +128</p>
22
- </div>
23
- <div class="panel">
24
- <h3>今日活跃</h3>
25
- <div class="panel-value">3,426</div>
26
- <p class="panel-desc">活跃率 27.2%</p>
27
- </div>
28
- <div class="panel">
29
- <h3>今日订单</h3>
30
- <div class="panel-value">856</div>
31
- <p class="panel-desc">较昨日 +52</p>
32
- </div>
33
- <div class="panel">
34
- <h3>今日营收</h3>
35
- <div class="panel-value">¥98,320</div>
36
- <p class="panel-desc">较昨日 +12.3%</p>
37
- </div>
38
- <div class="panel wide">
39
- <h3>📊 数据图表区域</h3>
40
- <div class="chart-placeholder">
41
- <p>此处可集成 ECharts / Chart.js 等图表库</p>
42
- </div>
43
- </div>
44
- <div class="panel wide">
45
- <h3>🗺️ 地图区域</h3>
46
- <div class="chart-placeholder">
47
- <p>此处可集成地图或其他可视化组件</p>
48
- </div>
49
- </div>
50
- </div>
51
- </div>
52
- </template>
53
-
54
- <style scoped lang="scss">
55
- .screen-page {
56
- height: 100vh;
57
- background: #0d1b2a;
58
- color: #e0e6ed;
59
- display: flex;
60
- flex-direction: column;
61
- overflow: hidden;
62
- }
63
-
64
- .screen-header {
65
- display: flex;
66
- align-items: center;
67
- justify-content: space-between;
68
- padding: 12px 24px;
69
- background: rgba(255, 255, 255, 0.05);
70
- border-bottom: 1px solid rgba(255, 255, 255, 0.1);
71
-
72
- h1 {
73
- font-size: 22px;
74
- background: linear-gradient(90deg, #00d2ff, #928dff);
75
- -webkit-background-clip: text;
76
- -webkit-text-fill-color: transparent;
77
- }
78
-
79
- .screen-time {
80
- font-size: 13px;
81
- color: #8892a4;
82
- }
83
- }
84
-
85
- .back-btn {
86
- background: rgba(255, 255, 255, 0.1);
87
- border: 1px solid rgba(255, 255, 255, 0.2);
88
- color: #e0e6ed;
89
- padding: 6px 16px;
90
- border-radius: 4px;
91
- cursor: pointer;
92
- font-size: 13px;
93
-
94
- &:hover {
95
- background: rgba(255, 255, 255, 0.2);
96
- }
97
- }
98
-
99
- .screen-body {
100
- flex: 1;
101
- display: grid;
102
- grid-template-columns: repeat(4, 1fr);
103
- gap: 16px;
104
- padding: 20px 24px;
105
- overflow-y: auto;
106
- }
107
-
108
- .panel {
109
- background: rgba(255, 255, 255, 0.05);
110
- border: 1px solid rgba(255, 255, 255, 0.08);
111
- border-radius: 8px;
112
- padding: 20px;
113
-
114
- h3 {
115
- font-size: 14px;
116
- color: #8892a4;
117
- margin-bottom: 12px;
118
- }
119
-
120
- &.wide {
121
- grid-column: span 2;
122
- }
123
- }
124
-
125
- .panel-value {
126
- font-size: 32px;
127
- font-weight: 700;
128
- background: linear-gradient(90deg, #00d2ff, #928dff);
129
- -webkit-background-clip: text;
130
- -webkit-text-fill-color: transparent;
131
- margin-bottom: 8px;
132
- }
133
-
134
- .panel-desc {
135
- font-size: 13px;
136
- color: #67c23a;
137
- }
138
-
139
- .chart-placeholder {
140
- height: 200px;
141
- display: flex;
142
- align-items: center;
143
- justify-content: center;
144
- border: 1px dashed rgba(255, 255, 255, 0.15);
145
- border-radius: 6px;
146
- color: #8892a4;
147
- font-size: 14px;
148
- }
149
- </style>
150
-
@@ -1,51 +0,0 @@
1
- <script setup lang="ts">
2
- const logs = [
3
- { id: 1, user: 'admin', ip: '192.168.1.1', location: '本地', browser: 'Chrome 122', os: 'Windows 10', time: '2024-03-20 09:00:00', status: '成功' },
4
- { id: 2, user: 'editor', ip: '192.168.1.2', location: '本地', browser: 'Firefox 123', os: 'macOS', time: '2024-03-20 09:30:00', status: '成功' },
5
- { id: 3, user: 'hacker', ip: '10.0.0.1', location: '未知', browser: 'Unknown', os: 'Linux', time: '2024-03-20 12:00:00', status: '失败' }
6
- ]
7
- </script>
8
-
9
- <template>
10
- <div class="page-container">
11
- <div class="page-header">
12
- <h2>登录日志</h2>
13
- <button class="btn-primary">导出日志</button>
14
- </div>
15
- <table class="data-table">
16
- <thead>
17
- <tr>
18
- <th>ID</th>
19
- <th>用户名</th>
20
- <th>IP 地址</th>
21
- <th>登录地点</th>
22
- <th>浏览器</th>
23
- <th>操作系统</th>
24
- <th>登录时间</th>
25
- <th>状态</th>
26
- </tr>
27
- </thead>
28
- <tbody>
29
- <tr v-for="log in logs" :key="log.id">
30
- <td>{{ log.id }}</td>
31
- <td>{{ log.user }}</td>
32
- <td>{{ log.ip }}</td>
33
- <td>{{ log.location }}</td>
34
- <td>{{ log.browser }}</td>
35
- <td>{{ log.os }}</td>
36
- <td>{{ log.time }}</td>
37
- <td>
38
- <span :class="log.status === '成功' ? 'status-active' : 'status-disabled'">
39
- {{ log.status }}
40
- </span>
41
- </td>
42
- </tr>
43
- </tbody>
44
- </table>
45
- </div>
46
- </template>
47
-
48
- <style scoped lang="scss">
49
- @import '@/styles/page-common.scss';
50
- </style>
51
-
@@ -1,47 +0,0 @@
1
- <script setup lang="ts">
2
- const logs = [
3
- { id: 1, user: 'admin', action: '新增用户', ip: '192.168.1.1', time: '2024-03-20 10:30:00', status: '成功' },
4
- { id: 2, user: 'admin', action: '修改角色', ip: '192.168.1.1', time: '2024-03-20 11:15:00', status: '成功' },
5
- { id: 3, user: 'editor', action: '删除文章', ip: '192.168.1.2', time: '2024-03-20 14:22:00', status: '失败' }
6
- ]
7
- </script>
8
-
9
- <template>
10
- <div class="page-container">
11
- <div class="page-header">
12
- <h2>操作日志</h2>
13
- <button class="btn-primary">导出日志</button>
14
- </div>
15
- <table class="data-table">
16
- <thead>
17
- <tr>
18
- <th>ID</th>
19
- <th>操作人</th>
20
- <th>操作内容</th>
21
- <th>IP 地址</th>
22
- <th>操作时间</th>
23
- <th>状态</th>
24
- </tr>
25
- </thead>
26
- <tbody>
27
- <tr v-for="log in logs" :key="log.id">
28
- <td>{{ log.id }}</td>
29
- <td>{{ log.user }}</td>
30
- <td>{{ log.action }}</td>
31
- <td>{{ log.ip }}</td>
32
- <td>{{ log.time }}</td>
33
- <td>
34
- <span :class="log.status === '成功' ? 'status-active' : 'status-disabled'">
35
- {{ log.status }}
36
- </span>
37
- </td>
38
- </tr>
39
- </tbody>
40
- </table>
41
- </div>
42
- </template>
43
-
44
- <style scoped lang="scss">
45
- @import '@/styles/page-common.scss';
46
- </style>
47
-
@@ -1,58 +0,0 @@
1
- <script setup lang="ts">
2
- const menus = [
3
- { id: 1, title: '首页', path: '/home', icon: '🏠', type: '菜单', sort: 1 },
4
- { id: 2, title: '系统管理', path: '/system', icon: '⚙️', type: '目录', sort: 2 },
5
- { id: 3, title: '用户管理', path: '/system/user', icon: '👤', type: '菜单', sort: 1, parentId: 2 },
6
- { id: 4, title: '角色管理', path: '/system/role', icon: '🔑', type: '菜单', sort: 2, parentId: 2 },
7
- { id: 5, title: '菜单管理', path: '/system/menu', icon: '📋', type: '菜单', sort: 3, parentId: 2 }
8
- ]
9
- </script>
10
-
11
- <template>
12
- <div class="page-container">
13
- <div class="page-header">
14
- <h2>菜单管理</h2>
15
- <button class="btn-primary">+ 新增菜单</button>
16
- </div>
17
- <table class="data-table">
18
- <thead>
19
- <tr>
20
- <th>ID</th>
21
- <th>标题</th>
22
- <th>路径</th>
23
- <th>图标</th>
24
- <th>类型</th>
25
- <th>排序</th>
26
- <th>操作</th>
27
- </tr>
28
- </thead>
29
- <tbody>
30
- <tr v-for="menu in menus" :key="menu.id">
31
- <td>{{ menu.id }}</td>
32
- <td>{{ menu.title }}</td>
33
- <td><code>{{ menu.path }}</code></td>
34
- <td>{{ menu.icon }}</td>
35
- <td>{{ menu.type }}</td>
36
- <td>{{ menu.sort }}</td>
37
- <td>
38
- <button class="btn-link">编辑</button>
39
- <button class="btn-link danger">删除</button>
40
- </td>
41
- </tr>
42
- </tbody>
43
- </table>
44
- </div>
45
- </template>
46
-
47
- <style scoped lang="scss">
48
- @import '@/styles/page-common.scss';
49
-
50
- code {
51
- background: var(--bg-color-page);
52
- padding: 2px 8px;
53
- border-radius: 3px;
54
- font-size: 13px;
55
- color: var(--primary-color);
56
- }
57
- </style>
58
-
@@ -1,59 +0,0 @@
1
- <script setup lang="ts">
2
- const roles = [
3
- { id: 1, name: 'admin', label: '超级管理员', description: '拥有所有权限', status: '启用' },
4
- { id: 2, name: 'editor', label: '编辑', description: '可编辑内容', status: '启用' },
5
- { id: 3, name: 'viewer', label: '只读', description: '只能查看', status: '启用' }
6
- ]
7
- </script>
8
-
9
- <template>
10
- <div class="page-container">
11
- <div class="page-header">
12
- <h2>角色管理</h2>
13
- <button class="btn-primary">+ 新增角色</button>
14
- </div>
15
- <table class="data-table">
16
- <thead>
17
- <tr>
18
- <th>ID</th>
19
- <th>角色标识</th>
20
- <th>角色名称</th>
21
- <th>描述</th>
22
- <th>状态</th>
23
- <th>操作</th>
24
- </tr>
25
- </thead>
26
- <tbody>
27
- <tr v-for="role in roles" :key="role.id">
28
- <td>{{ role.id }}</td>
29
- <td><code>{{ role.name }}</code></td>
30
- <td>{{ role.label }}</td>
31
- <td>{{ role.description }}</td>
32
- <td>
33
- <span :class="role.status === '启用' ? 'status-active' : 'status-disabled'">
34
- {{ role.status }}
35
- </span>
36
- </td>
37
- <td>
38
- <button class="btn-link">编辑</button>
39
- <button class="btn-link">权限</button>
40
- <button class="btn-link danger">删除</button>
41
- </td>
42
- </tr>
43
- </tbody>
44
- </table>
45
- </div>
46
- </template>
47
-
48
- <style scoped lang="scss">
49
- @import '@/styles/page-common.scss';
50
-
51
- code {
52
- background: var(--bg-color-page);
53
- padding: 2px 8px;
54
- border-radius: 3px;
55
- font-size: 13px;
56
- color: var(--primary-color);
57
- }
58
- </style>
59
-