Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
voucher-h5
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘琦
voucher-h5
Commits
f40c1a6e
Commit
f40c1a6e
authored
Aug 17, 2020
by
何为
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改签约身份证校验规则
parent
d67f725c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
18 deletions
+29
-18
validate.js
src/util/validate.js
+7
-1
index.vue
src/views/signingWD/index.vue
+22
-17
No files found.
src/util/validate.js
View file @
f40c1a6e
...
...
@@ -127,11 +127,14 @@ export function cardid (code) {
}
if
(
!
validatenull
(
code
))
{
console
.
log
(
'======='
)
console
.
log
(
code
)
if
(
code
.
length
===
18
)
{
if
(
!
code
||
!
/
(
^
\d{18}
$
)
|
(
^
\d{17}(\d
|X|x
)
$
)
/
.
test
(
code
))
{
msg
=
'证件号码格式错误'
result
=
false
}
else
if
(
!
city
[
code
.
substr
(
0
,
2
)])
{
msg
=
'地址编码错误'
result
=
false
}
else
{
// 18位身份证需要验证最后一位校验位
code
=
code
.
split
(
''
)
...
...
@@ -151,15 +154,18 @@ export function cardid (code) {
console
.
log
(
sum
%
11
)
if
(
parity
[
sum
%
11
].
toString
()
!==
code
[
17
])
{
msg
=
'证件号码校验位错误'
}
else
{
result
=
false
}
else
{
result
=
true
}
}
}
else
{
msg
=
'证件号码长度不为18位'
result
=
false
}
}
else
{
msg
=
'证件号码不能为空'
result
=
false
}
list
.
push
(
result
)
list
.
push
(
msg
)
...
...
src/views/signingWD/index.vue
View file @
f40c1a6e
...
...
@@ -849,15 +849,17 @@ export default {
return
false
}
const
_baseIdCardFlag
=
this
.
BaseValidateIdCard
()
if
(
_baseIdCardFlag
==
'不通过'
)
{
this
.
error
.
idCard
=
'请输入有效的女性身份证号'
this
.
BaseValidate
.
idCardState
=
false
this
.
$toast
({
message
:
'请输入有效的女性身份证号!'
,
position
:
'center'
,
duration
:
3000
})
return
false
if
(
_baseIdCardFlag
)
{
if
(
_baseIdCardFlag
.
error
==
'不通过'
)
{
this
.
error
.
idCard
=
_baseIdCardFlag
.
errorText
this
.
BaseValidate
.
idCardState
=
false
this
.
$toast
({
message
:
_baseIdCardFlag
.
errorText
,
position
:
'center'
,
duration
:
3000
})
return
false
}
}
// 姓名字段校验
const
_nameFlag
=
this
.
BaseForm
.
name
...
...
@@ -961,24 +963,27 @@ export default {
this
.
saveSignInfoToCookie
()
// 储存用户签约录入信息
},
BaseValidateIdCard
()
{
// 身份证验证
console
.
log
(
cardid
(
this
.
BaseForm
.
idCard
)[
0
])
if
(
!
cardid
(
this
.
BaseForm
.
idCard
)[
0
])
{
this
.
error
.
idCard
=
'请输入有效的女性身份证号'
this
.
error
.
idCard
=
cardid
(
this
.
BaseForm
.
idCard
)[
1
]
this
.
BaseValidate
.
idCardState
=
false
console
.
log
(
'不通过'
)
let
error
=
'不通过'
return
error
let
errorMsg
=
{}
errorMsg
.
error
=
'不通过'
errorMsg
.
errorText
=
this
.
error
.
idCard
return
errorMsg
}
else
{
console
.
log
(
getSexByIdCard
(
this
.
BaseForm
.
idCard
))
if
(
getSexByIdCard
(
this
.
BaseForm
.
idCard
)
===
'2'
)
{
this
.
BaseValidate
.
idCardState
=
true
}
else
{
this
.
BaseValidate
.
idCardState
=
false
this
.
error
.
idCard
=
'请输入有效的女性身份证号'
let
errorMsg
=
{}
errorMsg
.
error
=
'不通过'
errorMsg
.
errorText
=
'请输入有效的女性身份证号'
return
errorMsg
}
this
.
error
.
idCard
=
''
console
.
log
(
'通过'
)
let
success
=
'通过'
this
.
getManualPriKey
()
return
success
}
if
(
this
.
pageType
===
0
)
{
this
.
BaseFormIntoTab1
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment