@freelog/tools-lib 0.1.163 → 0.1.166

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