浏览代码

feat : 特殊手机号校验

zhangxinlei1996 3 年之前
父节点
当前提交
d71db4a4fb

+ 8 - 0
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -750,6 +750,14 @@ var Verification = {
     return /^[1][3-9][0-9]{9}$/.test(value);
   }
 }
+
+//深信服用户开了一批特殊规则的手机号
+var CreatePhone = {
+  //自己创建的手机号验证[格式为100xxxxxxxx]
+  isPhone: function (value) {
+    return /^[1][0][0][0-9]{8}$/.test(value);
+  }
+}
 // 部分页面没有全局工具函数
 if (typeof utils !== 'object') {
   utils = {}

+ 2 - 2
src/jfw/modules/app/src/web/templates/me/login.html

@@ -201,7 +201,7 @@
 					return
 				}
 				var phone = $.trim($("#tel").val());
-				if(!Verification.isPhone(phone)){
+				if((!Verification.isPhone(phone))||(!CreatePhone.isPhone(phone))){
 					EasyAlert.show("手机号格式错误");
 					return
 				}
@@ -374,7 +374,7 @@
 				dcsOne = false;
 	     		$("#sendIdentCode").css("color","#888888")
 			}
-			if($.trim(phone).length > 0 && Verification.isPhone(phone)){
+			if($.trim(phone).length > 0 && (Verification.isPhone(phone) || CreatePhone.isPhone(phone))){
 				if($(".header-tab>a.header-tab-active").index() == 0){
 					if($.trim(password).length > 0 && password.length >= 6){
 						$("#btn").removeClass("disabled");

+ 3 - 1
src/web/staticres/js/login.js

@@ -1167,7 +1167,9 @@ $(function(){
 
     // 表单规则
     function ruleForPhone (data, type) {
-        var checkStatus = /^[1][3-9][0-9]{9}$/.test(data.value)
+    		var phoneReg = /^[1][3-9][0-9]{9}$/.test(data.value);
+		var createPhoneReg =/^[1][0][0][0-9]{8}$/.test(data.value);
+        var checkStatus =  phoneReg || createPhoneReg;
         if (type === 'input') {
             return data.value.length >= 11 ? checkStatus : true
         }