Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2024-04-08 18:00:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
20c082b11284262f400a071ff9261b14fd43da9c
20c082b1
1 parent
87ed8b99
fix 身份证控件校验逻辑优化
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
src/components/IdentityField/index.vue
src/components/IdentityField/index.vue
View file @
20c082b
<!--
* @Date: 2022-09-14 14:44:30
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 202
3-04-07 06:09:28
* @LastEditTime: 202
4-04-08 17:59:03
* @FilePath: /data-table/src/components/IdentityField/index.vue
* @Description: 身份证输入控件
-->
...
...
@@ -57,7 +57,7 @@
import $ from "jquery";
import { storeToRefs, mainStore } from "@/utils/generatePackage";
import { showSuccessToast, showFailToast } from "vant";
import idCard from "idcard";
const props = defineProps({
item: Object,
...
...
@@ -137,7 +137,7 @@ const blurKeyboard = () => {
const input_val = props.item.value;
if (required && !input_val) {
showFailToast("身份证号码不能为空");
} else if (input_val && !
/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test
(input_val)) {
} else if (input_val && !
idCard.verify
(input_val)) {
showFailToast("请输入正确身份证号码");
} else {
// gender.value = getGenderByIdNumber(input_val)
...
...
@@ -150,7 +150,7 @@ const required = props.item.component_props.required;
const validator = (val) => {
if (required && !val) {
return false;
} else if (val && !
/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test
(val)) {
} else if (val && !
idCard.verify
(val)) {
return false;
} else {
return true;
...
...
@@ -160,7 +160,7 @@ const validator = (val) => {
const validatorMessage = (val, rule) => {
if (required && !val) {
return "身份证号码不能为空";
} else if (val && !
/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test
(val)) {
} else if (val && !
idCard.verify
(val)) {
return "请输入正确身份证号码";
}
};
...
...
Please
register
or
login
to post a comment