From 67ed2f4a0ebe1b265a563bad3f82627ed78c3054 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 20 十一月 2020 15:48:11 +0800
Subject: [PATCH] 2020-11-20 1.修改替换正则检测方法。2.修改请求失败tip方法。3.增加隐私政策功能。

---
 HDL_ON/Common/Utlis.cs |   73 +++++++++++++++++++++++-------------
 1 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/HDL_ON/Common/Utlis.cs b/HDL_ON/Common/Utlis.cs
index 3f8d765..4a8ae49 100644
--- a/HDL_ON/Common/Utlis.cs
+++ b/HDL_ON/Common/Utlis.cs
@@ -9,10 +9,10 @@
     /// </summary>
     public class Utlis
     {
-        /// <summary>
-        /// 鍏ㄥ眬鎵撳嵃
-        /// </summary>
-        public static void WriteLine(object mes)
+		/// <summary>
+		/// 鍏ㄥ眬鎵撳嵃
+		/// </summary>
+		public static void WriteLine(object mes)
         {
 #if DEBUG
             Console.WriteLine(mes);
@@ -31,25 +31,26 @@
         }
 
 		/// <summary>
-        /// 
-        /// </summary>
-        /// <param name="mes"></param>
-        /// <param name="bodyView"></param>
-		public static void ShowTip(String mes, View bodyView)
+		/// ShowTip
+		/// </summary>
+		/// <param name="mes"></param>
+		/// <param name="closeTime">鍏抽棴鏃堕棿</param>
+		public static void ShowTip(String mes, int closeTime = 2)
 		{
 			var tip = new Tip()
 			{
 				Text = mes,
-				CloseTime = 1,
+				CloseTime = closeTime,
 				Direction = AMPopTipDirection.None
 			};
-			tip.Show(bodyView);
+			tip.Show(MainPage.BaseView);
 		}
 
 
 		#region 鈻� 鍚勭姝e垯妫�娴媉______________________
 		/// <summary>
 		/// 鐢ㄤ簬涓浗澶ч檰楠岃瘉鎵嬫満鍙锋鍒欒〃杈惧紡
+		/// 浠�1寮�澶达紝11浣�
 		/// </summary>
 		public static string PhoneRegexStr = "^[1][0-9]{10}$";
 		/// <summary>
@@ -129,27 +130,47 @@
 			{
 				Regex reg = new Regex(PhoneForForeignRegexStr);
 				return reg.IsMatch(phoneNumber);
-			}
-
-			//鏍¢獙鍥藉唴鎵嬫満鍙�
-			if (phoneNumber.Length > 11)
-			{
-				return false;
-			}
-			else if (phoneNumber.Length == 11)
-			{
+            }
+            else
+            {
+				//鏍¢獙鍥藉唴鎵嬫満鍙�
 				Regex reg = new Regex(PhoneRegexStr);
-				return reg.IsMatch(phoneNumber);
-			}
-			else
-			{
-				//姝e垯琛ㄨ揪寮忓垽鏂槸鍚︽暟瀛�
-				Regex reg = new Regex("^[0-9]*$");
 				return reg.IsMatch(phoneNumber);
 			}
 		}
 
 		#endregion
+
+		/// <summary>
+		/// TextButton
+		/// 鏍规嵁鏂囨湰,璁$畻鎸夐挳瀹冨疄闄呯殑瀹藉害
+		/// </summary>
+		/// <param name="btn"></param>
+		/// <param name="extendWidth">琛ュ厖瀹藉害</param>
+		/// <returns></returns>
+		public static int GetRealWidthByTextButton(Button btn, int extendWidth = 1)
+		{
+			if (string.IsNullOrEmpty(btn.Text)) { return Application.GetRealWidth(extendWidth); }
+
+			return btn.GetTextWidth() + Application.GetRealWidth(extendWidth);
+		}
+
+		/// <summary>
+		/// 鏍规嵁鏂囨湰,璁$畻鎸夐挳瀹冨疄闄呯殑瀹藉害
+		/// </summary>
+		/// <returns></returns>
+		public static int GetRealWidthByText(Button btn)
+		{
+			if (string.IsNullOrEmpty(btn.Text)) { return Application.GetRealWidth(4); }
+#if __IOS__
+			//闇�瑕佸鍔犱竴涓宸��
+			return btn.GetTextWidth() + Application.GetRealWidth(8);
+#else
+            //闇�瑕佸鍔犱竴涓宸��
+            return btn.GetTextWidth() + Application.GetRealWidth(4);
+#endif
+		}
+
 	}
 
 }

--
Gitblit v1.8.0