create-young-proj 1.7.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. package/CHANGELOG.md +117 -1
  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/error.vue +3 -3
  79. package/template-nuxt-admin/nuxt.config.ts +33 -11
  80. package/template-nuxt-admin/package.json +14 -11
  81. package/template-nuxt-admin/pages/system/api.vue +6 -6
  82. package/template-nuxt-admin/pages/system/role.vue +4 -4
  83. package/template-nuxt-admin/pages/system/user.vue +4 -4
  84. package/template-nuxt-admin/server/api/[...all].ts +10 -3
  85. package/template-nuxt-admin/server/plugins/env.ts +5 -4
  86. package/template-nuxt-admin/uno.config.ts +1 -9
  87. package/template-nuxt-admin/yarn.lock +5271 -4123
  88. package/template-nuxt-mobile/package.json +1 -0
  89. package/template-nuxt-mobile/server/utils/proxy.ts +1 -30
  90. package/template-nuxt-mobile/yarn.lock +9 -0
  91. package/template-nuxt-website/app.vue +45 -1
  92. package/template-nuxt-website/layouts/default.vue +18 -16
  93. package/template-nuxt-website/layouts/home.vue +14 -12
  94. package/template-nuxt-website/layouts/tabbar.vue +18 -16
  95. package/template-nuxt-website/nuxt.config.ts +20 -5
  96. package/template-nuxt-website/package.json +3 -1
  97. package/template-nuxt-website/server/utils/proxy.ts +1 -30
  98. package/template-nuxt-website/yarn.lock +4683 -3595
  99. package/template-nuxt-admin/server/utils/index.ts +0 -36
@@ -17,6 +17,7 @@
17
17
  "@bluesyoung/logger": "^0.0.1",
18
18
  "@bluesyoung/utils": "^0.2.1",
19
19
  "c12": "^1.4.2",
20
+ "h3-proxy": "^1.12.0",
20
21
  "http-proxy": "^1.18.1"
21
22
  },
22
23
  "devDependencies": {
@@ -1,40 +1,11 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-09-27 11:22:08
4
- * @LastEditTime: 2023-11-01 19:10:45
4
+ * @LastEditTime: 2024-03-08 15:04:57
5
5
  * @Description:
6
6
  */
7
- import type { ServerOptions as HTTPProxyOptions } from 'http-proxy'
8
- import ProxyModule from 'http-proxy'
9
7
  import type { H3Event } from 'h3'
10
8
 
11
- /**
12
- * @param target 接口代理的具体地址
13
- * @param defaults 代理配置
14
- * @example
15
- * export default defineEventHandler(async (event) => {
16
- * const proxy = createTransparentProxy(`http://127.0.0.1:3333`);
17
- * await proxy.handle(event);
18
- * });
19
- */
20
- export function createTransparentProxy(target: string, defaults: HTTPProxyOptions = {}) {
21
- const proxy = ProxyModule.createProxy()
22
- const handle = (event: H3Event, opts: HTTPProxyOptions = {}) => {
23
- return new Promise<void>((resolve, reject) => {
24
- proxy.web(event.node.req, event.node.res, { target, ...defaults, ...opts }, (error: any) => {
25
- if (error.code !== 'ECONNRESET')
26
- reject(error)
27
-
28
- resolve()
29
- })
30
- })
31
- }
32
- return {
33
- proxy,
34
- handle,
35
- }
36
- }
37
-
38
9
  /**
39
10
  * 服务端发送的请求
40
11
  */
@@ -4232,6 +4232,15 @@ gzip-size@^7.0.0:
4232
4232
  dependencies:
4233
4233
  duplexer "^0.1.2"
4234
4234
 
4235
+ h3-proxy@^1.12.0:
4236
+ version "1.12.0"
4237
+ resolved "https://registry.npmmirror.com/h3-proxy/-/h3-proxy-1.12.0.tgz#2a25c6df3fae63e8a1183ba234cd100038e0d4ca"
4238
+ integrity sha512-nvYRfRVPyU2Nt3Z5gZoAPp8swUH6XTltV6mRQUnTJHc9UulYcCVyQCZX32tJdGESDvurE18WtjXT8sWWioCzFw==
4239
+ dependencies:
4240
+ consola "^3.2.3"
4241
+ is-glob "^4.0.3"
4242
+ micromatch "^4.0.5"
4243
+
4235
4244
  h3@^1.6.6, h3@^1.8.1, h3@^1.8.2:
4236
4245
  version "1.8.2"
4237
4246
  resolved "https://registry.npmmirror.com/h3/-/h3-1.8.2.tgz#69ea8ca0285c1bb268cd08b9a7017e02939f88b7"
@@ -1,9 +1,10 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-05-25 19:53:07
4
- * @LastEditTime: 2023-10-27 16:31:29
4
+ * @LastEditTime: 2024-06-17 12:02:16
5
5
  * @Description:
6
6
  -->
7
+
7
8
  <script lang="ts" setup>
8
9
  import '@unocss/reset/tailwind-compat.css'
9
10
 
@@ -18,6 +19,49 @@ app.hook('page:start', () => {
18
19
  app.hook('page:finish', () => {
19
20
  // console.log('loading end ...')
20
21
  hideLoading()
22
+
23
+ /**
24
+ * ua: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
25
+ * 解析出版本号 120.0.0.0
26
+ * todo: 按需调整版本号
27
+ */
28
+ const ua = navigator.userAgent
29
+
30
+ const version = ua.match(/Chrome\/(\d+)\./)?.[1] ?? ''
31
+
32
+ // 旧版浏览器
33
+ if (version && Number.parseInt(version) < 63) {
34
+ console.warn('浏览器版本过低,可能会出问题')
35
+ showConfirmDialog({
36
+ title: '温馨提示',
37
+ message:
38
+ '当前浏览器版本过低,可能会导致部分功能无法正常使用,建议您升级到最新版本的浏览器。',
39
+ confirmButtonText: '立即升级',
40
+ cancelButtonText: '仍要使用',
41
+ cancelButtonColor: 'red',
42
+ })
43
+ .then(() => {
44
+ location.href = 'https://support.dmeng.net/upgrade-your-browser.html'
45
+ })
46
+ .catch(() => {
47
+ // on cancel
48
+ // todo: 记住选项,不再弹窗
49
+ console.log('用户选择继续使用')
50
+ })
51
+ }
52
+ else if (
53
+ (/Alipay/i.test(ua) && /\(iPhone|iPod|iPad\)/i.test(ua))
54
+ || (/QQ\//i.test(ua) && /\(iPhone|iPod|iPad\)/i.test(ua))
55
+ ) {
56
+ // ios:
57
+ // 支付宝内置浏览器
58
+ // QQ 内置浏览器
59
+ console.warn('ios alipay/qq, has useFetch 400 problem, please use native app')
60
+ showConfirmDialog({
61
+ title: '温馨提示',
62
+ message: '当前环境访问受限,可能会导致部分功能无法正常使用,建议您使用系统自带浏览器访问',
63
+ }).catch(() => null)
64
+ }
21
65
  })
22
66
  </script>
23
67
 
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-09-27 14:15:48
4
- * @LastEditTime: 2023-11-08 09:26:21
4
+ * @LastEditTime: 2024-06-14 17:30:20
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -60,21 +60,23 @@ const bgColor = computed(() => (route.meta.bgColor as string) || '#fff')
60
60
  </script>
61
61
 
62
62
  <template>
63
- <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
64
- <YoungHeader lt-md="!hidden" />
65
- <!-- 移动端其他页面导航 -->
66
- <MobileNavBar v-if="$route.meta.name" :title="$route.meta.name" />
63
+ <div>
64
+ <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
65
+ <YoungHeader lt-md="!hidden" />
66
+ <!-- 移动端其他页面导航 -->
67
+ <MobileNavBar v-if="$route.meta.name" :title="$route.meta.name" />
67
68
 
68
- <main
69
- class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']" :style="{
70
- backgroundColor: bgColor,
71
- }"
72
- >
73
- <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
74
- <NuxtPage />
75
- </div>
76
- </main>
69
+ <main
70
+ class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']" :style="{
71
+ backgroundColor: bgColor,
72
+ }"
73
+ >
74
+ <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
75
+ <NuxtPage />
76
+ </div>
77
+ </main>
77
78
 
78
- <!-- 底部 -->
79
- <LazyYoungFooter lt-md="!hidden" />
79
+ <!-- 底部 -->
80
+ <LazyYoungFooter lt-md="!hidden" />
81
+ </div>
80
82
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-10-11 17:30:55
4
- * @LastEditTime: 2023-11-08 10:56:14
4
+ * @LastEditTime: 2024-06-14 17:19:56
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -59,17 +59,19 @@ const isFull = computed(() => route.query.full || route.meta.full)
59
59
  </script>
60
60
 
61
61
  <template>
62
- <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
63
- <YoungHeader />
62
+ <div>
63
+ <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
64
+ <YoungHeader />
64
65
 
65
- <main class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']">
66
- <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
67
- <NuxtPage />
68
- </div>
69
- </main>
66
+ <main class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']">
67
+ <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
68
+ <NuxtPage />
69
+ </div>
70
+ </main>
70
71
 
71
- <!-- 底部 -->
72
- <LazyYoungFooter />
73
- <!-- 移动端 tabbar -->
74
- <LazyYoungTabbar />
72
+ <!-- 底部 -->
73
+ <LazyYoungFooter />
74
+ <!-- 移动端 tabbar -->
75
+ <LazyYoungTabbar />
76
+ </div>
75
77
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-10-16 14:15:51
4
- * @LastEditTime: 2023-11-08 10:56:34
4
+ * @LastEditTime: 2024-06-14 17:29:19
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -59,20 +59,22 @@ const bgColor = computed(() => (route.meta.bgColor as string) || '#fff')
59
59
  </script>
60
60
 
61
61
  <template>
62
- <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
63
- <YoungHeader lt-md="!hidden" />
64
- <main
65
- class="m-auto mt-80px min-h-[calc(100vh-80px)] lt-md:mt-0 min-h-100vh" :style="{
66
- backgroundColor: bgColor,
67
- }"
68
- >
69
- <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
70
- <NuxtPage />
71
- </div>
72
- </main>
62
+ <div>
63
+ <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
64
+ <YoungHeader lt-md="!hidden" />
65
+ <main
66
+ class="m-auto mt-80px min-h-[calc(100vh-80px)] lt-md:mt-0 min-h-100vh" :style="{
67
+ backgroundColor: bgColor,
68
+ }"
69
+ >
70
+ <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
71
+ <NuxtPage />
72
+ </div>
73
+ </main>
73
74
 
74
- <!-- 底部 -->
75
- <LazyYoungFooter lt-md="!hidden" />
76
- <!-- 移动端 tabbar -->
77
- <LazyYoungTabbar />
75
+ <!-- 底部 -->
76
+ <LazyYoungFooter lt-md="!hidden" />
77
+ <!-- 移动端 tabbar -->
78
+ <LazyYoungTabbar />
79
+ </div>
78
80
  </template>
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-09-21 15:57:55
4
- * @LastEditTime: 2023-11-30 11:05:04
4
+ * @LastEditTime: 2024-06-17 12:00:53
5
5
  * @Description:
6
6
  */
7
7
  import { resolve } from 'node:path'
@@ -21,7 +21,7 @@ export default defineNuxtConfig({
21
21
  { name: 'renderer', content: 'webkit' },
22
22
  { name: 'mobile-web-app-capable', content: 'yes' },
23
23
  { name: 'creator', content: 'BluesYoung-web' },
24
- { 'http-equiv': 'X-UA-Compatible', 'content': 'IE=edge,chrome=1' },
24
+ { 'http-equiv': 'x-ua-compatible', 'content': 'IE=edge,chrome=1' },
25
25
  { id: 'viewportMeta', name: 'viewport', content: 'maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0' },
26
26
  { name: 'format-detection', content: 'telephone=no,email=no,date=no,address=no' },
27
27
  ],
@@ -45,6 +45,11 @@ export default defineNuxtConfig({
45
45
  }
46
46
  `,
47
47
  },
48
+ // ! 必须在这里导入,ResizeObserver 写在 additionalLegacyPolyfills 里面不生效
49
+ // ? 基于 polyfill.io 按需导入
50
+ {
51
+ src: '//cdn.polyfill.io/v3/polyfill.min.js?features=ResizeObserver%2CElement.prototype.getAttributeNames',
52
+ },
48
53
  ],
49
54
  link: [
50
55
  { rel: 'icon', type: 'image/png', href: '/favicon.ico' },
@@ -59,6 +64,7 @@ export default defineNuxtConfig({
59
64
  },
60
65
  'devtools': { enabled: false },
61
66
  'modules': [
67
+ 'nuxt-vite-legacy',
62
68
  'nuxt-swiper',
63
69
  '@nuxtjs/device',
64
70
  '@pinia/nuxt',
@@ -95,12 +101,17 @@ export default defineNuxtConfig({
95
101
  '*': { swr: true },
96
102
  },
97
103
 
104
+ // 兼容旧浏览器
105
+ // Optionally, provide @vitejs/plugin-legacy options.
106
+ // For example, for Chrome 49 you could use:
107
+ 'legacy': {
108
+ targets: ['chrome 49'],
109
+ },
110
+
98
111
  'vite': {
99
112
  build: {
100
113
  sourcemap: false,
101
- // 兼容旧浏览器
102
- target: ['chrome58'],
103
- cssTarget: ['chrome58'],
114
+ cssTarget: ['chrome49'],
104
115
  },
105
116
  },
106
117
  'runtimeConfig': {
@@ -111,4 +122,8 @@ export default defineNuxtConfig({
111
122
  cacheTime: 10,
112
123
  },
113
124
  },
125
+
126
+ 'experimental': {
127
+ appManifest: false,
128
+ },
114
129
  })
@@ -16,6 +16,7 @@
16
16
  "@bluesyoung/logger": "^0.0.1",
17
17
  "@bluesyoung/utils": "^0.2.1",
18
18
  "c12": "^1.4.2",
19
+ "h3-proxy": "^1.12.0",
19
20
  "http-proxy": "^1.18.1"
20
21
  },
21
22
  "devDependencies": {
@@ -31,8 +32,9 @@
31
32
  "@vueuse/nuxt": "^10.5.0",
32
33
  "element-plus": "^2.3.14",
33
34
  "eslint": "^8.51.0",
34
- "nuxt": "3.5.1",
35
+ "nuxt": "^3.12.2",
35
36
  "nuxt-swiper": "^1.2.2",
37
+ "nuxt-vite-legacy": "^1.2.0",
36
38
  "sass": "^1.69.5",
37
39
  "typescript": "^5.2.2",
38
40
  "vant": "^4.7.3"
@@ -1,40 +1,11 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-09-27 11:22:08
4
- * @LastEditTime: 2023-11-01 19:10:45
4
+ * @LastEditTime: 2024-03-08 15:05:53
5
5
  * @Description:
6
6
  */
7
- import type { ServerOptions as HTTPProxyOptions } from 'http-proxy'
8
- import ProxyModule from 'http-proxy'
9
7
  import type { H3Event } from 'h3'
10
8
 
11
- /**
12
- * @param target 接口代理的具体地址
13
- * @param defaults 代理配置
14
- * @example
15
- * export default defineEventHandler(async (event) => {
16
- * const proxy = createTransparentProxy(`http://127.0.0.1:3333`);
17
- * await proxy.handle(event);
18
- * });
19
- */
20
- export function createTransparentProxy(target: string, defaults: HTTPProxyOptions = {}) {
21
- const proxy = ProxyModule.createProxy()
22
- const handle = (event: H3Event, opts: HTTPProxyOptions = {}) => {
23
- return new Promise<void>((resolve, reject) => {
24
- proxy.web(event.node.req, event.node.res, { target, ...defaults, ...opts }, (error: any) => {
25
- if (error.code !== 'ECONNRESET')
26
- reject(error)
27
-
28
- resolve()
29
- })
30
- })
31
- }
32
- return {
33
- proxy,
34
- handle,
35
- }
36
- }
37
-
38
9
  /**
39
10
  * 服务端发送的请求
40
11
  */