Commit c8ab96b5 authored by Sixiang_Zzb's avatar Sixiang_Zzb

手机号码验证处理

parent e815bd8d
...@@ -155,7 +155,7 @@ const UsersDetail = (props: any) => { ...@@ -155,7 +155,7 @@ const UsersDetail = (props: any) => {
}; };
const deleteUnit = (values: any) => { const deleteUnit = (values: any) => {
const permissionArr = JSON.parse(localStorage.getItem('permission')); const permissionArr = JSON.parse(localStorage.getItem('permission') || '[]');
if (permissionArr.indexOf('5') < 0) { if (permissionArr.indexOf('5') < 0) {
message.error('No Permissions!!!', 3); message.error('No Permissions!!!', 3);
return; return;
...@@ -205,10 +205,10 @@ const UsersDetail = (props: any) => { ...@@ -205,10 +205,10 @@ const UsersDetail = (props: any) => {
const checkData = (rule: any, value: any, callback: any) => { const checkData = (rule: any, value: any, callback: any) => {
if (value) { if (value) {
if (/^\d{8}|1[3|5|7|8]\d{9}$/g.test(value)) { if (/^\d{8}$|^1[3|5|7|8]\d{9}$/.test(value)) {
callback(); callback();
} else { } else {
callback(new Error('Incorrect format of mobile phone number!')); callback(new Error('The format is incorrect!'));
} }
} }
callback('*it is required!'); callback('*it is required!');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment