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
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-02-13 14:58:26
4
- * @LastEditTime: 2023-07-20 15:31:59
4
+ * @LastEditTime: 2024-02-01 11:09:23
5
5
  * @Description:
6
6
  -->
7
7
  <script setup lang="ts">
@@ -17,9 +17,17 @@ onLaunch(async () => {
17
17
  setUuid()
18
18
 
19
19
  await getSystemInfo()
20
+
21
+ // #ifdef APP-PLUS
22
+ /**
23
+ * App 热更新
24
+ * 参见:https://ask.dcloud.net.cn/article/35667
25
+ */
26
+ // #endif
20
27
  })
21
28
 
22
29
  onShow(async () => {
30
+ // #ifdef MP
23
31
  /**
24
32
  * 自动更新
25
33
  */
@@ -46,6 +54,8 @@ onShow(async () => {
46
54
  // 新版本下载失败
47
55
  showModal({ title: '更新提示', content: '新版本下载失败', showCancel: false })
48
56
  })
57
+ // #endif
58
+
49
59
  console.log('App Show')
50
60
  })
51
61
 
@@ -17,8 +17,15 @@ const EnvConfig = {
17
17
  }
18
18
 
19
19
  export function getReqUrl(): string {
20
- // @ts-expect-error
21
- return import.meta.env.VITE_API_BASE_URL || EnvConfig[__wxConfig.envVersion]
20
+ let url = import.meta.env.VITE_API_BASE_URL
21
+
22
+ // #ifdef MP-WEIXIN
23
+ if (__wxConfig && __wxConfig.envVersion && EnvConfig[__wxConfig.envVersion])
24
+ url = EnvConfig[__wxConfig.envVersion]
25
+
26
+ // #endif
27
+
28
+ return url
22
29
  }
23
30
 
24
31
  const http = useHttp({
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-19 12:12:29
4
- * @LastEditTime: 2023-08-25 16:26:53
4
+ * @LastEditTime: 2024-02-01 11:15:49
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -15,8 +15,10 @@ withDefaults(defineProps<{
15
15
  */
16
16
  tip?: string
17
17
  }>(), {
18
+ // #ifdef MP-WEIXIN
18
19
  // @ts-expect-error
19
20
  loadingGif: __wxConfig.accountInfo.icon,
21
+ // #endif
20
22
  tip: '加载中...',
21
23
  })
22
24
 
@@ -28,7 +30,7 @@ const { fullscreenLoading } = storeToRefs(useHttpLoading())
28
30
  v-show="fullscreenLoading"
29
31
  class="w100vw h100vh fixed left-0 top-0 z-999999 bg-white flex flex-col items-center justify-center"
30
32
  >
31
- <image :src="loadingGif" class="w140rpx h140rpx mb-32rpx" />
33
+ <image v-if="loadingGif" :src="loadingGif" class="w140rpx h140rpx mb-32rpx" />
32
34
  <text class="text-[#999] text-24rpx leading-36rpx">
33
35
  {{ tip }}
34
36
  </text>
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-19 08:41:05
4
- * @LastEditTime: 2023-11-07 17:14:47
4
+ * @LastEditTime: 2024-02-01 11:28:01
5
5
  * @Description:
6
6
  */
7
7
  /// <reference types="vite/client" />
@@ -25,10 +25,15 @@ declare interface ImportMetaEnv {
25
25
  VITE_CUSTOM_LOADING: boolean
26
26
 
27
27
  /**
28
- * 微信小程序 appid
28
+ * appid
29
29
  */
30
30
  VITE_APPID: string
31
31
 
32
+ /**
33
+ * 应用名称
34
+ */
35
+ VITE_APPNAME: string
36
+
32
37
  /**
33
38
  * 接口请求地址
34
39
  */
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 14:28:16
4
- * @LastEditTime: 2023-08-29 10:22:48
4
+ * @LastEditTime: 2024-02-01 10:31:14
5
5
  * @Description: 权限相关
6
6
  */
7
7
  /**
@@ -66,6 +66,7 @@ export function locate(cancelback = true) {
66
66
  */
67
67
  export async function authLocation(cancelback = true, isShowModal = true) {
68
68
  return new Promise<UniApp.GetLocationSuccess>(async (resolve, reject) => {
69
+ // #ifdef MP
69
70
  uni.getSetting({
70
71
  withSubscriptions: true,
71
72
  success: async (conf) => {
@@ -128,6 +129,11 @@ export async function authLocation(cancelback = true, isShowModal = true) {
128
129
  reject(false)
129
130
  },
130
131
  })
132
+ // #endif
133
+ // #ifndef MP
134
+ console.error('this method can only used in miniprogram !')
135
+ reject(false)
136
+ // #endif
131
137
  })
132
138
  }
133
139
 
@@ -137,6 +143,7 @@ export async function authLocation(cancelback = true, isShowModal = true) {
137
143
  export async function getAuthInfo() {
138
144
  return new Promise<UniApp.CheckIsSupportSoterAuthenticationRes['supportMode'] | false>(
139
145
  (resolve) => {
146
+ // #ifdef APP-PLUS || MP-WEIXIN
140
147
  uni.checkIsSupportSoterAuthentication({
141
148
  success(res) {
142
149
  resolve(res.supportMode)
@@ -146,6 +153,12 @@ export async function getAuthInfo() {
146
153
  resolve(false)
147
154
  },
148
155
  })
156
+ // #endif
157
+
158
+ // #ifndef APP-PLUS || MP-WEIXIN
159
+ resolve(false)
160
+ console.error('this method can only used in app and mp-weixin !')
161
+ // #endif
149
162
  },
150
163
  )
151
164
  }
@@ -155,11 +168,16 @@ export async function getAuthInfo() {
155
168
  */
156
169
  export async function checkFingerPrint() {
157
170
  return new Promise<boolean>((resolve) => {
171
+ // #ifdef APP-PLUS || MP-WEIXIN
158
172
  uni.checkIsSoterEnrolledInDevice({
159
173
  checkAuthMode: 'fingerPrint',
160
174
  success: () => resolve(true),
161
175
  fail: () => resolve(false),
162
176
  })
177
+ // #endif
178
+ // #ifndef APP-PLUS || MP-WEIXIN
179
+ resolve(false)
180
+ // #endif
163
181
  })
164
182
  }
165
183
 
@@ -168,6 +186,7 @@ export async function checkFingerPrint() {
168
186
  */
169
187
  export async function fingerPrintAuth(signStr: string, authContent = '请验证本机指纹') {
170
188
  return new Promise<boolean>(async (resolve) => {
189
+ // #ifdef APP-PLUS || MP-WEIXIN
171
190
  const authMethods = await getAuthInfo()
172
191
  if (authMethods && authMethods.includes('fingerPrint')) {
173
192
  uni.checkIsSupportSoterAuthentication({
@@ -200,5 +219,9 @@ export async function fingerPrintAuth(signStr: string, authContent = '请验证
200
219
  else {
201
220
  resolve(false)
202
221
  }
222
+ // #endif
223
+ // #ifndef APP-PLUS || MP-WEIXIN
224
+ resolve(false)
225
+ // #endif
203
226
  })
204
227
  }
@@ -1,11 +1,10 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 14:12:16
4
- * @LastEditTime: 2023-07-18 15:30:03
4
+ * @LastEditTime: 2024-02-01 10:20:17
5
5
  * @Description:
6
6
  */
7
7
  export * from './modal'
8
8
  export * from './auth'
9
- export * from './map'
10
9
  export * from './system'
11
10
  export * from './route'
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 14:24:35
4
- * @LastEditTime: 2023-09-06 19:42:33
4
+ * @LastEditTime: 2024-02-01 10:26:40
5
5
  * @Description:
6
6
  */
7
7
  import type { SubscribeMessage } from '@/config'
@@ -10,6 +10,7 @@ import type { SubscribeMessage } from '@/config'
10
10
  * 订阅指定的消息
11
11
  */
12
12
  export function subscribeMessage(tmplIds: SubscribeMessage[]) {
13
+ // #ifdef MP-WEIXIN
13
14
  return new Promise((resolve) => {
14
15
  uni.requestSubscribeMessage({
15
16
  tmplIds,
@@ -22,6 +23,10 @@ export function subscribeMessage(tmplIds: SubscribeMessage[]) {
22
23
  complete: () => resolve(true),
23
24
  })
24
25
  })
26
+ // #endif
27
+ // #ifndef MP-WEIXIN
28
+ throw new Error('subscribeMessage 仅微信小程序支持')
29
+ // #endif
25
30
  }
26
31
 
27
32
  /**
@@ -1,36 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2023-05-29 10:29:52
4
- * @LastEditTime: 2023-06-17 16:20:40
5
- * @Description:
6
- */
7
- import type { ServerOptions as HTTPProxyOptions } from 'http-proxy'
8
- import ProxyModule from 'http-proxy'
9
- import type { H3Event } from 'h3'
10
-
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
- }
@@ -1,98 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2023-07-18 14:29:41
4
- * @LastEditTime: 2023-07-19 16:51:26
5
- * @Description: 地图相关(基于腾讯地图)
6
- */
7
- export interface TxLocationSearchRes {
8
- address: string
9
- title: string
10
- _distance: number
11
- id: string
12
- location: {
13
- lat: number
14
- lng: number
15
- }
16
- }
17
-
18
- export interface TxLocationSearch {
19
- /**
20
- * 分页信息
21
- */
22
- page_size: number
23
- page_index: number
24
- /**
25
- * 搜索关键字
26
- */
27
- keyword: string
28
-
29
- /**
30
- * 经纬度
31
- */
32
- latitude: number
33
- longitude: number
34
- }
35
-
36
- /**
37
- * 地点搜索
38
- */
39
- export function searchLoaction(args: TxLocationSearch) {
40
- const { page_size, page_index, keyword, latitude, longitude } = args
41
-
42
- return new Promise<TxLocationSearchRes[]>((resolve, reject): void => {
43
- uni.request({
44
- url: `https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(${latitude},${longitude},1000)${
45
- keyword ? `&keyword=${keyword}` : ''
46
- }&page_size=${page_size}&page_index=${page_index}&key=${getMapApiKey()}`,
47
- success: (res) => {
48
- resolve((res.data as unknown as { data: TxLocationSearchRes[] }).data)
49
- },
50
- fail: (err) => {
51
- console.log(err)
52
- reject()
53
- },
54
- complete: (err) => {
55
- console.log(err)
56
- reject()
57
- },
58
- })
59
- })
60
- }
61
-
62
- export interface GeoCoderRes {
63
- province_code: string
64
- city_code: string
65
- city: string
66
- province: string
67
- location: {
68
- lat: number
69
- lng: number
70
- }
71
- }
72
-
73
- /**
74
- * 逆地址解析(坐标位置描述)
75
- */
76
- export function geocoderLocation(latitude: number, longitude: number) {
77
- return new Promise<GeoCoderRes>((resolve, reject): void => {
78
- uni.request({
79
- url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${latitude},${longitude}&key=${getMapApiKey()}&get_poi=1`,
80
- success: (res) => {
81
- const ad_info = (res.data as any).result.ad_info
82
- resolve({
83
- ...ad_info,
84
- province_code: ad_info.adcode.slice(0, 2),
85
- city_code: ad_info.adcode.slice(0, 4),
86
- })
87
- },
88
- fail: (err) => {
89
- console.log(err)
90
- reject()
91
- },
92
- complete: (err) => {
93
- console.log(err)
94
- reject()
95
- },
96
- })
97
- })
98
- }