@gx-design-vue/create-gx-cli 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. package/package.json +2 -1
  2. package/src/main.js +0 -4
  3. package/template-gx-design-thin/.editorconfig +19 -0
  4. package/template-gx-design-thin/.env +4 -0
  5. package/template-gx-design-thin/.env.development +15 -0
  6. package/template-gx-design-thin/.env.production +28 -0
  7. package/template-gx-design-thin/.eslintignore +16 -0
  8. package/template-gx-design-thin/.prettierignore +9 -0
  9. package/template-gx-design-thin/LICENSE +21 -0
  10. package/template-gx-design-thin/README.md +112 -0
  11. package/template-gx-design-thin/build/constant.ts +1 -0
  12. package/template-gx-design-thin/build/generate/generateModifyVars.ts +14 -0
  13. package/template-gx-design-thin/build/rollupOptions/index.ts +22 -0
  14. package/template-gx-design-thin/build/util/hash.ts +17 -0
  15. package/template-gx-design-thin/build/util/index.ts +131 -0
  16. package/template-gx-design-thin/build/vite/cdn.ts +63 -0
  17. package/template-gx-design-thin/build/vite/optimizer.ts +26 -0
  18. package/template-gx-design-thin/build/vite/plugin/appConfig.ts +91 -0
  19. package/template-gx-design-thin/build/vite/plugin/autoImport.ts +26 -0
  20. package/template-gx-design-thin/build/vite/plugin/compress.ts +31 -0
  21. package/template-gx-design-thin/build/vite/plugin/html.ts +39 -0
  22. package/template-gx-design-thin/build/vite/plugin/index.ts +75 -0
  23. package/template-gx-design-thin/build/vite/plugin/mock.ts +14 -0
  24. package/template-gx-design-thin/build/vite/plugin/pwa.ts +31 -0
  25. package/template-gx-design-thin/build/vite/plugin/visualizer.ts +14 -0
  26. package/template-gx-design-thin/build/vite/plugin/viteMock/client.ts +88 -0
  27. package/template-gx-design-thin/build/vite/plugin/viteMock/createMockServer.ts +271 -0
  28. package/template-gx-design-thin/build/vite/plugin/viteMock/index.ts +69 -0
  29. package/template-gx-design-thin/build/vite/plugin/viteMock/types.ts +48 -0
  30. package/template-gx-design-thin/build/vite/plugin/viteMock/utils.ts +48 -0
  31. package/template-gx-design-thin/build/vite/plugin/viteNotice.ts +40 -0
  32. package/template-gx-design-thin/commitlint.config.cjs +32 -0
  33. package/template-gx-design-thin/config/default/defaultSettings.ts +78 -0
  34. package/template-gx-design-thin/config/default/network.ts +10 -0
  35. package/template-gx-design-thin/config/default/proxy.ts +47 -0
  36. package/template-gx-design-thin/config/default/theme.ts +3 -0
  37. package/template-gx-design-thin/config/index.ts +11 -0
  38. package/template-gx-design-thin/eslint.config.js +51 -0
  39. package/template-gx-design-thin/index.html +42 -0
  40. package/template-gx-design-thin/mock/_createProductionServer.ts +19 -0
  41. package/template-gx-design-thin/mock/_util.ts +33 -0
  42. package/template-gx-design-thin/mock/config/menu.ts +21 -0
  43. package/template-gx-design-thin/mock/config/user.ts +123 -0
  44. package/template-gx-design-thin/mock/datasSource/system/menu.ts +10 -0
  45. package/template-gx-design-thin/mock/datasSource/user/account.ts +30 -0
  46. package/template-gx-design-thin/mock/datasSource/user/index.ts +47 -0
  47. package/template-gx-design-thin/mock/util/crypto.ts +23 -0
  48. package/template-gx-design-thin/mock/util/table.ts +92 -0
  49. package/template-gx-design-thin/mock/util/utils.ts +73 -0
  50. package/template-gx-design-thin/package.json +129 -0
  51. package/template-gx-design-thin/pnpm-lock.yaml +12575 -0
  52. package/template-gx-design-thin/prettier.config.cjs +18 -0
  53. package/template-gx-design-thin/public/resource/css/index.css +119 -0
  54. package/template-gx-design-thin/public/resource/css/normalize.css +396 -0
  55. package/template-gx-design-thin/public/resource/img/favicon.ico +0 -0
  56. package/template-gx-design-thin/public/resource/img/logo.png +0 -0
  57. package/template-gx-design-thin/public/resource/img/pro_icon.svg +1 -0
  58. package/template-gx-design-thin/public/resource/img/pwa-192x192.png +0 -0
  59. package/template-gx-design-thin/public/resource/img/pwa-512x512.png +0 -0
  60. package/template-gx-design-thin/src/App.vue +42 -0
  61. package/template-gx-design-thin/src/assets/error_images/403.png +0 -0
  62. package/template-gx-design-thin/src/assets/error_images/404.png +0 -0
  63. package/template-gx-design-thin/src/assets/error_images/cloud.png +0 -0
  64. package/template-gx-design-thin/src/assets/login_images/login_background.svg +1 -0
  65. package/template-gx-design-thin/src/assets/logo.png +0 -0
  66. package/template-gx-design-thin/src/assets/menu_font/iconfont.css +94 -0
  67. package/template-gx-design-thin/src/assets/menu_font/iconfont.eot +0 -0
  68. package/template-gx-design-thin/src/assets/menu_font/iconfont.js +1 -0
  69. package/template-gx-design-thin/src/assets/menu_font/iconfont.json +142 -0
  70. package/template-gx-design-thin/src/assets/menu_font/iconfont.svg +1 -0
  71. package/template-gx-design-thin/src/assets/menu_font/iconfont.ttf +0 -0
  72. package/template-gx-design-thin/src/assets/menu_font/iconfont.woff +0 -0
  73. package/template-gx-design-thin/src/assets/menu_font/iconfont.woff2 +0 -0
  74. package/template-gx-design-thin/src/assets/menu_font/index.less +94 -0
  75. package/template-gx-design-thin/src/assets/public_icon/iconfont.css +42 -0
  76. package/template-gx-design-thin/src/assets/public_icon/iconfont.eot +0 -0
  77. package/template-gx-design-thin/src/assets/public_icon/iconfont.js +1 -0
  78. package/template-gx-design-thin/src/assets/public_icon/iconfont.json +51 -0
  79. package/template-gx-design-thin/src/assets/public_icon/iconfont.svg +1 -0
  80. package/template-gx-design-thin/src/assets/public_icon/iconfont.ttf +0 -0
  81. package/template-gx-design-thin/src/assets/public_icon/iconfont.woff +0 -0
  82. package/template-gx-design-thin/src/assets/public_icon/iconfont.woff2 +0 -0
  83. package/template-gx-design-thin/src/assets/public_icon/index.less +42 -0
  84. package/template-gx-design-thin/src/assets/public_images/nodata.svg +1 -0
  85. package/template-gx-design-thin/src/common/global.ts +4 -0
  86. package/template-gx-design-thin/src/components/GDesign/Result/index.tsx +144 -0
  87. package/template-gx-design-thin/src/components/GDesign/Result/style.less +140 -0
  88. package/template-gx-design-thin/src/components/GDesign/utils/index.ts +7 -0
  89. package/template-gx-design-thin/src/components/GlobalLayout/Confirm/index.ts +21 -0
  90. package/template-gx-design-thin/src/components/GlobalLayout/Empty/index.vue +18 -0
  91. package/template-gx-design-thin/src/components/GlobalLayout/RightContent/index.tsx +126 -0
  92. package/template-gx-design-thin/src/components/GlobalLayout/RightContent/style.ts +77 -0
  93. package/template-gx-design-thin/src/components/GlobalLayout/Spin/index.tsx +30 -0
  94. package/template-gx-design-thin/src/components/PageLoading/index.tsx +51 -0
  95. package/template-gx-design-thin/src/components/index.ts +6 -0
  96. package/template-gx-design-thin/src/core/ant-design/index.ts +10 -0
  97. package/template-gx-design-thin/src/core/gx-admin-design/index.ts +6 -0
  98. package/template-gx-design-thin/src/core/gx-design/index.ts +6 -0
  99. package/template-gx-design-thin/src/core/gx-pro-design/index.ts +8 -0
  100. package/template-gx-design-thin/src/core/index.ts +84 -0
  101. package/template-gx-design-thin/src/design/ant-design/index.less +4 -0
  102. package/template-gx-design-thin/src/design/ant-design/layout.less +22 -0
  103. package/template-gx-design-thin/src/design/ant-design/menu.less +48 -0
  104. package/template-gx-design-thin/src/design/ant-design/spin.less +23 -0
  105. package/template-gx-design-thin/src/design/ant-design/tooltip.less +7 -0
  106. package/template-gx-design-thin/src/design/color.less +1 -0
  107. package/template-gx-design-thin/src/design/config.less +5 -0
  108. package/template-gx-design-thin/src/design/imageEditor.less +180 -0
  109. package/template-gx-design-thin/src/design/index.less +95 -0
  110. package/template-gx-design-thin/src/design/mixin.less +65 -0
  111. package/template-gx-design-thin/src/design/normalize.less +391 -0
  112. package/template-gx-design-thin/src/design/root.less +3 -0
  113. package/template-gx-design-thin/src/hooks/core/index.ts +3 -0
  114. package/template-gx-design-thin/src/hooks/core/useRequest/index.ts +118 -0
  115. package/template-gx-design-thin/src/hooks/event/index.ts +3 -0
  116. package/template-gx-design-thin/src/hooks/event/useClipboard.ts +15 -0
  117. package/template-gx-design-thin/src/hooks/web/index.ts +5 -0
  118. package/template-gx-design-thin/src/hooks/web/useThemeStyle.ts +16 -0
  119. package/template-gx-design-thin/src/layout/BasicLayout.vue +123 -0
  120. package/template-gx-design-thin/src/layout/BlankLayout.vue +5 -0
  121. package/template-gx-design-thin/src/layout/ContentView.vue +50 -0
  122. package/template-gx-design-thin/src/layout/IframeView.vue +1 -0
  123. package/template-gx-design-thin/src/layout/UserLayout.vue +7 -0
  124. package/template-gx-design-thin/src/main.ts +34 -0
  125. package/template-gx-design-thin/src/plugins/index.ts +2 -0
  126. package/template-gx-design-thin/src/router/guard/index.ts +83 -0
  127. package/template-gx-design-thin/src/router/guard/permissions.ts +70 -0
  128. package/template-gx-design-thin/src/router/guard/stateGuard.ts +10 -0
  129. package/template-gx-design-thin/src/router/helper/routeHelper.ts +231 -0
  130. package/template-gx-design-thin/src/router/helper/utils.ts +19 -0
  131. package/template-gx-design-thin/src/router/index.ts +31 -0
  132. package/template-gx-design-thin/src/router/routes/index.ts +86 -0
  133. package/template-gx-design-thin/src/router/routes/modules/dataSource.ts +12 -0
  134. package/template-gx-design-thin/src/services/common/index.ts +11 -0
  135. package/template-gx-design-thin/src/services/systemCenter/index.ts +1 -0
  136. package/template-gx-design-thin/src/services/systemCenter/menu.ts +9 -0
  137. package/template-gx-design-thin/src/services/userCenter/account.ts +42 -0
  138. package/template-gx-design-thin/src/services/userCenter/index.ts +28 -0
  139. package/template-gx-design-thin/src/store/index.ts +32 -0
  140. package/template-gx-design-thin/src/store/modules/dict.ts +28 -0
  141. package/template-gx-design-thin/src/store/modules/global.ts +42 -0
  142. package/template-gx-design-thin/src/store/modules/permission.ts +19 -0
  143. package/template-gx-design-thin/src/store/modules/routes.ts +113 -0
  144. package/template-gx-design-thin/src/store/modules/tabsRouter.ts +76 -0
  145. package/template-gx-design-thin/src/store/modules/user.ts +136 -0
  146. package/template-gx-design-thin/src/utils/accessToken.ts +80 -0
  147. package/template-gx-design-thin/src/utils/crypto/base64.ts +101 -0
  148. package/template-gx-design-thin/src/utils/crypto/index.ts +57 -0
  149. package/template-gx-design-thin/src/utils/env.ts +50 -0
  150. package/template-gx-design-thin/src/utils/fetchFile.ts +81 -0
  151. package/template-gx-design-thin/src/utils/index.ts +123 -0
  152. package/template-gx-design-thin/src/utils/pageTitle.ts +20 -0
  153. package/template-gx-design-thin/src/utils/request/XHR.ts +139 -0
  154. package/template-gx-design-thin/src/utils/request/axiosCancel.ts +69 -0
  155. package/template-gx-design-thin/src/utils/request/checkStatus.ts +25 -0
  156. package/template-gx-design-thin/src/utils/request/index.ts +144 -0
  157. package/template-gx-design-thin/src/utils/request/typings.ts +171 -0
  158. package/template-gx-design-thin/src/utils/storage.ts +199 -0
  159. package/template-gx-design-thin/src/utils/uploadFile.ts +27 -0
  160. package/template-gx-design-thin/src/utils/util.ts +198 -0
  161. package/template-gx-design-thin/src/utils/validate.ts +216 -0
  162. package/template-gx-design-thin/src/views/Iframe/index.vue +76 -0
  163. package/template-gx-design-thin/src/views/Page/one.vue +13 -0
  164. package/template-gx-design-thin/src/views/Page/two.vue +13 -0
  165. package/template-gx-design-thin/src/views/exception/403/index.vue +7 -0
  166. package/template-gx-design-thin/src/views/exception/404/index.vue +9 -0
  167. package/template-gx-design-thin/src/views/user/login/index.vue +109 -0
  168. package/template-gx-design-thin/src/views/user/login/style.less +38 -0
  169. package/template-gx-design-thin/tsconfig.json +46 -0
  170. package/template-gx-design-thin/types/ant-design-import.d.ts +99 -0
  171. package/template-gx-design-thin/types/auto-imports.d.ts +81 -0
  172. package/template-gx-design-thin/types/components.d.ts +24 -0
  173. package/template-gx-design-thin/types/config.d.ts +44 -0
  174. package/template-gx-design-thin/types/global.d.ts +97 -0
  175. package/template-gx-design-thin/types/mock.d.ts +16 -0
  176. package/template-gx-design-thin/types/module.d.ts +20 -0
  177. package/template-gx-design-thin/types/response.d.ts +15 -0
  178. package/template-gx-design-thin/unocss.config.ts +101 -0
  179. package/template-gx-design-thin/vite.config.ts +120 -0
  180. package/template-gx-design-thin/yarn.lock +9492 -0
  181. package/template-mobile-vant-cli/package.json +1 -1
@@ -0,0 +1,391 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --gx-primary-color: transparent;
3
+ }
@@ -0,0 +1,3 @@
1
+ import useRequest from './useRequest'
2
+
3
+ export { useRequest }
@@ -0,0 +1,118 @@
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
@@ -0,0 +1,3 @@
1
+ import useClipboard from './useClipboard'
2
+
3
+ export { useClipboard }
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ import useThemeStyle from './useThemeStyle'
2
+
3
+ export {
4
+ useThemeStyle
5
+ }
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,123 @@
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>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <router-view v-slot="{ Component }">
3
+ <component :is="Component" />
4
+ </router-view>
5
+ </template>