Przeglądaj źródła

放宽手机格式检测

lvjincheng 3 lat temu
rodzic
commit
4ffeceffb3

+ 1 - 2
Assets/BowArrow/Scripts/Manager/LoginMgr/LoginView.cs

@@ -252,8 +252,7 @@ public class LoginView : MonoBehaviour
 
     void LoginByPhone() {
         InputField user = GetInputField(loginInPhone);
-        Regex regex = new Regex(@"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$");
-        bool isMobilePhone = regex.IsMatch(user.text);
+        bool isMobilePhone = ValidateHelper.IsMobilePhone(user.text);
         if (!isMobilePhone) {
             PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("手机号格式不正确"));
             return;

BIN
Assets/Plugins/Android/smartbowlib-debug.aar


+ 2 - 1
Assets/ThirdAssets/JCUnityLib/ValidateHelper.cs

@@ -12,6 +12,7 @@ public class ValidateHelper
 
     public static bool IsMobilePhone(string phone)
     {
-        return Regex.IsMatch(phone, @"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$");
+        // return Regex.IsMatch(phone, @"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$");
+        return phone.Length == 11;
     }
 }