@gx-design-vue/create-gx-cli 0.1.12 → 0.1.13

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 (184) hide show
  1. package/bin/create-gx-cli +3 -2
  2. package/package.json +4 -4
  3. package/src/cli.js +10 -7
  4. package/src/git.js +8 -5
  5. package/src/main.js +29 -16
  6. package/template-mobile-vant-cli/package.json +5 -5
  7. package/template-gx-design-thin/.editorconfig +0 -19
  8. package/template-gx-design-thin/.env +0 -4
  9. package/template-gx-design-thin/.env.development +0 -15
  10. package/template-gx-design-thin/.env.production +0 -28
  11. package/template-gx-design-thin/.eslintignore +0 -16
  12. package/template-gx-design-thin/.prettierignore +0 -9
  13. package/template-gx-design-thin/LICENSE +0 -21
  14. package/template-gx-design-thin/README.md +0 -112
  15. package/template-gx-design-thin/build/constant.ts +0 -1
  16. package/template-gx-design-thin/build/generate/generateModifyVars.ts +0 -14
  17. package/template-gx-design-thin/build/rollupOptions/index.ts +0 -22
  18. package/template-gx-design-thin/build/util/hash.ts +0 -17
  19. package/template-gx-design-thin/build/util/index.ts +0 -131
  20. package/template-gx-design-thin/build/vite/cdn.ts +0 -63
  21. package/template-gx-design-thin/build/vite/optimizer.ts +0 -26
  22. package/template-gx-design-thin/build/vite/plugin/appConfig.ts +0 -91
  23. package/template-gx-design-thin/build/vite/plugin/autoImport.ts +0 -26
  24. package/template-gx-design-thin/build/vite/plugin/compress.ts +0 -31
  25. package/template-gx-design-thin/build/vite/plugin/html.ts +0 -39
  26. package/template-gx-design-thin/build/vite/plugin/index.ts +0 -75
  27. package/template-gx-design-thin/build/vite/plugin/mock.ts +0 -14
  28. package/template-gx-design-thin/build/vite/plugin/pwa.ts +0 -31
  29. package/template-gx-design-thin/build/vite/plugin/visualizer.ts +0 -14
  30. package/template-gx-design-thin/build/vite/plugin/viteMock/client.ts +0 -88
  31. package/template-gx-design-thin/build/vite/plugin/viteMock/createMockServer.ts +0 -271
  32. package/template-gx-design-thin/build/vite/plugin/viteMock/index.ts +0 -69
  33. package/template-gx-design-thin/build/vite/plugin/viteMock/types.ts +0 -48
  34. package/template-gx-design-thin/build/vite/plugin/viteMock/utils.ts +0 -48
  35. package/template-gx-design-thin/build/vite/plugin/viteNotice.ts +0 -40
  36. package/template-gx-design-thin/commitlint.config.cjs +0 -32
  37. package/template-gx-design-thin/config/default/defaultSettings.ts +0 -78
  38. package/template-gx-design-thin/config/default/network.ts +0 -10
  39. package/template-gx-design-thin/config/default/proxy.ts +0 -47
  40. package/template-gx-design-thin/config/default/theme.ts +0 -3
  41. package/template-gx-design-thin/config/index.ts +0 -11
  42. package/template-gx-design-thin/eslint.config.js +0 -51
  43. package/template-gx-design-thin/index.html +0 -42
  44. package/template-gx-design-thin/mock/_createProductionServer.ts +0 -19
  45. package/template-gx-design-thin/mock/_util.ts +0 -33
  46. package/template-gx-design-thin/mock/config/menu.ts +0 -21
  47. package/template-gx-design-thin/mock/config/user.ts +0 -123
  48. package/template-gx-design-thin/mock/datasSource/system/menu.ts +0 -10
  49. package/template-gx-design-thin/mock/datasSource/user/account.ts +0 -30
  50. package/template-gx-design-thin/mock/datasSource/user/index.ts +0 -47
  51. package/template-gx-design-thin/mock/util/crypto.ts +0 -23
  52. package/template-gx-design-thin/mock/util/table.ts +0 -92
  53. package/template-gx-design-thin/mock/util/utils.ts +0 -73
  54. package/template-gx-design-thin/package.json +0 -129
  55. package/template-gx-design-thin/pnpm-lock.yaml +0 -12575
  56. package/template-gx-design-thin/prettier.config.cjs +0 -18
  57. package/template-gx-design-thin/public/resource/css/index.css +0 -119
  58. package/template-gx-design-thin/public/resource/css/normalize.css +0 -396
  59. package/template-gx-design-thin/public/resource/img/favicon.ico +0 -0
  60. package/template-gx-design-thin/public/resource/img/logo.png +0 -0
  61. package/template-gx-design-thin/public/resource/img/pro_icon.svg +0 -1
  62. package/template-gx-design-thin/public/resource/img/pwa-192x192.png +0 -0
  63. package/template-gx-design-thin/public/resource/img/pwa-512x512.png +0 -0
  64. package/template-gx-design-thin/src/App.vue +0 -42
  65. package/template-gx-design-thin/src/assets/error_images/403.png +0 -0
  66. package/template-gx-design-thin/src/assets/error_images/404.png +0 -0
  67. package/template-gx-design-thin/src/assets/error_images/cloud.png +0 -0
  68. package/template-gx-design-thin/src/assets/login_images/login_background.svg +0 -1
  69. package/template-gx-design-thin/src/assets/logo.png +0 -0
  70. package/template-gx-design-thin/src/assets/menu_font/iconfont.css +0 -94
  71. package/template-gx-design-thin/src/assets/menu_font/iconfont.eot +0 -0
  72. package/template-gx-design-thin/src/assets/menu_font/iconfont.js +0 -1
  73. package/template-gx-design-thin/src/assets/menu_font/iconfont.json +0 -142
  74. package/template-gx-design-thin/src/assets/menu_font/iconfont.svg +0 -1
  75. package/template-gx-design-thin/src/assets/menu_font/iconfont.ttf +0 -0
  76. package/template-gx-design-thin/src/assets/menu_font/iconfont.woff +0 -0
  77. package/template-gx-design-thin/src/assets/menu_font/iconfont.woff2 +0 -0
  78. package/template-gx-design-thin/src/assets/menu_font/index.less +0 -94
  79. package/template-gx-design-thin/src/assets/public_icon/iconfont.css +0 -42
  80. package/template-gx-design-thin/src/assets/public_icon/iconfont.eot +0 -0
  81. package/template-gx-design-thin/src/assets/public_icon/iconfont.js +0 -1
  82. package/template-gx-design-thin/src/assets/public_icon/iconfont.json +0 -51
  83. package/template-gx-design-thin/src/assets/public_icon/iconfont.svg +0 -1
  84. package/template-gx-design-thin/src/assets/public_icon/iconfont.ttf +0 -0
  85. package/template-gx-design-thin/src/assets/public_icon/iconfont.woff +0 -0
  86. package/template-gx-design-thin/src/assets/public_icon/iconfont.woff2 +0 -0
  87. package/template-gx-design-thin/src/assets/public_icon/index.less +0 -42
  88. package/template-gx-design-thin/src/assets/public_images/nodata.svg +0 -1
  89. package/template-gx-design-thin/src/common/global.ts +0 -4
  90. package/template-gx-design-thin/src/components/GDesign/Result/index.tsx +0 -144
  91. package/template-gx-design-thin/src/components/GDesign/Result/style.less +0 -140
  92. package/template-gx-design-thin/src/components/GDesign/utils/index.ts +0 -7
  93. package/template-gx-design-thin/src/components/GlobalLayout/Confirm/index.ts +0 -21
  94. package/template-gx-design-thin/src/components/GlobalLayout/Empty/index.vue +0 -18
  95. package/template-gx-design-thin/src/components/GlobalLayout/RightContent/index.tsx +0 -126
  96. package/template-gx-design-thin/src/components/GlobalLayout/RightContent/style.ts +0 -77
  97. package/template-gx-design-thin/src/components/GlobalLayout/Spin/index.tsx +0 -30
  98. package/template-gx-design-thin/src/components/PageLoading/index.tsx +0 -51
  99. package/template-gx-design-thin/src/components/index.ts +0 -6
  100. package/template-gx-design-thin/src/core/ant-design/index.ts +0 -10
  101. package/template-gx-design-thin/src/core/gx-admin-design/index.ts +0 -6
  102. package/template-gx-design-thin/src/core/gx-design/index.ts +0 -6
  103. package/template-gx-design-thin/src/core/gx-pro-design/index.ts +0 -8
  104. package/template-gx-design-thin/src/core/index.ts +0 -84
  105. package/template-gx-design-thin/src/design/ant-design/index.less +0 -4
  106. package/template-gx-design-thin/src/design/ant-design/layout.less +0 -22
  107. package/template-gx-design-thin/src/design/ant-design/menu.less +0 -48
  108. package/template-gx-design-thin/src/design/ant-design/spin.less +0 -23
  109. package/template-gx-design-thin/src/design/ant-design/tooltip.less +0 -7
  110. package/template-gx-design-thin/src/design/color.less +0 -1
  111. package/template-gx-design-thin/src/design/config.less +0 -5
  112. package/template-gx-design-thin/src/design/imageEditor.less +0 -180
  113. package/template-gx-design-thin/src/design/index.less +0 -95
  114. package/template-gx-design-thin/src/design/mixin.less +0 -65
  115. package/template-gx-design-thin/src/design/normalize.less +0 -391
  116. package/template-gx-design-thin/src/design/root.less +0 -3
  117. package/template-gx-design-thin/src/hooks/core/index.ts +0 -3
  118. package/template-gx-design-thin/src/hooks/core/useRequest/index.ts +0 -118
  119. package/template-gx-design-thin/src/hooks/event/index.ts +0 -3
  120. package/template-gx-design-thin/src/hooks/event/useClipboard.ts +0 -15
  121. package/template-gx-design-thin/src/hooks/web/index.ts +0 -5
  122. package/template-gx-design-thin/src/hooks/web/useThemeStyle.ts +0 -16
  123. package/template-gx-design-thin/src/layout/BasicLayout.vue +0 -123
  124. package/template-gx-design-thin/src/layout/BlankLayout.vue +0 -5
  125. package/template-gx-design-thin/src/layout/ContentView.vue +0 -50
  126. package/template-gx-design-thin/src/layout/IframeView.vue +0 -1
  127. package/template-gx-design-thin/src/layout/UserLayout.vue +0 -7
  128. package/template-gx-design-thin/src/main.ts +0 -34
  129. package/template-gx-design-thin/src/plugins/index.ts +0 -2
  130. package/template-gx-design-thin/src/router/guard/index.ts +0 -83
  131. package/template-gx-design-thin/src/router/guard/permissions.ts +0 -70
  132. package/template-gx-design-thin/src/router/guard/stateGuard.ts +0 -10
  133. package/template-gx-design-thin/src/router/helper/routeHelper.ts +0 -223
  134. package/template-gx-design-thin/src/router/helper/utils.ts +0 -19
  135. package/template-gx-design-thin/src/router/index.ts +0 -31
  136. package/template-gx-design-thin/src/router/routes/index.ts +0 -86
  137. package/template-gx-design-thin/src/router/routes/modules/dataSource.ts +0 -12
  138. package/template-gx-design-thin/src/services/common/index.ts +0 -11
  139. package/template-gx-design-thin/src/services/systemCenter/index.ts +0 -1
  140. package/template-gx-design-thin/src/services/systemCenter/menu.ts +0 -9
  141. package/template-gx-design-thin/src/services/userCenter/account.ts +0 -42
  142. package/template-gx-design-thin/src/services/userCenter/index.ts +0 -28
  143. package/template-gx-design-thin/src/store/index.ts +0 -32
  144. package/template-gx-design-thin/src/store/modules/dict.ts +0 -28
  145. package/template-gx-design-thin/src/store/modules/global.ts +0 -42
  146. package/template-gx-design-thin/src/store/modules/permission.ts +0 -19
  147. package/template-gx-design-thin/src/store/modules/routes.ts +0 -113
  148. package/template-gx-design-thin/src/store/modules/tabsRouter.ts +0 -76
  149. package/template-gx-design-thin/src/store/modules/user.ts +0 -136
  150. package/template-gx-design-thin/src/utils/accessToken.ts +0 -80
  151. package/template-gx-design-thin/src/utils/crypto/base64.ts +0 -101
  152. package/template-gx-design-thin/src/utils/crypto/index.ts +0 -57
  153. package/template-gx-design-thin/src/utils/env.ts +0 -50
  154. package/template-gx-design-thin/src/utils/fetchFile.ts +0 -81
  155. package/template-gx-design-thin/src/utils/index.ts +0 -123
  156. package/template-gx-design-thin/src/utils/pageTitle.ts +0 -20
  157. package/template-gx-design-thin/src/utils/request/XHR.ts +0 -139
  158. package/template-gx-design-thin/src/utils/request/axiosCancel.ts +0 -69
  159. package/template-gx-design-thin/src/utils/request/checkStatus.ts +0 -25
  160. package/template-gx-design-thin/src/utils/request/index.ts +0 -144
  161. package/template-gx-design-thin/src/utils/request/typings.ts +0 -171
  162. package/template-gx-design-thin/src/utils/storage.ts +0 -199
  163. package/template-gx-design-thin/src/utils/uploadFile.ts +0 -27
  164. package/template-gx-design-thin/src/utils/util.ts +0 -198
  165. package/template-gx-design-thin/src/utils/validate.ts +0 -216
  166. package/template-gx-design-thin/src/views/Iframe/index.vue +0 -76
  167. package/template-gx-design-thin/src/views/Page/one.vue +0 -13
  168. package/template-gx-design-thin/src/views/Page/two.vue +0 -13
  169. package/template-gx-design-thin/src/views/exception/403/index.vue +0 -7
  170. package/template-gx-design-thin/src/views/exception/404/index.vue +0 -9
  171. package/template-gx-design-thin/src/views/user/login/index.vue +0 -109
  172. package/template-gx-design-thin/src/views/user/login/style.less +0 -38
  173. package/template-gx-design-thin/tsconfig.json +0 -46
  174. package/template-gx-design-thin/types/ant-design-import.d.ts +0 -99
  175. package/template-gx-design-thin/types/auto-imports.d.ts +0 -81
  176. package/template-gx-design-thin/types/components.d.ts +0 -24
  177. package/template-gx-design-thin/types/config.d.ts +0 -44
  178. package/template-gx-design-thin/types/global.d.ts +0 -97
  179. package/template-gx-design-thin/types/mock.d.ts +0 -16
  180. package/template-gx-design-thin/types/module.d.ts +0 -20
  181. package/template-gx-design-thin/types/response.d.ts +0 -15
  182. package/template-gx-design-thin/unocss.config.ts +0 -101
  183. package/template-gx-design-thin/vite.config.ts +0 -120
  184. package/template-gx-design-thin/yarn.lock +0 -9492
@@ -1,391 +0,0 @@
1
- /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2
-
3
- /* Document
4
- ========================================================================== */
5
-
6
- /**
7
- * 1. Correct the line height in all browsers.
8
- * 2. Prevent adjustments of font size after orientation changes in iOS.
9
- */
10
-
11
- html {
12
- line-height: 1.15;
13
- /* 1 */
14
- -webkit-text-size-adjust: 100%;
15
- /* 2 */
16
- }
17
-
18
- /* Sections
19
- ========================================================================== */
20
-
21
- /**
22
- * Remove the margin in all browsers.
23
- */
24
-
25
- body {
26
- margin: 0;
27
- text-rendering: optimizeLegibility;
28
- -webkit-font-smoothing: antialiased;
29
- -moz-osx-font-smoothing: grayscale;
30
-
31
- h1,
32
- h2,
33
- h3,
34
- h4,
35
- h5,
36
- h6,
37
- p {
38
- box-sizing: border-box;
39
- padding: 0;
40
- margin: 0;
41
- vertical-align: baseline;
42
- border: 0;
43
- outline: 0;
44
- }
45
- }
46
-
47
- /**
48
- * Render the `main` element consistently in IE.
49
- */
50
-
51
- main {
52
- display: block;
53
- }
54
-
55
- canvas {
56
- display: block;
57
- }
58
-
59
- /* Grouping content
60
- ========================================================================== */
61
-
62
- /**
63
- * 1. Add the correct box sizing in Firefox.
64
- * 2. Show the overflow in Edge and IE.
65
- */
66
-
67
- hr {
68
- box-sizing: content-box;
69
- /* 1 */
70
- height: 0;
71
- /* 1 */
72
- overflow: visible;
73
- /* 2 */
74
- }
75
-
76
- /**
77
- * 1. Correct the inheritance and scaling of font size in all browsers.
78
- * 2. Correct the odd `em` font sizing in all browsers.
79
- */
80
-
81
- pre {
82
- font-family: monospace;
83
- /* 1 */
84
- font-size: 1em;
85
- /* 2 */
86
- }
87
-
88
- /* Text-level semantics
89
- ========================================================================== */
90
-
91
- /**
92
- * Remove the gray background on active links in IE 10.
93
- */
94
-
95
- a {
96
- background-color: transparent;
97
- }
98
-
99
- /**
100
- * 1. Remove the bottom border in Chrome 57-
101
- * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
102
- */
103
-
104
- abbr[title] {
105
- text-decoration: underline;
106
- /* 2 */
107
- text-decoration: underline dotted;
108
- /* 2 */
109
- border-bottom: none;
110
- /* 1 */
111
- }
112
-
113
- /**
114
- * Add the correct font weight in Chrome, Edge, and Safari.
115
- */
116
-
117
- b,
118
- strong {
119
- font-weight: bolder;
120
- }
121
-
122
- /**
123
- * 1. Correct the inheritance and scaling of font size in all browsers.
124
- * 2. Correct the odd `em` font sizing in all browsers.
125
- */
126
-
127
- code,
128
- kbd,
129
- samp {
130
- font-family: monospace;
131
- /* 1 */
132
- font-size: 1em;
133
- /* 2 */
134
- }
135
-
136
- /**
137
- * Add the correct font size in all browsers.
138
- */
139
-
140
- small {
141
- font-size: 80%;
142
- }
143
-
144
- /**
145
- * Prevent `sub` and `sup` elements from affecting the line height in
146
- * all browsers.
147
- */
148
-
149
- sub,
150
- sup {
151
- position: relative;
152
- font-size: 75%;
153
- line-height: 0;
154
- vertical-align: baseline;
155
- }
156
-
157
- sub {
158
- bottom: -0.25em;
159
- }
160
-
161
- sup {
162
- top: -0.5em;
163
- }
164
-
165
- /* Embedded content
166
- ========================================================================== */
167
-
168
- /**
169
- * Remove the border on images inside links in IE 10.
170
- */
171
-
172
- img {
173
- border-style: none;
174
- }
175
-
176
- /* Forms
177
- ========================================================================== */
178
-
179
- /**
180
- * 1. Change the font styles in all browsers.
181
- * 2. Remove the margin in Firefox and Safari.
182
- */
183
-
184
- button,
185
- input,
186
- optgroup,
187
- select,
188
- textarea {
189
- margin: 0;
190
- /* 2 */
191
- font-family: inherit;
192
- /* 1 */
193
- font-size: 100%;
194
- /* 1 */
195
- line-height: 1.15;
196
- /* 1 */
197
- }
198
-
199
- /**
200
- * Show the overflow in IE.
201
- * 1. Show the overflow in Edge.
202
- */
203
-
204
- button,
205
- input {
206
- /* 1 */
207
- overflow: visible;
208
- }
209
-
210
- /**
211
- * Remove the inheritance of text transform in Edge, Firefox, and IE.
212
- * 1. Remove the inheritance of text transform in Firefox.
213
- */
214
-
215
- button,
216
- select {
217
- /* 1 */
218
- text-transform: none;
219
- }
220
-
221
- /**
222
- * Correct the inability to style clickable types in iOS and Safari.
223
- */
224
-
225
- button,
226
- [type='button'],
227
- [type='reset'],
228
- [type='submit'] {
229
- -webkit-appearance: button;
230
- }
231
-
232
- /**
233
- * Remove the inner border and padding in Firefox.
234
- */
235
-
236
- button::-moz-focus-inner,
237
- [type='button']::-moz-focus-inner,
238
- [type='reset']::-moz-focus-inner,
239
- [type='submit']::-moz-focus-inner {
240
- padding: 0;
241
- border-style: none;
242
- }
243
-
244
- /**
245
- * Restore the focus styles unset by the previous rule.
246
- */
247
-
248
- button:-moz-focusring,
249
- [type='button']:-moz-focusring,
250
- [type='reset']:-moz-focusring,
251
- [type='submit']:-moz-focusring {
252
- outline: 1px dotted ButtonText;
253
- }
254
-
255
- /**
256
- * Correct the padding in Firefox.
257
- */
258
-
259
- fieldset {
260
- padding: 0.35em 0.75em 0.625em;
261
- }
262
-
263
- /**
264
- * 1. Correct the text wrapping in Edge and IE.
265
- * 2. Correct the color inheritance from `fieldset` elements in IE.
266
- * 3. Remove the padding so developers are not caught out when they zero out
267
- * `fieldset` elements in all browsers.
268
- */
269
-
270
- legend {
271
- box-sizing: border-box;
272
- /* 1 */
273
- display: table;
274
- /* 1 */
275
- max-width: 100%;
276
- /* 1 */
277
- padding: 0;
278
- /* 3 */
279
- color: inherit;
280
- /* 2 */
281
- white-space: normal;
282
- /* 1 */
283
- }
284
-
285
- /**
286
- * Add the correct vertical alignment in Chrome, Firefox, and Opera.
287
- */
288
-
289
- progress {
290
- vertical-align: baseline;
291
- }
292
-
293
- /**
294
- * Remove the default vertical scrollbar in IE 10+.
295
- */
296
-
297
- textarea {
298
- overflow: auto;
299
- }
300
-
301
- /**
302
- * 1. Add the correct box sizing in IE 10.
303
- * 2. Remove the padding in IE 10.
304
- */
305
-
306
- [type='checkbox'],
307
- [type='radio'] {
308
- box-sizing: border-box;
309
- /* 1 */
310
- padding: 0;
311
- /* 2 */
312
- }
313
-
314
- /**
315
- * Correct the cursor style of increment and decrement buttons in Chrome.
316
- */
317
-
318
- [type='number']::-webkit-inner-spin-button,
319
- [type='number']::-webkit-outer-spin-button {
320
- height: auto;
321
- }
322
-
323
- /**
324
- * 1. Correct the odd appearance in Chrome and Safari.
325
- * 2. Correct the outline style in Safari.
326
- */
327
-
328
- [type='search'] {
329
- -webkit-appearance: textfield;
330
- /* 1 */
331
- outline-offset: -2px;
332
- /* 2 */
333
- }
334
-
335
- /**
336
- * Remove the inner padding in Chrome and Safari on macOS.
337
- */
338
-
339
- [type='search']::-webkit-search-decoration {
340
- -webkit-appearance: none;
341
- }
342
-
343
- /**
344
- * 1. Correct the inability to style clickable types in iOS and Safari.
345
- * 2. Change font properties to `inherit` in Safari.
346
- */
347
-
348
- ::-webkit-file-upload-button {
349
- -webkit-appearance: button;
350
- /* 1 */
351
- font: inherit;
352
- /* 2 */
353
- }
354
-
355
- /* Interactive
356
- ========================================================================== */
357
-
358
- /*
359
- * Add the correct display in Edge, IE 10+, and Firefox.
360
- */
361
-
362
- details {
363
- display: block;
364
- }
365
-
366
- /*
367
- * Add the correct display in all browsers.
368
- */
369
-
370
- summary {
371
- display: list-item;
372
- }
373
-
374
- /* Misc
375
- ========================================================================== */
376
-
377
- /**
378
- * Add the correct display in IE 10+.
379
- */
380
-
381
- template {
382
- display: none;
383
- }
384
-
385
- /**
386
- * Add the correct display in IE 10.
387
- */
388
-
389
- [hidden] {
390
- display: none;
391
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --gx-primary-color: transparent;
3
- }
@@ -1,3 +0,0 @@
1
- import useRequest from './useRequest'
2
-
3
- export { useRequest }
@@ -1,118 +0,0 @@
1
- import type { MaybeRef, Ref, UnwrapRef, WatchSource } from 'vue'
2
- import { computed, isReactive, isRef, reactive, ref, watch } from 'vue'
3
- import { cloneDeep } from 'lodash-es'
4
- import { useThrottleFn } from '@vueuse/core'
5
- import { useState } from '@gx-design-vue/pro-hooks'
6
- import type { CancelOptions, GAxiosOptions } from '@/utils/request/typings'
7
-
8
- type DefaultToT<T, R> = R extends undefined ? T : R
9
-
10
- function useRequest<T, P = any, R = undefined, >(
11
- service: (opt: P, config?: Partial<GAxiosOptions>) => Promise<ResponseResult<T>>,
12
- options: {
13
- params?: MaybeRef<P>;
14
- stopWatchParams?: MaybeRef<boolean>;
15
- defaultData?: DefaultToT<T, R>;
16
- requestConfig?: Partial<GAxiosOptions>;
17
- manual?: boolean;
18
- defaultLoading?: boolean;
19
- ready?: Ref<boolean>;
20
- onBefore?: (params: P) => void;
21
- onSuccess?: (res: T) => void;
22
- onAfterMutateData?: (data: T) => Promise<DefaultToT<T, R>> | DefaultToT<T, R>;
23
- debounceInterval?: number;
24
- refreshDeps?: WatchSource[];
25
- refreshDepsAction?: () => Promise<any>;
26
- } = {}
27
- ) {
28
- const [ loading, setLoading ] = useState(!!options.defaultLoading)
29
-
30
- const data: Ref<UnwrapRef<DefaultToT<T, R>>> = ref(options?.defaultData)
31
-
32
- const state = reactive<{ params: MaybeRef<P> }>({
33
- params: (isRef(options.params) ? options.params?.value : options.params) || {} as P
34
- })
35
-
36
- const requestCancel: Partial<CancelOptions> = {
37
- cancel: null,
38
- cancelAll: null
39
- }
40
-
41
- const ready = computed(() =>
42
- !isRef(options?.ready) || options?.ready?.value === undefined ? true : options?.ready?.value)
43
-
44
- const stopWatchParams = computed(() =>
45
- isRef(options?.stopWatchParams) ? options?.stopWatchParams?.value : options?.stopWatchParams)
46
-
47
- const mergeParams = (opt?: P) => Object.assign(
48
- state.params,
49
- {
50
- ...(opt || {}), ...((isRef(options.params)
51
- ? options.params?.value as P
52
- : options.params) || {})
53
- }
54
- ) as UnwrapRef<P>
55
-
56
- const query = async (opt?: P) => {
57
- setLoading(true)
58
- state.params = mergeParams()
59
- options.onBefore && options.onBefore?.(unref(state.params) as P)
60
- const requestConfig: Partial<GAxiosOptions> = {
61
- ...(options.requestConfig || {
62
- cancelCallBackHook: (cancelOptions) => {
63
- Object.assign(requestCancel, cancelOptions)
64
- }
65
- })
66
- }
67
- const response: ResponseResult<T> = await service(mergeParams(opt) as P, requestConfig)
68
- if (response) {
69
- data.value = options?.onAfterMutateData
70
- ? await options?.onAfterMutateData?.(cloneDeep(response.data))
71
- : cloneDeep(response.data) as any
72
-
73
- options.onSuccess && options.onSuccess?.(response.data)
74
- }
75
-
76
- setLoading(false)
77
- }
78
-
79
- const run = useThrottleFn<(opt?: P) => Promise<void>>(query, options.debounceInterval || 50)
80
-
81
- const refresh = () => run()
82
-
83
- if (!options.manual)
84
- run()
85
-
86
- if (options.refreshDeps?.length) {
87
- watch(options.refreshDeps, () => {
88
- if (options.refreshDepsAction) {
89
- options?.refreshDepsAction()
90
- } else {
91
- run()
92
- }
93
- }, {
94
- deep: true
95
- })
96
- }
97
-
98
- if ((isReactive(options.params) || isRef(options.params))) {
99
- watch(() => isRef(options.params) ? options.params?.value : options.params, () => {
100
- if (!stopWatchParams.value)
101
- query()
102
- }, { deep: true })
103
- }
104
-
105
- watch(() => ready.value, val => val && run())
106
-
107
- return {
108
- run,
109
- refresh,
110
- data,
111
- loading,
112
- params: computed(() => state.params),
113
- cancel: requestCancel.cancel,
114
- cancelAll: requestCancel.cancelAll
115
- }
116
- }
117
-
118
- export default useRequest
@@ -1,3 +0,0 @@
1
- import useClipboard from './useClipboard'
2
-
3
- export { useClipboard }
@@ -1,15 +0,0 @@
1
- import { watchEffect } from 'vue'
2
- import { useClipboard as useClipboardVue } from '@vueuse/core'
3
- import { message } from 'ant-design-vue'
4
-
5
- export default function useClipboard(msg?: string) {
6
- const { text, copy, copied } = useClipboardVue()
7
-
8
- watchEffect(() => {
9
- if (copied.value && msg && text.value) {
10
- message.success(msg)
11
- }
12
- })
13
-
14
- return { copy, copied, text }
15
- }
@@ -1,5 +0,0 @@
1
- import useThemeStyle from './useThemeStyle'
2
-
3
- export {
4
- useThemeStyle
5
- }
@@ -1,16 +0,0 @@
1
- import type { ProAliasToken } from '@gx-design-vue/pro-provider'
2
- import { useProConfigContext } from '@gx-design-vue/pro-provider'
3
-
4
- export default function (options: Record<keyof CSSObject, keyof ProAliasToken>) {
5
- const { token } = useProConfigContext()
6
-
7
- const styleRef = reactive({})
8
-
9
- watchEffect(() => {
10
- for (const key in options) {
11
- styleRef[key] = token.value[options[key]]
12
- }
13
- })
14
-
15
- return styleRef
16
- }
@@ -1,123 +0,0 @@
1
- <script setup lang="ts">
2
- import { useRouter } from 'vue-router'
3
- import { isFunction, isString, merge } from '@gx-design-vue/pro-utils'
4
- import type { BaseLayoutDesignToken, ThemeConfig } from '@gx-design-vue/pro-provider'
5
- import type { AppRouteModule, BasicLayoutProps } from '@gx-design-vue/pro-layout'
6
- import {
7
- GProLayout,
8
- SettingDrawer,
9
- clearMenuItem,
10
- getMatchedList,
11
- getMenuData,
12
- getMenuFirstLastChildPath,
13
- hanlePathKey,
14
- } from '@gx-design-vue/pro-layout'
15
- import RightContent from '@/components/GlobalLayout/RightContent'
16
- import ProContent from './ContentView.vue'
17
-
18
- const { global } = useStore()
19
-
20
- const router = useRouter()
21
-
22
- const reloadStatus = ref(true)
23
-
24
- const routeData: AppRouteModule[] = router.getRoutes() as any
25
-
26
- const menuState = reactive<Pick<BasicLayoutProps, 'menuData' | 'levelMenuData'>>({
27
- menuData: [],
28
- levelMenuData: []
29
- })
30
-
31
- const baseState: Partial<BasicLayoutProps> = reactive({
32
- selectedKeys: [],
33
- openKeys: [],
34
- collapsed: false
35
- })
36
-
37
- const matchedMenu = computed(() => getMatchedList(
38
- menuState.levelMenuData as AppRouteModule[] || [],
39
- hanlePathKey(router.currentRoute.value as AppRouteModule)
40
- ))
41
-
42
- const breadcrumbRouters = computed(() => {
43
- return matchedMenu.value.map((menuItem: AppRouteModule) => {
44
- const path = getMenuFirstLastChildPath(menuItem.meta?.hideChildrenInMenu ? [] : menuItem.children || [])
45
- return {
46
- path: path ? isString(menuItem.redirect) ? menuItem.redirect as string : isFunction(menuItem.redirect)
47
- ? (menuItem.redirect as any)?.() as string
48
- : '' || menuItem.path : '',
49
- breadcrumbName: menuItem.meta?.title || ''
50
- }
51
- })
52
- })
53
-
54
- const handleMenuData = () => {
55
- const menuInfos = getMenuData(clearMenuItem(routeData))
56
- if (router.currentRoute?.value?.meta?.hideMenu) {
57
- menuState.menuData = []
58
- menuState.levelMenuData = []
59
- } else {
60
- menuState.menuData = menuInfos.menuData
61
- menuState.levelMenuData = menuInfos.levelMenuData
62
- }
63
- }
64
-
65
- watch(
66
- () => router.currentRoute.value,
67
- (val) => {
68
- if (val)
69
- handleMenuData()
70
- },
71
- { deep: true, immediate: true }
72
- )
73
-
74
- watchEffect(() => {
75
- if (router.currentRoute.value) {
76
- baseState.selectedKeys = matchedMenu.value.map(item => item.path)
77
- baseState.openKeys = matchedMenu.value.filter(item => item.path !== router.currentRoute.value.path)
78
- .map(item => item.path)
79
- }
80
- })
81
-
82
- const handleReload = () => {
83
- reloadStatus.value = false
84
- setTimeout(() => {
85
- reloadStatus.value = true
86
- }, 200)
87
- }
88
-
89
- const changeTabs = (_routers: any) => {
90
- // console.log(_routers)
91
- }
92
-
93
- const changeTheme = (newVal: ThemeConfig) => {
94
- global.globalLayout = merge(global.globalLayout, { ...newVal })
95
- }
96
-
97
- const changeLayoutTheme = (newVal: BaseLayoutDesignToken) => {
98
- global.globalLayout.token = merge(global.globalLayout.token, { ...newVal })
99
- }
100
- </script>
101
-
102
- <template>
103
- <GProLayout
104
- v-model:collapsed="baseState.collapsed"
105
- v-model:selectedKeys="baseState.selectedKeys"
106
- v-model:openKeys="baseState.openKeys"
107
- v-bind="global.globalLayout as BasicLayoutProps"
108
- :breadcrumb="{ routes: breadcrumbRouters }"
109
- :menu-data="menuState.menuData as AppRouteModule[]"
110
- @changeTabs="changeTabs"
111
- @reloadPage="handleReload"
112
- @menuHeaderClick="() => router.push('/')"
113
- >
114
- <template v-if="global.globalLayout.layout === 'wide'" #menuExtraRender>
115
- <div class="text-center"> 额外元素</div>
116
- </template>
117
- <template #rightContentRender>
118
- <RightContent />
119
- </template>
120
- <ProContent :animate="global.globalLayout.animate" :reloadStatus="reloadStatus" />
121
- <SettingDrawer :settings="global.globalLayout" @change="changeTheme" @changeLayout="changeLayoutTheme" weakmode show-progress />
122
- </GProLayout>
123
- </template>
@@ -1,5 +0,0 @@
1
- <template>
2
- <router-view v-slot="{ Component }">
3
- <component :is="Component" />
4
- </router-view>
5
- </template>