Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 86df61a4
authored
Aug 18, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
身份证验证
1 parent
71faa1ea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
html/merchant/edit.html
js/validator.js
html/merchant/edit.html
View file @
86df61a
...
@@ -472,7 +472,7 @@
...
@@ -472,7 +472,7 @@
if
((
merchantType
==
1
)
&&
!
validator
.
checkIdCard
(
value
))
{
if
((
merchantType
==
1
)
&&
!
validator
.
checkIdCard
(
value
))
{
return
'请填入正确的身份证'
return
'请填入正确的身份证'
}
}
if
(
value
&&
validator
.
ISCHINESE2
.
test
(
value
))
{
if
(
value
&&
validator
.
ISCHINESE2
.
test
(
value
))
{
return
'只能输入数字、字母和符号'
return
'只能输入数字、字母和符号'
}
}
}
}
...
...
js/validator.js
View file @
86df61a
...
@@ -85,7 +85,7 @@ layui.define(['store'], function (exports) {
...
@@ -85,7 +85,7 @@ layui.define(['store'], function (exports) {
var
pass
=
true
var
pass
=
true
// 身份证位数为15或18位
// 身份证位数为15或18位
// if (![15, 18].includes(code.length)) {
// if (![15, 18].includes(code.length)) {
if
(
(
code
.
length
!=
15
)
||
(
code
.
length
!=
18
))
{
if
(
!
((
code
.
length
==
15
)
||
(
code
.
length
==
18
)
))
{
pass
=
false
pass
=
false
}
else
if
(
!
code
||
(
code
.
length
===
18
&&
!
/^
\d{6}(
18|19|20
)\d{2}(
0
[
1-9
]
|1
[
012
])(
0
[
1-9
]
|
[
12
]\d
|3
[
01
])\d{3}(\d
|X
)
$/i
.
test
(
code
)))
{
}
else
if
(
!
code
||
(
code
.
length
===
18
&&
!
/^
\d{6}(
18|19|20
)\d{2}(
0
[
1-9
]
|1
[
012
])(
0
[
1-9
]
|
[
12
]\d
|3
[
01
])\d{3}(\d
|X
)
$/i
.
test
(
code
)))
{
// tip = '身份证号格式错误'
// tip = '身份证号格式错误'
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment