ztxkutils 2.10.36 → 2.10.38
Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
export { c as authority } from './authority-e6bde99f.js';
|
2
2
|
export { d as dataModel } from './dataModel-1fbaff40.js';
|
3
3
|
export { t as tools } from './tools-09a4d620.js';
|
4
|
-
export { v as validate } from './validate-
|
4
|
+
export { v as validate } from './validate-e51e4026.js';
|
5
5
|
export { r as request } from './request-8e2b5826.js';
|
6
6
|
export { r as reqUrl } from './reqUrl-787dd9e5.js';
|
7
7
|
import './tslib.es6-35653116.js';
|
@@ -0,0 +1,34 @@
|
|
1
|
+
declare const PV_URL_SET: Set<unknown>;
|
2
|
+
/**
|
3
|
+
* routeUrl: string
|
4
|
+
* systemId: string
|
5
|
+
* userId: string
|
6
|
+
* navigator: string // 浏览器信息 userAgent
|
7
|
+
* platform: string // 系统信息
|
8
|
+
* memory: string // 内存信息
|
9
|
+
* eventKey: string // 事件名
|
10
|
+
* eventValue: string // 事件值
|
11
|
+
* {
|
12
|
+
* jsHeapSizeLimit: 上下文内可用堆的最大体积,以字节计算。
|
13
|
+
* totalJSHeapSize: 已分配的堆体积,以字节计算。
|
14
|
+
* usedJSHeapSize: 当前 JS 堆活跃段(segment)的体积,以字节计算。
|
15
|
+
* }
|
16
|
+
*/
|
17
|
+
declare function getUserOsInfo(userAgent?: string): "Windows 10" | "Windows 8" | "Windows 7" | "Windows Vista" | "Windows XP" | "Windows 2000" | "Mac/iOS" | "UNIX" | "Linux" | "Other";
|
18
|
+
declare class MyStatistic {
|
19
|
+
private systemId;
|
20
|
+
private userId;
|
21
|
+
private navigator;
|
22
|
+
private platform;
|
23
|
+
constructor(systemId: any, userId: any);
|
24
|
+
private send;
|
25
|
+
private initPerformance;
|
26
|
+
private errorHandle;
|
27
|
+
private unhandledrejectionHandle;
|
28
|
+
private initError;
|
29
|
+
removeError(): void;
|
30
|
+
pv(): void;
|
31
|
+
event(eventKey: string, eventValue: string): void;
|
32
|
+
error(error: Error, info?: any): void;
|
33
|
+
}
|
34
|
+
declare const statistic: MyStatistic;
|
@@ -40,7 +40,8 @@ var validate = {
|
|
40
40
|
/**
|
41
41
|
* @description 密码验证
|
42
42
|
*/
|
43
|
-
passwordValidate: /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$)^.{8,16}$/,
|
43
|
+
// passwordValidate: /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$)^.{8,16}$/,
|
44
|
+
passwordValidate: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,}$/,
|
44
45
|
/**
|
45
46
|
* @description 空格验证
|
46
47
|
*/
|
@@ -66,14 +67,54 @@ var commonMessage = {
|
|
66
67
|
phoneMessage: '请输入正确的手机号',
|
67
68
|
idCardMessage: '请输入正确的身份证',
|
68
69
|
emailMessage: '请输入正确的邮箱',
|
69
|
-
passwordMessage: '密码由8-16位的字母+数字,字母+特殊字符,数字+特殊字符组成',
|
70
|
+
// passwordMessage: '密码由8-16位的字母+数字,字母+特殊字符,数字+特殊字符组成',
|
71
|
+
passwordMessage: '密码必须包含大小写字母、数字、特殊字符且最小长度为8,且不能出现连续数字或字符,不能出现相同字符,且禁止使用用户账号作为密码',
|
70
72
|
spaceMessage: '请勿输入空格',
|
71
|
-
};
|
73
|
+
};
|
74
|
+
function validatePassword(password, username) {
|
75
|
+
// 用正则表达式检查密码基本规则
|
76
|
+
var regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,}$/;
|
77
|
+
if (!regex.test(password)) {
|
78
|
+
return {
|
79
|
+
result: false,
|
80
|
+
message: '密码中必须包含大小写字母、数字、特殊字符,且长度必须大于8个字符!',
|
81
|
+
};
|
82
|
+
}
|
83
|
+
// 检查密码中是否有连续的字母或数字
|
84
|
+
for (var i = 0; i < password.length - 1; i++) {
|
85
|
+
if (Math.abs(password.charCodeAt(i) - password.charCodeAt(i + 1)) === 1) {
|
86
|
+
return {
|
87
|
+
result: false,
|
88
|
+
message: '密码中有连续的字母或数字!',
|
89
|
+
};
|
90
|
+
}
|
91
|
+
}
|
92
|
+
// 检查密码中是否有相同的字符
|
93
|
+
var uniqueChars = new Set(password.split(''));
|
94
|
+
if (uniqueChars.size !== password.length) {
|
95
|
+
return {
|
96
|
+
result: false,
|
97
|
+
message: '密码中有相同的字符!',
|
98
|
+
};
|
99
|
+
}
|
100
|
+
// 检查密码是否与用户名相同
|
101
|
+
if (password === username) {
|
102
|
+
return {
|
103
|
+
result: false,
|
104
|
+
message: '密码与用户名相同!',
|
105
|
+
};
|
106
|
+
}
|
107
|
+
// 如果通过了所有的检查,则返回true
|
108
|
+
return {
|
109
|
+
result: true,
|
110
|
+
};
|
111
|
+
}
|
72
112
|
|
73
113
|
var validate$1 = /*#__PURE__*/Object.freeze({
|
74
114
|
__proto__: null,
|
115
|
+
validatePassword: validatePassword,
|
75
116
|
validate: validate,
|
76
117
|
commonMessage: commonMessage
|
77
118
|
});
|
78
119
|
|
79
|
-
export {
|
120
|
+
export { validatePassword as a, validate as b, commonMessage as c, validate$1 as v };
|
package/dist/validate.d.ts
CHANGED
@@ -55,4 +55,11 @@ declare const commonMessage: {
|
|
55
55
|
passwordMessage: string;
|
56
56
|
spaceMessage: string;
|
57
57
|
};
|
58
|
+
export declare function validatePassword(password: any, username: any): {
|
59
|
+
result: boolean;
|
60
|
+
message: string;
|
61
|
+
} | {
|
62
|
+
result: boolean;
|
63
|
+
message?: undefined;
|
64
|
+
};
|
58
65
|
export { validate, commonMessage };
|
package/dist/validate.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { c as commonMessage,
|
1
|
+
export { c as commonMessage, b as validate, a as validatePassword } from './validate-e51e4026.js';
|