1. Check the mobile phone number

Return false if the mobile phone number is entered incorrectly. True if the mobile phone number is entered correctly.

validatePhone:(val)=>{
    return /^1[3456789]\d{9}$/.test(val);
  },
Copy the code

2. Verification of ID number

False if the id number is entered incorrectly. True if the ID number is entered correctly.

  validateCardNo:(val)=>{
    return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(val);
  },
Copy the code

3. Verify the id number in detail

Function cardFun (code) {var city = {11: "Beijing", 12: "tianjin", 13: "hebei", 14: "shanxi", 15: "Inner Mongolia", 21: "liaoning province", the 22: "jilin", 23: "31: heilongjiang province", "Shanghai", 32: "jiangsu", 33: "zhejiang", 34: "anhui", 35: "fujian", 36: "jiangxi", 37: "shandong", 41: "henan", 42: "hubei", 43: "hunan", 44: 45: "guangdong", "guangxi", 46: "hainan", 50: "chongqing", 51: "sichuan", 52: "guizhou", 53: "yunnan", 54: "Tibet", 61: "shaanxi", 62, "gansu province," 63: "qinghai", 64: "65: ningxia", "xinjiang", 71: "Taiwan", 81: "Hong Kong", 82, "macau", 91: "foreign"}; Var row = {pass: true, MSG: "verify ",}; if ( ! code || ! /^\d{6}(18|19|20)? \ d {2} [1-9] | (0. 1 [012]) (0 | [1-9] [12] \ | 3 d [01]) \ d {3} (\ d | [xX]) $/. The test (code)) {row = {pass: false, MSG: "id number format error,"}; } else if (! City [code.substr(0, 2)]) {row = {pass: false, MSG: "",}; If (code.length == 18) {code = code.split(""); if (code.length == 18) {code = code.split(""); / / ∑ (ai (Wi) (mod) / / var factor weighted factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); / / check digit var parity = (1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2); var sum = 0; var ai = 0; var wi = 0; for (var i = 0; i < 17; i++) { ai = code[i]; wi = factor[i]; sum += ai * wi; } if (parity[sum % 11] ! = code[17].toupPerCase () {row = {pass: false, MSG: "",}; } } } return row }Copy the code

4. Verify the Universal Social Credit code

Returns true if the verification format is correct, false if it is strictly incorrect

validateCommercialRegNo:(val)=>{

return /(^[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$)|(^[A-Za-z0-9]\w{14}$)/.test(val);

  }
Copy the code

5. Verification of authentication homepage url in the legal service network of the jurisdiction

Returns true if the verification format is correct, false if it is strictly incorrect

ValidateWebsite: (val) = > {return [s] {0, 1} / HTTP: \ \ / (/ \ w + \ /? \S*/.test(val); },Copy the code

6. Verify mobile phone numbers or numbers

Returns true if the verification format is correct, false if it is strictly incorrect

ValidateTelOrPhone: (val) = > {return/(a ^ 1 [3 4 5 | | | 8] [0-9] \ d {4, 8} $) | (^ 400 [0-9] {7}) | (^ (0 [0-9] {2, 3} \ -)? ([2-9] [0-9] {6, 7}) + (\ [0-9] {1, 4})? $)/.test(val); },Copy the code