create-young-proj 1.6.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +6 -1
  3. package/dist/index.mjs +19 -19
  4. package/package.json +1 -1
  5. package/src/index.ts +6 -1
  6. package/template-admin-server/src/service/role.service.ts +5 -3
  7. package/template-big-screen/.editorconfig +14 -0
  8. package/template-big-screen/.nvmrc +1 -0
  9. package/template-big-screen/.vscode/extensions.json +12 -0
  10. package/template-big-screen/.vscode/settings.json +39 -0
  11. package/template-big-screen/Dockerfile +49 -0
  12. package/template-big-screen/README.md +20 -0
  13. package/template-big-screen/_gitignore +23 -0
  14. package/template-big-screen/_npmrc +2 -0
  15. package/template-big-screen/_nvmrc +1 -0
  16. package/template-big-screen/boot.mjs +16 -0
  17. package/template-big-screen/config/.devrc +1 -0
  18. package/template-big-screen/config/.onlinerc +1 -0
  19. package/template-big-screen/config/.testrc +1 -0
  20. package/template-big-screen/eslint.config.js +34 -0
  21. package/template-big-screen/index.html +48 -0
  22. package/template-big-screen/nitro.config.ts +23 -0
  23. package/template-big-screen/package.json +66 -0
  24. package/template-big-screen/plugins/init.ts +57 -0
  25. package/template-big-screen/public/favicon.svg +3 -0
  26. package/template-big-screen/routes/api/[...all].ts +19 -0
  27. package/template-big-screen/routes/get/env.ts +13 -0
  28. package/template-big-screen/src/App.vue +24 -0
  29. package/template-big-screen/src/apis/get.ts +77 -0
  30. package/template-big-screen/src/apis/index.ts +53 -0
  31. package/template-big-screen/src/apis/post.ts +14 -0
  32. package/template-big-screen/src/assets/data/china.json +1 -0
  33. package/template-big-screen/src/components/YoungCountUp.vue +29 -0
  34. package/template-big-screen/src/components/YoungECharts/config.ts +56 -0
  35. package/template-big-screen/src/components/YoungECharts/index.vue +111 -0
  36. package/template-big-screen/src/components/YoungHeader.vue +54 -0
  37. package/template-big-screen/src/components/YoungSectionContainer.vue +55 -0
  38. package/template-big-screen/src/components/YoungSectionHeader.vue +23 -0
  39. package/template-big-screen/src/composables/breakPoint.ts +20 -0
  40. package/template-big-screen/src/composables/dark.ts +52 -0
  41. package/template-big-screen/src/composables/echarts.ts +17 -0
  42. package/template-big-screen/src/composables/loadData.ts +38 -0
  43. package/template-big-screen/src/directives/ellipsis.ts +20 -0
  44. package/template-big-screen/src/directives/index.ts +13 -0
  45. package/template-big-screen/src/enums/breakpointEnum.ts +9 -0
  46. package/template-big-screen/src/layouts/404.vue +19 -0
  47. package/template-big-screen/src/layouts/blank.vue +9 -0
  48. package/template-big-screen/src/layouts/default.vue +17 -0
  49. package/template-big-screen/src/main.ts +59 -0
  50. package/template-big-screen/src/modules/index.ts +8 -0
  51. package/template-big-screen/src/modules/pinia.ts +11 -0
  52. package/template-big-screen/src/modules/router.ts +28 -0
  53. package/template-big-screen/src/pages/[...all].vue +16 -0
  54. package/template-big-screen/src/pages/electricity/build.vue +135 -0
  55. package/template-big-screen/src/pages/electricity/reliability.vue +137 -0
  56. package/template-big-screen/src/pages/electricity/sale-and-cost.vue +158 -0
  57. package/template-big-screen/src/pages/index.vue +59 -0
  58. package/template-big-screen/src/pages/kpi.vue +129 -0
  59. package/template-big-screen/src/pages/manage-improve.vue +114 -0
  60. package/template-big-screen/src/pages/social/condition.vue +202 -0
  61. package/template-big-screen/src/pages/social/electricity-usage.vue +140 -0
  62. package/template-big-screen/src/styles/index.scss +82 -0
  63. package/template-big-screen/tsconfig.json +38 -0
  64. package/template-big-screen/types/auto-imports.d.ts +949 -0
  65. package/template-big-screen/types/components.d.ts +19 -0
  66. package/template-big-screen/types/echarts.d.ts +36 -0
  67. package/template-big-screen/types/index.d.ts +45 -0
  68. package/template-big-screen/types/type.d.ts +38 -0
  69. package/template-big-screen/uno.config.ts +68 -0
  70. package/template-big-screen/vite.config.ts +131 -0
  71. package/template-big-screen/yarn.lock +7443 -0
  72. package/template-nuxt-admin/README.md +3 -3
  73. package/template-nuxt-admin/boot.mjs +4 -1
  74. package/template-nuxt-admin/composables/config.ts +2 -2
  75. package/template-nuxt-admin/config/.devrc +1 -1
  76. package/template-nuxt-admin/config/.onlinerc +1 -1
  77. package/template-nuxt-admin/config/.testrc +1 -1
  78. package/template-nuxt-admin/nuxt.config.ts +14 -5
  79. package/template-nuxt-admin/package.json +12 -11
  80. package/template-nuxt-admin/pages/system/api.vue +6 -6
  81. package/template-nuxt-admin/pages/system/role.vue +4 -4
  82. package/template-nuxt-admin/pages/system/user.vue +4 -4
  83. package/template-nuxt-admin/server/api/[...all].ts +10 -3
  84. package/template-nuxt-admin/server/plugins/env.ts +5 -4
  85. package/template-nuxt-admin/uno.config.ts +1 -9
  86. package/template-nuxt-admin/yarn.lock +3659 -3363
  87. package/template-nuxt-mobile/package.json +1 -0
  88. package/template-nuxt-mobile/server/utils/proxy.ts +1 -30
  89. package/template-nuxt-mobile/yarn.lock +9 -0
  90. package/template-nuxt-website/package.json +1 -0
  91. package/template-nuxt-website/server/utils/proxy.ts +1 -30
  92. package/template-nuxt-website/yarn.lock +9 -0
  93. package/template-uni-app/README.md +6 -1
  94. package/template-uni-app/_env +2 -1
  95. package/template-uni-app/auto-imports.d.ts +0 -4
  96. package/template-uni-app/custom-plugins/multiconf.ts +13 -1
  97. package/template-uni-app/package.json +17 -17
  98. package/template-uni-app/pnpm-lock.yaml +565 -985
  99. package/template-uni-app/src/App.vue +11 -1
  100. package/template-uni-app/src/apis/index.ts +9 -2
  101. package/template-uni-app/src/components/young-loading/young-loading.vue +4 -2
  102. package/template-uni-app/src/env.d.ts +7 -2
  103. package/template-uni-app/src/utils/auth.ts +24 -1
  104. package/template-uni-app/src/utils/index.ts +1 -2
  105. package/template-uni-app/src/utils/system.ts +6 -1
  106. package/template-nuxt-admin/server/utils/index.ts +0 -36
  107. package/template-uni-app/src/utils/map.ts +0 -98
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![](https://img.shields.io/badge/Author-BluesYoung--web-blue)](https://gitee.com/BluesYoung-web)
4
4
 
5
-
6
5
  [![code style](https://antfu.me/badge-code-style.svg)](https://github.com/antfu/eslint-config)
7
6
 
8
7
  ## 与旧版的区别
@@ -76,6 +75,8 @@ npm i -g young-commit
76
75
 
77
76
  接口需要传递数组数据的,需要序列化为逗号拼接的字符串之后再传递!!!
78
77
 
78
+ **默认为 hash 路由,支持非根路径部署。**
79
+
79
80
  ## 使用响应式布局
80
81
 
81
82
  兼容 `PC` 端与移动端
@@ -92,7 +93,6 @@ throw createError({ statusCode: 404, message: '数据迷路了' })
92
93
 
93
94
  ### 响应式屏幕尺寸
94
95
 
95
-
96
96
  ```ts
97
97
  /*
98
98
  export const WindowSize = reactive({
@@ -108,4 +108,4 @@ export const WindowSize = reactive({
108
108
  '2xl': useMediaQuery('(min-width: 1536px)'),
109
109
  });
110
110
  */
111
- ```
111
+ ```
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2022-09-07 09:31:12
4
- * @LastEditTime: 2023-05-26 11:21:19
4
+ * @LastEditTime: 2024-05-08 14:24:58
5
5
  * @Description:
6
6
  */
7
7
  (async () => {
@@ -12,5 +12,8 @@
12
12
 
13
13
  process.env.NITRO_PORT = listenPort
14
14
 
15
+ // hack 非根路径部署
16
+ process.env.NUXT_APP_CDN_URL = './'
17
+
15
18
  await import('./dist/server/index.mjs')
16
19
  })()
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-26 11:48:46
4
- * @LastEditTime: 2023-07-26 11:48:46
4
+ * @LastEditTime: 2024-05-22 17:23:14
5
5
  * @Description:
6
6
  */
7
7
  export const MethodObj = {
8
8
  GET: 'info',
9
9
  POST: 'success',
10
10
  PATCH: 'warning',
11
- PUT: '',
11
+ PUT: 'primary',
12
12
  DELETE: 'danger',
13
13
  } as const
@@ -1 +1 @@
1
- NUXT_PUBLIC_API_BASE = http://192.168.10.168:7001
1
+ NUXT_PUBLIC_API_BASE = http://localhost:7001
@@ -1 +1 @@
1
- NUXT_PUBLIC_API_BASE = http://192.168.10.168:9000
1
+ NUXT_PUBLIC_API_BASE = http://localhost:9000
@@ -1 +1 @@
1
- NUXT_PUBLIC_API_BASE = http://192.168.10.168:9000
1
+ NUXT_PUBLIC_API_BASE = http://localhost:9000
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-09-21 15:57:55
4
- * @LastEditTime: 2023-12-22 09:31:07
4
+ * @LastEditTime: 2024-05-08 14:29:12
5
5
  * @Description:
6
6
  */
7
7
  import { resolve } from 'node:path'
@@ -25,20 +25,22 @@ export default defineNuxtConfig({
25
25
  { 'http-equiv': 'X-UA-Compatible', 'content': 'IE=edge,chrome=1' },
26
26
  { id: 'viewportMeta', name: 'viewport', content: 'maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0' },
27
27
  ],
28
+
29
+ // hack 支持非根路径部署
28
30
  link: [
29
31
  {
30
32
  rel: 'icon',
31
- href: '/favicon.svg',
33
+ href: './favicon.svg',
32
34
  },
33
35
  {
34
36
  rel: 'prefetch',
35
37
  as: 'image',
36
- href: '/image_placeholder.svg',
38
+ href: './image_placeholder.svg',
37
39
  },
38
40
  {
39
41
  rel: 'prefetch',
40
42
  as: 'image',
41
- href: '/tabbar_bg.png',
43
+ href: './tabbar_bg.png',
42
44
  },
43
45
  ],
44
46
  script: [
@@ -56,7 +58,7 @@ export default defineNuxtConfig({
56
58
  `,
57
59
  },
58
60
  {
59
- src: '/index.umd.js',
61
+ src: './index.umd.js',
60
62
  async: true,
61
63
  },
62
64
  ],
@@ -106,4 +108,11 @@ export default defineNuxtConfig({
106
108
  isCustomElement: tag => ['young-float-ball'].includes(tag),
107
109
  },
108
110
  },
111
+
112
+ router: {
113
+ options: {
114
+ // hash 路由,支持非根路径部署;如需 history 路由,则其他的 ./ 需要换成 /
115
+ hashMode: true,
116
+ },
117
+ },
109
118
  })
@@ -15,13 +15,14 @@
15
15
  "dependencies": {
16
16
  "@bluesyoung/casdoor-auth": "^0.1.0",
17
17
  "@bluesyoung/http": "^1.0.1",
18
- "@bluesyoung/ui-vue3": "^0.1.1",
19
- "@bluesyoung/ui-vue3-element-plus": "1.3.5",
20
- "@bluesyoung/utils": "0.2.1",
18
+ "@bluesyoung/ui-vue3": "^1.0.0",
19
+ "@bluesyoung/ui-vue3-element-plus": "1.5.6",
20
+ "@bluesyoung/utils": "0.3.0",
21
21
  "@wangeditor/editor": "^5.1.23",
22
22
  "@wangeditor/editor-for-vue": "^5.1.12",
23
23
  "c12": "^1.4.2",
24
24
  "file-saver": "^2.0.5",
25
+ "h3-proxy": "^1.12.0",
25
26
  "http-proxy": "^1.18.1",
26
27
  "jszip": "^3.10.1",
27
28
  "md5": "^2.3.0",
@@ -30,8 +31,8 @@
30
31
  "vue-cropper": "^1.0.9"
31
32
  },
32
33
  "devDependencies": {
33
- "@antfu/eslint-config": "^1.1.0",
34
- "@bluesyoung/logger": "^0.0.1",
34
+ "@antfu/eslint-config": "^2.18.1",
35
+ "@bluesyoung/logger": "^0.1.0",
35
36
  "@element-plus/nuxt": "^1.0.5",
36
37
  "@iconify/json": "^2.2.93",
37
38
  "@pinia/nuxt": "^0.5.1",
@@ -39,16 +40,16 @@
39
40
  "@types/md5": "^2.3.2",
40
41
  "@types/node": "20.8.10",
41
42
  "@types/qrcode": "^1.5.1",
42
- "@unocss/nuxt": "^0.57.2",
43
+ "@unocss/nuxt": "^0.60.3",
43
44
  "@vant/nuxt": "^1.0.2",
44
45
  "@vueuse/nuxt": "^10.2.1",
45
46
  "dayjs": "^1.11.9",
46
- "element-plus": "^2.3.8",
47
- "eslint": "^8.48.0",
48
- "lint-staged": "^15.0.2",
49
- "nuxt": "^3.8.1",
47
+ "element-plus": "^2.7.3",
48
+ "eslint": "^9.3.0",
49
+ "lint-staged": "^15.2.4",
50
+ "nuxt": "^3.11.2",
50
51
  "pinia": "^2.1.4",
51
- "sass": "^1.64.0",
52
+ "sass": "^1.77.2",
52
53
  "simple-git-hooks": "^2.9.0",
53
54
  "typescript": "^5.2.2",
54
55
  "vant": "^4.6.2"
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-25 16:44:56
4
- * @LastEditTime: 2023-11-07 14:42:48
4
+ * @LastEditTime: 2024-05-22 17:28:59
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -151,14 +151,14 @@ useTabReOpen(getList)
151
151
  <template #body>
152
152
  <ElForm ref="formRef" :model="form" label-width="100px" :label-position="WindowSize['lt-lg'] ? 'top' : 'left'">
153
153
  <ElFormItem label="分组名称" prop="category" :rules="{ required: true, message: '请填写分组名称', trigger: 'blur' }">
154
- <ElInput v-model.trim="form.category" class="!w-300px" />
154
+ <ElInput v-model.trim="form.category" />
155
155
  </ElFormItem>
156
156
  <ElFormItem label="接口描述" prop="desc" :rules="{ required: true, message: '请填写接口描述', trigger: 'blur' }">
157
- <ElInput v-model.trim="form.desc" class="!w-300px" />
157
+ <ElInput v-model.trim="form.desc" />
158
158
  </ElFormItem>
159
159
  <ElFormItem label="请求方法">
160
160
  <YoungSelect
161
- v-model="form.method" class="!w-300px"
161
+ v-model="form.method"
162
162
  :options="Object.keys(MethodObj).map((item) => ({ label: item, value: item }))"
163
163
  />
164
164
  </ElFormItem>
@@ -166,10 +166,10 @@ useTabReOpen(getList)
166
166
  label="接口路径" prop="path"
167
167
  :rules="{ message: '请填写合法的接口路径, eg: /user/list', trigger: 'blur', validator: (_: any, v: string) => /\/(.*)\/(.*)/.test(v) }"
168
168
  >
169
- <ElInput v-model.trim="form.path" class="!w-300px" />
169
+ <ElInput v-model.trim="form.path" />
170
170
  </ElFormItem>
171
171
  <ElFormItem label="关联角色">
172
- <YoungSelect v-model="form.roleIds" multiple placeholder="请选择角色" class="!w-300px" :options="roleList" />
172
+ <YoungSelect v-model="form.roleIds" multiple placeholder="请选择角色" :options="roleList" />
173
173
  </ElFormItem>
174
174
  </ElForm>
175
175
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-25 16:45:39
4
- * @LastEditTime: 2023-11-07 14:41:43
4
+ * @LastEditTime: 2024-05-22 17:29:19
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -79,13 +79,13 @@ useTabReOpen(getList)
79
79
  :label-position="WindowSize['lt-lg'] ? 'top' : 'left'"
80
80
  >
81
81
  <ElFormItem label="角色名称(中文)" prop="name" :rules="[{ required: true, message: '请填写角色名称', trigger: 'blur' }]">
82
- <ElInput v-model.trim="base.form.name" class="!w-300px" />
82
+ <ElInput v-model.trim="base.form.name" />
83
83
  </ElFormItem>
84
84
  <ElFormItem label="关键字(英文)" prop="keyword" :rules="[{ required: true, message: '请填写关键字', trigger: 'blur' }]">
85
- <ElInput v-model.trim="base.form.keyword" class="!w-300px" />
85
+ <ElInput v-model.trim="base.form.keyword" />
86
86
  </ElFormItem>
87
87
  <ElFormItem label="角色描述">
88
- <ElInput v-model.trim="base.form.desc" class="!w-300px" />
88
+ <ElInput v-model.trim="base.form.desc" />
89
89
  </ElFormItem>
90
90
  </ElForm>
91
91
  </template>
@@ -200,13 +200,13 @@ useTabReOpen(getList)
200
200
  <template #body>
201
201
  <ElForm ref="formRef" :model="form" label-width="100px" :label-position="WindowSize['lt-lg'] ? 'top' : 'left'">
202
202
  <ElFormItem label="用户名" prop="username" :rules="{ required: true, message: '请输用户名', trigger: 'blur' }">
203
- <ElInput v-model.trim="form.username" class="!w-300px" />
203
+ <ElInput v-model.trim="form.username" />
204
204
  </ElFormItem>
205
205
  <ElFormItem label="昵称" prop="nickname" :rules="{ required: true, message: '请输昵称(用于右上角展示)', trigger: 'blur' }">
206
- <ElInput v-model.trim="form.nickname" class="!w-300px" />
206
+ <ElInput v-model.trim="form.nickname" />
207
207
  </ElFormItem>
208
208
  <ElFormItem label="手机号" prop="mobile" :rules="{ required: true, message: '请输手机号', trigger: 'blur' }">
209
- <ElInput v-model.trim="form.mobile" :maxlength="11" class="!w-300px" />
209
+ <ElInput v-model.trim="form.mobile" :maxlength="11" />
210
210
  </ElFormItem>
211
211
  <ElFormItem label="角色">
212
212
  <YoungSelect v-model="form.roleId" placeholder="请选择角色" :options="roleList" />
@@ -215,7 +215,7 @@ useTabReOpen(getList)
215
215
  v-if="isAdd" label="初始密码" prop="initPassword"
216
216
  :rules="{ required: true, message: '请输初始密码', trigger: 'blur' }"
217
217
  >
218
- <ElInput v-model.trim="form.initPassword" class="!w-300px" />
218
+ <ElInput v-model.trim="form.initPassword" />
219
219
  </ElFormItem>
220
220
  </ElForm>
221
221
  </template>
@@ -1,10 +1,17 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 09:50:36
4
- * @LastEditTime: 2023-07-21 09:50:36
4
+ * @LastEditTime: 2024-03-08 15:02:22
5
5
  * @Description:
6
6
  */
7
+ import { createProxyEventHandler } from 'h3-proxy'
8
+
7
9
  export default eventHandler(async (event) => {
8
- const proxy = createTransparentProxy(process.env.NUXT_PUBLIC_API_BASE as string)
9
- await proxy.handle(event)
10
+ const proxy = createProxyEventHandler({
11
+ target: process.env.NUXT_PUBLIC_API_BASE as string,
12
+ })
13
+ return proxy(event).catch((error: Error) => {
14
+ console.error('🚀 ~ api proxy error:', error)
15
+ throw error
16
+ })
10
17
  })
@@ -10,6 +10,11 @@ import { useYoungLogger } from '@bluesyoung/logger'
10
10
 
11
11
  export default defineNitroPlugin(async (nitroApp) => {
12
12
  const env = (process.env.DEPLOY_ENV as 'dev' | 'test' | 'online') || 'dev'
13
+
14
+ // 仅打包之后格式化日志
15
+ if (process.env.NODE_ENV !== 'development')
16
+ useYoungLogger({ tag: 'XXX-后台管理系统' })
17
+
13
18
  const { config } = await loadConfig<Record<string, any>>({
14
19
  name: env,
15
20
  cwd: resolve(process.cwd(), 'config'),
@@ -48,10 +53,6 @@ export default defineNitroPlugin(async (nitroApp) => {
48
53
  delete config[key]
49
54
  }
50
55
 
51
- // 仅打包之后格式化日志
52
- if (process.env.NODE_ENV !== 'development')
53
- useYoungLogger()
54
-
55
56
  console.log('------------------------读取配置文件------------------------')
56
57
  console.log(config)
57
58
  console.log('-------------------------------------------------------------')
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2022-06-15 08:59:22
4
- * @LastEditTime: 2023-05-27 19:36:43
4
+ * @LastEditTime: 2024-05-08 14:32:03
5
5
  * @Description:
6
6
  */
7
7
  import {
@@ -10,7 +10,6 @@ import {
10
10
  presetIcons,
11
11
  presetTypography,
12
12
  presetUno,
13
- presetWebFonts,
14
13
  transformerDirectives,
15
14
  transformerVariantGroup,
16
15
  } from 'unocss'
@@ -24,13 +23,6 @@ export default defineConfig({
24
23
  scale: 1.2,
25
24
  }),
26
25
  presetTypography(),
27
- presetWebFonts({
28
- fonts: {
29
- sans: 'DM Sans',
30
- serif: 'DM Serif Display',
31
- mono: 'DM Mono',
32
- },
33
- }),
34
26
  ],
35
27
  transformers: [
36
28
  // 不加 enforce 会有 bug