瀏覽代碼

提交曲谱

1
mo 2 年之前
父節點
當前提交
8b26a3ea5f
共有 1 個文件被更改,包括 27 次插入23 次删除
  1. 27 23
      src/helpers/validate.ts

+ 27 - 23
src/helpers/validate.ts

@@ -1,37 +1,41 @@
 // 学生地址
 // 学生地址
 export function vaildStudentUrl() {
 export function vaildStudentUrl() {
-  const url = window.location.href;
-  let returnUrl = '';
-  if (/online/.test(url)) {
-    //线上
-    returnUrl = 'https://mstuonline.dayaedu.com';
-  } else if (/dev/.test(url)) {
+  const url = window.location.href
+  let returnUrl = ''
+  if (/dev/.test(url)) {
     // dev 环境
     // dev 环境
-    returnUrl = 'http://mstudev.dayaedu.com';
+    returnUrl = 'http://mstudev.dayaedu.com'
+    return returnUrl
+  } else if (/online/.test(url)) {
+    //线上
+    returnUrl = 'https://mstuonline.dayaedu.com'
+    return returnUrl
   } else if (/test/.test(url)) {
   } else if (/test/.test(url)) {
     // dev 环境
     // dev 环境
-    returnUrl = 'http://mstutest.dayaedu.com';
+    returnUrl = 'http://mstutest.dayaedu.com'
+    return returnUrl
   } else {
   } else {
     // 默认dev环境
     // 默认dev环境
-    returnUrl = 'http://mstudev.dayaedu.com';
+    returnUrl = 'http://mstudev.dayaedu.com'
+    return returnUrl
   }
   }
-  return returnUrl;
+  return returnUrl
 }
 }
 
 
 export function checkPhone(phone: string) {
 export function checkPhone(phone: string) {
-  const phoneRule = /^1[3456789]\d{9}$/;
-  return phoneRule.test(phone);
+  const phoneRule = /^1[3456789]\d{9}$/
+  return phoneRule.test(phone)
 }
 }
 
 
 // 身份证号验证
 // 身份证号验证
 export function checkIDCard(idCardNo?: string) {
 export function checkIDCard(idCardNo?: string) {
-  let result = true;
+  let result = true
   //
   //
-  const idCardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
+  const idCardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
   if (idCardReg.test(idCardNo || '') === false) {
   if (idCardReg.test(idCardNo || '') === false) {
-    result = false;
+    result = false
   }
   }
-  return result;
+  return result
 }
 }
 
 
 // 港澳居民来往内地通行证(回乡证)
 // 港澳居民来往内地通行证(回乡证)
@@ -39,13 +43,13 @@ export function checkPassport(idCardNo: string) {
   // 港澳居民来往内地通行证
   // 港澳居民来往内地通行证
   // 规则: H/M + 10位或6位数字
   // 规则: H/M + 10位或6位数字
   // 样本: H1234567890
   // 样本: H1234567890
-  let result = true;
+  let result = true
   // let idReg = /^[mMhH]\\d{10}|[mMhH]\\d{8}$/
   // let idReg = /^[mMhH]\\d{10}|[mMhH]\\d{8}$/
-  const idReg = /^([A-Z]\d{6,10}(\(\w{1}\))?)$/;
+  const idReg = /^([A-Z]\d{6,10}(\(\w{1}\))?)$/
   if (idReg.test(idCardNo) === false) {
   if (idReg.test(idCardNo) === false) {
-    result = false;
+    result = false
   }
   }
-  return result;
+  return result
 }
 }
 
 
 // 台湾居民来往大陆通行证(台胞证)
 // 台湾居民来往大陆通行证(台胞证)
@@ -54,9 +58,9 @@ export function checkPassportTaiwan(idCardNo: string) {
   // 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母
   // 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母
   // 样本: 12345678 或 1234567890B
   // 样本: 12345678 或 1234567890B
   let result = true
   let result = true
-  const idReg = /(^\\d{8}$)|(^[a-zA-Z0-9]{10}$)|(^\\d{18}$)/;
+  const idReg = /(^\\d{8}$)|(^[a-zA-Z0-9]{10}$)|(^\\d{18}$)/
   if (idReg.test(idCardNo) === false) {
   if (idReg.test(idCardNo) === false) {
-    result = false;
+    result = false
   }
   }
-  return result;
+  return result
 }
 }