@freelog/tools-lib 0.1.30 → 0.1.34
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/dist/service-API/transactions.d.ts +11 -0
- package/dist/tools-lib.cjs.development.js +34 -25
- package/dist/tools-lib.cjs.development.js.map +1 -1
- package/dist/tools-lib.cjs.production.min.js +1 -1
- package/dist/tools-lib.cjs.production.min.js.map +1 -1
- package/dist/tools-lib.esm.js +34 -25
- package/dist/tools-lib.esm.js.map +1 -1
- package/dist/utils/format.d.ts +1 -2
- package/dist/utils/linkTo.d.ts +1 -0
- package/package.json +1 -1
- package/src/service-API/transactions.ts +29 -8
- package/src/utils/format.ts +38 -43
- package/src/utils/linkTo.ts +9 -0
- package/src/utils/regexp.ts +35 -35
package/dist/utils/format.d.ts
CHANGED
|
@@ -11,6 +11,5 @@ export declare function formatDateTime(date: string, showTime?: boolean): string
|
|
|
11
11
|
/**
|
|
12
12
|
* 根据传入的子域名拼合成完整的适合的url
|
|
13
13
|
* @param domain 要组合的三级域名
|
|
14
|
-
* @param strict 是否严格返回,如 localhost 就放回空字符
|
|
15
14
|
*/
|
|
16
|
-
export declare function completeUrlByDomain(domain: string
|
|
15
|
+
export declare function completeUrlByDomain(domain: string): string;
|
package/dist/utils/linkTo.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ interface RetrieveUserPasswordParamsType {
|
|
|
87
87
|
goTo?: string;
|
|
88
88
|
}
|
|
89
89
|
export declare function retrieveUserPassword({ goTo }?: RetrieveUserPasswordParamsType): string;
|
|
90
|
+
export declare function retrievePayPassword(): string;
|
|
90
91
|
export declare function wallet(): string;
|
|
91
92
|
export declare function contract(): string;
|
|
92
93
|
export declare function setting(): string;
|
package/package.json
CHANGED
|
@@ -8,9 +8,6 @@ interface DetailsParamsType {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function details({accountId, ...params}: DetailsParamsType) {
|
|
11
|
-
// return FUtil.Axios.get(`/v2/transactions/details/${accountId}`, {
|
|
12
|
-
// params,
|
|
13
|
-
// });
|
|
14
11
|
return FUtil.Request({
|
|
15
12
|
method: 'GET',
|
|
16
13
|
url: `/v2/transactions/details/${accountId}`,
|
|
@@ -24,9 +21,6 @@ interface IndividualAccountsParamsType {
|
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
export function individualAccounts({userId, ...params}: IndividualAccountsParamsType) {
|
|
27
|
-
// return FUtil.Axios.get(`/v2/accounts/individualAccounts/${userId}`, {
|
|
28
|
-
// params,
|
|
29
|
-
// });
|
|
30
24
|
return FUtil.Request({
|
|
31
25
|
method: 'GET',
|
|
32
26
|
url: `/v2/accounts/individualAccounts/${userId}`,
|
|
@@ -34,6 +28,19 @@ export function individualAccounts({userId, ...params}: IndividualAccountsParams
|
|
|
34
28
|
});
|
|
35
29
|
}
|
|
36
30
|
|
|
31
|
+
// 查询交易记录详情
|
|
32
|
+
interface TransactionDetailsParamsType {
|
|
33
|
+
recordId: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function transactionDetails({recordId}: TransactionDetailsParamsType) {
|
|
37
|
+
return FUtil.Request({
|
|
38
|
+
method: 'GET',
|
|
39
|
+
url: `/v2/transactions/records/${recordId}`,
|
|
40
|
+
// params: params,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
// 激活个人账户
|
|
38
45
|
interface ActivateIndividualAccountsParamsType {
|
|
39
46
|
password: string;
|
|
@@ -42,7 +49,6 @@ interface ActivateIndividualAccountsParamsType {
|
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
export function activateIndividualAccounts({...params}: ActivateIndividualAccountsParamsType) {
|
|
45
|
-
// return FUtil.Axios.put(`/v2/accounts/individualAccounts/activate`, params);
|
|
46
52
|
return FUtil.Request({
|
|
47
53
|
method: 'PUT',
|
|
48
54
|
url: `/v2/accounts/individualAccounts/activate`,
|
|
@@ -59,10 +65,25 @@ interface ChangePasswordParamsType {
|
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
export function changePassword({...params}: ChangePasswordParamsType) {
|
|
62
|
-
// return FUtil.Axios.put(`/v2/accounts/individualAccounts`, params);
|
|
63
68
|
return FUtil.Request({
|
|
64
69
|
method: 'PUT',
|
|
65
70
|
url: `/v2/accounts/individualAccounts`,
|
|
66
71
|
data: params,
|
|
67
72
|
});
|
|
68
73
|
}
|
|
74
|
+
|
|
75
|
+
// 重置交易密码
|
|
76
|
+
interface ResetPasswordParamsType {
|
|
77
|
+
loginPassword: string;
|
|
78
|
+
password: string;
|
|
79
|
+
authCode: string;
|
|
80
|
+
messageAddress: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function resetPassword({...params}: ResetPasswordParamsType) {
|
|
84
|
+
return FUtil.Request({
|
|
85
|
+
method: 'PUT',
|
|
86
|
+
url: `/v2/accounts/individualAccounts/resetPassword`,
|
|
87
|
+
data: params,
|
|
88
|
+
});
|
|
89
|
+
}
|
package/src/utils/format.ts
CHANGED
|
@@ -1,43 +1,38 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 将对应的字节数,转换为易读单位数量
|
|
5
|
-
* @param bytes
|
|
6
|
-
* @return {string}
|
|
7
|
-
*/
|
|
8
|
-
export function humanizeSize(bytes: number): string {
|
|
9
|
-
// console.log('dddhumanizeSizesdfsd');
|
|
10
|
-
if (bytes <= 0) {
|
|
11
|
-
return '0 B';
|
|
12
|
-
}
|
|
13
|
-
const unitArr = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
14
|
-
const index = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
15
|
-
const size = Math.round((bytes / Math.pow(1024, index)) * 100) / 100; //保留的小数位数
|
|
16
|
-
return size + ' ' + unitArr[index];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 格式化日期时间
|
|
21
|
-
*/
|
|
22
|
-
export function formatDateTime(date: string, showTime: boolean = false) {
|
|
23
|
-
return moment(date).format('YYYY/MM/DD' + (showTime ? ' HH:mm' : ''));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 根据传入的子域名拼合成完整的适合的url
|
|
28
|
-
* @param domain 要组合的三级域名
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
origin = `https://${domain}.freelog.com`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return origin;
|
|
43
|
-
}
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 将对应的字节数,转换为易读单位数量
|
|
5
|
+
* @param bytes
|
|
6
|
+
* @return {string}
|
|
7
|
+
*/
|
|
8
|
+
export function humanizeSize(bytes: number): string {
|
|
9
|
+
// console.log('dddhumanizeSizesdfsd');
|
|
10
|
+
if (bytes <= 0) {
|
|
11
|
+
return '0 B';
|
|
12
|
+
}
|
|
13
|
+
const unitArr = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
14
|
+
const index = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
15
|
+
const size = Math.round((bytes / Math.pow(1024, index)) * 100) / 100; //保留的小数位数
|
|
16
|
+
return size + ' ' + unitArr[index];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 格式化日期时间
|
|
21
|
+
*/
|
|
22
|
+
export function formatDateTime(date: string, showTime: boolean = false) {
|
|
23
|
+
return moment(date).format('YYYY/MM/DD' + (showTime ? ' HH:mm' : ''));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 根据传入的子域名拼合成完整的适合的url
|
|
28
|
+
* @param domain 要组合的三级域名
|
|
29
|
+
*/
|
|
30
|
+
export function completeUrlByDomain(domain: string): string {
|
|
31
|
+
let origin: string = `http://${domain}.testfreelog.com`;
|
|
32
|
+
|
|
33
|
+
if (window.location.origin.includes('.freelog.com')) {
|
|
34
|
+
origin = `https://${domain}.freelog.com`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return origin;
|
|
38
|
+
}
|
package/src/utils/linkTo.ts
CHANGED
|
@@ -226,6 +226,15 @@ export function retrieveUserPassword({goTo}: RetrieveUserPasswordParamsType = {}
|
|
|
226
226
|
})}`;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
// 找回支付密码
|
|
230
|
+
// interface RetrievePayPasswordParamsType {
|
|
231
|
+
// goTo?: string;
|
|
232
|
+
// }
|
|
233
|
+
|
|
234
|
+
export function retrievePayPassword() {
|
|
235
|
+
return `/retrievePayPassword`;
|
|
236
|
+
}
|
|
237
|
+
|
|
229
238
|
// 钱包
|
|
230
239
|
// interface WalletParamsType {
|
|
231
240
|
// }
|
package/src/utils/regexp.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
// 展品名称
|
|
2
|
-
export const EXHIBIT_NAME: RegExp = /^(?!.*(\\|\/|:|\*|\?|"|<|>|\||\s|@|\$|#)).{1,60}$/;
|
|
3
|
-
|
|
4
|
-
// 资源名称
|
|
5
|
-
export const RESOURCE_NAME: RegExp = /^(?!.*(\\|\/|:|\*|\?|"|<|>|\||\s|@|\$|#)).{1,60}$/;
|
|
6
|
-
|
|
7
|
-
// 资源类型
|
|
8
|
-
export const RESOURCE_TYPE: RegExp = /^(?!_)[a-z0-9_]{3,20}(?<!_)$/;
|
|
9
|
-
|
|
10
|
-
// 自定义属性键
|
|
11
|
-
export const CUSTOM_KEY: RegExp = /^[a-zA-Z0-9_]{1,20}$/;
|
|
12
|
-
|
|
13
|
-
// 节点名称
|
|
14
|
-
export const NODE_NAME: RegExp = /^[\u4E00-\u9FA5|a-zA-Z0-9]{2,24}$/;
|
|
15
|
-
|
|
16
|
-
// 节点地址
|
|
17
|
-
export const NODE_DOMAIN = /^(?!-)[a-z0-9-]{4,24}(?<!-)$/;
|
|
18
|
-
|
|
19
|
-
// 支付密码
|
|
20
|
-
export const PAY_PASSWORD = /^\d{6}$/;
|
|
21
|
-
|
|
22
|
-
// 手机号码
|
|
23
|
-
export const MOBILE_PHONE_NUMBER = /^
|
|
24
|
-
// export const TELEPHONE_NUMBER = /^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1|3])|(19[5|6])|(19[8|9]))\d{8}$/
|
|
25
|
-
|
|
26
|
-
// 邮箱地址
|
|
27
|
-
export const EMAIL_ADDRESS = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
|
28
|
-
|
|
29
|
-
// 用户名
|
|
30
|
-
// export const USERNAME = /^(?!-)[A-Za-z0-9-]{1,30}(?<!-)$/;
|
|
31
|
-
export const USERNAME = /^(?!-)[A-Za-z0-9-]{1,30}(?<!-)$/;
|
|
32
|
-
|
|
33
|
-
// 用户密码
|
|
34
|
-
// export const PASSWORD = /^(?=.*[a-zA-Z])(?=.*[0-9]).{6,24}$/;
|
|
35
|
-
export const PASSWORD = /^(?=.*[0-9])(?=.*[a-zA-Z])(.{6,24})$/;
|
|
1
|
+
// 展品名称
|
|
2
|
+
export const EXHIBIT_NAME: RegExp = /^(?!.*(\\|\/|:|\*|\?|"|<|>|\||\s|@|\$|#)).{1,60}$/;
|
|
3
|
+
|
|
4
|
+
// 资源名称
|
|
5
|
+
export const RESOURCE_NAME: RegExp = /^(?!.*(\\|\/|:|\*|\?|"|<|>|\||\s|@|\$|#)).{1,60}$/;
|
|
6
|
+
|
|
7
|
+
// 资源类型
|
|
8
|
+
export const RESOURCE_TYPE: RegExp = /^(?!_)[a-z0-9_]{3,20}(?<!_)$/;
|
|
9
|
+
|
|
10
|
+
// 自定义属性键
|
|
11
|
+
export const CUSTOM_KEY: RegExp = /^[a-zA-Z0-9_]{1,20}$/;
|
|
12
|
+
|
|
13
|
+
// 节点名称
|
|
14
|
+
export const NODE_NAME: RegExp = /^[\u4E00-\u9FA5|a-zA-Z0-9]{2,24}$/;
|
|
15
|
+
|
|
16
|
+
// 节点地址
|
|
17
|
+
export const NODE_DOMAIN = /^(?!-)[a-z0-9-]{4,24}(?<!-)$/;
|
|
18
|
+
|
|
19
|
+
// 支付密码
|
|
20
|
+
export const PAY_PASSWORD = /^\d{6}$/;
|
|
21
|
+
|
|
22
|
+
// 手机号码
|
|
23
|
+
export const MOBILE_PHONE_NUMBER = /^1[345789]\d{9}$/;
|
|
24
|
+
// export const TELEPHONE_NUMBER = /^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1|3])|(19[5|6])|(19[8|9]))\d{8}$/
|
|
25
|
+
|
|
26
|
+
// 邮箱地址
|
|
27
|
+
export const EMAIL_ADDRESS = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
|
28
|
+
|
|
29
|
+
// 用户名
|
|
30
|
+
// export const USERNAME = /^(?!-)[A-Za-z0-9-]{1,30}(?<!-)$/;
|
|
31
|
+
export const USERNAME = /^(?!-)[A-Za-z0-9-]{1,30}(?<!-)$/;
|
|
32
|
+
|
|
33
|
+
// 用户密码
|
|
34
|
+
// export const PASSWORD = /^(?=.*[a-zA-Z])(?=.*[0-9]).{6,24}$/;
|
|
35
|
+
export const PASSWORD = /^(?=.*[0-9])(?=.*[a-zA-Z])(.{6,24})$/;
|