@freelog/tools-lib 0.1.185 → 0.1.186

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.
@@ -1,683 +1,697 @@
1
- import * as querystring from 'querystring';
2
-
3
- type TReturnType = string;
4
-
5
- /************** www Start ******************************************************/
6
- // 首页
7
- interface HomeParamsType {}
8
-
9
- export function home({}: HomeParamsType = {}) {
10
- return `/home`;
11
- }
12
-
13
- // 活动列表
14
- interface ActivitiesParamsType {}
15
-
16
- export function activities({}: ActivitiesParamsType = {}) {
17
- return `/activities`;
18
- }
19
-
20
- // 活动详情
21
- interface ActivitiesParamsType {
22
- activityID: string;
23
- }
24
-
25
- export function activity({ activityID }: ActivitiesParamsType) {
26
- return `/activity/${activityID}`;
27
- }
28
-
29
- interface WXShareParamsType {
30
- link: string;
31
- title: string;
32
- desc: string;
33
- imgUrl: string;
34
- }
35
-
36
- export function wxShare({ link, title, desc, imgUrl }: WXShareParamsType) {
37
- return `/wx-share/index.html#title=${title}&desc=${desc}&link=${link}&imgUrl=${imgUrl}`;
38
- }
39
-
40
- /************** www End ******************************************************/
41
-
42
- /************** console Start ******************************************************/
43
- // dashboard
44
- interface DashboardParamsType {}
45
-
46
- export function dashboard({}: DashboardParamsType = {}) {
47
- return `/dashboard`;
48
- }
49
-
50
- // 资源市场
51
- interface MarketParamsType {
52
- // nodeID: number;
53
- query?: string;
54
- }
55
-
56
- export function market({ ...params }: MarketParamsType = {}): TReturnType {
57
- return `/market${handleQuery(params)}`;
58
- }
59
-
60
- // 示例节点
61
- interface ExampleNodesParamsType {}
62
-
63
- export function exampleNodes({}: ExampleNodesParamsType = {}): TReturnType {
64
- return `/examples`;
65
- }
66
-
67
- // 资源详情
68
- interface ResourceDetailsParamsType {
69
- resourceID: string;
70
- version?: string;
71
- }
72
-
73
- export function resourceDetails({
74
- resourceID,
75
- ...params
76
- }: ResourceDetailsParamsType): TReturnType {
77
- return `/resource/details/${resourceID}${handleQuery(params)}`;
78
- }
79
-
80
- // 集合详情
81
- interface CollectionDetailsParamsType {
82
- collectionID: string;
83
- // version?: string;
84
- }
85
-
86
- export function collectionDetails({
87
- collectionID,
88
- }: CollectionDetailsParamsType): TReturnType {
89
- return `/resource/collectionDetails/${collectionID}`;
90
- }
91
-
92
- // 资源创建入口
93
- interface ResourceCreatorParamsType {}
94
-
95
- export function resourceCreatorEntry({}: ResourceCreatorParamsType = {}): TReturnType {
96
- return `/resource/creatorEntry`;
97
- }
98
-
99
- // 资源创建
100
- interface ResourceCreatorParamsType {}
101
-
102
- export function resourceCreator({}: ResourceCreatorParamsType = {}): TReturnType {
103
- return `/resource/creator`;
104
- }
105
-
106
- // 资源批量创建
107
- interface ResourceCreatorParamsType {}
108
-
109
- export function resourceCreatorBatch({}: ResourceCreatorParamsType = {}): TReturnType {
110
- return `/resource/creatorBatch`;
111
- }
112
-
113
- // 集合创建
114
- interface CollectionCreatorParamsType {}
115
-
116
- export function collectionCreator({}: CollectionCreatorParamsType = {}): TReturnType {
117
- return `/resource/collectionCreator`;
118
- }
119
-
120
- // 我的资源
121
- interface MyResourcesParamsType {}
122
-
123
- export function myResources({}: MyResourcesParamsType = {}): TReturnType {
124
- return `/resource/list`;
125
- }
126
-
127
- // 我的集合
128
- interface MyCollectionsParamsType {}
129
-
130
- export function myCollections({}: MyCollectionsParamsType = {}): TReturnType {
131
- return `/resource/collection`;
132
- }
133
-
134
- // 我的收藏
135
- interface MyCollectsParamsType {}
136
-
137
- export function myCollects({}: MyCollectsParamsType = {}): TReturnType {
138
- return `/resource/collect`;
139
- }
140
-
141
- // 资源版本信息
142
- interface ResourceVersionInfoParamsType {
143
- resourceID: string;
144
- version?: string;
145
- }
146
-
147
- export function resourceVersionInfo({
148
- resourceID,
149
- version = '',
150
- }: ResourceVersionInfoParamsType): TReturnType {
151
- return `/resource/sidebar/versionInfo/${resourceID}${handleQuery({
152
- version,
153
- })}`;
154
- }
155
-
156
- // 资源信息
157
- interface ResourceInfoParamsType {
158
- resourceID: string;
159
- }
160
-
161
- export function resourceInfo({
162
- resourceID,
163
- }: ResourceInfoParamsType): TReturnType {
164
- return `/resource/sidebar/info/${resourceID}`;
165
- }
166
-
167
- // 资源授权策略
168
- interface ResourcePolicyParamsType {
169
- resourceID: string;
170
- }
171
-
172
- export function resourcePolicy({
173
- resourceID,
174
- }: ResourcePolicyParamsType): TReturnType {
175
- return `/resource/sidebar/policy/${resourceID}`;
176
- }
177
-
178
- // 资源授权合约
179
- interface ResourceContractParamsType {
180
- resourceID: string;
181
- }
182
-
183
- export function resourceContract({
184
- resourceID,
185
- }: ResourceContractParamsType): TReturnType {
186
- return `/resource/sidebar/contract/${resourceID}`;
187
- }
188
-
189
- // 资源被授权管理
190
- interface ResourceDependencyParamsType {
191
- resourceID: string;
192
- }
193
-
194
- export function resourceDependency({
195
- resourceID,
196
- }: ResourceDependencyParamsType): TReturnType {
197
- return `/resource/sidebar/dependency/${resourceID}`;
198
- }
199
-
200
- // 资源版本创建
201
- interface ResourceVersionCreatorParamsType {
202
- resourceID: string;
203
- }
204
-
205
- export function resourceVersionCreator({
206
- resourceID,
207
- }: ResourceVersionCreatorParamsType): TReturnType {
208
- return `/resource/versionCreator/${resourceID}`;
209
- }
210
-
211
- // 集合版本信息
212
- interface CollectionVersionInfoParamsType {
213
- collectionID: string;
214
- // version?: string;
215
- }
216
-
217
- export function collectionVersionInfo({
218
- collectionID,
219
- }: CollectionVersionInfoParamsType): TReturnType {
220
- return `/resource/collectionSidebar/versionInfo/${collectionID}`;
221
- }
222
-
223
- // 集合信息
224
- interface CollectionInfoParamsType {
225
- collectionID: string;
226
- }
227
-
228
- export function collectionInfo({
229
- collectionID,
230
- }: CollectionInfoParamsType): TReturnType {
231
- return `/resource/collectionSidebar/info/${collectionID}`;
232
- }
233
-
234
- // 集合授权策略
235
- interface CollectionPolicyParamsType {
236
- collectionID: string;
237
- }
238
-
239
- export function collectionPolicy({
240
- collectionID,
241
- }: CollectionPolicyParamsType): TReturnType {
242
- return `/resource/collectionSidebar/policy/${collectionID}`;
243
- }
244
-
245
- // 集合授权合约
246
- interface CollectionContractParamsType {
247
- collectionID: string;
248
- }
249
-
250
- export function collectionContract({
251
- collectionID,
252
- }: CollectionContractParamsType): TReturnType {
253
- return `/resource/collectionSidebar/contract/${collectionID}`;
254
- }
255
-
256
- // 集合被授权管理
257
- interface CollectionDependencyParamsType {
258
- collectionID: string;
259
- }
260
-
261
- export function collectionDependency({
262
- collectionID,
263
- }: CollectionDependencyParamsType): TReturnType {
264
- return `/resource/collectionSidebar/dependency/${collectionID}`;
265
- }
266
-
267
- // 节点创建
268
- interface NodeCreatorParamsType {
269
- // nodeID: number;
270
- }
271
-
272
- export function nodeCreator({}: NodeCreatorParamsType = {}): TReturnType {
273
- return `/node/creator`;
274
- }
275
-
276
- // 节点管理
277
- interface NodeManagementParamsType {
278
- nodeID: number;
279
- showPage?:
280
- | 'exhibit'
281
- | 'theme'
282
- | 'contract'
283
- | 'setting'
284
- | 'income'
285
- | 'transaction';
286
- }
287
-
288
- export function nodeManagement({
289
- nodeID,
290
- showPage = 'exhibit',
291
- ...params
292
- }: NodeManagementParamsType): TReturnType {
293
- return `/node/formal/${nodeID}${handleQuery({ showPage, ...params })}`;
294
- }
295
-
296
- // 展品管理
297
- interface ExhibitManagementParamsType {
298
- exhibitID: string;
299
- openAuthDrawer?: boolean;
300
- showMoreSetting?: boolean;
301
- }
302
-
303
- export function exhibitManagement({
304
- exhibitID,
305
- ...params
306
- }: ExhibitManagementParamsType): TReturnType {
307
- return `/node/exhibit/formal/${exhibitID}${handleQuery({
308
- ...params,
309
- })}`;
310
- }
311
-
312
- // 集合展品管理
313
- interface CollectionExhibitManagementParamsType {
314
- exhibitID: string;
315
- openAuthDrawer?: boolean;
316
- }
317
-
318
- export function collectionExhibitManagement({
319
- exhibitID,
320
- openAuthDrawer,
321
- }: CollectionExhibitManagementParamsType): TReturnType {
322
- return `/node/collectionExhibit/formal/${exhibitID}${handleQuery({
323
- openAuthDrawer,
324
- })}`;
325
- }
326
-
327
- // 集合展品创建
328
- interface CollectionExhibitCreatorParamsType {
329
- nodeID: number;
330
- }
331
-
332
- export function collectionExhibitCreator({
333
- nodeID,
334
- }: CollectionExhibitCreatorParamsType): TReturnType {
335
- return `/node/collectionExhibitCreator/${nodeID}`;
336
- }
337
-
338
- // 创建的集合展品管理
339
- interface CreatedCollectionExhibitManagementParamsType {
340
- exhibitID: string;
341
- }
342
-
343
- export function createdCollectionExhibitManagement({
344
- exhibitID,
345
- }: CreatedCollectionExhibitManagementParamsType): TReturnType {
346
- return `/node/createdCollectionExhibit/formal/${exhibitID}`;
347
- }
348
-
349
- // 测试节点管理
350
- interface InformNodeManagementParamsType {
351
- nodeID: number;
352
- showPage?: 'exhibit' | 'theme' | 'mappingRule';
353
- }
354
-
355
- export function informNodeManagement({
356
- nodeID,
357
- showPage = 'exhibit',
358
- ...params
359
- }: InformNodeManagementParamsType): TReturnType {
360
- return `/node/informal/${nodeID}${handleQuery({ showPage, ...params })}`;
361
- }
362
-
363
- // 测试展品管理
364
- interface InformExhibitManagementParamsType {
365
- exhibitID: string;
366
- openAuthDrawer?: boolean;
367
- }
368
-
369
- export function informExhibitManagement({
370
- exhibitID,
371
- openAuthDrawer = undefined,
372
- }: InformExhibitManagementParamsType): TReturnType {
373
- return `/node/exhibit/informal/${exhibitID}${handleQuery({
374
- openAuthDrawer,
375
- })}`;
376
- }
377
-
378
- // 存储空间
379
- interface StorageSpaceParamsType {
380
- bucketName?: string;
381
- createBucket?: boolean;
382
- }
383
-
384
- export function storageSpace({
385
- ...params
386
- }: StorageSpaceParamsType = {}): TReturnType {
387
- return `/storage${handleQuery(params)}`;
388
- }
389
-
390
- // 对象详情
391
- interface ObjectDetailsParamsType {
392
- bucketName: string;
393
- objectID: string;
394
- }
395
-
396
- export function objectDetails({
397
- ...params
398
- }: ObjectDetailsParamsType): TReturnType {
399
- return `/storage${handleQuery(params)}`;
400
- }
401
-
402
- // 集合创建成功
403
- interface CollectionCreateSuccessParamsType {
404
- collectionID: string;
405
- }
406
-
407
- export function collectionCreateSuccess({
408
- collectionID,
409
- }: CollectionCreateSuccessParamsType) {
410
- return `/result/collection/create/success/${collectionID}`;
411
- }
412
-
413
- // 资源创建成功
414
- interface ResourceCreateSuccessParamsType {
415
- resourceID: string;
416
- }
417
-
418
- export function resourceCreateSuccess({
419
- resourceID,
420
- }: ResourceCreateSuccessParamsType) {
421
- return `/result/resource/create/success/${resourceID}`;
422
- }
423
-
424
- // 资源版本创建成功
425
- interface ResourceVersionCreateSuccessParamsType {
426
- resourceID: string;
427
- version: string;
428
- }
429
-
430
- export function resourceVersionCreateSuccess({
431
- resourceID,
432
- version,
433
- }: ResourceVersionCreateSuccessParamsType) {
434
- return `/result/resource/version/create/success/${resourceID}/${version}`;
435
- }
436
-
437
- // 资源版本正在创建
438
- interface ResourceVersionCreateReleaseParamsType {
439
- resourceID: string;
440
- version: string;
441
- }
442
-
443
- export function resourceVersionCreateRelease({
444
- resourceID,
445
- version,
446
- }: ResourceVersionCreateReleaseParamsType) {
447
- return `/result/resource/version/create/release/${resourceID}/${version}`;
448
- }
449
-
450
- // 节点创建成功
451
- interface NodeCreateSuccessParamsType {
452
- nodeID: number;
453
- }
454
-
455
- export function nodeCreateSuccess({ nodeID }: NodeCreateSuccessParamsType) {
456
- return `/result/node/create/success/${nodeID}`;
457
- }
458
-
459
- // 内测资格申请
460
- interface InvitationParamsType {
461
- goTo?: string;
462
- invitationCode?: string;
463
- }
464
-
465
- export function invitation({ goTo, ...params }: InvitationParamsType = {}) {
466
- // console.log(params.goTo, 'goTo9iowjefklsdj;flksdjflk')
467
- return `/invitation${handleQuery({
468
- ...params,
469
- returnUrl: goTo ? encodeURIComponent(goTo) : undefined,
470
- })}`;
471
- }
472
-
473
- // 403
474
- interface Exception403ParamsType {
475
- from?: string;
476
- }
477
-
478
- export function exception403({ ...params }: Exception403ParamsType = {}) {
479
- let fromUrl: string = params.from || '';
480
- if (!fromUrl) {
481
- const { href, origin } = window.location;
482
- fromUrl = href.replace(origin, '');
483
- }
484
-
485
- return `/exception/403${handleQuery({
486
- from: fromUrl,
487
- })}`;
488
- }
489
-
490
- // unableToAccess
491
- interface ExceptionUnableToAccessParamsType {
492
- from?: string;
493
- }
494
-
495
- export function exceptionUnableToAccess({
496
- ...params
497
- }: ExceptionUnableToAccessParamsType = {}) {
498
- let fromUrl: string = params.from || '';
499
- if (!fromUrl) {
500
- const { href, origin } = window.location;
501
- fromUrl = href.replace(origin, '');
502
- }
503
-
504
- return `/exception/unableToAccess${handleQuery({
505
- from: fromUrl,
506
- })}`;
507
- }
508
-
509
- // /exception/common?tipText=1234
510
- // 通用异常
511
- interface ExceptionCommonParamsType {
512
- tipText?: string;
513
- btnText?: string;
514
- }
515
-
516
- export function exceptionCommon({ ...params }: ExceptionCommonParamsType = {}) {
517
- return `/exception/common${handleQuery({
518
- ...params,
519
- })}`;
520
- }
521
-
522
- // 节点封禁
523
- interface NodeFreezeParamsType {
524
- nodeID: number;
525
- }
526
-
527
- export function nodeFreeze({ nodeID }: NodeFreezeParamsType) {
528
- return `/result/node/freeze/${nodeID}`;
529
- }
530
-
531
- // 资源封禁
532
- interface ResourceFreezeParamsType {
533
- resourceID: string;
534
- }
535
-
536
- export function resourceFreeze({ resourceID }: ResourceFreezeParamsType) {
537
- return `/result/resource/freeze/${resourceID}`;
538
- }
539
-
540
- // 站内搜索
541
- interface GlobalSearchParamsType {
542
- search: string;
543
- }
544
-
545
- export function globalSearch({ search }: GlobalSearchParamsType) {
546
- return `/search${handleQuery({
547
- search,
548
- })}`;
549
- }
550
-
551
- /************** console End ******************************************************/
552
-
553
- /************** user Start ******************************************************/
554
- // 登录
555
- interface LoginParamsType {
556
- goTo?: string;
557
- }
558
-
559
- export function login({ goTo }: LoginParamsType = {}) {
560
- return `/login${handleQuery({
561
- goTo: goTo ? encodeURIComponent(goTo) : undefined,
562
- })}`;
563
- }
564
-
565
- // 注册
566
- interface LoginParamsType {
567
- goTo?: string;
568
- invitationCode?: string;
569
- }
570
-
571
- export function logon({ goTo, ...params }: LoginParamsType = {}) {
572
- return `/logon${handleQuery({
573
- goTo: goTo ? encodeURIComponent(goTo) : undefined,
574
- ...params,
575
- })}`;
576
- }
577
-
578
- // 绑定账户
579
- interface LoginParamsType {
580
- goTo?: string;
581
- identityId?: string;
582
- returnUrl?: string;
583
- }
584
-
585
- export function bind({ goTo, returnUrl, ...params }: LoginParamsType = {}) {
586
- return `/bind${handleQuery({
587
- goTo: goTo ? encodeURIComponent(goTo) : undefined,
588
- returnUrl: returnUrl ? encodeURIComponent(returnUrl) : undefined,
589
- ...params,
590
- })}`;
591
- }
592
-
593
- // 找回密码
594
- interface RetrieveUserPasswordParamsType {
595
- goTo?: string;
596
- }
597
-
598
- export function retrieveUserPassword({
599
- goTo,
600
- }: RetrieveUserPasswordParamsType = {}) {
601
- return `/retrieve${handleQuery({
602
- goTo: goTo ? encodeURIComponent(goTo) : undefined,
603
- })}`;
604
- }
605
-
606
- // 找回支付密码
607
- interface RetrievePayPasswordParamsType {
608
- goTo?: string;
609
- }
610
-
611
- export function retrievePayPassword({}: RetrievePayPasswordParamsType = {}) {
612
- return `/retrievePayPassword`;
613
- }
614
-
615
- // 用户冻结
616
- interface UserFreezeParamsType {
617
- // goTo?: string;
618
- }
619
-
620
- export function userFreeze({}: UserFreezeParamsType = {}) {
621
- return `/freeze`;
622
- }
623
-
624
- // 我的钱包
625
- interface WalletParamsType {}
626
-
627
- export function wallet({}: WalletParamsType = {}) {
628
- return `/logged/wallet`;
629
- }
630
-
631
- // 活动奖励
632
- interface RewardParamsType {}
633
-
634
- export function reward({}: RewardParamsType = {}) {
635
- return `/logged/reward`;
636
- }
637
-
638
- // 我的合约
639
- interface ContractParamsType {
640
- identityType?: 1 | 2;
641
- licensorName?: string;
642
- licenseeName?: string;
643
- }
644
-
645
- export function contract({ ...params }: ContractParamsType = {}) {
646
- return `/logged/contract${handleQuery({
647
- ...params,
648
- })}`;
649
- }
650
-
651
- // 个人设置
652
- interface SettingParamsType {}
653
-
654
- export function setting({}: SettingParamsType = {}) {
655
- return `/logged/setting`;
656
- }
657
-
658
- // 绑定
659
- interface BindingParamsType {}
660
-
661
- export function binding({}: BindingParamsType = {}) {
662
- return `/logged/binding`;
663
- }
664
-
665
- // 绑定成功
666
- interface ResultBindingSuccessParamsType {}
667
-
668
- export function resultBindingSuccess({}: ResultBindingSuccessParamsType = {}) {
669
- return `/result/binding`;
670
- }
671
-
672
- /************** user End ******************************************************/
673
-
674
- function handleQuery(query: object): string {
675
- const obj: any = {};
676
- for (const [key, value] of Object.entries(query)) {
677
- if (key && value) {
678
- obj[key] = value;
679
- }
680
- }
681
- const result: string = querystring.stringify(obj);
682
- return result ? '?' + result : '';
683
- }
1
+ import * as querystring from 'querystring';
2
+
3
+ type TReturnType = string;
4
+
5
+ /************** www Start ******************************************************/
6
+ // 首页
7
+ interface HomeParamsType {}
8
+
9
+ export function home({}: HomeParamsType = {}) {
10
+ return `/home`;
11
+ }
12
+
13
+ // 活动列表
14
+ interface ActivitiesParamsType {}
15
+
16
+ export function activities({}: ActivitiesParamsType = {}) {
17
+ return `/activities`;
18
+ }
19
+
20
+ // 活动详情
21
+ interface ActivitiesParamsType {
22
+ activityID: string;
23
+ }
24
+
25
+ export function activity({ activityID }: ActivitiesParamsType) {
26
+ return `/activity/${activityID}`;
27
+ }
28
+
29
+ interface WXShareParamsType {
30
+ link: string;
31
+ title: string;
32
+ desc: string;
33
+ imgUrl: string;
34
+ }
35
+
36
+ export function wxShare({ link, title, desc, imgUrl }: WXShareParamsType) {
37
+ return `/wx-share/index.html#title=${title}&desc=${desc}&link=${link}&imgUrl=${imgUrl}`;
38
+ }
39
+
40
+ /************** www End ******************************************************/
41
+
42
+ /************** console Start ******************************************************/
43
+ // dashboard
44
+ interface DashboardParamsType {}
45
+
46
+ export function dashboard({}: DashboardParamsType = {}) {
47
+ return `/dashboard`;
48
+ }
49
+
50
+ // 资源市场
51
+ interface MarketParamsType {
52
+ // nodeID: number;
53
+ query?: string;
54
+ }
55
+
56
+ export function market({ ...params }: MarketParamsType = {}): TReturnType {
57
+ return `/market${handleQuery(params)}`;
58
+ }
59
+
60
+ // 示例节点
61
+ interface ExampleNodesParamsType {}
62
+
63
+ export function exampleNodes({}: ExampleNodesParamsType = {}): TReturnType {
64
+ return `/examples`;
65
+ }
66
+
67
+ // 资源详情
68
+ interface ResourceDetailsParamsType {
69
+ resourceID: string;
70
+ version?: string;
71
+ }
72
+
73
+ export function resourceDetails({
74
+ resourceID,
75
+ ...params
76
+ }: ResourceDetailsParamsType): TReturnType {
77
+ return `/resource/details/${resourceID}${handleQuery(params)}`;
78
+ }
79
+
80
+ // 集合详情
81
+ interface CollectionDetailsParamsType {
82
+ collectionID: string;
83
+ // version?: string;
84
+ }
85
+
86
+ export function collectionDetails({
87
+ collectionID,
88
+ }: CollectionDetailsParamsType): TReturnType {
89
+ return `/resource/collectionDetails/${collectionID}`;
90
+ }
91
+
92
+ // 资源创建入口
93
+ interface ResourceCreatorParamsType {}
94
+
95
+ export function resourceCreatorEntry({}: ResourceCreatorParamsType = {}): TReturnType {
96
+ return `/resource/creatorEntry`;
97
+ }
98
+
99
+ // 资源创建
100
+ interface ResourceCreatorParamsType {}
101
+
102
+ export function resourceCreator({}: ResourceCreatorParamsType = {}): TReturnType {
103
+ return `/resource/creator`;
104
+ }
105
+
106
+ // 资源批量创建
107
+ interface ResourceCreatorParamsType {}
108
+
109
+ export function resourceCreatorBatch({}: ResourceCreatorParamsType = {}): TReturnType {
110
+ return `/resource/creatorBatch`;
111
+ }
112
+
113
+ // 集合创建
114
+ interface CollectionCreatorParamsType {}
115
+
116
+ export function collectionCreator({}: CollectionCreatorParamsType = {}): TReturnType {
117
+ return `/resource/collectionCreator`;
118
+ }
119
+
120
+ // 我的资源
121
+ interface MyResourcesParamsType {}
122
+
123
+ export function myResources({}: MyResourcesParamsType = {}): TReturnType {
124
+ return `/resource/list`;
125
+ }
126
+
127
+ // 我的集合
128
+ interface MyCollectionsParamsType {}
129
+
130
+ export function myCollections({}: MyCollectionsParamsType = {}): TReturnType {
131
+ return `/resource/collection`;
132
+ }
133
+
134
+ // 我的收藏
135
+ interface MyCollectsParamsType {}
136
+
137
+ export function myCollects({}: MyCollectsParamsType = {}): TReturnType {
138
+ return `/resource/collect`;
139
+ }
140
+
141
+ // 我的资源收入
142
+ interface MyResourceIncomeParamsType {}
143
+
144
+ export function myResourceIncome({}: MyResourceIncomeParamsType = {}): TReturnType {
145
+ return `/resource/income`;
146
+ }
147
+
148
+ // 我的资源交易
149
+ interface MyResourceTransactionParamsType {}
150
+
151
+ export function myResourceTransaction({}: MyResourceTransactionParamsType = {}): TReturnType {
152
+ return `/resource/transaction`;
153
+ }
154
+
155
+ // 资源版本信息
156
+ interface ResourceVersionInfoParamsType {
157
+ resourceID: string;
158
+ version?: string;
159
+ }
160
+
161
+ export function resourceVersionInfo({
162
+ resourceID,
163
+ version = '',
164
+ }: ResourceVersionInfoParamsType): TReturnType {
165
+ return `/resource/sidebar/versionInfo/${resourceID}${handleQuery({
166
+ version,
167
+ })}`;
168
+ }
169
+
170
+ // 资源信息
171
+ interface ResourceInfoParamsType {
172
+ resourceID: string;
173
+ }
174
+
175
+ export function resourceInfo({
176
+ resourceID,
177
+ }: ResourceInfoParamsType): TReturnType {
178
+ return `/resource/sidebar/info/${resourceID}`;
179
+ }
180
+
181
+ // 资源授权策略
182
+ interface ResourcePolicyParamsType {
183
+ resourceID: string;
184
+ }
185
+
186
+ export function resourcePolicy({
187
+ resourceID,
188
+ }: ResourcePolicyParamsType): TReturnType {
189
+ return `/resource/sidebar/policy/${resourceID}`;
190
+ }
191
+
192
+ // 资源授权合约
193
+ interface ResourceContractParamsType {
194
+ resourceID: string;
195
+ }
196
+
197
+ export function resourceContract({
198
+ resourceID,
199
+ }: ResourceContractParamsType): TReturnType {
200
+ return `/resource/sidebar/contract/${resourceID}`;
201
+ }
202
+
203
+ // 资源被授权管理
204
+ interface ResourceDependencyParamsType {
205
+ resourceID: string;
206
+ }
207
+
208
+ export function resourceDependency({
209
+ resourceID,
210
+ }: ResourceDependencyParamsType): TReturnType {
211
+ return `/resource/sidebar/dependency/${resourceID}`;
212
+ }
213
+
214
+ // 资源版本创建
215
+ interface ResourceVersionCreatorParamsType {
216
+ resourceID: string;
217
+ }
218
+
219
+ export function resourceVersionCreator({
220
+ resourceID,
221
+ }: ResourceVersionCreatorParamsType): TReturnType {
222
+ return `/resource/versionCreator/${resourceID}`;
223
+ }
224
+
225
+ // 集合版本信息
226
+ interface CollectionVersionInfoParamsType {
227
+ collectionID: string;
228
+ // version?: string;
229
+ }
230
+
231
+ export function collectionVersionInfo({
232
+ collectionID,
233
+ }: CollectionVersionInfoParamsType): TReturnType {
234
+ return `/resource/collectionSidebar/versionInfo/${collectionID}`;
235
+ }
236
+
237
+ // 集合信息
238
+ interface CollectionInfoParamsType {
239
+ collectionID: string;
240
+ }
241
+
242
+ export function collectionInfo({
243
+ collectionID,
244
+ }: CollectionInfoParamsType): TReturnType {
245
+ return `/resource/collectionSidebar/info/${collectionID}`;
246
+ }
247
+
248
+ // 集合授权策略
249
+ interface CollectionPolicyParamsType {
250
+ collectionID: string;
251
+ }
252
+
253
+ export function collectionPolicy({
254
+ collectionID,
255
+ }: CollectionPolicyParamsType): TReturnType {
256
+ return `/resource/collectionSidebar/policy/${collectionID}`;
257
+ }
258
+
259
+ // 集合授权合约
260
+ interface CollectionContractParamsType {
261
+ collectionID: string;
262
+ }
263
+
264
+ export function collectionContract({
265
+ collectionID,
266
+ }: CollectionContractParamsType): TReturnType {
267
+ return `/resource/collectionSidebar/contract/${collectionID}`;
268
+ }
269
+
270
+ // 集合被授权管理
271
+ interface CollectionDependencyParamsType {
272
+ collectionID: string;
273
+ }
274
+
275
+ export function collectionDependency({
276
+ collectionID,
277
+ }: CollectionDependencyParamsType): TReturnType {
278
+ return `/resource/collectionSidebar/dependency/${collectionID}`;
279
+ }
280
+
281
+ // 节点创建
282
+ interface NodeCreatorParamsType {
283
+ // nodeID: number;
284
+ }
285
+
286
+ export function nodeCreator({}: NodeCreatorParamsType = {}): TReturnType {
287
+ return `/node/creator`;
288
+ }
289
+
290
+ // 节点管理
291
+ interface NodeManagementParamsType {
292
+ nodeID: number;
293
+ showPage?:
294
+ | 'exhibit'
295
+ | 'theme'
296
+ | 'contract'
297
+ | 'setting'
298
+ | 'income'
299
+ | 'transaction';
300
+ }
301
+
302
+ export function nodeManagement({
303
+ nodeID,
304
+ showPage = 'exhibit',
305
+ ...params
306
+ }: NodeManagementParamsType): TReturnType {
307
+ return `/node/formal/${nodeID}${handleQuery({ showPage, ...params })}`;
308
+ }
309
+
310
+ // 展品管理
311
+ interface ExhibitManagementParamsType {
312
+ exhibitID: string;
313
+ openAuthDrawer?: boolean;
314
+ showMoreSetting?: boolean;
315
+ }
316
+
317
+ export function exhibitManagement({
318
+ exhibitID,
319
+ ...params
320
+ }: ExhibitManagementParamsType): TReturnType {
321
+ return `/node/exhibit/formal/${exhibitID}${handleQuery({
322
+ ...params,
323
+ })}`;
324
+ }
325
+
326
+ // 集合展品管理
327
+ interface CollectionExhibitManagementParamsType {
328
+ exhibitID: string;
329
+ openAuthDrawer?: boolean;
330
+ }
331
+
332
+ export function collectionExhibitManagement({
333
+ exhibitID,
334
+ openAuthDrawer,
335
+ }: CollectionExhibitManagementParamsType): TReturnType {
336
+ return `/node/collectionExhibit/formal/${exhibitID}${handleQuery({
337
+ openAuthDrawer,
338
+ })}`;
339
+ }
340
+
341
+ // 集合展品创建
342
+ interface CollectionExhibitCreatorParamsType {
343
+ nodeID: number;
344
+ }
345
+
346
+ export function collectionExhibitCreator({
347
+ nodeID,
348
+ }: CollectionExhibitCreatorParamsType): TReturnType {
349
+ return `/node/collectionExhibitCreator/${nodeID}`;
350
+ }
351
+
352
+ // 创建的集合展品管理
353
+ interface CreatedCollectionExhibitManagementParamsType {
354
+ exhibitID: string;
355
+ }
356
+
357
+ export function createdCollectionExhibitManagement({
358
+ exhibitID,
359
+ }: CreatedCollectionExhibitManagementParamsType): TReturnType {
360
+ return `/node/createdCollectionExhibit/formal/${exhibitID}`;
361
+ }
362
+
363
+ // 测试节点管理
364
+ interface InformNodeManagementParamsType {
365
+ nodeID: number;
366
+ showPage?: 'exhibit' | 'theme' | 'mappingRule';
367
+ }
368
+
369
+ export function informNodeManagement({
370
+ nodeID,
371
+ showPage = 'exhibit',
372
+ ...params
373
+ }: InformNodeManagementParamsType): TReturnType {
374
+ return `/node/informal/${nodeID}${handleQuery({ showPage, ...params })}`;
375
+ }
376
+
377
+ // 测试展品管理
378
+ interface InformExhibitManagementParamsType {
379
+ exhibitID: string;
380
+ openAuthDrawer?: boolean;
381
+ }
382
+
383
+ export function informExhibitManagement({
384
+ exhibitID,
385
+ openAuthDrawer = undefined,
386
+ }: InformExhibitManagementParamsType): TReturnType {
387
+ return `/node/exhibit/informal/${exhibitID}${handleQuery({
388
+ openAuthDrawer,
389
+ })}`;
390
+ }
391
+
392
+ // 存储空间
393
+ interface StorageSpaceParamsType {
394
+ bucketName?: string;
395
+ createBucket?: boolean;
396
+ }
397
+
398
+ export function storageSpace({
399
+ ...params
400
+ }: StorageSpaceParamsType = {}): TReturnType {
401
+ return `/storage${handleQuery(params)}`;
402
+ }
403
+
404
+ // 对象详情
405
+ interface ObjectDetailsParamsType {
406
+ bucketName: string;
407
+ objectID: string;
408
+ }
409
+
410
+ export function objectDetails({
411
+ ...params
412
+ }: ObjectDetailsParamsType): TReturnType {
413
+ return `/storage${handleQuery(params)}`;
414
+ }
415
+
416
+ // 集合创建成功
417
+ interface CollectionCreateSuccessParamsType {
418
+ collectionID: string;
419
+ }
420
+
421
+ export function collectionCreateSuccess({
422
+ collectionID,
423
+ }: CollectionCreateSuccessParamsType) {
424
+ return `/result/collection/create/success/${collectionID}`;
425
+ }
426
+
427
+ // 资源创建成功
428
+ interface ResourceCreateSuccessParamsType {
429
+ resourceID: string;
430
+ }
431
+
432
+ export function resourceCreateSuccess({
433
+ resourceID,
434
+ }: ResourceCreateSuccessParamsType) {
435
+ return `/result/resource/create/success/${resourceID}`;
436
+ }
437
+
438
+ // 资源版本创建成功
439
+ interface ResourceVersionCreateSuccessParamsType {
440
+ resourceID: string;
441
+ version: string;
442
+ }
443
+
444
+ export function resourceVersionCreateSuccess({
445
+ resourceID,
446
+ version,
447
+ }: ResourceVersionCreateSuccessParamsType) {
448
+ return `/result/resource/version/create/success/${resourceID}/${version}`;
449
+ }
450
+
451
+ // 资源版本正在创建
452
+ interface ResourceVersionCreateReleaseParamsType {
453
+ resourceID: string;
454
+ version: string;
455
+ }
456
+
457
+ export function resourceVersionCreateRelease({
458
+ resourceID,
459
+ version,
460
+ }: ResourceVersionCreateReleaseParamsType) {
461
+ return `/result/resource/version/create/release/${resourceID}/${version}`;
462
+ }
463
+
464
+ // 节点创建成功
465
+ interface NodeCreateSuccessParamsType {
466
+ nodeID: number;
467
+ }
468
+
469
+ export function nodeCreateSuccess({ nodeID }: NodeCreateSuccessParamsType) {
470
+ return `/result/node/create/success/${nodeID}`;
471
+ }
472
+
473
+ // 内测资格申请
474
+ interface InvitationParamsType {
475
+ goTo?: string;
476
+ invitationCode?: string;
477
+ }
478
+
479
+ export function invitation({ goTo, ...params }: InvitationParamsType = {}) {
480
+ // console.log(params.goTo, 'goTo9iowjefklsdj;flksdjflk')
481
+ return `/invitation${handleQuery({
482
+ ...params,
483
+ returnUrl: goTo ? encodeURIComponent(goTo) : undefined,
484
+ })}`;
485
+ }
486
+
487
+ // 403
488
+ interface Exception403ParamsType {
489
+ from?: string;
490
+ }
491
+
492
+ export function exception403({ ...params }: Exception403ParamsType = {}) {
493
+ let fromUrl: string = params.from || '';
494
+ if (!fromUrl) {
495
+ const { href, origin } = window.location;
496
+ fromUrl = href.replace(origin, '');
497
+ }
498
+
499
+ return `/exception/403${handleQuery({
500
+ from: fromUrl,
501
+ })}`;
502
+ }
503
+
504
+ // unableToAccess
505
+ interface ExceptionUnableToAccessParamsType {
506
+ from?: string;
507
+ }
508
+
509
+ export function exceptionUnableToAccess({
510
+ ...params
511
+ }: ExceptionUnableToAccessParamsType = {}) {
512
+ let fromUrl: string = params.from || '';
513
+ if (!fromUrl) {
514
+ const { href, origin } = window.location;
515
+ fromUrl = href.replace(origin, '');
516
+ }
517
+
518
+ return `/exception/unableToAccess${handleQuery({
519
+ from: fromUrl,
520
+ })}`;
521
+ }
522
+
523
+ // /exception/common?tipText=1234
524
+ // 通用异常
525
+ interface ExceptionCommonParamsType {
526
+ tipText?: string;
527
+ btnText?: string;
528
+ }
529
+
530
+ export function exceptionCommon({ ...params }: ExceptionCommonParamsType = {}) {
531
+ return `/exception/common${handleQuery({
532
+ ...params,
533
+ })}`;
534
+ }
535
+
536
+ // 节点封禁
537
+ interface NodeFreezeParamsType {
538
+ nodeID: number;
539
+ }
540
+
541
+ export function nodeFreeze({ nodeID }: NodeFreezeParamsType) {
542
+ return `/result/node/freeze/${nodeID}`;
543
+ }
544
+
545
+ // 资源封禁
546
+ interface ResourceFreezeParamsType {
547
+ resourceID: string;
548
+ }
549
+
550
+ export function resourceFreeze({ resourceID }: ResourceFreezeParamsType) {
551
+ return `/result/resource/freeze/${resourceID}`;
552
+ }
553
+
554
+ // 站内搜索
555
+ interface GlobalSearchParamsType {
556
+ search: string;
557
+ }
558
+
559
+ export function globalSearch({ search }: GlobalSearchParamsType) {
560
+ return `/search${handleQuery({
561
+ search,
562
+ })}`;
563
+ }
564
+
565
+ /************** console End ******************************************************/
566
+
567
+ /************** user Start ******************************************************/
568
+ // 登录
569
+ interface LoginParamsType {
570
+ goTo?: string;
571
+ }
572
+
573
+ export function login({ goTo }: LoginParamsType = {}) {
574
+ return `/login${handleQuery({
575
+ goTo: goTo ? encodeURIComponent(goTo) : undefined,
576
+ })}`;
577
+ }
578
+
579
+ // 注册
580
+ interface LoginParamsType {
581
+ goTo?: string;
582
+ invitationCode?: string;
583
+ }
584
+
585
+ export function logon({ goTo, ...params }: LoginParamsType = {}) {
586
+ return `/logon${handleQuery({
587
+ goTo: goTo ? encodeURIComponent(goTo) : undefined,
588
+ ...params,
589
+ })}`;
590
+ }
591
+
592
+ // 绑定账户
593
+ interface LoginParamsType {
594
+ goTo?: string;
595
+ identityId?: string;
596
+ returnUrl?: string;
597
+ }
598
+
599
+ export function bind({ goTo, returnUrl, ...params }: LoginParamsType = {}) {
600
+ return `/bind${handleQuery({
601
+ goTo: goTo ? encodeURIComponent(goTo) : undefined,
602
+ returnUrl: returnUrl ? encodeURIComponent(returnUrl) : undefined,
603
+ ...params,
604
+ })}`;
605
+ }
606
+
607
+ // 找回密码
608
+ interface RetrieveUserPasswordParamsType {
609
+ goTo?: string;
610
+ }
611
+
612
+ export function retrieveUserPassword({
613
+ goTo,
614
+ }: RetrieveUserPasswordParamsType = {}) {
615
+ return `/retrieve${handleQuery({
616
+ goTo: goTo ? encodeURIComponent(goTo) : undefined,
617
+ })}`;
618
+ }
619
+
620
+ // 找回支付密码
621
+ interface RetrievePayPasswordParamsType {
622
+ goTo?: string;
623
+ }
624
+
625
+ export function retrievePayPassword({}: RetrievePayPasswordParamsType = {}) {
626
+ return `/retrievePayPassword`;
627
+ }
628
+
629
+ // 用户冻结
630
+ interface UserFreezeParamsType {
631
+ // goTo?: string;
632
+ }
633
+
634
+ export function userFreeze({}: UserFreezeParamsType = {}) {
635
+ return `/freeze`;
636
+ }
637
+
638
+ // 我的钱包
639
+ interface WalletParamsType {}
640
+
641
+ export function wallet({}: WalletParamsType = {}) {
642
+ return `/logged/wallet`;
643
+ }
644
+
645
+ // 活动奖励
646
+ interface RewardParamsType {}
647
+
648
+ export function reward({}: RewardParamsType = {}) {
649
+ return `/logged/reward`;
650
+ }
651
+
652
+ // 我的合约
653
+ interface ContractParamsType {
654
+ identityType?: 1 | 2;
655
+ licensorName?: string;
656
+ licenseeName?: string;
657
+ }
658
+
659
+ export function contract({ ...params }: ContractParamsType = {}) {
660
+ return `/logged/contract${handleQuery({
661
+ ...params,
662
+ })}`;
663
+ }
664
+
665
+ // 个人设置
666
+ interface SettingParamsType {}
667
+
668
+ export function setting({}: SettingParamsType = {}) {
669
+ return `/logged/setting`;
670
+ }
671
+
672
+ // 绑定
673
+ interface BindingParamsType {}
674
+
675
+ export function binding({}: BindingParamsType = {}) {
676
+ return `/logged/binding`;
677
+ }
678
+
679
+ // 绑定成功
680
+ interface ResultBindingSuccessParamsType {}
681
+
682
+ export function resultBindingSuccess({}: ResultBindingSuccessParamsType = {}) {
683
+ return `/result/binding`;
684
+ }
685
+
686
+ /************** user End ******************************************************/
687
+
688
+ function handleQuery(query: object): string {
689
+ const obj: any = {};
690
+ for (const [key, value] of Object.entries(query)) {
691
+ if (key && value) {
692
+ obj[key] = value;
693
+ }
694
+ }
695
+ const result: string = querystring.stringify(obj);
696
+ return result ? '?' + result : '';
697
+ }