@fairys/taro-tools-react 0.0.1
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.
- package/README.md +1 -0
- package/esm/components/EnterLoading/index.d.ts +14 -0
- package/esm/components/EnterLoading/index.js +65 -0
- package/esm/components/MainPage/index.d.ts +10 -0
- package/esm/components/MainPage/index.js +49 -0
- package/esm/components/Mesage/index.d.ts +48 -0
- package/esm/components/Mesage/index.js +122 -0
- package/esm/components/Portal/index.d.ts +8 -0
- package/esm/components/Portal/index.js +11 -0
- package/esm/components/Toast/index.d.ts +1 -0
- package/esm/components/Toast/index.js +20 -0
- package/esm/components/connectToastMessage/index.d.ts +10 -0
- package/esm/components/connectToastMessage/index.js +28 -0
- package/esm/components/index.d.ts +6 -0
- package/esm/components/index.js +6 -0
- package/esm/context/global.data.instance.d.ts +5411 -0
- package/esm/context/global.data.instance.js +66 -0
- package/esm/context/global.setting.data.instance.d.ts +28 -0
- package/esm/context/global.setting.data.instance.js +20 -0
- package/esm/context/index.d.ts +4 -0
- package/esm/context/index.js +4 -0
- package/esm/context/page.data.instance.d.ts +71 -0
- package/esm/context/page.data.instance.js +139 -0
- package/esm/context/page.info.data.instance.d.ts +72 -0
- package/esm/context/page.info.data.instance.js +107 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +3 -0
- package/esm/styles/index.css +711 -0
- package/esm/utils/index.d.ts +4 -0
- package/esm/utils/index.js +4 -0
- package/esm/utils/navigate.d.ts +109 -0
- package/esm/utils/navigate.js +45 -0
- package/esm/utils/request.d.ts +112 -0
- package/esm/utils/request.js +212 -0
- package/esm/utils/useId.d.ts +2 -0
- package/esm/utils/useId.js +13 -0
- package/esm/utils/valtio/index.d.ts +9 -0
- package/esm/utils/valtio/index.js +23 -0
- package/esm/utils/valtio/instance.d.ts +15 -0
- package/esm/utils/valtio/instance.js +34 -0
- package/lib/index.js +78 -0
- package/package.json +40 -0
- package/src/components/EnterLoading/index.tsx +57 -0
- package/src/components/MainPage/index.tsx +72 -0
- package/src/components/Mesage/index.tsx +217 -0
- package/src/components/Portal/index.tsx +18 -0
- package/src/components/Toast/index.tsx +22 -0
- package/src/components/connectToastMessage/index.tsx +41 -0
- package/src/components/index.ts +6 -0
- package/src/context/global.data.instance.ts +106 -0
- package/src/context/global.setting.data.instance.ts +36 -0
- package/src/context/index.ts +4 -0
- package/src/context/page.data.instance.ts +215 -0
- package/src/context/page.info.data.instance.ts +182 -0
- package/src/index.ts +3 -0
- package/src/styles/index.css +515 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/navigate.ts +159 -0
- package/src/utils/request.ts +319 -0
- package/src/utils/useId.ts +14 -0
- package/src/utils/valtio/index.ts +23 -0
- package/src/utils/valtio/instance.ts +59 -0
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
@unocss preflights;
|
|
2
|
+
@unocss default;
|
|
3
|
+
|
|
4
|
+
/* fairys_taro_loading */
|
|
5
|
+
@keyframes fairys_taro_loading_transform {
|
|
6
|
+
0% {
|
|
7
|
+
--fairys-enter-loading-transform-color: #00a98e;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
1.25% {
|
|
11
|
+
--fairys-enter-loading-transform-color: #00a996;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
2.5% {
|
|
15
|
+
--fairys-enter-loading-transform-color: #00a99f;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
3.75% {
|
|
19
|
+
--fairys-enter-loading-transform-color: #00a9a7;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
5% {
|
|
23
|
+
--fairys-enter-loading-transform-color: #00a9b0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
6.25% {
|
|
27
|
+
--fairys-enter-loading-transform-color: #00a9b8;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
7.5% {
|
|
31
|
+
--fairys-enter-loading-transform-color: #00a9c0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
8.75% {
|
|
35
|
+
--fairys-enter-loading-transform-color: #00a8c7;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
10% {
|
|
39
|
+
--fairys-enter-loading-transform-color: #00a8cf;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
11.25% {
|
|
43
|
+
--fairys-enter-loading-transform-color: #00a7d5;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
12.5% {
|
|
47
|
+
--fairys-enter-loading-transform-color: #00a6dc;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
13.75% {
|
|
51
|
+
--fairys-enter-loading-transform-color: #00a6e2;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
15% {
|
|
55
|
+
--fairys-enter-loading-transform-color: #00a4e7;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
16.25% {
|
|
59
|
+
--fairys-enter-loading-transform-color: #00a3ec;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
17.5% {
|
|
63
|
+
--fairys-enter-loading-transform-color: #00a2f1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
18.75% {
|
|
67
|
+
--fairys-enter-loading-transform-color: #00a0f4;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
20% {
|
|
71
|
+
--fairys-enter-loading-transform-color: #009ff7;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
21.25% {
|
|
75
|
+
--fairys-enter-loading-transform-color: #009dfa;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
22.5% {
|
|
79
|
+
--fairys-enter-loading-transform-color: #009bfc;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
23.75% {
|
|
83
|
+
--fairys-enter-loading-transform-color: #0098fd;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
25% {
|
|
87
|
+
--fairys-enter-loading-transform-color: #0096fd;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
26.25% {
|
|
91
|
+
--fairys-enter-loading-transform-color: #0093fd;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
27.5% {
|
|
95
|
+
--fairys-enter-loading-transform-color: #2e90fc;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
28.75% {
|
|
99
|
+
--fairys-enter-loading-transform-color: #4d8dfa;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
30% {
|
|
103
|
+
--fairys-enter-loading-transform-color: #638af8;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
31.25% {
|
|
107
|
+
--fairys-enter-loading-transform-color: #7587f5;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
32.5% {
|
|
111
|
+
--fairys-enter-loading-transform-color: #8583f1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
33.75% {
|
|
115
|
+
--fairys-enter-loading-transform-color: #9280ed;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
35% {
|
|
119
|
+
--fairys-enter-loading-transform-color: #9f7ce9;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
36.25% {
|
|
123
|
+
--fairys-enter-loading-transform-color: #aa78e3;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
37.5% {
|
|
127
|
+
--fairys-enter-loading-transform-color: #b574dd;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
38.75% {
|
|
131
|
+
--fairys-enter-loading-transform-color: #be71d7;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
40% {
|
|
135
|
+
--fairys-enter-loading-transform-color: #c76dd1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
41.25% {
|
|
139
|
+
--fairys-enter-loading-transform-color: #cf69c9;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
42.5% {
|
|
143
|
+
--fairys-enter-loading-transform-color: #d566c2;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
43.75% {
|
|
147
|
+
--fairys-enter-loading-transform-color: #dc63ba;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
45% {
|
|
151
|
+
--fairys-enter-loading-transform-color: #e160b3;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
46.25% {
|
|
155
|
+
--fairys-enter-loading-transform-color: #e65eab;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
47.5% {
|
|
159
|
+
--fairys-enter-loading-transform-color: #e95ca2;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
48.75% {
|
|
163
|
+
--fairys-enter-loading-transform-color: #ed5a9a;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
50% {
|
|
167
|
+
--fairys-enter-loading-transform-color: #ef5992;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
51.25% {
|
|
171
|
+
--fairys-enter-loading-transform-color: #f15989;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
52.5% {
|
|
175
|
+
--fairys-enter-loading-transform-color: #f25981;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
53.75% {
|
|
179
|
+
--fairys-enter-loading-transform-color: #f25a79;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
55% {
|
|
183
|
+
--fairys-enter-loading-transform-color: #f25c71;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
56.25% {
|
|
187
|
+
--fairys-enter-loading-transform-color: #f15e69;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
57.5% {
|
|
191
|
+
--fairys-enter-loading-transform-color: #ef6061;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
58.75% {
|
|
195
|
+
--fairys-enter-loading-transform-color: #ed635a;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
60% {
|
|
199
|
+
--fairys-enter-loading-transform-color: #eb6552;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
61.25% {
|
|
203
|
+
--fairys-enter-loading-transform-color: #e8694b;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
62.5% {
|
|
207
|
+
--fairys-enter-loading-transform-color: #e46c44;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
63.75% {
|
|
211
|
+
--fairys-enter-loading-transform-color: #e06f3d;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
65% {
|
|
215
|
+
--fairys-enter-loading-transform-color: #db7336;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
66.25% {
|
|
219
|
+
--fairys-enter-loading-transform-color: #d77630;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
67.5% {
|
|
223
|
+
--fairys-enter-loading-transform-color: #d17a2a;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
68.75% {
|
|
227
|
+
--fairys-enter-loading-transform-color: #cc7d24;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
70% {
|
|
231
|
+
--fairys-enter-loading-transform-color: #c6811e;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
71.25% {
|
|
235
|
+
--fairys-enter-loading-transform-color: #bf8418;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
72.5% {
|
|
239
|
+
--fairys-enter-loading-transform-color: #b98713;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
73.75% {
|
|
243
|
+
--fairys-enter-loading-transform-color: #b28a0f;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
75% {
|
|
247
|
+
--fairys-enter-loading-transform-color: #ab8d0c;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
76.25% {
|
|
251
|
+
--fairys-enter-loading-transform-color: #a3900b;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
77.5% {
|
|
255
|
+
--fairys-enter-loading-transform-color: #9c920d;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
78.75% {
|
|
259
|
+
--fairys-enter-loading-transform-color: #949510;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
80% {
|
|
263
|
+
--fairys-enter-loading-transform-color: #8b9715;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
81.25% {
|
|
267
|
+
--fairys-enter-loading-transform-color: #83991b;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
82.5% {
|
|
271
|
+
--fairys-enter-loading-transform-color: #7a9b21;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
83.75% {
|
|
275
|
+
--fairys-enter-loading-transform-color: #719d27;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
85% {
|
|
279
|
+
--fairys-enter-loading-transform-color: #679e2e;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
86.25% {
|
|
283
|
+
--fairys-enter-loading-transform-color: #5da035;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
87.5% {
|
|
287
|
+
--fairys-enter-loading-transform-color: #51a13c;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
88.75% {
|
|
291
|
+
--fairys-enter-loading-transform-color: #44a244;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
90% {
|
|
295
|
+
--fairys-enter-loading-transform-color: #34a44b;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
91.25% {
|
|
299
|
+
--fairys-enter-loading-transform-color: #1ba553;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
92.5% {
|
|
303
|
+
--fairys-enter-loading-transform-color: #00a65b;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
93.75% {
|
|
307
|
+
--fairys-enter-loading-transform-color: #00a663;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
95% {
|
|
311
|
+
--fairys-enter-loading-transform-color: #00a76c;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
96.25% {
|
|
315
|
+
--fairys-enter-loading-transform-color: #00a874;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
97.5% {
|
|
319
|
+
--fairys-enter-loading-transform-color: #00a87d;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
98.75% {
|
|
323
|
+
--fairys-enter-loading-transform-color: #00a985;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
100% {
|
|
327
|
+
--fairys-enter-loading-transform-color: #00a98e;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
.fairys_taro_loading {
|
|
331
|
+
--fairys-enter-loading-transform-color: #00a98e;
|
|
332
|
+
animation: fairys_taro_loading_transform 20s linear infinite;
|
|
333
|
+
position: fixed;
|
|
334
|
+
top: 0;
|
|
335
|
+
left: 0;
|
|
336
|
+
z-index: 10000;
|
|
337
|
+
display: flex;
|
|
338
|
+
flex-direction: column;
|
|
339
|
+
align-items: center;
|
|
340
|
+
justify-content: center;
|
|
341
|
+
width: 100%;
|
|
342
|
+
height: 100%;
|
|
343
|
+
color: var(--fairys-enter-loading-transform-color);
|
|
344
|
+
user-select: none;
|
|
345
|
+
}
|
|
346
|
+
.fairys_taro_loading *::before,
|
|
347
|
+
.fairys_taro_loading *::after {
|
|
348
|
+
box-sizing: content-box;
|
|
349
|
+
}
|
|
350
|
+
.fairys_taro_loading .fairys_taro_loading-main {
|
|
351
|
+
display: flex;
|
|
352
|
+
flex-wrap: wrap;
|
|
353
|
+
align-items: center;
|
|
354
|
+
justify-content: center;
|
|
355
|
+
width: 2.4rem;
|
|
356
|
+
height: 2.4rem;
|
|
357
|
+
}
|
|
358
|
+
.fairys_taro_loading .fairys_taro_loading-main .square {
|
|
359
|
+
display: flex;
|
|
360
|
+
align-items: center;
|
|
361
|
+
justify-content: center;
|
|
362
|
+
width: 1.2rem;
|
|
363
|
+
height: 1.2rem;
|
|
364
|
+
}
|
|
365
|
+
.fairys_taro_loading .fairys_taro_loading-main .square::before {
|
|
366
|
+
width: 0.5rem;
|
|
367
|
+
height: 0.5rem;
|
|
368
|
+
content: '';
|
|
369
|
+
border: 3px solid var(--fairys-enter-loading-transform-color);
|
|
370
|
+
border-radius: 15%;
|
|
371
|
+
animation: square-to-dot-animation 2s linear infinite;
|
|
372
|
+
}
|
|
373
|
+
.fairys_taro_loading .fairys_taro_loading-main .square:nth-child(1)::before {
|
|
374
|
+
animation-delay: calc(150ms * 1);
|
|
375
|
+
}
|
|
376
|
+
.fairys_taro_loading .fairys_taro_loading-main .square:nth-child(2)::before {
|
|
377
|
+
animation-delay: calc(150ms * 2);
|
|
378
|
+
}
|
|
379
|
+
.fairys_taro_loading .fairys_taro_loading-main .square:nth-child(3)::before {
|
|
380
|
+
animation-delay: calc(150ms * 3);
|
|
381
|
+
}
|
|
382
|
+
.fairys_taro_loading .fairys_taro_loading-main .square:nth-child(4)::before {
|
|
383
|
+
animation-delay: calc(150ms * 4);
|
|
384
|
+
}
|
|
385
|
+
@keyframes square-to-dot-animation {
|
|
386
|
+
15%,
|
|
387
|
+
25% {
|
|
388
|
+
width: 0;
|
|
389
|
+
height: 0;
|
|
390
|
+
margin: 0.2rem;
|
|
391
|
+
border-width: 0.2rem;
|
|
392
|
+
border-radius: 100%;
|
|
393
|
+
}
|
|
394
|
+
40% {
|
|
395
|
+
width: 0.5rem;
|
|
396
|
+
height: 0.5rem;
|
|
397
|
+
margin: initial;
|
|
398
|
+
border-width: 3px;
|
|
399
|
+
border-radius: 15%;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
.fairys_taro_loading .name {
|
|
403
|
+
position: relative;
|
|
404
|
+
margin-top: 1.5rem;
|
|
405
|
+
font-size: 0.8rem;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.fairys_taro_loading .tips {
|
|
409
|
+
position: relative;
|
|
410
|
+
margin-top: 1rem;
|
|
411
|
+
font-size: 0.8rem;
|
|
412
|
+
opacity: 0.5;
|
|
413
|
+
}
|
|
414
|
+
.fairys_taro_loading .loading-dots {
|
|
415
|
+
display: inline-block;
|
|
416
|
+
text-align: left;
|
|
417
|
+
}
|
|
418
|
+
.fairys_taro_loading .loading-dots::after {
|
|
419
|
+
content: '';
|
|
420
|
+
animation: fairys_taro_loading_dots 1.5s steps(4) infinite;
|
|
421
|
+
}
|
|
422
|
+
@keyframes fairys_taro_loading_dots {
|
|
423
|
+
0% {
|
|
424
|
+
content: '';
|
|
425
|
+
}
|
|
426
|
+
25% {
|
|
427
|
+
content: '.';
|
|
428
|
+
}
|
|
429
|
+
50% {
|
|
430
|
+
content: '..';
|
|
431
|
+
}
|
|
432
|
+
75% {
|
|
433
|
+
content: '...';
|
|
434
|
+
}
|
|
435
|
+
100% {
|
|
436
|
+
content: '';
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* 信息图标 */
|
|
441
|
+
.ant-design--info-circle-outlined {
|
|
442
|
+
display: inline-block;
|
|
443
|
+
width: 1.2em;
|
|
444
|
+
height: 1.2em;
|
|
445
|
+
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath fill='%23000' d='M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64m0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372'/%3E%3Cpath fill='%23000' d='M464 336a48 48 0 1 0 96 0a48 48 0 1 0-96 0m72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8'/%3E%3C/svg%3E");
|
|
446
|
+
background-color: currentColor;
|
|
447
|
+
-webkit-mask-image: var(--svg);
|
|
448
|
+
mask-image: var(--svg);
|
|
449
|
+
-webkit-mask-repeat: no-repeat;
|
|
450
|
+
mask-repeat: no-repeat;
|
|
451
|
+
-webkit-mask-size: 100% 100%;
|
|
452
|
+
mask-size: 100% 100%;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.fairys_taro-ui-message-icon-info {
|
|
456
|
+
border-color: rgb(145, 202, 255);
|
|
457
|
+
background-color: rgb(230, 244, 255);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.ant-design--check-circle-outlined {
|
|
461
|
+
display: inline-block;
|
|
462
|
+
width: 1.2em;
|
|
463
|
+
height: 1.2em;
|
|
464
|
+
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath fill='%23000' d='M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0 0 51.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7'/%3E%3Cpath fill='%23000' d='M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64m0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372'/%3E%3C/svg%3E");
|
|
465
|
+
background-color: currentColor;
|
|
466
|
+
-webkit-mask-image: var(--svg);
|
|
467
|
+
mask-image: var(--svg);
|
|
468
|
+
-webkit-mask-repeat: no-repeat;
|
|
469
|
+
mask-repeat: no-repeat;
|
|
470
|
+
-webkit-mask-size: 100% 100%;
|
|
471
|
+
mask-size: 100% 100%;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.fairys_taro-ui-message-icon-success {
|
|
475
|
+
border-color: rgb(183, 235, 143);
|
|
476
|
+
background-color: rgb(246, 255, 237);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.ant-design--exclamation-circle-outlined {
|
|
480
|
+
display: inline-block;
|
|
481
|
+
width: 1.2em;
|
|
482
|
+
height: 1.2em;
|
|
483
|
+
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath fill='%23000' d='M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64m0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372'/%3E%3Cpath fill='%23000' d='M464 688a48 48 0 1 0 96 0a48 48 0 1 0-96 0m24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8'/%3E%3C/svg%3E");
|
|
484
|
+
background-color: currentColor;
|
|
485
|
+
-webkit-mask-image: var(--svg);
|
|
486
|
+
mask-image: var(--svg);
|
|
487
|
+
-webkit-mask-repeat: no-repeat;
|
|
488
|
+
mask-repeat: no-repeat;
|
|
489
|
+
-webkit-mask-size: 100% 100%;
|
|
490
|
+
mask-size: 100% 100%;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.fairys_taro-ui-message-icon-warning {
|
|
494
|
+
border-color: rgb(255, 229, 143);
|
|
495
|
+
background-color: rgb(255, 251, 230);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.ant-design--close-circle-outlined {
|
|
499
|
+
display: inline-block;
|
|
500
|
+
width: 1.2em;
|
|
501
|
+
height: 1.2em;
|
|
502
|
+
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960S64 759.4 64 512S264.6 64 512 64m0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372s372-166.6 372-372s-166.6-372-372-372m128.013 198.826c.023.007.042.018.083.059l45.02 45.019c.04.04.05.06.058.083a.12.12 0 0 1 0 .07c-.007.022-.018.041-.059.082L557.254 512l127.861 127.862a.3.3 0 0 1 .05.06l.009.023a.12.12 0 0 1 0 .07c-.007.022-.018.041-.059.082l-45.019 45.02c-.04.04-.06.05-.083.058a.12.12 0 0 1-.07 0c-.022-.007-.041-.018-.082-.059L512 557.254L384.14 685.115c-.042.041-.06.052-.084.059a.12.12 0 0 1-.07 0c-.022-.007-.041-.018-.082-.059l-45.02-45.019a.2.2 0 0 1-.058-.083a.12.12 0 0 1 0-.07c.007-.022.018-.041.059-.082L466.745 512l-127.86-127.86a.3.3 0 0 1-.05-.061l-.009-.023a.12.12 0 0 1 0-.07c.007-.022.018-.041.059-.082l45.019-45.02c.04-.04.06-.05.083-.058a.12.12 0 0 1 .07 0c.022.007.041.018.082.059L512 466.745l127.862-127.86c.04-.041.06-.052.083-.059a.12.12 0 0 1 .07 0Z'/%3E%3C/svg%3E");
|
|
503
|
+
background-color: currentColor;
|
|
504
|
+
-webkit-mask-image: var(--svg);
|
|
505
|
+
mask-image: var(--svg);
|
|
506
|
+
-webkit-mask-repeat: no-repeat;
|
|
507
|
+
mask-repeat: no-repeat;
|
|
508
|
+
-webkit-mask-size: 100% 100%;
|
|
509
|
+
mask-size: 100% 100%;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.fairys_taro-ui-message-icon-error {
|
|
513
|
+
border-color: rgb(255, 204, 199);
|
|
514
|
+
background-color: rgb(255, 242, 240);
|
|
515
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro';
|
|
2
|
+
|
|
3
|
+
class NavigateInstance {
|
|
4
|
+
/**判断是否已登录(方法需要在项目入口文件中进行挂载)*/
|
|
5
|
+
public isAuth: (url: string) => Promise<boolean> | boolean;
|
|
6
|
+
|
|
7
|
+
private _isAuth = async (url?: string) => {
|
|
8
|
+
let isAuthTo = true;
|
|
9
|
+
if (url && typeof this.isAuth === 'function') {
|
|
10
|
+
isAuthTo = await this.isAuth(url);
|
|
11
|
+
}
|
|
12
|
+
if (isAuthTo === false) {
|
|
13
|
+
// 无权访问页面
|
|
14
|
+
Taro.showToast({ title: '无权访问', icon: 'none' });
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 判断是否当前页面
|
|
22
|
+
*/
|
|
23
|
+
isCurrentPage = (route: string) => {
|
|
24
|
+
/**处理路由前缀*/
|
|
25
|
+
const _route = route.replace(/^\//, '');
|
|
26
|
+
const currentPath = (Taro.getCurrentInstance().router?.path || '').replace(/^\//, '');
|
|
27
|
+
return currentPath === _route;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
|
|
31
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
32
|
+
* @example
|
|
33
|
+
* ```json
|
|
34
|
+
* {
|
|
35
|
+
* "tabBar": {
|
|
36
|
+
* "list": [{
|
|
37
|
+
* "pagePath": "index",
|
|
38
|
+
* "text": "首页"
|
|
39
|
+
* },{
|
|
40
|
+
* "pagePath": "other",
|
|
41
|
+
* "text": "其他"
|
|
42
|
+
* }]
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* Taro.switchTab({
|
|
49
|
+
* url: '/index'
|
|
50
|
+
* })
|
|
51
|
+
* ```
|
|
52
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html
|
|
53
|
+
*/
|
|
54
|
+
switchTab = async (options: Taro.switchTab.Option) => {
|
|
55
|
+
const isAuthTo = await this._isAuth(options.url);
|
|
56
|
+
if (isAuthTo === false) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return Taro.switchTab(options);
|
|
60
|
+
};
|
|
61
|
+
/** 关闭所有页面,打开到应用内的某个页面
|
|
62
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* Taro.reLaunch({
|
|
66
|
+
* url: 'test?id=1'
|
|
67
|
+
* })
|
|
68
|
+
* ```
|
|
69
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html
|
|
70
|
+
*/
|
|
71
|
+
reLaunch = async (options: Taro.reLaunch.Option) => {
|
|
72
|
+
const isAuthTo = await this._isAuth(options.url);
|
|
73
|
+
if (isAuthTo === false) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return Taro.reLaunch(options);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
|
|
80
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
81
|
+
* @h5 未针对 tabbar 页面做限制处理
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* Taro.redirectTo({
|
|
85
|
+
* url: 'test?id=1'
|
|
86
|
+
* })
|
|
87
|
+
* ```
|
|
88
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html
|
|
89
|
+
*/
|
|
90
|
+
redirectTo = async (options: Taro.redirectTo.Option) => {
|
|
91
|
+
const isAuthTo = await this._isAuth(options.url);
|
|
92
|
+
if (isAuthTo === false) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
return Taro.redirectTo(options);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。
|
|
99
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
100
|
+
* @h5 未针对 tabbar 页面做限制处理
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* Taro.navigateTo({
|
|
104
|
+
* url: 'test?id=1',
|
|
105
|
+
* events: {
|
|
106
|
+
* // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
|
|
107
|
+
* acceptDataFromOpenedPage: function(data) {
|
|
108
|
+
* console.log(data)
|
|
109
|
+
* },
|
|
110
|
+
* someEvent: function(data) {
|
|
111
|
+
* console.log(data)
|
|
112
|
+
* }
|
|
113
|
+
* ...
|
|
114
|
+
* },
|
|
115
|
+
* success: function (res) {
|
|
116
|
+
* // 通过eventChannel向被打开页面传送数据
|
|
117
|
+
* res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'test' })
|
|
118
|
+
* }
|
|
119
|
+
* })
|
|
120
|
+
* ```
|
|
121
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
|
|
122
|
+
*/
|
|
123
|
+
navigateTo = async (options: Taro.navigateTo.Option) => {
|
|
124
|
+
const isAuthTo = await this._isAuth(options.url);
|
|
125
|
+
if (isAuthTo === false) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
return Taro.navigateTo(options);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。
|
|
132
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
133
|
+
* @h5 若入参 delta 大于现有页面数时,返回应用打开的第一个页面(如果想要返回首页请使用 reLaunch 方法)。
|
|
134
|
+
* @example
|
|
135
|
+
* ```tsx
|
|
136
|
+
* // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码
|
|
137
|
+
* // 此处是A页面
|
|
138
|
+
* Taro.navigateTo({
|
|
139
|
+
* url: 'B?id=1'
|
|
140
|
+
* })
|
|
141
|
+
* // 此处是B页面
|
|
142
|
+
* Taro.navigateTo({
|
|
143
|
+
* url: 'C?id=1'
|
|
144
|
+
* })
|
|
145
|
+
* // 在C页面内 navigateBack,将返回A页面
|
|
146
|
+
* Taro.navigateBack({
|
|
147
|
+
* delta: 2
|
|
148
|
+
* })
|
|
149
|
+
* ```
|
|
150
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html
|
|
151
|
+
*/
|
|
152
|
+
navigateBack = (options?: Taro.navigateBack.Option) => {
|
|
153
|
+
return Taro.navigateBack(options);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**路由跳转*/
|
|
158
|
+
export const navigate = new NavigateInstance();
|
|
159
|
+
export default navigate;
|