@freelog/tools-lib 0.1.157 → 0.1.158

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,293 +1,293 @@
1
- import FUtil from '../utils';
2
-
3
- // 创建展品
4
- export interface CreatePresentableParamsType {
5
- nodeId: number;
6
- resourceId: string;
7
- version: string;
8
- resolveResources: {
9
- resourceId: string;
10
- contracts: {
11
- policyId: string;
12
- }[];
13
- }[];
14
- presentableName: string;
15
- tags?: string[];
16
- policies?: {
17
- policyName: string;
18
- policyText: string;
19
- status?: 0 | 1;
20
- }[];
21
- }
22
-
23
- export function createPresentable(params: CreatePresentableParamsType) {
24
- // return FUtil.Axios.post(`/v2/presentables`, params);
25
- return FUtil.Request({
26
- method: 'POST',
27
- url: `/v2/presentables`,
28
- data: params,
29
- });
30
- }
31
-
32
- // 更新展品
33
- interface UpdatePresentableParamsType {
34
- presentableId: string;
35
- presentableTitle?: string;
36
- presentableIntro?: string;
37
- tags?: string[];
38
- coverImages?: string[];
39
- addPolicies?: {
40
- policyName: string;
41
- policyText: string;
42
- status?: 0 | 1;
43
- }[];
44
- updatePolicies?: {
45
- policyId: string;
46
- status: 0 | 1;
47
- }[];
48
- resolveResources?: {
49
- resourceId: string;
50
- contracts: {
51
- policyId: string;
52
- }[];
53
- }[];
54
- }
55
-
56
- export function updatePresentable({presentableId, ...params}: UpdatePresentableParamsType) {
57
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}`, params);
58
- return FUtil.Request({
59
- method: 'PUT',
60
- url: `/v2/presentables/${presentableId}`,
61
- data: params,
62
- });
63
- }
64
-
65
- // 上下线presentable
66
- interface PresentablesOnlineParamsType {
67
- presentableId: string;
68
- onlineStatus: 0 | 1;
69
- updatePolicies?: {
70
- policyId: string;
71
- status: 0 | 1;
72
- }
73
- }
74
-
75
- export function presentablesOnlineStatus({presentableId, ...params}: PresentablesOnlineParamsType) {
76
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/onlineStatus`, params);
77
- return FUtil.Request({
78
- method: 'PUT',
79
- url: `/v2/presentables/${presentableId}/onlineStatus`,
80
- data: params,
81
- });
82
- }
83
-
84
- // 查看展品详情
85
- interface PresentableDetailsParamsType1 {
86
- presentableId: string;
87
- projection?: string;
88
- isLoadVersionProperty?: 0 | 1;
89
- isLoadPolicyInfo?: 0 | 1;
90
- isTranslate?: 0 | 1;
91
- isLoadCustomPropertyDescriptors?: 0 | 1;
92
- isLoadResourceDetailInfo?: 0 | 1;
93
- isLoadResourceVersionInfo?: 0 | 1;
94
- }
95
-
96
- interface PresentableDetailsParamsType2 {
97
- nodeId: number;
98
- resourceId?: string;
99
- resourceName?: string;
100
- presentableName?: string;
101
- projection?: string;
102
- isLoadVersionProperty?: 0 | 1;
103
- isLoadPolicyInfo?: 0 | 1;
104
- isLoadCustomPropertyDescriptors?: 0 | 1;
105
- }
106
-
107
- export function presentableDetails(params: PresentableDetailsParamsType1 | PresentableDetailsParamsType2) {
108
- if ((params as PresentableDetailsParamsType2).nodeId) {
109
- // return FUtil.Axios.get(`/v2/presentables/detail`, {
110
- // params,
111
- // });
112
- return FUtil.Request({
113
- method: 'GET',
114
- url: `/v2/presentables/detail`,
115
- params: params,
116
- });
117
- }
118
- const {presentableId, ...p} = params as PresentableDetailsParamsType1;
119
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
120
- // params: p,
121
- // });
122
- return FUtil.Request({
123
- method: 'GET',
124
- url: `/v2/presentables/${presentableId}`,
125
- params: p,
126
- });
127
- }
128
-
129
- // 查询展品分页列表
130
- interface PresentablesParamsType {
131
- nodeId: number;
132
- skip?: number;
133
- limit?: number;
134
- resourceType?: string;
135
- resourceTypeCode?: string;
136
- omitResourceType?: string;
137
- onlineStatus?: number;
138
- tags?: string;
139
- projection?: string;
140
- keywords?: string;
141
- isLoadVersionProperty?: 0 | 1;
142
- isLoadPolicyInfo?: 0 | 1;
143
- }
144
-
145
- export function presentables(params: PresentablesParamsType) {
146
- return FUtil.Request({
147
- method: 'GET',
148
- url: `/v2/presentables`,
149
- params: params,
150
- });
151
- }
152
-
153
- // 批量查询展品列表
154
- interface PresentableListParamsType {
155
- nodeId?: number;
156
- userId?: number;
157
- presentableIds?: string;
158
- resourceIds?: string;
159
- resourceNames?: string;
160
- isLoadVersionProperty?: 0 | 1;
161
- isLoadPolicyInfo?: 0 | 1;
162
- isTranslate?: 0 | 1;
163
- projection?: string;
164
- resolveResourceIds?: string;
165
- }
166
-
167
- export function presentableList(params: PresentableListParamsType) {
168
- return FUtil.Request({
169
- method: 'GET',
170
- url: `/v2/presentables/list`,
171
- params: params,
172
- });
173
- }
174
-
175
- // 查看展品依赖树
176
- interface DependencyTreeParamsType {
177
- presentableId: string;
178
- maxDeep?: number;
179
- nid?: string;
180
- isContainRootNode?: boolean;
181
- version?: string;
182
- }
183
-
184
- export function dependencyTree({presentableId, ...params}: DependencyTreeParamsType) {
185
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/dependencyTree`, {params});
186
- return FUtil.Request({
187
- method: 'GET',
188
- url: `/v2/presentables/${presentableId}/dependencyTree`,
189
- params: params,
190
- });
191
- }
192
-
193
- // 查看展品关系树
194
- interface RelationTreeParamsType {
195
- presentableId: string;
196
- version?: string;
197
- }
198
-
199
- export function relationTree({presentableId, ...params}: RelationTreeParamsType) {
200
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/relationTree`, {params});
201
- return FUtil.Request({
202
- method: 'GET',
203
- url: `/v2/presentables/${presentableId}/relationTree`,
204
- params: params,
205
- });
206
- }
207
-
208
- // 查看展品授权树
209
- interface AuthTreeParamsType {
210
- presentableId: string;
211
- maxDeep?: number;
212
- nid?: string;
213
- isContainRootNode?: boolean;
214
- version?: string;
215
- }
216
-
217
- export function authTree({presentableId, ...params}: AuthTreeParamsType) {
218
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/authTree`, {params});
219
- return FUtil.Request({
220
- method: 'GET',
221
- url: `/v2/presentables/${presentableId}/authTree`,
222
- params: params,
223
- });
224
- }
225
-
226
- // 切换展品版本
227
- interface PresentablesVersionParamsType {
228
- presentableId: string;
229
- version: string;
230
- }
231
-
232
- export function presentablesVersion({presentableId, ...params}: PresentablesVersionParamsType) {
233
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/version`, params);
234
- return FUtil.Request({
235
- method: 'PUT',
236
- url: `/v2/presentables/${presentableId}/version`,
237
- data: params,
238
- });
239
- }
240
-
241
- // 设置展品自定义属性
242
- interface UpdateRewritePropertyParamsType {
243
- presentableId: string;
244
- rewriteProperty: {
245
- key: string;
246
- value: string;
247
- remark: string;
248
- }[];
249
- }
250
-
251
- export function updateRewriteProperty({presentableId, ...params}: UpdateRewritePropertyParamsType) {
252
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/rewriteProperty`, params);
253
- return FUtil.Request({
254
- method: 'PUT',
255
- url: `/v2/presentables/${presentableId}/rewriteProperty`,
256
- data: params,
257
- });
258
- }
259
-
260
- // 批量获取展品授权结果
261
- interface BatchAuthParamsType {
262
- nodeId: number;
263
- authType: 1 | 2 | 3; // 1:节点侧授权 2:资源侧授权 3:节点+资源侧授权
264
- presentableIds: string;
265
- }
266
-
267
- export function batchAuth({nodeId, ...params}: BatchAuthParamsType) {
268
- // return FUtil.Axios.get(`/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`, {
269
- // params,
270
- // });
271
- return FUtil.Request({
272
- method: 'GET',
273
- url: `/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`,
274
- params: params,
275
- });
276
- }
277
-
278
- // 查看合约应用的展品列表
279
- interface ContractAppliedPresentableParamsType {
280
- nodeId: number;
281
- contractIds: string;
282
- }
283
-
284
- export function contractAppliedPresentable({nodeId, ...params}: ContractAppliedPresentableParamsType) {
285
- // return FUtil.Axios.get(`/v2/presentables/${nodeId}/contractAppliedPresentable`, {
286
- // params,
287
- // });
288
- return FUtil.Request({
289
- method: 'GET',
290
- url: `/v2/presentables/${nodeId}/contractAppliedPresentable`,
291
- params: params,
292
- });
293
- }
1
+ import FUtil from '../utils';
2
+
3
+ // 创建展品
4
+ export interface CreatePresentableParamsType {
5
+ nodeId: number;
6
+ resourceId: string;
7
+ version: string;
8
+ resolveResources: {
9
+ resourceId: string;
10
+ contracts: {
11
+ policyId: string;
12
+ }[];
13
+ }[];
14
+ presentableName: string;
15
+ tags?: string[];
16
+ policies?: {
17
+ policyName: string;
18
+ policyText: string;
19
+ status?: 0 | 1;
20
+ }[];
21
+ }
22
+
23
+ export function createPresentable(params: CreatePresentableParamsType) {
24
+ // return FUtil.Axios.post(`/v2/presentables`, params);
25
+ return FUtil.Request({
26
+ method: 'POST',
27
+ url: `/v2/presentables`,
28
+ data: params,
29
+ });
30
+ }
31
+
32
+ // 更新展品
33
+ interface UpdatePresentableParamsType {
34
+ presentableId: string;
35
+ presentableTitle?: string;
36
+ presentableIntro?: string;
37
+ tags?: string[];
38
+ coverImages?: string[];
39
+ addPolicies?: {
40
+ policyName: string;
41
+ policyText: string;
42
+ status?: 0 | 1;
43
+ }[];
44
+ updatePolicies?: {
45
+ policyId: string;
46
+ status: 0 | 1;
47
+ }[];
48
+ resolveResources?: {
49
+ resourceId: string;
50
+ contracts: {
51
+ policyId: string;
52
+ }[];
53
+ }[];
54
+ }
55
+
56
+ export function updatePresentable({presentableId, ...params}: UpdatePresentableParamsType) {
57
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}`, params);
58
+ return FUtil.Request({
59
+ method: 'PUT',
60
+ url: `/v2/presentables/${presentableId}`,
61
+ data: params,
62
+ });
63
+ }
64
+
65
+ // 上下线presentable
66
+ interface PresentablesOnlineParamsType {
67
+ presentableId: string;
68
+ onlineStatus: 0 | 1;
69
+ updatePolicies?: {
70
+ policyId: string;
71
+ status: 0 | 1;
72
+ }
73
+ }
74
+
75
+ export function presentablesOnlineStatus({presentableId, ...params}: PresentablesOnlineParamsType) {
76
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/onlineStatus`, params);
77
+ return FUtil.Request({
78
+ method: 'PUT',
79
+ url: `/v2/presentables/${presentableId}/onlineStatus`,
80
+ data: params,
81
+ });
82
+ }
83
+
84
+ // 查看展品详情
85
+ interface PresentableDetailsParamsType1 {
86
+ presentableId: string;
87
+ projection?: string;
88
+ isLoadVersionProperty?: 0 | 1;
89
+ isLoadPolicyInfo?: 0 | 1;
90
+ isTranslate?: 0 | 1;
91
+ isLoadCustomPropertyDescriptors?: 0 | 1;
92
+ isLoadResourceDetailInfo?: 0 | 1;
93
+ isLoadResourceVersionInfo?: 0 | 1;
94
+ }
95
+
96
+ interface PresentableDetailsParamsType2 {
97
+ nodeId: number;
98
+ resourceId?: string;
99
+ resourceName?: string;
100
+ presentableName?: string;
101
+ projection?: string;
102
+ isLoadVersionProperty?: 0 | 1;
103
+ isLoadPolicyInfo?: 0 | 1;
104
+ isLoadCustomPropertyDescriptors?: 0 | 1;
105
+ }
106
+
107
+ export function presentableDetails(params: PresentableDetailsParamsType1 | PresentableDetailsParamsType2) {
108
+ if ((params as PresentableDetailsParamsType2).nodeId) {
109
+ // return FUtil.Axios.get(`/v2/presentables/detail`, {
110
+ // params,
111
+ // });
112
+ return FUtil.Request({
113
+ method: 'GET',
114
+ url: `/v2/presentables/detail`,
115
+ params: params,
116
+ });
117
+ }
118
+ const {presentableId, ...p} = params as PresentableDetailsParamsType1;
119
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
120
+ // params: p,
121
+ // });
122
+ return FUtil.Request({
123
+ method: 'GET',
124
+ url: `/v2/presentables/${presentableId}`,
125
+ params: p,
126
+ });
127
+ }
128
+
129
+ // 查询展品分页列表
130
+ interface PresentablesParamsType {
131
+ nodeId: number;
132
+ skip?: number;
133
+ limit?: number;
134
+ resourceType?: string;
135
+ resourceTypeCode?: string;
136
+ omitResourceType?: string;
137
+ onlineStatus?: number;
138
+ tags?: string;
139
+ projection?: string;
140
+ keywords?: string;
141
+ isLoadVersionProperty?: 0 | 1;
142
+ isLoadPolicyInfo?: 0 | 1;
143
+ }
144
+
145
+ export function presentables(params: PresentablesParamsType) {
146
+ return FUtil.Request({
147
+ method: 'GET',
148
+ url: `/v2/presentables`,
149
+ params: params,
150
+ });
151
+ }
152
+
153
+ // 批量查询展品列表
154
+ interface PresentableListParamsType {
155
+ nodeId?: number;
156
+ userId?: number;
157
+ presentableIds?: string;
158
+ resourceIds?: string;
159
+ resourceNames?: string;
160
+ isLoadVersionProperty?: 0 | 1;
161
+ isLoadPolicyInfo?: 0 | 1;
162
+ isTranslate?: 0 | 1;
163
+ projection?: string;
164
+ resolveResourceIds?: string;
165
+ }
166
+
167
+ export function presentableList(params: PresentableListParamsType) {
168
+ return FUtil.Request({
169
+ method: 'GET',
170
+ url: `/v2/presentables/list`,
171
+ params: params,
172
+ });
173
+ }
174
+
175
+ // 查看展品依赖树
176
+ interface DependencyTreeParamsType {
177
+ presentableId: string;
178
+ maxDeep?: number;
179
+ nid?: string;
180
+ isContainRootNode?: boolean;
181
+ version?: string;
182
+ }
183
+
184
+ export function dependencyTree({presentableId, ...params}: DependencyTreeParamsType) {
185
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/dependencyTree`, {params});
186
+ return FUtil.Request({
187
+ method: 'GET',
188
+ url: `/v2/presentables/${presentableId}/dependencyTree`,
189
+ params: params,
190
+ });
191
+ }
192
+
193
+ // 查看展品关系树
194
+ interface RelationTreeParamsType {
195
+ presentableId: string;
196
+ version?: string;
197
+ }
198
+
199
+ export function relationTree({presentableId, ...params}: RelationTreeParamsType) {
200
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/relationTree`, {params});
201
+ return FUtil.Request({
202
+ method: 'GET',
203
+ url: `/v2/presentables/${presentableId}/relationTree`,
204
+ params: params,
205
+ });
206
+ }
207
+
208
+ // 查看展品授权树
209
+ interface AuthTreeParamsType {
210
+ presentableId: string;
211
+ maxDeep?: number;
212
+ nid?: string;
213
+ isContainRootNode?: boolean;
214
+ version?: string;
215
+ }
216
+
217
+ export function authTree({presentableId, ...params}: AuthTreeParamsType) {
218
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/authTree`, {params});
219
+ return FUtil.Request({
220
+ method: 'GET',
221
+ url: `/v2/presentables/${presentableId}/authTree`,
222
+ params: params,
223
+ });
224
+ }
225
+
226
+ // 切换展品版本
227
+ interface PresentablesVersionParamsType {
228
+ presentableId: string;
229
+ version: string;
230
+ }
231
+
232
+ export function presentablesVersion({presentableId, ...params}: PresentablesVersionParamsType) {
233
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/version`, params);
234
+ return FUtil.Request({
235
+ method: 'PUT',
236
+ url: `/v2/presentables/${presentableId}/version`,
237
+ data: params,
238
+ });
239
+ }
240
+
241
+ // 设置展品自定义属性
242
+ interface UpdateRewritePropertyParamsType {
243
+ presentableId: string;
244
+ rewriteProperty: {
245
+ key: string;
246
+ value: string;
247
+ remark: string;
248
+ }[];
249
+ }
250
+
251
+ export function updateRewriteProperty({presentableId, ...params}: UpdateRewritePropertyParamsType) {
252
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/rewriteProperty`, params);
253
+ return FUtil.Request({
254
+ method: 'PUT',
255
+ url: `/v2/presentables/${presentableId}/rewriteProperty`,
256
+ data: params,
257
+ });
258
+ }
259
+
260
+ // 批量获取展品授权结果
261
+ interface BatchAuthParamsType {
262
+ nodeId: number;
263
+ authType: 1 | 2 | 3; // 1:节点侧授权 2:资源侧授权 3:节点+资源侧授权
264
+ presentableIds: string;
265
+ }
266
+
267
+ export function batchAuth({nodeId, ...params}: BatchAuthParamsType) {
268
+ // return FUtil.Axios.get(`/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`, {
269
+ // params,
270
+ // });
271
+ return FUtil.Request({
272
+ method: 'GET',
273
+ url: `/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`,
274
+ params: params,
275
+ });
276
+ }
277
+
278
+ // 查看合约应用的展品列表
279
+ interface ContractAppliedPresentableParamsType {
280
+ nodeId: number;
281
+ contractIds: string;
282
+ }
283
+
284
+ export function contractAppliedPresentable({nodeId, ...params}: ContractAppliedPresentableParamsType) {
285
+ // return FUtil.Axios.get(`/v2/presentables/${nodeId}/contractAppliedPresentable`, {
286
+ // params,
287
+ // });
288
+ return FUtil.Request({
289
+ method: 'GET',
290
+ url: `/v2/presentables/${nodeId}/contractAppliedPresentable`,
291
+ params: params,
292
+ });
293
+ }
@@ -30,7 +30,7 @@ if (window.location.hostname.includes('.com')) {
30
30
  // apiHost = `${window.location.protocol}//qi.${(window.location.host.match(/(?<=\.).*/) || [''])[0]}`;
31
31
  // apiHost = window.location.origin.replace('console', 'qi');
32
32
  axios.defaults.withCredentials = true;
33
- axios.defaults.baseURL = completeUrlByDomain('qi');
33
+ axios.defaults.baseURL = completeUrlByDomain('api');
34
34
  }
35
35
 
36
36
  /**
@@ -32,7 +32,7 @@ export function formatDateTime(date: string, showTime: boolean = false) {
32
32
  * @param domain 要组合的三级域名
33
33
  */
34
34
  export function completeUrlByDomain(domain: string): string {
35
- let origin: string = `http://${domain}.testfreelog.com`;
35
+ let origin: string = `https://${domain}.testfreelog.com`;
36
36
 
37
37
  if (window.location.origin.includes('.freelog.com')) {
38
38
  origin = `https://${domain}.freelog.com`;