vue2-client 1.20.100 → 1.21.2
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/.idea/.name +1 -0
- package/.idea/MarsCodeWorkspaceAppSettings.xml +8 -0
- package/.idea/gradle.xml +7 -0
- package/.idea/libraries/contour_plot.xml +9 -0
- package/.idea/material_theme_project_new.xml +17 -11
- package/.idea/misc.xml +87 -5
- package/package.json +1 -1
- package/src/base-client/components/common/HIS/HForm/HForm.vue +237 -1
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +4 -1
- package/src/pages/system/ticket/index.vue +1 -1
- package/src/services/api/TicketDetailsViewApi.js +1 -1
- package/src/utils/reg.js +0 -95
- package/src/utils/request.js +1 -1
- package/.idea/git_toolbox_blame.xml +0 -6
package/.idea/.name
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
af-vue2-client
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
|
|
4
|
+
<option name="chatAppRouterInfo" value="chat" />
|
|
5
|
+
<option name="ckgOperationStatus" value="SUCCESS" />
|
|
6
|
+
<option name="progress" value="1.0" />
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/gradle.xml
ADDED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="MaterialThemeProjectNewConfig">
|
|
4
|
-
<option name="metadata">
|
|
5
|
-
<MTProjectMetadataState>
|
|
6
|
-
<option name="migrated" value="true" />
|
|
7
|
-
<option name="pristineConfig" value="false" />
|
|
8
|
-
<option name="userId" value="
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="MaterialThemeProjectNewConfig">
|
|
4
|
+
<option name="metadata">
|
|
5
|
+
<MTProjectMetadataState>
|
|
6
|
+
<option name="migrated" value="true" />
|
|
7
|
+
<option name="pristineConfig" value="false" />
|
|
8
|
+
<option name="userId" value="-1f970a2c:17cde818e34:-8000" />
|
|
9
|
+
<option name="version" value="8.6.4" />
|
|
10
|
+
</MTProjectMetadataState>
|
|
11
|
+
</option>
|
|
12
|
+
<option name="titleBarState">
|
|
13
|
+
<MTProjectTitleBarConfigState>
|
|
14
|
+
<option name="overrideColor" value="false" />
|
|
15
|
+
</MTProjectTitleBarConfigState>
|
|
16
|
+
</option>
|
|
17
|
+
</component>
|
|
12
18
|
</project>
|
package/.idea/misc.xml
CHANGED
|
@@ -1,6 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<project version="4">
|
|
2
|
+
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
3
|
+
<entry key="Project Default">
|
|
4
|
+
<profile-state>
|
|
5
|
+
<expanded-state>
|
|
6
|
+
<State>
|
|
7
|
+
<id>EditorConfig</id>
|
|
8
|
+
</State>
|
|
9
|
+
<State>
|
|
10
|
+
<id>Gradle</id>
|
|
11
|
+
</State>
|
|
12
|
+
<State>
|
|
13
|
+
<id>Java</id>
|
|
14
|
+
</State>
|
|
15
|
+
<State>
|
|
16
|
+
<id>Java 21Java 语言级别迁移帮助Java</id>
|
|
17
|
+
</State>
|
|
18
|
+
<State>
|
|
19
|
+
<id>Java 5Java 语言级别迁移帮助Java</id>
|
|
20
|
+
</State>
|
|
21
|
+
<State>
|
|
22
|
+
<id>Java 语言级别迁移帮助Java</id>
|
|
23
|
+
</State>
|
|
24
|
+
<State>
|
|
25
|
+
<id>JavaScript 和 TypeScript</id>
|
|
26
|
+
</State>
|
|
27
|
+
<State>
|
|
28
|
+
<id>PostCSS</id>
|
|
29
|
+
</State>
|
|
30
|
+
<State>
|
|
31
|
+
<id>代码样式问题Java</id>
|
|
32
|
+
</State>
|
|
33
|
+
<State>
|
|
34
|
+
<id>代码样式问题JavaScript 和 TypeScript</id>
|
|
35
|
+
</State>
|
|
36
|
+
<State>
|
|
37
|
+
<id>可能的 bugGradle</id>
|
|
38
|
+
</State>
|
|
39
|
+
<State>
|
|
40
|
+
<id>可能的 bugJava</id>
|
|
41
|
+
</State>
|
|
42
|
+
<State>
|
|
43
|
+
<id>声明冗余Java</id>
|
|
44
|
+
</State>
|
|
45
|
+
<State>
|
|
46
|
+
<id>安全性</id>
|
|
47
|
+
</State>
|
|
48
|
+
<State>
|
|
49
|
+
<id>安全性Java</id>
|
|
50
|
+
</State>
|
|
51
|
+
<State>
|
|
52
|
+
<id>性能Java</id>
|
|
53
|
+
</State>
|
|
54
|
+
<State>
|
|
55
|
+
<id>抽象问题Java</id>
|
|
56
|
+
</State>
|
|
57
|
+
<State>
|
|
58
|
+
<id>控制流问题Java</id>
|
|
59
|
+
</State>
|
|
60
|
+
<State>
|
|
61
|
+
<id>最佳做法Gradle</id>
|
|
62
|
+
</State>
|
|
63
|
+
<State>
|
|
64
|
+
<id>有效性问题Gradle</id>
|
|
65
|
+
</State>
|
|
66
|
+
<State>
|
|
67
|
+
<id>样式Gradle</id>
|
|
68
|
+
</State>
|
|
69
|
+
<State>
|
|
70
|
+
<id>测试框架Java</id>
|
|
71
|
+
</State>
|
|
72
|
+
<State>
|
|
73
|
+
<id>线程问题Java</id>
|
|
74
|
+
</State>
|
|
75
|
+
<State>
|
|
76
|
+
<id>详细或冗余的代码结构Java</id>
|
|
77
|
+
</State>
|
|
78
|
+
<State>
|
|
79
|
+
<id>资源管理Java</id>
|
|
80
|
+
</State>
|
|
81
|
+
</expanded-state>
|
|
82
|
+
</profile-state>
|
|
83
|
+
</entry>
|
|
84
|
+
</component>
|
|
85
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
|
86
|
+
<output url="file://$PROJECT_DIR$/out" />
|
|
87
|
+
</component>
|
|
6
88
|
</project>
|
package/package.json
CHANGED
|
@@ -50,7 +50,8 @@ const wrapperClassObject = computed(() => {
|
|
|
50
50
|
'charge-form',
|
|
51
51
|
'mini-form',
|
|
52
52
|
'content-right',
|
|
53
|
-
'label-font-style'
|
|
53
|
+
'label-font-style',
|
|
54
|
+
'small-input-style'
|
|
54
55
|
]
|
|
55
56
|
// 只要属性存在就生效的样式开关
|
|
56
57
|
const existStyleKeys = ['radio-style_1']
|
|
@@ -806,5 +807,240 @@ defineExpose({
|
|
|
806
807
|
}
|
|
807
808
|
}
|
|
808
809
|
}
|
|
810
|
+
|
|
811
|
+
// small-input-style 小输入框文字样式(32px高度,234px宽度)
|
|
812
|
+
&.h-form-small-input-style {
|
|
813
|
+
// 输入框基础样式
|
|
814
|
+
:deep(.ant-input) {
|
|
815
|
+
width: 234px;
|
|
816
|
+
height: 32px;
|
|
817
|
+
border-radius: 6px;
|
|
818
|
+
opacity: 1;
|
|
819
|
+
box-sizing: border-box;
|
|
820
|
+
border: 1px solid #E5E9F0;
|
|
821
|
+
|
|
822
|
+
&::placeholder {
|
|
823
|
+
height: 23px;
|
|
824
|
+
opacity: 1;
|
|
825
|
+
font-family: Source Han Sans;
|
|
826
|
+
font-size: 16px;
|
|
827
|
+
font-weight: normal;
|
|
828
|
+
line-height: 32px;
|
|
829
|
+
letter-spacing: 0em;
|
|
830
|
+
font-feature-settings: "kern" on;
|
|
831
|
+
color: #A7A7A7;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
:deep(.ant-input-affix-wrapper) {
|
|
836
|
+
width: 234px;
|
|
837
|
+
height: 32px;
|
|
838
|
+
border-radius: 6px;
|
|
839
|
+
opacity: 1;
|
|
840
|
+
box-sizing: border-box;
|
|
841
|
+
border: 1px solid #E5E9F0;
|
|
842
|
+
|
|
843
|
+
&::placeholder {
|
|
844
|
+
height: 23px;
|
|
845
|
+
opacity: 1;
|
|
846
|
+
font-family: Source Han Sans;
|
|
847
|
+
font-size: 16px;
|
|
848
|
+
font-weight: normal;
|
|
849
|
+
line-height: 32px;
|
|
850
|
+
letter-spacing: 0em;
|
|
851
|
+
|
|
852
|
+
font-feature-settings: "kern" on;
|
|
853
|
+
color: #A7A7A7;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
.ant-input {
|
|
857
|
+
font-family: Source Han Sans;
|
|
858
|
+
font-size: 16px;
|
|
859
|
+
font-weight: normal;
|
|
860
|
+
line-height: 32px;
|
|
861
|
+
letter-spacing: 0em;
|
|
862
|
+
|
|
863
|
+
font-feature-settings: "kern" on;
|
|
864
|
+
color: #313131;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// 输入框文字样式
|
|
869
|
+
:deep(.ant-input) {
|
|
870
|
+
font-family: Source Han Sans;
|
|
871
|
+
font-size: 16px;
|
|
872
|
+
font-weight: normal;
|
|
873
|
+
line-height: 32px;
|
|
874
|
+
letter-spacing: 0em;
|
|
875
|
+
|
|
876
|
+
font-feature-settings: "kern" on;
|
|
877
|
+
color: #313131;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// 下拉框样式
|
|
881
|
+
:deep(.ant-select) {
|
|
882
|
+
width: 234px;
|
|
883
|
+
|
|
884
|
+
.ant-select-selector {
|
|
885
|
+
width: 234px !important;
|
|
886
|
+
height: 32px !important;
|
|
887
|
+
padding: 0 11px !important;
|
|
888
|
+
border-radius: 6px !important;
|
|
889
|
+
border: 1px solid #E5E9F0 !important;
|
|
890
|
+
background: #fff !important;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
.ant-select-selection-placeholder,
|
|
894
|
+
.ant-select-selection__placeholder,
|
|
895
|
+
.ant-select-search__field__placeholder {
|
|
896
|
+
position: absolute !important;
|
|
897
|
+
top: 0 !important;
|
|
898
|
+
right: 11px !important;
|
|
899
|
+
max-width: 100% !important;
|
|
900
|
+
height: 32px !important;
|
|
901
|
+
margin-top: 0 !important;
|
|
902
|
+
overflow: hidden !important;
|
|
903
|
+
color: #A7A7A7 !important;
|
|
904
|
+
line-height: 30px !important;
|
|
905
|
+
white-space: nowrap !important;
|
|
906
|
+
text-overflow: ellipsis !important;
|
|
907
|
+
font-family: Source Han Sans !important;
|
|
908
|
+
font-size: 16px !important;
|
|
909
|
+
font-weight: normal !important;
|
|
910
|
+
letter-spacing: 0em !important;
|
|
911
|
+
font-feature-settings: "kern" on !important;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
.ant-select-selection-selected-value {
|
|
915
|
+
opacity: 1;
|
|
916
|
+
font-family: Source Han Sans;
|
|
917
|
+
font-size: 16px;
|
|
918
|
+
font-weight: normal;
|
|
919
|
+
line-height: 32px;
|
|
920
|
+
letter-spacing: 0em;
|
|
921
|
+
|
|
922
|
+
font-feature-settings: "kern" on;
|
|
923
|
+
color: #313131;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// 单选按钮组样式
|
|
928
|
+
:deep(.ant-radio-group) {
|
|
929
|
+
display: inline-flex;
|
|
930
|
+
flex-wrap: wrap;
|
|
931
|
+
gap: 0;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
:deep(.ant-radio-button-wrapper) {
|
|
935
|
+
height: 32px;
|
|
936
|
+
line-height: 32px;
|
|
937
|
+
padding: 0 7px;
|
|
938
|
+
font-family: Source Han Sans;
|
|
939
|
+
font-size: 16px;
|
|
940
|
+
font-weight: normal;
|
|
941
|
+
letter-spacing: 0em;
|
|
942
|
+
|
|
943
|
+
font-feature-settings: "kern" on;
|
|
944
|
+
color: #313131;
|
|
945
|
+
background: #fff;
|
|
946
|
+
border: 1px solid #E5E9F0;
|
|
947
|
+
border-radius: 0;
|
|
948
|
+
|
|
949
|
+
&:first-child {
|
|
950
|
+
border-radius: 6px 0 0 6px;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
&:last-child {
|
|
954
|
+
border-radius: 0 6px 6px 0;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
&:not(:first-child)::before {
|
|
958
|
+
display: none;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
.ant-radio-button {
|
|
962
|
+
display: none;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
.ant-radio-button-input {
|
|
966
|
+
display: none;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
& > span:not(.ant-radio-button) {
|
|
970
|
+
font-family: Source Han Sans;
|
|
971
|
+
font-size: 16px;
|
|
972
|
+
font-weight: normal;
|
|
973
|
+
line-height: 32px;
|
|
974
|
+
letter-spacing: 0em;
|
|
975
|
+
color: #313131;
|
|
976
|
+
|
|
977
|
+
font-feature-settings: "kern" on;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
:deep(.ant-radio-button-wrapper-checked) {
|
|
982
|
+
background: #0057FE;
|
|
983
|
+
border-color: #0057FE;
|
|
984
|
+
|
|
985
|
+
& > span:not(.ant-radio-button) {
|
|
986
|
+
color: #fff;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// 单选框样式
|
|
991
|
+
:deep(.ant-radio-wrapper) {
|
|
992
|
+
height: 40px;
|
|
993
|
+
line-height: 40px;
|
|
994
|
+
font-family: Source Han Sans;
|
|
995
|
+
font-size: 16px;
|
|
996
|
+
font-weight: normal;
|
|
997
|
+
letter-spacing: 0em;
|
|
998
|
+
|
|
999
|
+
font-feature-settings: "kern" on;
|
|
1000
|
+
color: #313131;
|
|
1001
|
+
|
|
1002
|
+
.ant-radio {
|
|
1003
|
+
width: 16px;
|
|
1004
|
+
height: 16px;
|
|
1005
|
+
opacity: 1;
|
|
1006
|
+
|
|
1007
|
+
.ant-radio-inner {
|
|
1008
|
+
width: 16px;
|
|
1009
|
+
height: 16px;
|
|
1010
|
+
background: #FFFFFF;
|
|
1011
|
+
box-sizing: border-box;
|
|
1012
|
+
border: 1px solid #CDCFD4;
|
|
1013
|
+
border-radius: 50%;
|
|
1014
|
+
|
|
1015
|
+
&::after {
|
|
1016
|
+
width: 8px;
|
|
1017
|
+
height: 8px;
|
|
1018
|
+
background: #0057FE;
|
|
1019
|
+
border-radius: 50%;
|
|
1020
|
+
top: 50%;
|
|
1021
|
+
left: 50%;
|
|
1022
|
+
transform: translate(-50%, -50%);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.ant-radio-checked {
|
|
1028
|
+
.ant-radio-inner {
|
|
1029
|
+
border-color: #0057FE;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
span:not(.ant-radio) {
|
|
1034
|
+
font-family: Source Han Sans;
|
|
1035
|
+
font-size: 16px;
|
|
1036
|
+
font-weight: normal;
|
|
1037
|
+
line-height: 40px;
|
|
1038
|
+
letter-spacing: 0em;
|
|
1039
|
+
color: #313131;
|
|
1040
|
+
|
|
1041
|
+
font-feature-settings: "kern" on;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
809
1045
|
}
|
|
810
1046
|
</style>
|
|
@@ -201,7 +201,7 @@ import { formatDate, setDataByRealKey } from '@vue2-client/utils/util'
|
|
|
201
201
|
import * as util from '@vue2-client/utils/util'
|
|
202
202
|
import { mapState } from 'vuex'
|
|
203
203
|
import { addOrModify, getConfigByName, getConfigByNameAsync, runLogic } from '@vue2-client/services/api/common'
|
|
204
|
-
import {
|
|
204
|
+
import {checkIdNumber, REG_EMAIL, REG_LANDLINE, REG_PHONE, REG_PHONE_MASKED} from '@vue2-client/utils/reg'
|
|
205
205
|
import moment from 'moment/moment'
|
|
206
206
|
import { executeStrFunction, executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
|
|
207
207
|
import formValidationMixin from '@vue2-client/mixins/formValidationMixin'
|
|
@@ -855,6 +855,9 @@ export default {
|
|
|
855
855
|
this.rules[rulesArrayKey].push({
|
|
856
856
|
type: 'userPhone',
|
|
857
857
|
validator: (rule, value, callback) => {
|
|
858
|
+
if(value && REG_PHONE_MASKED.test(value)){
|
|
859
|
+
callback()
|
|
860
|
+
}
|
|
858
861
|
if (value && !REG_PHONE.test(value)) {
|
|
859
862
|
callback(new Error('请输入正确的手机号码'))
|
|
860
863
|
} else {
|
|
@@ -26,7 +26,7 @@ const TicketDetailsViewApi = {
|
|
|
26
26
|
// 获取用户填写附加信息
|
|
27
27
|
getAddonDescription: '/api/af-oa/logic/getAddonDescription',
|
|
28
28
|
// 发起售后工单流程
|
|
29
|
-
createTicket: '/api/af-oa/logic/
|
|
29
|
+
createTicket: '/api/af-oa/logic/createTicket',
|
|
30
30
|
// 查询:获取所有员工名,供前端展示备选项
|
|
31
31
|
getAllEmployeeName: '/api/af-oa/logic/getAllEmployeeName',
|
|
32
32
|
// 改变报装进度
|
package/src/utils/reg.js
CHANGED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/** 手机号 */
|
|
2
|
-
export const REG_PHONE =
|
|
3
|
-
/^[1](([3][0-9])|([4][01456789])|([5][012356789])|([6][2567])|([7][0-8])|([8][0-9])|([9][012356789]))[0-9]{8}$/
|
|
4
|
-
|
|
5
|
-
/** 邮箱 */
|
|
6
|
-
export const REG_EMAIL = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
|
|
7
|
-
|
|
8
|
-
/** url */
|
|
9
|
-
export const REG_URL =
|
|
10
|
-
/(((^https?:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)$/
|
|
11
|
-
|
|
12
|
-
/** 身份证号校验 */
|
|
13
|
-
export function checkIdNumber (value) {
|
|
14
|
-
const psidno = String(value)
|
|
15
|
-
// 1.校验身份证号格式和长度
|
|
16
|
-
const regPsidno = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[X])$)$/
|
|
17
|
-
if (!regPsidno.test(psidno)) {
|
|
18
|
-
return false
|
|
19
|
-
}
|
|
20
|
-
// 2.校验前两位的省份编码是否正确
|
|
21
|
-
const province = { 11: '北京', 12: '天津', 13: '河北', 14: '山西', 15: '内蒙古', 21: '辽宁', 22: '吉林', 23: '黑龙江 ', 31: '上海', 32: '江苏', 33: '浙江', 34: '安徽', 35: '福建', 36: '江西', 37: '山东', 41: '河南', 42: '湖北 ', 43: '湖南', 44: '广东', 45: '广西', 46: '海南', 50: '重庆', 51: '四川', 52: '贵州', 53: '云南', 54: '西藏 ', 61: '陕西', 62: '甘肃', 63: '青海', 64: '宁夏', 65: '新疆', 71: '台湾', 81: '香港', 82: '澳门', 91: '国外' }
|
|
22
|
-
if (!province[Number(psidno.slice(0, 2))]) {
|
|
23
|
-
return false
|
|
24
|
-
}
|
|
25
|
-
// 3.校验出生日期
|
|
26
|
-
if (psidno.length === 15) {
|
|
27
|
-
// 15位号码 省(2位)市(2位)县(2位)年(2位)月(2位)日(2位)校验码(3位)
|
|
28
|
-
const reg = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/
|
|
29
|
-
const arrSplit = psidno.match(reg)
|
|
30
|
-
// 15位号码在年份前补 19 或 20
|
|
31
|
-
const year = Number(arrSplit[2].charAt(0)) > 0 ? '19' + arrSplit[2] : '20' + arrSplit[2]
|
|
32
|
-
const month = arrSplit[3]
|
|
33
|
-
const day = arrSplit[4]
|
|
34
|
-
if (!validateBirthday(year, month, day)) {
|
|
35
|
-
return false
|
|
36
|
-
}
|
|
37
|
-
} else if (psidno.length === 18) {
|
|
38
|
-
// 18位号码 省(2位)市(2位)县(2位)年(4位)月(2位)日(2位)校验码(4位)
|
|
39
|
-
const reg = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/
|
|
40
|
-
const arrSplit = psidno.match(reg)
|
|
41
|
-
const year = arrSplit[2]
|
|
42
|
-
const month = arrSplit[3]
|
|
43
|
-
const day = arrSplit[4]
|
|
44
|
-
if (!validateBirthday(year, month, day)) {
|
|
45
|
-
return false
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
return false
|
|
49
|
-
}
|
|
50
|
-
// 校验出生日期是否合理
|
|
51
|
-
function validateBirthday (year, month, day) {
|
|
52
|
-
year = Number(year) // 年
|
|
53
|
-
month = Number(month) // 月
|
|
54
|
-
day = Number(day) // 日
|
|
55
|
-
const nowTime = new Date().getTime() // 当前时间戳
|
|
56
|
-
const birthTime = new Date(`${year}-${month}-${day}`).getTime() // 获取出生日期的时间戳
|
|
57
|
-
// 不能是明天出生的吧
|
|
58
|
-
if (birthTime > nowTime) {
|
|
59
|
-
return false
|
|
60
|
-
}
|
|
61
|
-
// 一般人活不到150岁吧
|
|
62
|
-
const nowYear = new Date().getFullYear()
|
|
63
|
-
if ((nowYear - year) > 150) {
|
|
64
|
-
return false
|
|
65
|
-
}
|
|
66
|
-
// 不能是13月出生的吧
|
|
67
|
-
if (month < 1 || month > 12) {
|
|
68
|
-
return false
|
|
69
|
-
}
|
|
70
|
-
// 不能是2月30号、4月31号、5月32号出生的吧
|
|
71
|
-
const date = new Date(year, month, 0) // 获取当月的最后一天
|
|
72
|
-
if (day < 1 || day > date.getDate()) {
|
|
73
|
-
return false
|
|
74
|
-
}
|
|
75
|
-
return true
|
|
76
|
-
}
|
|
77
|
-
// 4.18位号码校验生成的校验码
|
|
78
|
-
if (psidno.length === 18) {
|
|
79
|
-
const Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] // 加权因子
|
|
80
|
-
const parity = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'] // 校验码
|
|
81
|
-
let sum = 0
|
|
82
|
-
for (let i = 0; i < 17; i++) {
|
|
83
|
-
sum += Number(psidno.charAt(i)) * Wi[i]
|
|
84
|
-
}
|
|
85
|
-
if (parity[sum % 11] !== psidno[17]) {
|
|
86
|
-
return false
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return true
|
|
90
|
-
}
|
|
91
|
-
/** 座机号 */
|
|
92
|
-
export const REG_LANDLINE = /\d{3}-\d{8}|\d{4}-\d{7}/
|
|
93
|
-
|
|
94
|
-
/** 营业执照 */
|
|
95
|
-
export const REG_BUSINESS_LICENSE = /^[0-9a-zA-Z]{15}$/
|
package/src/utils/request.js
CHANGED