From 8c1bf42c5fca66625b59728006bd47bae0b6a3ad Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 23 十一月 2020 10:18:16 +0800 Subject: [PATCH] Revert "Merge branch 'CJL' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into CJL" --- HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/ResidentialManagePageBLL.cs | 2 HDL_ON/UI/UI0-Public/ConfirmDialog.cs | 153 ++ HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs | 6 HDL_ON/UI/UI0-Public/TopViewDivBLL.cs | 15 HDL_ON/DriverLayer/Control_Udp_Bus.cs | 4 HDL_ON/UI/UI1-Login/ForgetPasswordPage.cs | 1 HDL_ON/UI/UI0-Public/AppUnlockPage.cs | 2 HDL-ON_iOS/AppDelegate.cs | 8 HDL_ON/UI/UI0-Public/Widget/TextButton.cs | 24 HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs | 50 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/BindAccountPage.cs | 388 +++--- HDL-ON_iOS/Info.plist | 26 HDL_ON/UI/UI0-Public/WebViewDialog.cs | 42 HDL_ON/Common/Utlis.cs | 169 ++ HDL_ON/DAL/Server/HttpServerRequestBase.cs | 2 HDL_ON/UI/UI1-Login/RegisterPageBLL.cs | 28 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindVerificationCodePage.cs | 0 HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs | 32 HDL_ON/DAL/Net/Mqtt_Cloud.cs | 16 HDL_ON/UI/UI1-Login/LoginPage.cs | 157 ++ HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs | 151 + HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/ChooseShareMemberTargetListPageBLL.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs | 167 + HDL_ON/DriverLayer/UdpSocket.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 18 HDL_ON/UI/UI1-Login/LoginPageBLL.cs | 90 + HDL_ON/Entity/DB_ResidenceData.cs | 6 HDL_ON/UI/UI0-Public/LineView.cs | 20 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs | 4 HDL_ON/UI/UI0-Public/TopViewDiv.cs | 19 HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordOptionPage.cs | 54 HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs | 313 ++++ HDL_ON/UI/UI1-Login/RegisterPage.cs | 36 HDL_ON/Common/MqttCommon.cs | 28 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs | 225 +++ HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs | 2 HDL_ON/DAL/Server/HttpUtil.cs | 51 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs | 711 ++++++++++++ HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordVerificationCodePage.cs | 304 +++- HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs | 6 HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/AccountBindInfoPage.cs | 32 41 files changed, 2,736 insertions(+), 630 deletions(-) diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index ac81ce3..4dfffc8 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -23,7 +23,7 @@ // UserConfig.Instance.IsAppStoreVersionNewer = Harpy.Harpy.SharedInstance.TestIsAppStoreVersionNewer; // UserConfig.Instance.StoreVersion = Harpy.Harpy.SharedInstance.CurrentAppStoreVersion; // UserConfig.Instance.SaveUserConfig(); - // if (Shared.SimpleControl.MainPage.LoginUser.AccountString == @"464027401@qq.com") + // if (Shared.SimpleControl. UserInfo.Current.AccountString == @"464027401@qq.com") // { // return $"TestIsAppStoreVersionNewer : {UserConfig.Instance.IsAppStoreVersionNewer};; CurrentAppStoreVersion : {UserConfig.Instance.StoreVersion}"; // } @@ -196,9 +196,11 @@ string nsCount = NSLocale.CurrentLocale.CountryCode; - if (MainPage.LoginUser != null && nsCount != MainPage.LoginUser.areaCode.ToString()) + if ( UserInfo.Current != null && nsCount != UserInfo.Current.areaCode.ToString()) { - int.TryParse(nsCount,out MainPage.LoginUser.areaCode); + //int.TryParse(nsCount,out UserInfo.Current.areaCode); + //2020-11-18 + UserInfo.Current.areaCode = nsCount; OnAppConfig.Instance.SaveUserConfig(); } application.IdleTimerDisabled = true; diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index 8967a81..c76ed24 100755 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -6,6 +6,26 @@ <array> <dict> <key>CFBundleURLName</key> + <string>weixin</string> + </dict> + <dict> + <key>CFBundleURLName</key> + <string>AispeechMobile</string> + </dict> + <dict> + <key>CFBundleURLName</key> + <string>xiaoduapp</string> + </dict> + <dict> + <key>CFBundleURLSchemes</key> + <array> + <string>hdlonpro</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleURLName</key> <string>qqmusic</string> </dict> </array> @@ -87,7 +107,13 @@ <string>鑾峰彇澶╂皵棰勬姤</string> <key>LSApplicationQueriesSchemes</key> <array> + <string>weixinULAPI</string> + <string>weixin</string> + <string>xiaoduapp</string> + <string>AispeechMobile</string> <string>qqmusic</string> </array> + <key>CFBundleDevelopmentRegion</key> + <string>zh_CN</string> </dict> </plist> diff --git a/HDL_ON/Common/MqttCommon.cs b/HDL_ON/Common/MqttCommon.cs index 3a94096..68ed1cd 100644 --- a/HDL_ON/Common/MqttCommon.cs +++ b/HDL_ON/Common/MqttCommon.cs @@ -158,7 +158,7 @@ // try // { // System.Threading.Thread.Sleep(200); -// //if (!MainPage.LoginUser.IsLogin) { +// //if (! UserInfo.Current.IsLogin) { // // continue; // //} // if (!CommonPage.IsRemote) continue; @@ -207,7 +207,7 @@ // var topicFilterPush2 = new TopicFilter // { -// Topic = $"/BusGateWayToClient/{MainPage.LoginUser.ID}" + PushNotifySqueeze, +// Topic = $"/BusGateWayToClient/{ UserInfo.Current.ID}" + PushNotifySqueeze, // QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce, // //QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.ExactlyOnce // }; @@ -255,7 +255,7 @@ // return; // } -// if (!MainPage.LoginUser.IsLogin) +// if (! UserInfo.Current.IsLogin) // { // return; // } @@ -315,7 +315,7 @@ // // ReceiveNotifySqueezeAsync (mMes); // //} else -// if (topic == $"/BusGateWayToClient/{MainPage.LoginUser.ID}" + PushNotifySqueeze) +// if (topic == $"/BusGateWayToClient/{ UserInfo.Current.ID}" + PushNotifySqueeze) // { // var mMes = System.Text.Encoding.UTF8.GetString(e.ApplicationMessage.Payload); // //鏂版尋涓嬬嚎涓婚鏂规 鏀跺埌鎸や笅绾夸富棰� @@ -679,7 +679,7 @@ // var username = MqttInfoConfig.Instance.mMqttInfo.connEmqUserName; // var passwordRemote = MqttInfoConfig.Instance.mMqttInfo.connEmqPwd; // MqttInfoConfig.Instance.CurRemoteMACInfo.clientId = clientId; -// //MqttInfoConfig.Instance.CurRemoteMACInfo.LoginAccessToken = MainPage.LoginUser.LoginTokenString; +// //MqttInfoConfig.Instance.CurRemoteMACInfo.LoginAccessToken = UserInfo.Current.LoginTokenString; // //鑾峰彇鍙傛暟鎴愬姛锛屼繚瀛樺埌鏈湴骞舵爣璁颁负true // MqttInfoConfig.Instance.IfGetMqttInfoSuccess = true; @@ -818,19 +818,19 @@ // //鏂紑杩滅▼杩炴帴 // CommonPage.IsRemote = false; -// if (!MainPage.LoginUser.IsLogin) +// if (! UserInfo.Current.IsLogin) // { // return; // } // DisConnectRemoteMqttClient("鎸や笅绾�"); -// MainPage.LoginUser.LastTime = DateTime.MinValue; -// MainPage.LoginUser.SaveUserInfo(); +// UserInfo.Current.LastTime = DateTime.MinValue; +// UserInfo.Current.SaveUserInfo(); // Room.Lists.Clear(); // ////鍒犻櫎鎺ㄩ�佹暟鎹� // //var webclient = new System.Net.WebClient (); -// //webclient.Headers.Add (System.Net.HttpRequestHeader.Authorization, MainPage.LoginUser.LoginTokenString); +// //webclient.Headers.Add (System.Net.HttpRequestHeader.Authorization, UserInfo.Current.LoginTokenString); // //webclient.DownloadStringAsync (new Uri ("https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/SignOut")); @@ -838,7 +838,7 @@ // Application.RunOnMainThread(() => // { // Utlis.ShowAppLinkStatus(AppLinkStatus.WiFi); -// new Shared.SimpleControl.Phone.AccountLogin(MainPage.LoginUser.AccountString, "").Show(); +// new Shared.SimpleControl.Phone.AccountLogin( UserInfo.Current.AccountString, "").Show(); // SharedMethod.SharedMethod.CurPageLayout = null; // //CommonPage.IsRemote = false; @@ -852,7 +852,7 @@ // //2020-06-30 鍒犻櫎鎺ㄩ�佹暟鎹� // ForceUpdateUtlis.Current.SignOut(); //#if HDL -// if (!String.IsNullOrEmpty (MainPage.LoginUser.AllVisionRegisterDevUserNameGuid)) { +// if (!String.IsNullOrEmpty ( UserInfo.Current.AllVisionRegisterDevUserNameGuid)) { // com.freeview.global.Video.Logout (); // }///BusGateWayToClient/320c1fea-1866-4708-8277-e2321a4dd236/NotifyGateWayInfoChange //#endif @@ -945,7 +945,7 @@ // await RemoteMqttClient.PublishAsync(new MqttApplicationMessage { Topic = topicName, Retain = false, QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }); // break; // case 4://鍙戝竷鏂版柟妗堢殑鎸や笅绾夸富棰� -// topicName = $"/BusGateWayToClient/{MainPage.LoginUser.ID}" + PushNotifySqueeze; +// topicName = $"/BusGateWayToClient/{ UserInfo.Current.ID}" + PushNotifySqueeze; // //message = System.Text.Encoding.UTF8.GetBytes (PushSignStr); // await RemoteMqttClient.PublishAsync(new MqttApplicationMessage { Topic = topicName, Payload = message, Retain = false, QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }); // break; @@ -1003,7 +1003,7 @@ // { // var mqttInfoRequestPar = new GetConnMqttInfoObj() // { -// LoginAccessToken = MainPage.LoginUser.LoginTokenString, +// LoginAccessToken = UserInfo.Current.LoginTokenString, // PlatformStr = GetRandomKey(), // PublishPayloadJsonStr = PushSignStr, // Mac = UserConfig.Instance.GatewayMAC, @@ -1029,7 +1029,7 @@ // MqttInfoConfig.Instance.CurRemoteMACInfo = mqttInfoRequestResult_Obj.AccountAllGateways.Find((obj) => obj.mac == UserConfig.Instance.GatewayMAC); // if (MqttInfoConfig.Instance.CurRemoteMACInfo != null) // { -// //MqttInfoConfig.Instance.CurRemoteMACInfo.LoginAccessToken = MainPage.LoginUser.LoginTokenString; +// //MqttInfoConfig.Instance.CurRemoteMACInfo.LoginAccessToken = UserInfo.Current.LoginTokenString; // MqttInfoConfig.Instance.CurRemoteMACInfo.clientId = clientId; // //----绗笁姝� 寮�濮嬭繛鎺� // await MQTTConnectAsync(); diff --git a/HDL_ON/Common/Utlis.cs b/HDL_ON/Common/Utlis.cs index 329f7f5..4a8ae49 100644 --- a/HDL_ON/Common/Utlis.cs +++ b/HDL_ON/Common/Utlis.cs @@ -1,19 +1,176 @@ 锘縰sing System; -namespace HDL_ON.Common +using Shared; +using System.Text.RegularExpressions; + +namespace HDL_ON { /// <summary> /// 甯哥敤宸ュ叿绫� /// </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); #endif } - } + + /// <summary> + /// 寮圭獥鎻愮ず + /// </summary> + /// <param name="mes"></param> + public static void ShowAlertOnMainThread(string mes) + { + Application.RunOnMainThread(() => { + new Alert("", mes, Language.StringByID(StringId.Close)).Show(); + }); + } + + /// <summary> + /// 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 = closeTime, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + } + + + #region 鈻� 鍚勭姝e垯妫�娴媉______________________ + /// <summary> + /// 鐢ㄤ簬涓浗澶ч檰楠岃瘉鎵嬫満鍙锋鍒欒〃杈惧紡 + /// 浠�1寮�澶达紝11浣� + /// </summary> + public static string PhoneRegexStr = "^[1][0-9]{10}$"; + /// <summary> + /// 鐢ㄤ簬楠岃瘉闈炰腑鍥藉ぇ闄嗘墜鏈哄彿姝e垯琛ㄨ揪寮� + /// </summary> + public static string PhoneForForeignRegexStr = "^[0-9]*$"; + /// <summary> + /// 鐢ㄤ簬楠岃瘉閭姝e垯琛ㄨ揪寮� + /// </summary> + public static string EmailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"; + + /// <summary> + /// 鍒ゆ柇鏄惁鍖呭惈澶у啓瀛楁瘝 + /// </summary> + /// <returns><c>true</c>, if contain upper was checked, <c>false</c> otherwise.</returns> + /// <param name="value">Value.</param> + public static bool CheckContainUpper(string value) + { + Regex reg = new Regex("[A-Z]+"); + return reg.IsMatch(value); + } + + /// <summary> + /// 鍒ゆ柇鏄惁鍖呭惈灏忓啓瀛楁瘝 + /// </summary> + /// <returns><c>true</c>, if contain lower was checked, <c>false</c> otherwise.</returns> + /// <param name="value">Value.</param> + public static bool CheckContainLower(string value) + { + Regex reg = new Regex("[a-z]+"); + return reg.IsMatch(value); + } + + /// <summary> + /// 鍒ゆ柇鏄惁鍖呭惈鏁板瓧 + /// </summary> + /// <returns><c>true</c>, if contain lower was checked, <c>false</c> otherwise.</returns> + /// <param name="value">Value.</param> + public static bool CheckContainNum(string value) + { + Regex reg = new Regex("[0-9]+"); + return reg.IsMatch(value); + } + + /// <summary> + /// 鍒ゆ柇鏄惁鍖呭惈绗﹀彿 + /// </summary> + /// <returns><c>true</c>, if contain lower was checked, <c>false</c> otherwise.</returns> + /// <param name="value">Value.</param> + public static bool CheckContainSymbol(string value) + { + Regex reg = new Regex("([^a-z0-9A-Z])+"); + return reg.IsMatch(value); + } + + /// <summary> + /// 妫�娴嬮偖绠辨槸鍚﹀悎娉� + /// </summary> + /// <param name="email"></param> + /// <returns></returns> + public static bool CheckEmail(string email) + { + Regex reg = new Regex(EmailRegexStr); + return reg.IsMatch(email); + } + + /// <summary> + /// 妫�娴嬫墜鏈哄彿鏄惁鍚堟硶 + /// </summary> + /// <param name="phoneNumber">鎵嬫満鍙�</param> + /// <param name="areaCode">鍦板尯浠g爜</param> + /// <returns></returns> + public static bool CheckPhoneNumber(string phoneNumber, string areaCode) + { + //鏍¢獙澶栧浗鎵嬫満鍙� + if (areaCode != "86") + { + Regex reg = new Regex(PhoneForForeignRegexStr); + return reg.IsMatch(phoneNumber); + } + else + { + //鏍¢獙鍥藉唴鎵嬫満鍙� + Regex reg = new Regex(PhoneRegexStr); + 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 + } + + } + } diff --git a/HDL_ON/DAL/Net/Mqtt_Cloud.cs b/HDL_ON/DAL/Net/Mqtt_Cloud.cs index ea35f24..9e7f3a7 100644 --- a/HDL_ON/DAL/Net/Mqtt_Cloud.cs +++ b/HDL_ON/DAL/Net/Mqtt_Cloud.cs @@ -116,7 +116,7 @@ { //杩藉姞锛氭病鏈夎繙绋嬭繛鎺ョ殑鏉冮檺 if (remoteMqttIsConnecting - || remoteIsConnected || !MainPage.LoginUser.IsLogin) + || remoteIsConnected || ! UserInfo.Current.IsLogin) { return; } @@ -221,7 +221,7 @@ var mqttInfoRequestPar = new RemoteRequestParameters() { PlatformStr = "ON", - LoginAccessToken = MainPage.LoginUser.loginTokenString, + LoginAccessToken = UserInfo.Current.loginTokenString, RequestVersion = MainPage.VersionString, RequestProtocolType = 0, RequestSource = 1, @@ -257,7 +257,7 @@ } if (CurRemoteMACInfo != null) { - CurRemoteMACInfo.LoginAccessToken = MainPage.LoginUser.loginTokenString; + CurRemoteMACInfo.LoginAccessToken = UserInfo.Current.loginTokenString; CurRemoteMACInfo.clientId = clientId; mqttEncryptKey = CurRemoteMACInfo.isNewBusproGateway ? CurRemoteMACInfo.aesKey : ""; @@ -304,7 +304,7 @@ //static void ReceiveNotifyBusGateWayInfoChange() //{ // var gatewayListUrl = @"https://developer.hdlcontrol.com/Center/Center/GetGatewayPagger"; //App銆丅uspro杞欢鐧诲綍鍚庤幏鍙栫綉鍏冲垪琛� http 璇锋眰 - // var gatewayListRequestPar = new RemoteRequestParameters() { Mac = CurRemoteMACInfo.mac, LoginAccessToken = MainPage.LoginUser.loginTokenString, RequestVersion = "RequestVersion1", RequestProtocolType = 0, RequestSource = 1 }; + // var gatewayListRequestPar = new RemoteRequestParameters() { Mac = CurRemoteMACInfo.mac, LoginAccessToken = UserInfo.Current.loginTokenString, RequestVersion = "RequestVersion1", RequestProtocolType = 0, RequestSource = 1 }; // var gatewayListRequestResult = MainPage.RequestHttps("", Newtonsoft.Json.JsonConvert.SerializeObject(gatewayListRequestPar), false, false, gatewayListUrl); // var gatewayListRequestResult_Obj = Newtonsoft.Json.JsonConvert.DeserializeObject<MqttRemoteInfo>(gatewayListRequestResult.ResponseData.ToString()); // if (gatewayListRequestResult_Obj != null && gatewayListRequestResult_Obj.pageData.Count > 0) @@ -322,12 +322,12 @@ if (mMes == PushSignStr) return;//鏄嚜宸辩殑鐧诲綍鎺ㄩ�佷笉澶勭悊 //鏂紑杩滅▼杩炴帴 MainPage.IsRemote = false; - if (!MainPage.LoginUser.IsLogin) + if (! UserInfo.Current.IsLogin) { return; } - MainPage.LoginUser.lastTime = DateTime.MinValue; - MainPage.LoginUser.SaveUserInfo(); + UserInfo.Current.lastTime = DateTime.MinValue; + UserInfo.Current.SaveUserInfo(); string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); new System.Threading.Thread(() => @@ -375,7 +375,7 @@ DisConnectRemoteMqttClient("鎸や笅绾�"); Application.RunOnMainThread(() => { - MainPage.GoLoginPage(MainPage.LoginUser); + MainPage.GoLoginPage( UserInfo.Current); }); } diff --git a/HDL_ON/DAL/Server/HttpServerRequestBase.cs b/HDL_ON/DAL/Server/HttpServerRequestBase.cs index b1956ba..b84b637 100644 --- a/HDL_ON/DAL/Server/HttpServerRequestBase.cs +++ b/HDL_ON/DAL/Server/HttpServerRequestBase.cs @@ -20,7 +20,7 @@ webClient.Headers.Add("CONTENT-TYPE", "application/json"); if (needAuthorization) { - webClient.Headers.Add("Authorization", MainPage.LoginUser.loginTokenString); + webClient.Headers.Add("Authorization", UserInfo.Current.loginTokenString); } byte[] bytes = null; try diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index c36697b..b0af7fb 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -152,8 +152,9 @@ try { - //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = APIInfoConfig.Current.RequestHttpsHost; + //if (string.IsNullOrEmpty(urlHead)) + //{ + // urlHead = UserInfo.Current.RequestHttpsHost; //} //string requestFullUrl = urlHead + apiPath; @@ -171,9 +172,9 @@ if (string.IsNullOrEmpty(replaceToken)) { - if (MainPage.LoginUser != null) + if(UserInfo.Current != null) {/* 濡傛灉涓嶉渶瑕侀獙璇乀oken鍙互涓嶇敤浼犲叆 */ - request.AddHeader("Authorization", MainPage.LoginUser.loginTokenString); + request.AddHeader("Authorization", UserInfo.Current.loginTokenString); } } else @@ -227,20 +228,20 @@ } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "DATA_EXCEPTION" }; } } else { - HDL_ON.Common.Utlis.WriteLine(response.Content); + HDL_ON.Utlis.WriteLine(response.Content); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } @@ -264,7 +265,7 @@ try { //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = APIInfoConfig.Current.RequestHttpsHost; + // urlHead = UserInfo.Current.RequestHttpsHost; //} //string requestFullUrl = urlHead + apiPath; @@ -280,9 +281,9 @@ if (string.IsNullOrEmpty(replaceToken)) { - if (MainPage.LoginUser != null) + if ( UserInfo.Current != null) {/* 濡傛灉涓嶉渶瑕侀獙璇乀oken鍙互涓嶇敤浼犲叆 */ - request.AddHeader("Authorization", MainPage.LoginUser.loginTokenString); + request.AddHeader("Authorization", UserInfo.Current.loginTokenString); } } else @@ -308,7 +309,7 @@ } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return null; } #endregion @@ -334,7 +335,7 @@ { //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = APIInfoConfig.Current.RequestHttpsHost; + // urlHead = UserInfo.Current.RequestHttpsHost; //} //string requestFullUrl = urlHead + apiPath; @@ -351,9 +352,9 @@ if (string.IsNullOrEmpty(replaceToken)) { - if (MainPage.LoginUser != null) + if ( UserInfo.Current != null) {/* 濡傛灉涓嶉渶瑕侀獙璇乀oken鍙互涓嶇敤浼犲叆 */ - request.AddHeader("Authorization", MainPage.LoginUser.loginTokenString); + request.AddHeader("Authorization", UserInfo.Current.loginTokenString); } } else @@ -399,20 +400,20 @@ } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "DATA_EXCEPTION" }; } } else { - HDL_ON.Common.Utlis.WriteLine(response.Content); + HDL_ON.Utlis.WriteLine(response.Content); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } @@ -478,11 +479,25 @@ string str = string.Empty; foreach (KeyValuePair<string, object> item in paramDictionary) { + //Value涓簄ull涓嶅弬鍔犳牎楠� if (item.Value != null) { - str += item.Key + "=" + item.Value.ToString() + "&"; + //Value.ToString()涓簄ull鎴栬��""涔熶笉鍙傚姞鏍¢獙 + if (!string.IsNullOrEmpty(item.Value.ToString())) + { + //濡傛灉鏄痓ool绫诲瀷锛岃杞皬鍐� + if (item.Value is bool) + { + str += item.Key + "=" + item.Value.ToString().ToLower() + "&"; + } + else + { + str += item.Key + "=" + item.Value.ToString() + "&"; + } + } } } + //2.3 鎷兼帴SECRET_KEY str = str.Substring(0, str.Length - 1) + SECRET_KEY; //2.4 MD5杞崲+杞皬鍐� diff --git a/HDL_ON/DriverLayer/Control_Udp_Bus.cs b/HDL_ON/DriverLayer/Control_Udp_Bus.cs index 27a9243..6b01e14 100644 --- a/HDL_ON/DriverLayer/Control_Udp_Bus.cs +++ b/HDL_ON/DriverLayer/Control_Udp_Bus.cs @@ -86,13 +86,13 @@ try { //璐﹀彿娌$櫥褰曚笉鍥炲 - if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) + if ( UserInfo.Current == null || ! UserInfo.Current.IsLogin) { return; } Control.ins.ChangeCommunicationMode(CommunicationMode.tcp_local_server); - var sendStr = MainPage.LoginUser.accountString; + var sendStr = UserInfo.Current.accountString; if (usefullBytes.Length == 0) { SendRemark(sendStr); diff --git a/HDL_ON/DriverLayer/UdpSocket.cs b/HDL_ON/DriverLayer/UdpSocket.cs index ac83f9b..3a3758f 100644 --- a/HDL_ON/DriverLayer/UdpSocket.cs +++ b/HDL_ON/DriverLayer/UdpSocket.cs @@ -27,7 +27,7 @@ { get { - if (MainPage.LoginUser != null && Entity.DB_ResidenceData.residenceData != null) + if ( UserInfo.Current != null && Entity.DB_ResidenceData.residenceData != null) { return Entity.DB_ResidenceData.residenceData.GatewayType == 0 ? 6000 : 8585; } diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs index ff40908..2c4bde6 100644 --- a/HDL_ON/Entity/DB_ResidenceData.cs +++ b/HDL_ON/Entity/DB_ResidenceData.cs @@ -33,11 +33,11 @@ } else { - var curRegion = MainPage.LoginUser.regionList.Find((obj) => obj.RegionID == CurReginID); + var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == CurReginID); //if (curRegion == null) //{ - // CurReginID = MainPage.LoginUser.regionList[0].RegionID; - // return MainPage.LoginUser.regionList[0]; + // CurReginID = UserInfo.Current.regionList[0].RegionID; + // return UserInfo.Current.regionList[0]; //} return curRegion; } diff --git a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs index b248f49..c5bd852 100644 --- a/HDL_ON/UI/UI0-Public/AppUnlockPage.cs +++ b/HDL_ON/UI/UI0-Public/AppUnlockPage.cs @@ -9,7 +9,7 @@ { void LoadOption() { - if (MainPage.LoginUser == null) + if ( UserInfo.Current == null) { return; } diff --git a/HDL_ON/UI/UI0-Public/ConfirmDialog.cs b/HDL_ON/UI/UI0-Public/ConfirmDialog.cs new file mode 100644 index 0000000..e3e2527 --- /dev/null +++ b/HDL_ON/UI/UI0-Public/ConfirmDialog.cs @@ -0,0 +1,153 @@ +锘縰sing System; +using Shared; +using HDL_ON.UI.CSS; + +namespace HDL_ON.UI +{ + /// <summary> + /// 閫氱敤浜屾纭鐣岄潰 + /// 鍙互鑷畾涔夋寜閽枃瀛� + /// </summary> + public class ConfirmDialog : Dialog + { + /// <summary> + /// + /// </summary> + public ConfirmDialog() + { + + } + + /// <summary> + /// 鍒濆鍖朌ialog + /// </summary> + /// <param name="titleId"></param> + /// <param name="msgId"></param> + /// <param name="okAction"></param> + /// <param name="cancelAction"></param> + /// <param name="cancelID"></param> + /// <param name="confirmID"></param> + void ShowDialogBase(int titleId, int msgId, Action okAction, Action cancelAction, int cancelID = StringId.Cancel, int confirmID = StringId.Confirm) + { + + this.BackgroundColor = CSS_Color.DialogTransparentColor1; + + FrameLayout contentView = new FrameLayout() + { + Gravity = Gravity.Center, + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(140), + BackgroundColor = CSS_Color.MainBackgroundColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(10), + }; + this.AddChidren(contentView); + + Button btnTitle = new Button() + { + Y = Application.GetRealHeight(16), + Height = Application.GetRealHeight(30), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + TextID = titleId, + }; + contentView.AddChidren(btnTitle); + + Button btnMsg = new Button() + { + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealHeight(25), + Y = btnTitle.Bottom, + Width = Application.GetRealHeight(200), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextID = msgId, + }; + contentView.AddChidren(btnMsg); + + Button btnLine = new Button() + { + Y = Application.GetRealHeight(96), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(270 / 2), + BackgroundColor = CSS_Color.DividingLineColor, + }; + contentView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(43), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = cancelID, + }; + contentView.AddChidren(btnCancel); + + Button btnConfirm = new Button() + { + X = btnCancel.Right, + Y = btnLine.Y, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(45), + TextAlignment = TextAlignment.Center, + //TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + BackgroundColor = CSS_Color.MainColor, + TextID = confirmID, + }; + contentView.AddChidren(btnConfirm); + //渚嬶細鍙充笅鍦嗚 澶у皬涓�50 + int mRectCornerID = HDLUtils.RectCornerBottomRight; + btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), mRectCornerID); + + btnCancel.MouseUpEventHandler += (sender, e) => + { + this.Close(); + cancelAction?.Invoke(); + }; + + btnConfirm.MouseUpEventHandler += (sender, e) => + { + this.Close(); + okAction?.Invoke(); + }; + + this.Show(); + } + + /// <summary> + /// 鍔犺浇鎻愮ずDialog + /// </summary> + /// <param name="titleId"></param> + /// <param name="msgId"></param> + /// <param name="callBackAction"></param> + public void ShowDialog(int titleId, int msgId, Action okAction, Action cancelAction = null) + { + this.ShowDialogBase(titleId, msgId, okAction, cancelAction); + } + + /// <summary> + /// 鍔犺浇鎻愮ずDialog + /// 鍙互鑷畾涔夋寜閽枃瀛� + /// </summary> + /// <param name="titleId"></param> + /// <param name="msgId"></param> + /// <param name="okAction"></param> + /// <param name="cancelAction"></param> + /// <param name="cancelID"></param> + /// <param name="confirmID"></param> + public void ShowDialog(int titleId, int msgId, Action okAction, Action cancelAction, int cancelID, int confirmID) + { + this.ShowDialogBase(titleId, msgId, okAction, cancelAction, cancelID, confirmID); + } + + } +} diff --git a/HDL_ON/UI/UI0-Public/LineView.cs b/HDL_ON/UI/UI0-Public/LineView.cs new file mode 100644 index 0000000..eaf0f04 --- /dev/null +++ b/HDL_ON/UI/UI0-Public/LineView.cs @@ -0,0 +1,20 @@ +锘縰sing System; +using Shared; +using HDL_ON.UI.CSS; + +namespace HDL_ON.UI +{ + /// <summary> + /// 閫氱敤LineView + /// </summary> + public class LineView : FrameLayout + { + public LineView() + { + X = Application.GetRealWidth(16); + Height = Application.GetRealHeight(1); + Width = Application.GetRealWidth(343); + BackgroundColor = CSS_Color.DividingLineColor; + } + } +} diff --git a/HDL_ON/UI/UI0-Public/TopViewDiv.cs b/HDL_ON/UI/UI0-Public/TopViewDiv.cs index 84a2cae..0b31b9d 100644 --- a/HDL_ON/UI/UI0-Public/TopViewDiv.cs +++ b/HDL_ON/UI/UI0-Public/TopViewDiv.cs @@ -20,7 +20,6 @@ /// </summary> FrameLayout contentView; - /// <summary> /// 鍚庨��鎸夐挳 /// </summary> @@ -32,6 +31,11 @@ string title; /// <summary> + /// 鏄惁闇�瑕佸叧闂〉闈� + /// </summary> + bool needClose = true; + + /// <summary> /// 鍚庨��鏃惰Е鍙戝浜嬩欢 /// </summary> Action backAction; @@ -43,6 +47,19 @@ } /// <summary> + /// TopViewDiv + /// </summary> + /// <param name="frame">鐖舵帶浠�</param> + /// <param name="str">鏍囬</param> + /// <param name="needClose">鏄惁闇�瑕佸叧闂〉闈�</param> + public TopViewDiv(FrameLayout frame, string str, bool needClose) + { + baseView = frame; + title = str; + this.needClose = needClose; + } + + /// <summary> /// /// </summary> /// <param name="dialog">鏄剧ず鐨刣ialog</param> diff --git a/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs b/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs index bc222ab..c2f6a6c 100644 --- a/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs +++ b/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs @@ -15,13 +15,16 @@ { btnBack.MouseUpEventHandler = (sender, e) => { backAction?.Invoke(); - if (baseView != null) + if (needClose) { - baseView.RemoveFromParent(); - } - if (baseDialog != null) - { - baseDialog.Close(); + if (baseView != null) + { + baseView.RemoveFromParent(); + } + if (baseDialog != null) + { + baseDialog.Close(); + } } }; } diff --git a/HDL_ON/UI/UI0-Public/WebViewDialog.cs b/HDL_ON/UI/UI0-Public/WebViewDialog.cs new file mode 100644 index 0000000..7845cdf --- /dev/null +++ b/HDL_ON/UI/UI0-Public/WebViewDialog.cs @@ -0,0 +1,42 @@ +锘縰sing System; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + /// <summary> + /// WebViewDialog + /// 鍔犺浇缃戦〉 + /// </summary> + public class WebViewDialog : Dialog + { + FrameLayout bodyView; + public WebViewDialog() + { + bodyView = new FrameLayout(); + } + + + /// <summary> + /// + /// </summary> + /// <param name="titleStr"></param> + /// <param name="url"></param> + public void LoadPage(string titleStr, string url) + { + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + this.AddChidren(bodyView); + new TopViewDiv(this, bodyView, titleStr).LoadTopView(); + + //WebView + var webView = new WebView() { + Y = Application.GetRealHeight(64), + Height = bodyView.Height - Application.GetRealHeight(64), + }; + bodyView.AddChidren(webView); + //鍔犺浇缃戝潃 + webView.LoadRequest(url); + this.Show(); + } + } +} diff --git a/HDL_ON/UI/UI0-Public/Widget/TextButton.cs b/HDL_ON/UI/UI0-Public/Widget/TextButton.cs new file mode 100644 index 0000000..c0a5b02 --- /dev/null +++ b/HDL_ON/UI/UI0-Public/Widget/TextButton.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using Shared; +#if __IOS__ +using UIKit; +#endif + +namespace HDL_ON.UI +{ + /// <summary> + /// TextButton + /// 瑙e喅iOS 鏂囨湰鍒拌竟妗嗘湁杈硅窛闂 + /// </summary> + public class TextButton : Button + { + public TextButton() + { +#if __IOS__ + //閲嶅啓淇敼鏂囨湰鍒拌竟妗嗙殑鍐呰竟璺濅负0 + (this.uiView as MyButton).ContentEdgeInsets = new UIEdgeInsets(0, 0, 0, 0); +#endif + + } + } +} diff --git a/HDL_ON/UI/UI1-Login/ForgetPasswordPage.cs b/HDL_ON/UI/UI1-Login/ForgetPasswordPage.cs index 1d03af1..5fccaf0 100644 --- a/HDL_ON/UI/UI1-Login/ForgetPasswordPage.cs +++ b/HDL_ON/UI/UI1-Login/ForgetPasswordPage.cs @@ -255,6 +255,7 @@ TextSize = CSS_FontSize.TextFontSize, PlaceholderTextColor = CSS_Color.PromptingColor1, PlaceholderText = Language.StringByID(StringId.PlsEntryPhoneNumber), + IsNumberKeyboardType = true }; accountView.AddChidren(etAccount); diff --git a/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs b/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs index 7f1cb99..33b5fa3 100644 --- a/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs @@ -32,6 +32,7 @@ { if (registerType == 0) return; + etAccount.IsNumberKeyboardType = true; etAccount.Text = registerPhone; etPassword.Text = ""; etRepeatPassword.Text = ""; @@ -60,6 +61,7 @@ { if (registerType == 1) return; + etAccount.IsNumberKeyboardType = false; etAccount.Text = registerEmail; etPassword.Text = ""; etRepeatPassword.Text = ""; @@ -92,11 +94,11 @@ { etAccount.TextChangeEventHandler += (sender, e) => { - Regex reg = new Regex(@"^[1]+\d{10}"); - var mFalg = reg.Match(etAccount.Text.Trim()); + //Regex reg = new Regex(@"^[1]+\d{10}"); + //var mFalg = reg.Match(etAccount.Text.Trim()); if (registerType == 0)//鎵嬫満鑾峰彇楠岃瘉鐮佹寜閽敓鏁堟潯浠� { - if (btnGlobalRoaming.Text == "+86" && etAccount.Text.Trim().Length != 11) + if (!Utlis.CheckPhoneNumber(etAccount.Text.Trim(), phoneZoneCode)) { btnGetVerificationCode_Phone.IsSelected = false; } @@ -108,7 +110,7 @@ } else//閭鑾峰彇楠岃瘉鐮佹寜閽敓鏁堟潯浠� { - if (!mFalg.Success) + if (!Utlis.CheckEmail(etAccount.Text.Trim())) { btnGetVerificationCode_Mail.IsSelected = false; } @@ -142,10 +144,8 @@ //鎵嬫満鏂瑰紡-楠岃瘉鎵嬫満鍙风爜鏄惁姝g‘ if (registerType == 0) { - btnGetVerificationCode_Phone.IsSelected = false; - Regex reg = new Regex(@"^[1]+\d{9}"); - var mFalg = reg.Match(etAccount.Text.Trim()); - if (!mFalg.Success || (btnGlobalRoaming.Text == "+86" && etAccount.Text.Trim().Length != 11)) + btnGetVerificationCode_Phone.IsSelected = false; + if (!Utlis.CheckPhoneNumber(etAccount.Text.Trim(), phoneZoneCode)) { btnAccountViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; btnAccountViewBottomLine.Height = Application.GetRealHeight(2); @@ -169,9 +169,7 @@ { btnGetVerificationCode_Mail.IsSelected = false; //閭鏂瑰紡-楠岃瘉閭鏄惁姝g‘ - var reg = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"); - var mFalg = reg.Match(etAccount.Text.Trim()); - if (!mFalg.Success ) + if (!Utlis.CheckEmail(etAccount.Text.Trim())) { btnAccountViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; btnAccountViewBottomLine.Height = Application.GetRealHeight(2); @@ -291,6 +289,25 @@ } /// <summary> + /// 妫�娴嬪綋鍓嶉厤缃煙鍚嶆槸鍚︿竴鑷达紝涓嶄竴鑷村垯鏇挎崲 + /// </summary> + /// <param name="result"></param> + void CheckAndSetUserRequestHost(ResponsePackNew result) { + try + { + var mGlobalRegionListObj = Newtonsoft.Json.JsonConvert.DeserializeObject<GlobalRegionListRes>(result.Data.ToString()); + if (UserInfo.Current.RequestHttpsHost != mGlobalRegionListObj.regionUrl) + { + UserInfo.Current.RequestHttpsHost = mGlobalRegionListObj.regionUrl; + UserInfo.Current.GlobalRegion = mGlobalRegionListObj; + UserInfo.Current.SaveUserInfo(); + } + } + catch { } + } + + + /// <summary> /// 鑾峰彇楠岃瘉鐮� /// </summary> void LoadEvent_GetVerificationCode() @@ -307,12 +324,15 @@ var result = pm.GetRegionByAccount(account); if (result.Code != StateCode.SUCCESS) { - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code); + IMessageCommon.Current.ShowErrorInfoAlter(result.Code); return; } else { - //2.宸茬粡娉ㄥ唽杩囷紝鍙戦�侀獙璇佺爜鎵惧洖瀵嗙爜 + //2.1妫�娴嬪綋鍓嶉厤缃煙鍚嶆槸鍚︿竴鑷达紝涓嶄竴鑷村垯鏇挎崲 + CheckAndSetUserRequestHost(result); + + //2.2宸茬粡娉ㄥ唽杩囷紝鍙戦�侀獙璇佺爜鎵惧洖瀵嗙爜 Application.RunOnMainThread(() => { //鐭俊鍙戦�侀棿闅�60s @@ -354,7 +374,7 @@ if (resultObj.Code != StateCode.SUCCESS) { // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Send, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } } }) @@ -423,7 +443,7 @@ waitPage.Hide(); }); // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Member_ForgetPwd, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } }); } diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index b8f1b69..9dbe678 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -240,8 +240,10 @@ }; //璺宠浆鍥藉鍖哄彿閫夋嫨鐣岄潰 - EventHandler<MouseEventArgs> eHandler = (sender, e) => { - JLCountrycode.CountryCodeView.Current.Show((countryName, code) => { + EventHandler<MouseEventArgs> eHandler = (sender, e) => + { + JLCountrycode.CountryCodeView.Current.Show((countryName, code) => + { if (!string.IsNullOrEmpty(code)) { phoneZoneCode = code; @@ -460,7 +462,7 @@ LoadEventList(); account = etAccount.Text.Trim(); - #if DEBUG1211 +#if DEBUG1211 //鏈湴妯″紡 Button btnLocalMode = new Button() { @@ -476,14 +478,159 @@ btnLocalMode.MouseUpEventHandler = (sender, e) => { MainPage.LocalMode = true; - MainPage.LoginUser = new UserInfo(); + UserInfo.Current = new UserInfo(); MainPage.GoUserPage(); }; MainPage.Log("etAccount.TextAlignment : " + etAccount.TextAlignment.ToString()); - #endif +#endif + + #region 闅愮鏀跨瓥 + AddServiceAgreementControl(bodyView); + #endregion } + + #region 鈻� 鏈嶅姟鍗忚___________________________ + bool isAgreePrivacyPolicy = false; + /// <summary> + /// 娣诲姞鏈嶅姟鍗忚鎺т欢 + /// </summary> + /// <param name="frameBack"></param> + private void AddServiceAgreementControl(FrameLayout frameLayout) + { + isAgreePrivacyPolicy = UserInfo.Current.isAgreePrivacyPolicy; + var frameRow = new FrameLayout() + { + Height = Application.GetRealHeight(28), + Y = Application.GetRealHeight(628), + }; + frameLayout.AddChidren(frameRow); + + //鍚屾剰鎸夐挳鑳屾櫙 + var agreeView = new FrameLayout() + { + Height = Application.GetRealHeight(28), + Width = Application.GetRealWidth(28), + X = Application.GetRealWidth(82), + }; + frameRow.AddChidren(agreeView); + //鍚屾剰鍥炬爣鎸夐挳 + var agreeBtn = new Button() + { + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + UnSelectedImagePath = "Public/ChooseIcon.png", + SelectedImagePath = "Public/ChooseOnIcon.png", + IsSelected = isAgreePrivacyPolicy, + Gravity = Gravity.Center + }; + agreeView.AddChidren(agreeBtn); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + isAgreePrivacyPolicy = !isAgreePrivacyPolicy; + agreeBtn.IsSelected = isAgreePrivacyPolicy; + UserInfo.Current.isAgreePrivacyPolicy = isAgreePrivacyPolicy; + UserInfo.Current.SaveUserInfo(); + }; + + agreeBtn.MouseUpEventHandler = eventHandler; + agreeView.MouseUpEventHandler = eventHandler; + + //int btnWidth = 0; + //鍚屾剰鏂囨湰 + var agreeTextBtn = new TextButton() + { + X = agreeView.Right, + Width = Application.GetRealWidth(28), + Height = Application.GetRealHeight(28), + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextID = StringId.Agree + }; + frameRow.AddChidren(agreeTextBtn); + agreeTextBtn.Width = Utlis.GetRealWidthByTextButton(agreeTextBtn); + + //鐢ㄦ埛鍗忚鎸夐挳 + var userAgreementBtn = new TextButton() + { + X = agreeTextBtn.Right, + Width = Application.GetRealWidth(28), + Height = Application.GetRealHeight(28), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + Text = "銆�" + Language.StringByID(StringId.UserAgreement) + "銆�" + }; + frameRow.AddChidren(userAgreementBtn); + userAgreementBtn.Width = Utlis.GetRealWidthByTextButton(userAgreementBtn); + + //鍜屾枃鏈� + var andTextBtn = new TextButton() + { + X = userAgreementBtn.Right, + Width = Application.GetRealWidth(28), + Height = Application.GetRealHeight(28), + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextID = StringId.And + }; + frameRow.AddChidren(andTextBtn); + andTextBtn.Width = Utlis.GetRealWidthByTextButton(andTextBtn); + + //闅愮鏀跨瓥鎸夐挳 + var privacyPolicyBtn = new TextButton() + { + X = andTextBtn.Right, + Width = Application.GetRealWidth(28), + Height = Application.GetRealHeight(28), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + Text = "銆�" + Language.StringByID(StringId.PrivacyPolicy) + "銆�" + }; + frameRow.AddChidren(privacyPolicyBtn); + privacyPolicyBtn.Width = Utlis.GetRealWidthByTextButton(privacyPolicyBtn); + + //鎵撳紑鐢ㄦ埛鍗忚 + userAgreementBtn.MouseUpEventHandler = (sender, e) => + { + OpenWebViewPage(false); + }; + + //鎵撳紑闅愮鏀跨瓥 + privacyPolicyBtn.MouseUpEventHandler = (sender, e) => + { + OpenWebViewPage(true); + }; + } + + /// <summary> + /// OpenWebViewPage + /// </summary> + /// <param name="isOpenPrivacyPolicy">鏄惁闅愮鏀跨瓥</param> + private void OpenWebViewPage(bool isOpenPrivacyPolicy) + { + string url = isAgreePrivacyPolicy ? Constant.URL_PrivacyPolicy : Constant.URL_UserAgreement; + string titleStr = isAgreePrivacyPolicy ? Language.StringByID(StringId.PrivacyPolicy) : Language.StringByID(StringId.UserAgreement); + new WebViewDialog().LoadPage(titleStr, url); + } + + /// <summary> + /// 妫�娴嬮殣绉佸崗璁� + /// </summary> + /// <returns></returns> + private bool CheckPrivacyPolicy() + { + if (isAgreePrivacyPolicy == false) + { + //璇峰悓鎰忋�婄敤鎴峰崗璁�嬪拰銆婇殣绉佹斂绛栥�� + Utlis.ShowTip(Language.StringByID(StringId.PleaseReadAndAgreePrivacyPolicyMsg)); + return false; + } + return true; + } + + #endregion } } \ No newline at end of file diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs index d91a9b9..5803f90 100644 --- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs @@ -28,6 +28,25 @@ } /// <summary> + /// 妫�娴嬪綋鍓嶉厤缃煙鍚嶆槸鍚︿竴鑷达紝涓嶄竴鑷村垯鏇挎崲 + /// </summary> + /// <param name="result"></param> + void CheckAndSetUserRequestHost(ResponsePackNew result) + { + try + { + var mGlobalRegionListObj = Newtonsoft.Json.JsonConvert.DeserializeObject<GlobalRegionListRes>(result.Data.ToString()); + if (UserInfo.Current.RequestHttpsHost != mGlobalRegionListObj.regionUrl) + { + UserInfo.Current.RequestHttpsHost = mGlobalRegionListObj.regionUrl; + UserInfo.Current.GlobalRegion = mGlobalRegionListObj; + UserInfo.Current.SaveUserInfo(); + } + } + catch { } + } + + /// <summary> /// 鐐瑰嚮鎸夐挳鑾峰彇楠岃瘉鐮� /// </summary> void GetVerificationCode() @@ -51,7 +70,7 @@ btnAccountViewBottomLine.Height = Application.GetRealHeight(2); return; } - if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11)) + if (!Utlis.CheckPhoneNumber(phoneNumber, phoneZoneCode)) { var tip = new Tip() { @@ -73,11 +92,14 @@ var result = pm.GetRegionByAccount(account); if (result.Code != StateCode.SUCCESS) { - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code); + IMessageCommon.Current.ShowErrorInfoAlter(result.Code); return; } else { + //妫�娴嬪綋鍓嶉厤缃煙鍚嶆槸鍚︿竴鑷达紝涓嶄竴鑷村垯鏇挎崲 + CheckAndSetUserRequestHost(result); + // Application.RunOnMainThread(() => { btnGetVerificationCode.IsSelected = false; @@ -113,7 +135,7 @@ btnPasswordViewBottomLine.Height = Application.GetRealHeight(2); }); // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Send, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } } @@ -395,7 +417,7 @@ return; if (loginType == 0) { - if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11)) + if (!Utlis.CheckPhoneNumber(registerPhone, phoneZoneCode)) { var tip = new Tip() { @@ -418,7 +440,7 @@ } else { - if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+")) + if (!Utlis.CheckEmail(registerEmail)) { var tip = new Tip() { @@ -493,12 +515,15 @@ { if (btnLogin.IsSelected) { + //鍒ゆ柇鏄惁鍚屾剰浜嗛殣绉佹斂绛� + if (CheckPrivacyPolicy() == false) return; + account = etAccount.Text.Trim(); password = etPassword.Text.Trim(); if (loginType == 0) { - if (!Regex.IsMatch(account, @"^[1]+\d{10}") && account.Length == 11) + if (!Utlis.CheckPhoneNumber(account, phoneZoneCode)) { var tip = new Tip() { @@ -512,7 +537,7 @@ } else { - if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+")) + if (!Utlis.CheckEmail(account)) { var tip = new Tip() { @@ -584,8 +609,13 @@ var result = pm.GetRegionByAccount(account); if (result.Code != StateCode.SUCCESS) { - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code); + IMessageCommon.Current.ShowErrorInfoAlter(result.Code); return; + } + else + { + //璁剧疆鐢ㄦ埛鎵�娉ㄥ唽鍦板尯鐨勫煙鍚嶏紝鐢ㄦ埛鐩稿叧鎿嶄綔閮界敤杩欎釜鍩熷悕 + CheckAndSetUserRequestHost(result); } } @@ -627,7 +657,7 @@ OnAppConfig.Instance.RefreshUserConfig(); DB_ResidenceData.InitRoomFunction(); } - if (MainPage.LoginUser.userEmailInfo == "464027401@qq.com") + if ( UserInfo.Current.userEmailInfo == "464027401@qq.com") { DB_ResidenceData.residenceData.floors.Add(new Floor() { name = "1F", sid = "09888" }); var r111 = new Room() { sid = "0001", name = "Room-1", floorId = "09888", backgroundImage = "Classification/Room/Roombg.png" }; @@ -901,7 +931,11 @@ else { //2020-11-13 寰呯‘璁� - MainPage.ShowAlertOnMainThread("鐧诲綍澶辫触锛岃鍏堟坊鍔犱綇瀹呫��"); + //鑾峰彇浣忓畢澶辫触锛岄噸鏂版爣璁颁负鏈櫥褰曠姸鎬� + UserInfo.Current.lastTime = DateTime.MinValue; + UserInfo.Current.SaveUserInfo(); + //鐧诲綍澶辫触锛岃鍏堟坊鍔犱綇瀹咃紒 + Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.FailedGetHomeList)); } } } @@ -945,18 +979,26 @@ if (loginResult.Code == StateCode.SUCCESS) { var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString()); - MainPage.LoginUser = new UserInfo - { - userType = revertData.userType, - accountString = account, - password = password, - lastTime = DateTime.Now, - ID = revertData.userId, - loginTokenString = revertData.headerPrefix + revertData.accessToken, - refreshToken = revertData.refreshToken, - userName = revertData.name - }; - MainPage.LoginUser.SaveUserInfo(); + // UserInfo.Current = new UserInfo + //{ + // userType = revertData.userType, + // accountString = account, + // password = password, + // lastTime = DateTime.Now, + // ID = revertData.userId, + // loginTokenString = revertData.headerPrefix + revertData.accessToken, + // refreshToken = revertData.refreshToken, + // userName = revertData.name + //}; + UserInfo.Current.userType = revertData.userType; + UserInfo.Current.accountString = account; + //UserInfo.Current.password = password; + UserInfo.Current.lastTime = DateTime.Now; + UserInfo.Current.ID = revertData.userId; + UserInfo.Current.loginTokenString = revertData.headerPrefix + revertData.accessToken; + UserInfo.Current.refreshToken = revertData.refreshToken; + UserInfo.Current.userName = revertData.name; + UserInfo.Current.SaveUserInfo(); MainPage.Log("鐧诲綍鎴愬姛銆�"); result = true; //鑾峰彇鐢ㄦ埛淇℃伅 @@ -1031,7 +1073,7 @@ if (responsePack == StateCode.SUCCESS) { //2020-11-13 寰呯‘璁わ紝娌℃湁浣忓畢锛屼笉绠楃櫥褰曟垚鍔� - if (MainPage.LoginUser.regionList != null && MainPage.LoginUser.regionList.Count > 0){ + if ( UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0){ result = true; } //result = true; @@ -1039,7 +1081,7 @@ else { // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Gethomepager, responsePack); + IMessageCommon.Current.ShowErrorInfoAlter(responsePack); } return result; } diff --git a/HDL_ON/UI/UI1-Login/RegisterPage.cs b/HDL_ON/UI/UI1-Login/RegisterPage.cs index da291bd..25dd3d1 100644 --- a/HDL_ON/UI/UI1-Login/RegisterPage.cs +++ b/HDL_ON/UI/UI1-Login/RegisterPage.cs @@ -283,6 +283,7 @@ TextSize = CSS_FontSize.TextFontSize, PlaceholderTextColor = CSS_Color.PromptingColor1, PlaceholderText = Language.StringByID(StringId.PlsEntryPhoneNumber), + IsNumberKeyboardType = true }; accountView.AddChidren(etAccount); @@ -680,25 +681,34 @@ if (loginResult.Code == StateCode.SUCCESS) { var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString()); - MainPage.LoginUser = new UserInfo - { - userType = revertData.userType, - accountString = account, - password = password, - lastTime = DateTime.Now, - ID = revertData.userId, - loginTokenString = revertData.headerPrefix + revertData.accessToken, - refreshToken = revertData.refreshToken, - userName = revertData.name - }; - MainPage.LoginUser.SaveUserInfo(); + // UserInfo.Current = new UserInfo + //{ + // userType = revertData.userType, + // accountString = account, + // password = password, + // lastTime = DateTime.Now, + // ID = revertData.userId, + // loginTokenString = revertData.headerPrefix + revertData.accessToken, + // refreshToken = revertData.refreshToken, + // userName = revertData.name + //}; + UserInfo.Current.userType = revertData.userType; + UserInfo.Current.accountString = account; + //UserInfo.Current.password = password; + UserInfo.Current.lastTime = DateTime.Now; + UserInfo.Current.ID = revertData.userId; + UserInfo.Current.loginTokenString = revertData.headerPrefix + revertData.accessToken; + UserInfo.Current.refreshToken = revertData.refreshToken; + UserInfo.Current.userName = revertData.name; + + UserInfo.Current.SaveUserInfo(); MainPage.Log("鐧诲綍鎴愬姛銆�"); result = true; } else { //鐧诲綍澶辫触 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Login, loginResult.Code); + IMessageCommon.Current.ShowErrorInfoAlter(loginResult.Code); Application.RunOnMainThread(() => { btnPasswordViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; diff --git a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs index ce1f7a3..25fd27b 100644 --- a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs @@ -30,11 +30,11 @@ { etAccount.TextChangeEventHandler = (sender, e) => { - Regex reg = new Regex(@"^[1]+\d{10}"); - var mFalg = reg.Match(etAccount.Text.Trim()); + //Regex reg = new Regex(@"^[1]+\d{10}"); + //var mFalg = reg.Match(etAccount.Text.Trim()); if (registerType == 0)//鎵嬫満娉ㄥ唽鑾峰彇楠岃瘉鐮佹寜閽敓鏁堟潯浠� { - if (btnGlobalRoaming.Text == "+86" && etAccount.Text.Trim().Length != 11) + if (!Utlis.CheckPhoneNumber(etAccount.Text.Trim(), phoneZoneCode)) { btnGetVerificationCode_Phone.IsSelected = false; } @@ -46,7 +46,7 @@ } else//閭娉ㄥ唽鑾峰彇楠岃瘉鐮佹寜閽敓鏁堟潯浠� { - if (!mFalg.Success) + if (!Utlis.CheckEmail(etAccount.Text.Trim())) { btnGetVerificationCode_Mail.IsSelected = false; } @@ -72,6 +72,7 @@ { return; } + etAccount.IsNumberKeyboardType = true; etAccount.Text = registerPhone; etPassword.Text = ""; etRepeatPassword.Text = ""; @@ -100,6 +101,8 @@ { if (registerType == 1) return; + + etAccount.IsNumberKeyboardType = false; etAccount.Text = registerEmail; etPassword.Text = ""; etRepeatPassword.Text = ""; @@ -148,9 +151,7 @@ { if (registerType == 0) { - Regex reg = new Regex(@"^[1]+\d{10}"); - var mFalg = reg.Match(etAccount.Text.Trim()); - if (!mFalg.Success || (btnGlobalRoaming.Text == "+86" && etAccount.Text.Trim().Length != 11)) + if (!Utlis.CheckPhoneNumber(etAccount.Text.Trim(), phoneZoneCode)) { btnAccountViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; btnAccountViewBottomLine.Height = Application.GetRealHeight(2); @@ -179,10 +180,7 @@ else if (registerType == 1) { //閭娉ㄥ唽-楠岃瘉閭鏄惁姝g‘ - var reg = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"); - //Regex.IsMatch(etAccount.Text.Trim(), "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+"); - var mFalg = reg.Match(etAccount.Text.Trim()); - if (!mFalg.Success) + if (!Utlis.CheckEmail(etAccount.Text.Trim())) { btnAccountViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; btnAccountViewBottomLine.Height = Application.GetRealHeight(2); @@ -420,17 +418,17 @@ if (resultObj.Code != StateCode.SUCCESS) { // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Send, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } }else if (result.Code.ToUpper() == StateCode.SUCCESS) { //3.鎻愮ず璐﹀彿宸插瓨鍦紝鏃犳硶閲嶅娉ㄥ唽 - MainPage.ShowAlertOnMainThread(Language.StringByID(StringId.AccountAlreadyUse)); + Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.AccountAlreadyUse)); } else { //4.鎻愮ず鍏跺畠寮傚父閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_GetRegionByAccount, result.Code); + IMessageCommon.Current.ShowErrorInfoAlter(result.Code); } }) { IsBackground = true }.Start(); @@ -540,7 +538,7 @@ else// 娉ㄥ唽澶辫触 { // 鎻愮ず閿欒 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Member_Register, validateSmsResult.Code); + IMessageCommon.Current.ShowErrorInfoAlter(validateSmsResult.Code); //2020-11-13 寰呬慨鏀� //string erorrInfo = ""; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/AccountBindInfoPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/AccountBindInfoPage.cs index d1a0a8d..cc2daf6 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/AccountBindInfoPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/AccountBindInfoPage.cs @@ -4,6 +4,9 @@ namespace HDL_ON.UI { + /// <summary> + /// 宸茬粦瀹氭墜鏈烘垨鑰呴偖绠辩殑椤甸潰 + /// </summary> public partial class AccountBindInfoPage : FrameLayout { FrameLayout bodyView; @@ -27,7 +30,7 @@ /// </summary> /// <param name="act">鍒锋柊缁戝畾淇℃伅鏂规硶</param> /// <param name="option">淇淇℃伅鐨勭被鍨�:1:閭锛�2:鎵嬫満</param> - public void LoadPage(Action<string> act,int ot,int tId) + public void LoadPage(Action<string> act, int ot, int tId) { action = act; optionType = ot; @@ -50,7 +53,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextAlignment = TextAlignment.CenterLeft, - TextID = optionType == 1 ? StringId.CurrentEmail : StringId.CurPhone, + TextID = optionType == 1 ? StringId.CurrentEmail : StringId.CurPhone, }; rowView.AddChidren(btnTitle); @@ -60,7 +63,7 @@ TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, TextAlignment = TextAlignment.CenterRight, - Text = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo, + Text = optionType == 1 ? UserInfo.Current.userEmailInfo : UserInfo.Current.userMobileInfo, }; rowView.AddChidren(btnContent); @@ -82,7 +85,8 @@ }; bodyView.AddChidren(btnChangeBind); - if( (!string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo) && optionType == 1) || (!string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo) && optionType == 2)) + //鍚屾椂缁戝畾閭鎴栬�呮墜鏈烘墠鏄剧ず"鏇存崲楠岃瘉鏂瑰紡" + if (!string.IsNullOrEmpty( UserInfo.Current.userMobileInfo) && !string.IsNullOrEmpty( UserInfo.Current.userEmailInfo)) { Button btnUnbind = new Button() { @@ -111,16 +115,18 @@ /// </summary> void LoadEvent_SkipChangeBandAccountInfo(Button button) { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { var cbe = new ChangeBindAccountPage(); + cbe.isUnbind = false; MainPage.BasePageView.AddChidren(cbe); if (optionType == 1) { - cbe.LoadPage(action, optionType, StringId.ModifyBindingEmail, StringId.CurrentEmail); + cbe.LoadPage(action, optionType, StringId.ModifyBindingEmail); } - else if(optionType == 2) + else if (optionType == 2) { - cbe.LoadPage(action, optionType, StringId.ModifyBindingPhone, StringId.CurPhone); + cbe.LoadPage(action, optionType, StringId.ModifyBindingPhone); } MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; @@ -132,16 +138,18 @@ /// </summary> void LoadEvent_SkipDelBandAccountInfo(Button button) { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { var cbe = new ChangeBindAccountPage(); + cbe.isUnbind = true;//鏄惁涓鸿В缁戞爣璁� MainPage.BasePageView.AddChidren(cbe); if (optionType == 1) { - cbe.LoadPage(action, optionType, StringId.UnbindEmail, StringId.CurrentEmail); + cbe.LoadPage(action, optionType, StringId.UnbindEmail); } - else if(optionType == 2) + else if (optionType == 2) { - cbe.LoadPage(action, optionType, StringId.UnbindPhone, StringId.CurPhone); + cbe.LoadPage(action, optionType, StringId.UnbindPhone); } MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/BindAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/BindAccountPage.cs index ad35668..4129820 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/BindAccountPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/BindAccountPage.cs @@ -1,206 +1,206 @@ -锘縰sing System; -using Shared; -using HDL_ON.UI.CSS; -using System.Text.RegularExpressions; -using HDL_ON.DAL.Server; +锘�//using System; +//using Shared; +//using HDL_ON.UI.CSS; +//using System.Text.RegularExpressions; +//using HDL_ON.DAL.Server; -namespace HDL_ON.UI -{ - public partial class BindAccountPage : FrameLayout - { - FrameLayout bodyView; - Button btnBind; - EditText etContent; - Action<string> action; - /// <summary> - /// 鏍囬ID - /// </summary> - int titleId; - public BindAccountPage() - { - bodyView = this; - } +//namespace HDL_ON.UI +//{ +// public partial class BindAccountPage : FrameLayout +// { +// FrameLayout bodyView; +// Button btnBind; +// EditText etContent; +// Action<string> action; +// /// <summary> +// /// 鏍囬ID +// /// </summary> +// int titleId; +// public BindAccountPage() +// { +// bodyView = this; +// } - public void LoadPage(Action<string> act,int tId) - { - action = act; - titleId = tId; - bodyView.BackgroundColor = CSS_Color.BackgroundColor; - new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); +// public void LoadPage(Action<string> act,int tId) +// { +// action = act; +// titleId = tId; +// bodyView.BackgroundColor = CSS_Color.BackgroundColor; +// new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); - FrameLayout rowView = new FrameLayout() - { - Y = Application.GetRealHeight(72), - Height = Application.GetRealHeight(50), - BackgroundColor = CSS_Color.MainBackgroundColor, - }; - bodyView.AddChidren(rowView); +// FrameLayout rowView = new FrameLayout() +// { +// Y = Application.GetRealHeight(72), +// Height = Application.GetRealHeight(50), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// }; +// bodyView.AddChidren(rowView); - Button btnTitle = new Button() - { - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(180), - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.SubheadingFontSize, - TextAlignment = TextAlignment.CenterLeft, - TextID = titleId == StringId.BindEmail ? StringId.EntryNewEmail : StringId.EntryNewPhone, - }; - rowView.AddChidren(btnTitle); +// Button btnTitle = new Button() +// { +// X = Application.GetRealWidth(16), +// Width = Application.GetRealWidth(180), +// TextColor = CSS_Color.FirstLevelTitleColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// TextAlignment = TextAlignment.CenterLeft, +// TextID = titleId == StringId.BindEmail ? StringId.EntryNewEmail : StringId.EntryNewPhone, +// }; +// rowView.AddChidren(btnTitle); - etContent = new EditText() - { - Width = Application.GetRealWidth(359), - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.TextFontSize, - TextAlignment = TextAlignment.CenterRight, - Foucs = true - }; - rowView.AddChidren(etContent); +// etContent = new EditText() +// { +// Width = Application.GetRealWidth(359), +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.TextFontSize, +// TextAlignment = TextAlignment.CenterRight, +// Foucs = true +// }; +// rowView.AddChidren(etContent); - btnBind = new Button() - { - Y = Application.GetRealHeight(213), - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(220), - Height = Application.GetRealHeight(44), - BackgroundColor = CSS_Color.MainColor, - TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.MainBackgroundColor, - TextID = StringId.Confirm, - TextSize = CSS_FontSize.SubheadingFontSize, - IsBold = true, - Radius = (uint)Application.GetRealWidth(22), - BorderColor = 0x00000000, - BorderWidth = 0, - }; - bodyView.AddChidren(btnBind); +// btnBind = new Button() +// { +// Y = Application.GetRealHeight(213), +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(220), +// Height = Application.GetRealHeight(44), +// BackgroundColor = CSS_Color.MainColor, +// TextAlignment = TextAlignment.Center, +// TextColor = CSS_Color.MainBackgroundColor, +// TextID = StringId.Confirm, +// TextSize = CSS_FontSize.SubheadingFontSize, +// IsBold = true, +// Radius = (uint)Application.GetRealWidth(22), +// BorderColor = 0x00000000, +// BorderWidth = 0, +// }; +// bodyView.AddChidren(btnBind); - LoadEvent_BindEmail(); +// LoadEvent_BindEmail(); - } - } +// } +// } - //-------------------------------------------- - public partial class BindAccountPage - { - void LoadEvent_BindEmail() - { - btnBind.MouseUpEventHandler = (sender, e) => { - Application.HideSoftInput(); - var account = etContent.Text.Trim(); - if (titleId == StringId.BindEmail) - { - if (account == MainPage.LoginUser.userEmailInfo) - { - var tip = new Tip() - { - Text = Language.StringByID(StringId.EmailIsSameNoNeedModfiy), - CloseTime = 1, - Direction = AMPopTipDirection.None - }; - tip.Show(bodyView); - return; - } - if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+")) - { - var tip = new Tip() - { - Text = Language.StringByID(StringId.PlsEntryCorrectEmailAddress), - CloseTime = 1, - Direction = AMPopTipDirection.None - }; - tip.Show(bodyView); - return; - } - } - else if (titleId == StringId.BindPhone) - { - if(account == MainPage.LoginUser.userMobileInfo) - { - var tip = new Tip() - { - Text = Language.StringByID(StringId.PhoneNumberIsSameNoNeedModfiy), - CloseTime = 1, - Direction = AMPopTipDirection.None - }; - tip.Show(bodyView); - return; - } - if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11)) - { - var tip = new Tip() - { - Text = Language.StringByID(StringId.PlsEntryCorrectMobilNeumber), - CloseTime = 1, - Direction = AMPopTipDirection.None - }; - tip.Show(bodyView); - return; - } - } - new System.Threading.Thread(() => - { - var result = new HttpServerRequest().BindAccount(account); - if (result.ToUpper() == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - if (titleId == StringId.BindEmail) - { - MainPage.LoginUser.userEmailInfo = account; - } - else if (titleId == StringId.BindPhone) - { - MainPage.LoginUser.userMobileInfo = account; - } - var page = new OperationResultDisPalyPage(); - page.Show(); - if (titleId == StringId.BindEmail) - { - page.LoadPage(true, Language.StringByID(StringId.BindEmail), Language.StringByID(StringId.BindEmailSuccess), ""); - } - else if (titleId == StringId.BindPhone) - { - page.LoadPage(true, Language.StringByID(StringId.BindPhone), Language.StringByID(StringId.BindPhoneSuccess), ""); - } +// //-------------------------------------------- +// public partial class BindAccountPage +// { +// void LoadEvent_BindEmail() +// { +// btnBind.MouseUpEventHandler = (sender, e) => { +// Application.HideSoftInput(); +// var account = etContent.Text.Trim(); +// if (titleId == StringId.BindEmail) +// { +// if (account == UserInfo.Current.userEmailInfo) +// { +// var tip = new Tip() +// { +// Text = Language.StringByID(StringId.EmailIsSameNoNeedModfiy), +// CloseTime = 1, +// Direction = AMPopTipDirection.None +// }; +// tip.Show(bodyView); +// return; +// } +// if (!Regex.IsMatch(account, "([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5})+")) +// { +// var tip = new Tip() +// { +// Text = Language.StringByID(StringId.PlsEntryCorrectEmailAddress), +// CloseTime = 1, +// Direction = AMPopTipDirection.None +// }; +// tip.Show(bodyView); +// return; +// } +// } +// else if (titleId == StringId.BindPhone) +// { +// if(account == UserInfo.Current.userMobileInfo) +// { +// var tip = new Tip() +// { +// Text = Language.StringByID(StringId.PhoneNumberIsSameNoNeedModfiy), +// CloseTime = 1, +// Direction = AMPopTipDirection.None +// }; +// tip.Show(bodyView); +// return; +// } +// if (!Regex.IsMatch(account, @"^[1]+\d{10}") || (account.Length != 11)) +// { +// var tip = new Tip() +// { +// Text = Language.StringByID(StringId.PlsEntryCorrectMobilNeumber), +// CloseTime = 1, +// Direction = AMPopTipDirection.None +// }; +// tip.Show(bodyView); +// return; +// } +// } +// new System.Threading.Thread(() => +// { +// var result = new HttpServerRequest().BindAccount(account); +// if (result.ToUpper() == StateCode.SUCCESS) +// { +// Application.RunOnMainThread(() => +// { +// if (titleId == StringId.BindEmail) +// { +// UserInfo.Current.userEmailInfo = account; +// } +// else if (titleId == StringId.BindPhone) +// { +// UserInfo.Current.userMobileInfo = account; +// } +// var page = new OperationResultDisPalyPage(); +// page.Show(); +// if (titleId == StringId.BindEmail) +// { +// page.LoadPage(true, Language.StringByID(StringId.BindEmail), Language.StringByID(StringId.BindEmailSuccess), ""); +// } +// else if (titleId == StringId.BindPhone) +// { +// page.LoadPage(true, Language.StringByID(StringId.BindPhone), Language.StringByID(StringId.BindPhoneSuccess), ""); +// } - for (int i = 0; i < 3; i++) - { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - } - action(account); - }); - } - else - { - var tipMsg = ""; +// for (int i = 0; i < 3; i++) +// { +// MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); +// } +// action(account); +// }); +// } +// else +// { +// var tipMsg = ""; - Application.RunOnMainThread(() => - { - var page = new OperationResultDisPalyPage(); - page.Show(); - if (titleId == StringId.BindEmail) - { - if (result == "Exist") - { - tipMsg = Language.StringByID(StringId.EmailAlreadyUse); - } - page.LoadPage(false, Language.StringByID(StringId.BindEmail), Language.StringByID(StringId.BindEmailFail) + "," + tipMsg, ""); - } - else - { - if (result == "Exist") - { - tipMsg = Language.StringByID(StringId.PhoneNumberAlreadyUse); - } - page.LoadPage(false, Language.StringByID(StringId.BindPhone), Language.StringByID(StringId.BindPhoneFail) + "," + tipMsg, ""); - } - }); - } - }) - { IsBackground = true }.Start(); - }; - } - } -} +// Application.RunOnMainThread(() => +// { +// var page = new OperationResultDisPalyPage(); +// page.Show(); +// if (titleId == StringId.BindEmail) +// { +// if (result == "Exist") +// { +// tipMsg = Language.StringByID(StringId.EmailAlreadyUse); +// } +// page.LoadPage(false, Language.StringByID(StringId.BindEmail), Language.StringByID(StringId.BindEmailFail) + "," + tipMsg, ""); +// } +// else +// { +// if (result == "Exist") +// { +// tipMsg = Language.StringByID(StringId.PhoneNumberAlreadyUse); +// } +// page.LoadPage(false, Language.StringByID(StringId.BindPhone), Language.StringByID(StringId.BindPhoneFail) + "," + tipMsg, ""); +// } +// }); +// } +// }) +// { IsBackground = true }.Start(); +// }; +// } +// } +//} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs index 2420826..44b9478 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindAccountPage.cs @@ -6,14 +6,40 @@ namespace HDL_ON.UI { + /// <summary> + /// 淇敼缁戝畾鎴栬�呰В缁�--鍙戦�侀獙璇佺爜椤甸潰 + /// </summary> public partial class ChangeBindAccountPage : FrameLayout { + /// <summary> + /// + /// </summary> FrameLayout bodyView; + /// <summary> + /// + /// </summary> Action<string> action; /// <summary> /// 鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満 /// </summary> int optionType; + /// <summary> + /// 鏄惁涓鸿В缁戦獙璇� + /// </summary> + public bool isUnbind; + + /// <summary> + /// + /// </summary> + Button btnTitle; + /// <summary> + /// + /// </summary> + Button btnContent; + + /// <summary> + /// ChangeBindAccountPage + /// </summary> public ChangeBindAccountPage() { bodyView = this; @@ -25,18 +51,18 @@ /// <param name="optionType">鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満</param> /// <param name="titleId"></param> /// <param name="contentTitleId"></param> - public void LoadPage(Action<string> act, int opt, int titleId, int contentTitleId) + public void LoadPage(Action<string> act, int opt, int titleId) { action = act; optionType = opt; string account; if (optionType == 0) { - account = MainPage.LoginUser.userEmailInfo; + account = UserInfo.Current.userEmailInfo; } else { - account = MainPage.LoginUser.userMobileInfo; + account = UserInfo.Current.userMobileInfo; } bodyView.BackgroundColor = CSS_Color.BackgroundColor; new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); @@ -49,24 +75,24 @@ }; bodyView.AddChidren(rowView); - Button btnTitle = new Button() + btnTitle = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(180), TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextAlignment = TextAlignment.CenterLeft, - TextID = contentTitleId, + //TextID = contentTitleId, }; rowView.AddChidren(btnTitle); - Button btnContent = new Button() + btnContent = new Button() { Width = Application.GetRealWidth(359), TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, TextAlignment = TextAlignment.CenterRight, - Text = optionType == 1 ? MainPage.LoginUser.userEmailInfo : MainPage.LoginUser.userMobileInfo, + //Text = optionType == 1 ? UserInfo.Current.userEmailInfo : UserInfo.Current.userMobileInfo, }; rowView.AddChidren(btnContent); @@ -88,7 +114,10 @@ }; bodyView.AddChidren(btnChangeBind); - if (!string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo)) + + + //鍚屾椂缁戝畾閭鎴栬�呮墜鏈烘墠鏄剧ず"鏇存崲楠岃瘉鏂瑰紡" + if (!string.IsNullOrEmpty( UserInfo.Current.userMobileInfo) && !string.IsNullOrEmpty( UserInfo.Current.userEmailInfo)) { Button btnChangeGetVer = new Button() { @@ -106,7 +135,27 @@ LoadEvent_ChangeVerificationMethod(btnChangeGetVer, btnTitle, btnContent); } + SetContentTitleId(); LoadEvent_GetVerification(btnChangeBind, titleId); + } + + /// <summary> + /// 璁剧疆鎸夐挳鎻愮ず鏂囧瓧 + /// 淇敼缁戝畾鏃舵彁绀猴細鎵嬫満楠岃瘉銆侀偖绠遍獙璇� + /// 瑙g粦鏃舵彁绀猴細褰撳墠鎵嬫満鎵嬫満鍙风爜銆佸綋鍓嶉偖绠卞湴鍧� + /// </summary> + void SetContentTitleId() + { + if (optionType == 2) + { + btnTitle.TextID = isUnbind ? StringId.CurPhone : StringId.PhoneNumberVerification; + btnContent.Text = UserInfo.Current.userMobileInfo; + } + else + { + btnTitle.TextID = isUnbind ? StringId.CurrentEmail : StringId.EmailVerification; + btnContent.Text = UserInfo.Current.userEmailInfo; + } } } @@ -121,16 +170,7 @@ btn.MouseUpEventHandler = (sender, e) => { optionType = optionType == 1 ? 2 : 1; - if (optionType == 2) - { - btnTitle.TextID = StringId.CurPhone; - btnContent.Text = MainPage.LoginUser.userMobileInfo; - } - else - { - btnTitle.TextID = StringId.CurrentEmail; - btnContent.Text = MainPage.LoginUser.userEmailInfo; - } + SetContentTitleId(); }; } @@ -146,47 +186,64 @@ { new Thread(() => { - if (optionType == 1) + //1.鑾峰彇楠岃瘉鐮�,閲囩敤鏁忔劅鏁版嵁楠岃瘉 + ResponsePackNew resultObj; + if (optionType == 1)//閭 { - var resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, MainPage.LoginUser.userEmailInfo); + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, UserInfo.Current.userEmailInfo); + } + else + { + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.SENSITIVE_DATA, UserInfo.Current.userMobileInfo, true, UserInfo.Current.areaCode); + } - } - else if (optionType == 2) + if (resultObj.Code != StateCode.SUCCESS) { - var resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, MainPage.LoginUser.userMobileInfo, true, MainPage.LoginUser.areaCode.ToString()); + // 鎻愮ず閿欒 + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } - }) - { IsBackground = true }.Start(); - } - if (time == 0) - { - time = 60; - new Thread(() => - { - while (time > 0) + else { - time--; + if (time == 0) + { + time = 60; + new Thread(() => + { + while (time > 0) + { + time--; + Application.RunOnMainThread(() => + { + button.Text = time.ToString() + "s"; + }); + Thread.Sleep(1000); + } + Application.RunOnMainThread(() => + { + button.IsSelected = true; + button.TextID = StringId.GetVerificationCode; + button.BackgroundColor = CSS_Color.MainColor; + time = 0; + }); + }) + { IsBackground = true }.Start(); + } Application.RunOnMainThread(() => { - button.Text = time.ToString() + "s"; + button.BackgroundColor = CSS_Color.PromptingColor1; + var vcp = new ChangeBindVerificationCodePage(); + vcp.isUnbind = isUnbind; + MainPage.BasePageView.AddChidren(vcp); + vcp.LoadPage(action, titleId, optionType, time); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); - Thread.Sleep(1000); } - Application.RunOnMainThread(() => - { - button.IsSelected = true; - button.TextID = StringId.GetVerificationCode; - button.BackgroundColor = CSS_Color.MainColor; - time = 0; - }); + }) { IsBackground = true }.Start(); } - button.BackgroundColor = CSS_Color.PromptingColor1; - var vcp = new VerificationCodePage(); - MainPage.BasePageView.AddChidren(vcp); - vcp.LoadPage(action, titleId, optionType, time); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }; } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindVerificationCodePage.cs similarity index 100% rename from HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/VerificationCodePage.cs rename to HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/ChangeBindVerificationCodePage.cs diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs new file mode 100644 index 0000000..494fc3f --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindAccountPage.cs @@ -0,0 +1,225 @@ +锘縰sing System; +using Shared; +using HDL_ON.UI.CSS; +using System.Threading; +using System.Text.RegularExpressions; +using HDL_ON.DAL.Server; + + +namespace HDL_ON.UI +{ + /// <summary> + /// 鏂扮粦瀹氭垨鑰呮崲缁�--鎵嬫満鎴栬�呴偖绠卞彂閫侀獙璇佺爜 + /// </summary> + public partial class NewBindAccountPage : FrameLayout + { + FrameLayout bodyView; + Button btnBind; + EditText etContent; + Action<string> action; + + /// <summary> + /// 鏍囬ID + /// </summary> + int titleId; + /// <summary> + /// 鏄惁鎵嬫満 + /// </summary> + bool isPhone; + /// <summary> + /// 鏄惁鎹㈢粦 + /// </summary> + bool isModifyBind; + + /// <summary> + /// 鎵嬫満鍖哄彿 + /// </summary> + string phoneZoneCode = "86"; + + /// <summary> + /// + /// </summary> + public NewBindAccountPage() + { + bodyView = this; + } + + /// <summary> + /// LoadPage + /// </summary> + /// <param name="act"></param> + /// <param name="isPhone">鏄惁缁戝畾鎵嬫満</param> + public void LoadPage(Action<string> act, bool isPhone = false, bool isModifyBind = false) + { + action = act; + this.isPhone = isPhone; + this.isModifyBind = isModifyBind; + if (isModifyBind) + { + //淇敼缁戝畾 + titleId = isPhone ? StringId.ModifyBindingPhone : StringId.ModifyBindingEmail; + } + else + { + //鏂扮粦瀹� + titleId = isPhone ? StringId.BoundMobileInfo : StringId.BoundEmailInfo; + } + + + + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); + + FrameLayout rowView = new FrameLayout() + { + Y = Application.GetRealHeight(72), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(rowView); + + //缁戝畾閭鎴栬�呯粦瀹氭墜鏈哄彿 + Button btnTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(180), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = titleId, + }; + rowView.AddChidren(btnTitle); + + etContent = new EditText() + { + Width = Application.GetRealWidth(359), + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterRight, + Foucs = true + }; + rowView.AddChidren(etContent); + + btnBind = new Button() + { + Y = Application.GetRealHeight(213), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(220), + Height = Application.GetRealHeight(44), + BackgroundColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + TextID = StringId.GetVerificationCode, + TextSize = CSS_FontSize.SubheadingFontSize, + IsBold = true, + Radius = (uint)Application.GetRealWidth(22), + BorderColor = 0x00000000, + BorderWidth = 0, + }; + bodyView.AddChidren(btnBind); + + //鐐瑰嚮鑾峰彇楠岃瘉鐮� + LoadEvent_GetVerification(btnBind); + + } + } + + + //-------------------------------------------- + public partial class NewBindAccountPage + { + /// <summary> + /// 鐐瑰嚮鑾峰彇楠岃瘉鐮� + /// </summary> + void LoadEvent_GetVerification(Button button) + { + button.MouseUpEventHandler = (sender, e) => + { + if (button.Text == Language.StringByID(StringId.GetVerificationCode)) + { + Application.HideSoftInput(); + var account = etContent.Text.Trim(); + #region 姝e垯琛ㄨ揪寮� + //1.妫�娴嬭处鍙锋槸鍚﹀悎娉� + if (!isPhone) + { + if (!Utlis.CheckEmail(account)) + { + Utlis.ShowTip(Language.StringByID(StringId.PlsEntryCorrectEmailAddress)); + return; + } + } + else + { + if (!Utlis.CheckPhoneNumber(account, phoneZoneCode)) + { + Utlis.ShowTip(Language.StringByID(StringId.PlsEntryCorrectMobilNeumber)); + return; + } + } + #endregion + int time = 0; + //2.妫�楠岄�氳繃 + new Thread(() => + { + //2.2 鑾峰彇楠岃瘉鐮� + ResponsePackNew resultObj; + if (!isPhone)//閭 + { + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account); + } + else + { + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, account, true, phoneZoneCode); + } + + if (resultObj.Code != StateCode.SUCCESS) + { + // 鎻愮ず閿欒 + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); + } + else + { + if (time == 0) + { + time = 60; + new Thread(() => + { + while (time > 0) + { + time--; + Application.RunOnMainThread(() => + { + button.Text = time.ToString() + "s"; + }); + Thread.Sleep(1000); + } + Application.RunOnMainThread(() => + { + button.IsSelected = true; + button.TextID = StringId.GetVerificationCode; + button.BackgroundColor = CSS_Color.MainColor; + time = 0; + }); + }) + { IsBackground = true }.Start(); + } + Application.RunOnMainThread(() => + { + button.BackgroundColor = CSS_Color.PromptingColor1; + var vcp = new NewBindVerificationCodePage(); + vcp.phoneZoneCode = phoneZoneCode; + MainPage.BasePageView.AddChidren(vcp); + vcp.LoadPage(action, titleId, account, isPhone, time, isModifyBind); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + } + + }) + { IsBackground = true }.Start(); + } + + }; + } + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs new file mode 100644 index 0000000..91255e5 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AccountBindInfo/NewBindVerificationCodePage.cs @@ -0,0 +1,711 @@ +锘縰sing System; +using Shared; +using HDL_ON.UI.CSS; +using System.Threading; +using HDL_ON.DAL.Server; + +namespace HDL_ON.UI +{ + /// <summary> + /// 鏂扮粦瀹氭垨鑰呮崲缁�--楠岃瘉鐮侀獙璇佸苟缁戝畾 + /// </summary> + public partial class NewBindVerificationCodePage : FrameLayout + { + FrameLayout bodyView; + + Button btnNum1; + Button btnNum1Line; + + Button btnNum2; + Button btnNum2Line; + + Button btnNum3; + Button btnNum3Line; + + Button btnNum4; + Button btnNum4Line; + + Button btnNum5; + Button btnNum5Line; + + Button btnNum6; + Button btnNum6Line; + + EditText et; + + Button btnResend; + + Button btnTip; + + Action<string> action; + + int titleId; + + ///// <summary> + ///// 鎿嶄綔鐩爣绫诲瀷 1:閭锛�2:鎵嬫満 + ///// </summary> + //int optionType; + /// <summary> + /// 鍊掕鏃舵椂闂� + /// </summary> + int time = 0; + /// <summary> + /// 鏄惁鎵嬫満 + /// </summary> + public bool isPhone; + /// <summary> + /// 鏄惁鎹㈢粦 + /// </summary> + public bool isModifyBind; + + /// <summary> + /// 鏂扮粦瀹氱殑璐﹀彿 + /// </summary> + public string verAccount; + /// <summary> + /// 鎵嬫満鍖哄彿 + /// </summary> + public string phoneZoneCode = "86"; + + + public NewBindVerificationCodePage() + { + bodyView = this; + } + + /// </summary> + /// <param name="act">鍥炴帀鍑芥暟</param> + /// <param name="tId">椤甸潰鏍囬</param> + /// <param name="account">璐﹀彿</param> + /// <param name="bPhone">鏄惁鎵嬫満</param> + /// <param name="t">鍊掕鏃舵椂闂�</param> + /// <param name="isModifyBind">鏄惁涓轰慨鏀圭粦瀹�</param> + public void LoadPage(Action<string> act, int tId, string account, bool bPhone, int t, bool isModifyBind) + { + action = act; + titleId = tId; + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + isPhone = bPhone; + time = t; + this.verAccount = account; + this.isModifyBind = isModifyBind; + + Action backAction = () => { + Application.HideSoftInput(); + BackConfirmAction(); + }; + new TopViewDiv(bodyView, Language.StringByID(tId), false).LoadTopView(backAction); + + btnTip = new Button() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(84), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.Center, + TextID = StringId.VerificationCodePrompt, + }; + bodyView.AddChidren(btnTip); + + btnNum1 = new Button() + { + X = Application.GetRealWidth(24), + Y = Application.GetRealHeight(156), + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(38), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + }; + bodyView.AddChidren(btnNum1); + + btnNum1Line = new Button() + { + X = Application.GetRealWidth(24), + Y = btnNum1.Bottom, + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(2), + BackgroundColor = CSS_Color.PromptingColor2, + SelectedBackgroundColor = CSS_Color.MainColor, + IsSelected = true + }; + bodyView.AddChidren(btnNum1Line); + + btnNum2 = new Button() + { + X = Application.GetRealWidth(80), + Y = Application.GetRealHeight(156), + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(38), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + }; + bodyView.AddChidren(btnNum2); + + btnNum2Line = new Button() + { + X = Application.GetRealWidth(80), + Y = btnNum2.Bottom, + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.PromptingColor2, + SelectedBackgroundColor = CSS_Color.MainColor, + }; + bodyView.AddChidren(btnNum2Line); + + btnNum3 = new Button() + { + X = Application.GetRealWidth(136), + Y = Application.GetRealHeight(156), + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(38), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + }; + bodyView.AddChidren(btnNum3); + + btnNum3Line = new Button() + { + X = Application.GetRealWidth(136), + Y = btnNum3.Bottom, + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.PromptingColor2, + SelectedBackgroundColor = CSS_Color.MainColor, + }; + bodyView.AddChidren(btnNum3Line); + + btnNum4 = new Button() + { + X = Application.GetRealWidth(192), + Y = Application.GetRealHeight(156), + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(38), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + }; + bodyView.AddChidren(btnNum4); + + btnNum4Line = new Button() + { + X = Application.GetRealWidth(192), + Y = btnNum4.Bottom, + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.PromptingColor2, + SelectedBackgroundColor = CSS_Color.MainColor, + }; + bodyView.AddChidren(btnNum4Line); + + btnNum5 = new Button() + { + X = Application.GetRealWidth(248), + Y = Application.GetRealHeight(156), + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(38), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + }; + bodyView.AddChidren(btnNum5); + + btnNum5Line = new Button() + { + X = Application.GetRealWidth(248), + Y = btnNum5.Bottom, + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.PromptingColor2, + SelectedBackgroundColor = CSS_Color.MainColor, + }; + bodyView.AddChidren(btnNum5Line); + + btnNum6 = new Button() + { + X = Application.GetRealWidth(304), + Y = Application.GetRealHeight(156), + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(38), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + IsBold = true, + }; + bodyView.AddChidren(btnNum6); + + btnNum6Line = new Button() + { + X = Application.GetRealWidth(304), + Y = btnNum6.Bottom, + Width = Application.GetRealWidth(48), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.PromptingColor2, + SelectedBackgroundColor = CSS_Color.MainColor, + }; + bodyView.AddChidren(btnNum6Line); + + et = new EditText() + { + Y = Application.GetRealHeight(276), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(100), + Height = Application.GetRealHeight(10), + IsNumberKeyboardType = true, + Foucs = true, + }; + bodyView.AddChidren(et); + + btnResend = new Button() + { + Y = Application.GetRealHeight(276), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(220), + Height = Application.GetRealHeight(44), + SelectedBackgroundColor = CSS_Color.MainColor, + BackgroundColor = CSS_Color.PromptingColor1, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + TextID = StringId.Resend, + TextSize = CSS_FontSize.SubheadingFontSize, + IsBold = true, + Radius = (uint)Application.GetRealWidth(22), + BorderColor = 0x00000000, + BorderWidth = 0, + }; + bodyView.AddChidren(btnResend); + + LoadThread_SendVerCode(); + LoadEvent_Resend(); + LoadEvent_VerificationEntryEvent(); + } + } + + + //--------------------------------------------- + public partial class NewBindVerificationCodePage + { + /// <summary> + /// 楠岃瘉鐮佽緭鍏ュ彉鍖栦簨浠� + /// </summary> + void LoadEvent_VerificationEntryEvent() + { + EventHandler<MouseEventArgs> clickEvent = (sender, e) => { + et.Foucs = true; + var etCode = et.Text; + switch (etCode.Length) + { + case 0: + btnNum1Line.IsSelected = true; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum1Line.Height = Application.GetRealHeight(2); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + break; + case 1: + btnNum2Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(2); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + break; + case 2: + btnNum3Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(3); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + break; + case 3: + btnNum4Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(4); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + break; + case 4: + btnNum5Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(5); + btnNum6Line.Height = Application.GetRealHeight(1); + break; + case 5: + btnNum6Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(2); + break; + } + }; + btnNum1.MouseUpEventHandler = clickEvent; + btnNum2.MouseUpEventHandler = clickEvent; + btnNum3.MouseUpEventHandler = clickEvent; + btnNum4.MouseUpEventHandler = clickEvent; + btnNum5.MouseUpEventHandler = clickEvent; + btnNum6.MouseUpEventHandler = clickEvent; + + et.TextChangeEventHandler = (sender, e) => { + var etCode = et.Text; + switch (etCode.Length) + { + case 0: + btnNum1Line.IsSelected = true; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum1Line.Height = Application.GetRealHeight(2); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + btnNum1.Text = ""; + btnNum2.Text = ""; + btnNum3.Text = ""; + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; + break; + case 1: + btnNum2Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum1.Text = etCode.Substring(0, 1); + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(2); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + btnNum2.Text = ""; + btnNum3.Text = ""; + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; + break; + case 2: + btnNum3Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum2.Text = etCode.Substring(1, 1); + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(2); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + btnNum3.Text = ""; + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; + break; + case 3: + btnNum4Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum3.Text = etCode.Substring(2, 1); + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(2); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(1); + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; + break; + case 4: + btnNum5Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum6Line.IsSelected = false; + btnNum4.Text = etCode.Substring(3, 1); + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(2); + btnNum6Line.Height = Application.GetRealHeight(1); + btnNum5.Text = ""; + btnNum6.Text = ""; + break; + case 5: + btnNum6Line.IsSelected = true; + btnNum1Line.IsSelected = false; + btnNum2Line.IsSelected = false; + btnNum3Line.IsSelected = false; + btnNum4Line.IsSelected = false; + btnNum5Line.IsSelected = false; + btnNum5.Text = etCode.Substring(4, 1); + btnNum1Line.Height = Application.GetRealHeight(1); + btnNum2Line.Height = Application.GetRealHeight(1); + btnNum3Line.Height = Application.GetRealHeight(1); + btnNum4Line.Height = Application.GetRealHeight(1); + btnNum5Line.Height = Application.GetRealHeight(1); + btnNum6Line.Height = Application.GetRealHeight(2); + btnNum6.Text = ""; + break; + case 6: + btnNum6.Text = etCode.Substring(5, 1); + et.Foucs = false; + new Thread(() => + { + bool result = false; + Action act = () => { }; + Application.RunOnMainThread(() => + { + act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); + }); + + var resultObj = new HttpServerRequest().BindAccount(verAccount, etCode, isPhone); + if (resultObj == StateCode.SUCCESS) + { + result = true; + } + else + { + //澶辫触鎻愮ず + IMessageCommon.Current.ShowErrorInfoAlter(resultObj); + } + Application.RunOnMainThread(() => + { + act(); + }); + if (result) + { + //缁戝畾鎴愬姛 + BindSuccess(); + + } + }) + { IsBackground = true }.Start(); + + break; + } + }; + } + + /// <summary> + /// 缁戝畾鎴愬姛 + /// </summary> + void BindSuccess() + { + Application.RunOnMainThread(() => + { + var tipTitle = ""; + var tipMsg = ""; + if (isPhone) + { + UserInfo.Current.userMobileInfo = verAccount; + //璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP + tipMsg = Language.StringByID(StringId.PleaseLoginWithNewMobileAccount); + if (isModifyBind) + { + //鐧诲綍鎵嬫満淇敼瀹屾垚 + tipTitle = Language.StringByID(StringId.LoginMobileAccountModificationCompleted); + } + else + { + //鐧诲綍鎵嬫満缁戝畾瀹屾垚 + tipTitle = Language.StringByID(StringId.LoginMobileAccountBindCompleted); + } + } + else + { + UserInfo.Current.userEmailInfo = verAccount; + //璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP + tipMsg = Language.StringByID(StringId.PleaseLoginWithNewEmailAccount); + if (isModifyBind) + { + //鐧诲綍閭淇敼瀹屾垚 + tipTitle = Language.StringByID(StringId.LoginEmailAccountModificationCompleted); + } + else + { + //鐧诲綍閭缁戝畾瀹屾垚 + tipTitle = Language.StringByID(StringId.LoginEmailAccountBindCompleted); + + } + } + + var page = new OperationResultDisPalyPage(); + page.Show(); + page.LoadPage(true, Language.StringByID(titleId), tipTitle, tipMsg); + + if (isModifyBind) + { + ClosePageWithCount(3); + } + else + { + ClosePageWithCount(2); + } + + action(verAccount); + }); + } + + /// <summary> + /// 鎸囧畾鍏抽棴椤甸潰涓暟 + /// </summary> + /// <param name="countPage"></param> + void ClosePageWithCount(int countPage) + { + //鍏抽棴澶氬皯涓〉闈� + for (int i = 0; i < countPage; i++) + { + MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + } + } + + /// <summary> + /// 閲嶅彂楠岃瘉鐮佺瓑寰呯嚎绋� + /// </summary> + void LoadThread_SendVerCode() + { + btnResend.IsSelected = false; + et.Foucs = true; + if (time == 0) + { + time = 60; + new Thread(() => + { + //2.2 鑾峰彇楠岃瘉鐮� + ResponsePackNew resultObj; + if (!isPhone)//閭 + { + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount); + } + else + { + resultObj = new HttpServerRequest().VerificationCodeSend(VerifyType.REGISTER_USER_SYSTEM, verAccount, true, phoneZoneCode); + } + + + }) + { IsBackground = true }.Start(); + } + new Thread(() => + { + while (time > 0) + { + time--; + Application.RunOnMainThread(() => + { + btnResend.Text = time.ToString() + "s"; + }); + Thread.Sleep(1000); + } + Application.RunOnMainThread(() => + { + btnResend.IsSelected = true; + btnResend.TextID = StringId.GetVerificationCode; + time = 0; + }); + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 閲嶅彂楠岃瘉鐮佷簨浠� + /// </summary> + void LoadEvent_Resend() + { + btnResend.MouseUpEventHandler = (sender, e) => { + LoadThread_SendVerCode(); + }; + } + + /// <summary> + /// 杩斿洖浜屾纭浜嬩欢 + /// </summary> + void BackConfirmAction() + { + //楠岃瘉鐮佸彂閫佹垚鍔燂紝浜屾纭閫�鍑� + if (btnTip.TextID == StringId.VerificationCodePrompt) + { + Action cancelAction = () => + { + if (bodyView != null) + { + bodyView.RemoveFromParent(); + } + }; + new ConfirmDialog().ShowDialog(StringId.Tip, StringId.VerificationCodeMayBeDelayed, null, cancelAction, StringId.ReturnStr, StringId.WaitAMoment); + } + else + { + //鐩存帴鍏抽棴 + if (bodyView != null) + { + bodyView.RemoveFromParent(); + } + } + } + + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/ChooseShareMemberTargetListPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/ChooseShareMemberTargetListPageBLL.cs index 76a5282..d3bf8f2 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/ChooseShareMemberTargetListPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/ChooseShareMemberTargetListPageBLL.cs @@ -236,7 +236,7 @@ else { //鎻愮ず - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Child_FindAll, responePack.Code); + IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); //璐﹀彿鎴栬�呭瘑鐮侀敊璇� Application.RunOnMainThread(() => { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs index 52dbfc3..79c7a1d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPageBLL.cs @@ -111,7 +111,7 @@ else { //鎻愮ず - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Child_FindAll, responePack.Code); + IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); //璐﹀彿鎴栬�呭瘑鐮侀敊璇� Application.RunOnMainThread(() => { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs index e97c197..0763905 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs @@ -17,8 +17,8 @@ { Action action = () => { - ResponsePack responePack = new HttpServerRequest().DeleteResidenceMemberAccount(memberInfo.SubAccountDistributedMark); - if (responePack.StateCode.ToUpper() == StateCode.SUCCESS) + var responePack = new HttpServerRequest().DeleteResidenceMemberAccount(memberInfo); + if (responePack.Code == StateCode.SUCCESS) { this.RemoveFromParent(); backAction(); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index 4bcc52c..f6d7949 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -61,10 +61,10 @@ }; dispalyView.AddChidren(contentView); - if (MainPage.LoginUser.regionList.Count < 3) + if ( UserInfo.Current.regionList.Count < 3) { } - else if (MainPage.LoginUser.regionList.Count < 4) + else if ( UserInfo.Current.regionList.Count < 4) { dispalyView = new FrameLayout() { @@ -79,7 +79,7 @@ contentView.Height = Application.GetRealHeight(45 * 3); dispalyView.AddChidren(contentView); } - else if (MainPage.LoginUser.regionList.Count < 5) + else if ( UserInfo.Current.regionList.Count < 5) { dispalyView = new FrameLayout() { @@ -113,7 +113,7 @@ - foreach (var home in MainPage.LoginUser.regionList) + foreach (var home in UserInfo.Current.regionList) { var btnHomeName = new Button() { @@ -130,7 +130,7 @@ }; contentView.AddChidren(btnHomeName); - if (MainPage.LoginUser.regionList.IndexOf(home) < MainPage.LoginUser.regionList.Count - 1) + if ( UserInfo.Current.regionList.IndexOf(home) < UserInfo.Current.regionList.Count - 1) { contentView.AddChidren(new Button() { @@ -145,7 +145,7 @@ var regionId = (string)btnHomeName.Tag; dialog.Close(); //DB_ResidenceData.residenceData.CurReginID = regionId; - LoadEvent_ChangeCurHome(MainPage.LoginUser.regionList.Find((obj) => obj.RegionID == regionId)); + LoadEvent_ChangeCurHome( UserInfo.Current.regionList.Find((obj) => obj.RegionID == regionId)); LoadContentView(); }; } @@ -208,7 +208,7 @@ } //鍊掑嚭鏂颁綇瀹呮暟鎹� FileUtils.RestoreRegionFiles(newRegionRootPath); - MainPage.LoginUser.SaveUserInfo(); + UserInfo.Current.SaveUserInfo(); DB_ResidenceData.residenceData.EixtAccount(); DB_ResidenceData.residenceData.CurReginID = homeTemp.RegionID; OnAppConfig.Instance.SaveUserConfig(); @@ -270,11 +270,11 @@ { Action updataHeadImage = () => { - userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath; + userHeadImageView.ImagePath = UserInfo.Current.headImagePagePath; }; Action updataUserName = () => { - btnUserName.Text = MainPage.LoginUser.userName; + btnUserName.Text = UserInfo.Current.userName; }; var personalDataView = new PersonalDataPage(updataHeadImage, updataUserName); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs index 57dd341..f915cbe 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs @@ -171,7 +171,7 @@ /// </summary> Action updataUserName; - public PersonalDataPage(Action upHeadImage,Action upUserName) + public PersonalDataPage(Action upHeadImage, Action upUserName) { updataHeadImage = upHeadImage; updataUserName = upUserName; @@ -197,7 +197,7 @@ Width = Application.GetMinRealAverage(84), Height = Application.GetMinRealAverage(84), Radius = (uint)Application.GetMinRealAverage(42), - ImagePath = MainPage.LoginUser.headImagePagePath, + ImagePath = UserInfo.Current.headImagePagePath, }; headPortraitView.AddChidren(userHeadImageView); @@ -245,7 +245,7 @@ TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, - Text = string.IsNullOrEmpty(MainPage.LoginUser.userName) ? "涓嶆効鎰忛�忛湶濮撳悕鐨勭敤鎴�" : MainPage.LoginUser.userName + Text = string.IsNullOrEmpty( UserInfo.Current.userName) ? Language.StringByID(StringId.UsersWhoNameIsEmpty) : UserInfo.Current.userName }; userNameView.AddChidren(btnUserName); /// <summary> @@ -342,7 +342,7 @@ TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, - Text = string.IsNullOrEmpty(MainPage.LoginUser.userEmailInfo) ? Language.StringByID(StringId.Unbound) : MainPage.LoginUser.userEmailInfo + Text = GetBindAccountText( UserInfo.Current.userEmailInfo) }; userEmailInfoView.AddChidren(btnUserEmailInfo); /// <summary> @@ -391,7 +391,7 @@ TextAlignment = TextAlignment.CenterRight, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.TextFontSize, - Text = string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo) ? Language.StringByID(StringId.Unbound) : MainPage.LoginUser.userMobileInfo + Text = GetBindAccountText( UserInfo.Current.userMobileInfo) }; userPhoneInfoView.AddChidren(btnUserPhoneInfo); /// <summary> @@ -532,7 +532,7 @@ }; bodyView.AddChidren(btnLogout); - if(MainPage.Increase) + if (MainPage.Increase) { btnLogout.Y = Application.GetRealHeight(613); btnLogout.Height = Application.GetRealHeight(50); @@ -540,6 +540,7 @@ } LoadEventList(); + } /// <summary> @@ -617,5 +618,24 @@ LoadEvent_PictureOptionViewEventList(pictureBaseView); } + + /// <summary> + /// 鑾峰彇缁戝畾璐﹀彿鏄剧ず鏂囨湰锛岀┖鐨勬椂鍊欐樉绀轰负鏈粦瀹� + /// </summary> + /// <param name="account"></param> + string GetBindAccountText(string account) + { + return string.IsNullOrEmpty(account) ? Language.StringByID(StringId.Unbound) : account; + } + + /// <summary> + /// 鍒ゆ柇鏄惁涓烘湭缁戝畾 + /// </summary> + /// <param name="account"></param> + /// <returns></returns> + bool CheckIfUnbound(string account) + { + return string.IsNullOrEmpty(account) || account == Language.StringByID(StringId.Unbound); + } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs index e2208cb..c1eab97 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs @@ -19,6 +19,7 @@ LoadEvent_ChangeBindEmail(); LoadEvent_ChangeBindPhone(); LoadEvent_SkipModifyPassword(); + GetUserInfo(); } /// <summary> @@ -33,46 +34,58 @@ } /// <summary> + /// 閫�鍑虹櫥褰曟搷浣� + /// </summary> + void Logout() + { + #region 淇濆瓨鏈湴鏁版嵁鑷虫枃浠跺す + string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); + new System.Threading.Thread(() => + { + try + { + var backuplist = FileUtils.ReadFiles(); + FileUtils.DeleteRegionFiles(oldRegionRootPath); + //绉诲姩鏂囦欢 + foreach (var fileName in backuplist) + { + System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); + if (fileInfo.Exists) + { + fileInfo.MoveTo(oldRegionRootPath + fileName); + MainPage.Log("move file : " + fileName); + } + } + } + catch (Exception ex) + { + MainPage.Log($"xxx:{ex.Message}"); + } + finally + { + FileUtils.DeleteAllFile(); + } + }).Start(); + #endregion + + UserInfo.Current.lastTime = DateTime.MinValue; + UserInfo.Current.SaveUserInfo(); + MainPage.GoLoginPage(UserInfo.Current); + DB_ResidenceData.residenceData.EixtAccount(); + } + + /// <summary> /// 閫�鍑鸿处鍙风櫥褰曚簨浠� /// </summary> void LoadEvent_Logout() { btnLogout.MouseUpEventHandler += (sender, e) => { - #region 淇濆瓨鏈湴鏁版嵁鑷虫枃浠跺す - string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); - new System.Threading.Thread(() => + Action okAction = () => { - try - { - var backuplist = FileUtils.ReadFiles(); - FileUtils.DeleteRegionFiles(oldRegionRootPath); - //绉诲姩鏂囦欢 - foreach (var fileName in backuplist) - { - System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); - if (fileInfo.Exists) - { - fileInfo.MoveTo(oldRegionRootPath + fileName); - MainPage.Log("move file : " + fileName); - } - } - } - catch (Exception ex) - { - MainPage.Log($"xxx:{ex.Message}"); - } - finally - { - FileUtils.DeleteAllFile(); - } - }).Start(); - #endregion - - MainPage.LoginUser.lastTime = DateTime.MinValue; - MainPage.LoginUser.SaveUserInfo(); - MainPage.GoLoginPage(MainPage.LoginUser); - DB_ResidenceData.residenceData.EixtAccount(); + Logout(); + }; + new ConfirmDialog().ShowDialog(StringId.Tip, StringId.IfConfirmLogout, okAction); }; } @@ -85,7 +98,8 @@ { baseView.RemoveFromParent(); }; - baseView.MouseUpEventHandler = (sender, e) => { + baseView.MouseUpEventHandler = (sender, e) => + { baseView.RemoveFromParent(); }; btnCancel.MouseUpEventHandler = (sender, e) => @@ -105,7 +119,7 @@ { if (imagePath != null) { - MainPage.LoginUser.headImagePagePath = imagePath.ToString(); + UserInfo.Current.headImagePagePath = imagePath.ToString(); userHeadImageView.ImagePath = imagePath.ToString(); updataHeadImage(); new System.Threading.Thread(() => @@ -113,7 +127,7 @@ new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); }) { IsBackground = true }.Start(); - MainPage.LoginUser.SaveUserInfo(); + UserInfo.Current.SaveUserInfo(); MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); } }), pid.ToString(), 1, 1); @@ -134,7 +148,7 @@ { if (imagePath != null) { - MainPage.LoginUser.headImagePagePath = imagePath.ToString(); + UserInfo.Current.headImagePagePath = imagePath.ToString(); userHeadImageView.ImagePath = imagePath.ToString(); updataHeadImage(); @@ -142,7 +156,7 @@ { new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); }) - { IsBackground = true }.Start(); MainPage.LoginUser.SaveUserInfo(); + { IsBackground = true }.Start(); UserInfo.Current.SaveUserInfo(); MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); } }, pid.ToString(), 1, 1); @@ -170,7 +184,7 @@ }.Show(bodyView); return; } - if(str == MainPage.LoginUser.userName) + if (str == UserInfo.Current.userName) { return; } @@ -183,8 +197,8 @@ var resultObj = new HttpServerRequest().EditUserName(str); if (resultObj.Code == StateCode.SUCCESS) { - MainPage.LoginUser.userName = str; - MainPage.LoginUser.SaveUserInfo(); + UserInfo.Current.userName = str; + UserInfo.Current.SaveUserInfo(); Application.RunOnMainThread(() => { btnUserName.Text = str; @@ -194,7 +208,7 @@ else { //澶辫触鎻愮ず - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Member_UpdateMemberInfo, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } } catch (Exception ex) @@ -211,7 +225,7 @@ }) { IsBackground = true }.Start(); }; - new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, MainPage.LoginUser.userName, callBack, StringId.UesrNameCannotBeEmpty, 0, new System.Collections.Generic.List<string>()); + new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, UserInfo.Current.userName, callBack, StringId.UesrNameCannotBeEmpty, 0, new System.Collections.Generic.List<string>()); }; btnUserName.MouseUpEventHandler = eventHandler; btnEditUserNameIcon.MouseUpEventHandler = eventHandler; @@ -223,36 +237,65 @@ /// </summary> void LoadEvent_ChangeBindEmail() { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { Action<string> action = (email) => { - btnUserEmailInfo.Text = email; + + btnUserEmailInfo.Text = GetBindAccountText(email); }; - var aep = new AccountBindInfoPage(); - MainPage.BasePageView.AddChidren(aep); - aep.LoadPage(action,1,StringId.EmailAddress); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (CheckIfUnbound(btnUserEmailInfo.Text)) + { + //鏈粦瀹�,璺宠浆鏂扮粦瀹氶〉闈� + var aep = new NewBindAccountPage(); + MainPage.BasePageView.AddChidren(aep); + aep.LoadPage(action); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + var aep = new AccountBindInfoPage(); + MainPage.BasePageView.AddChidren(aep); + aep.LoadPage(action, 1, StringId.EmailAddress); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + }; btnUserEmailInfo.MouseUpEventHandler = eventHandler; btnUserEmailRight.MouseUpEventHandler = eventHandler; userEmailInfoView.MouseUpEventHandler = eventHandler; } + /// <summary> /// 淇敼缁戝畾鎵嬫満 /// </summary> void LoadEvent_ChangeBindPhone() { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { Action<string> action = (phone) => { - btnUserPhoneInfo.Text = phone; + btnUserPhoneInfo.Text = GetBindAccountText(phone); }; - var aep = new AccountBindInfoPage(); - MainPage.BasePageView.AddChidren(aep); - aep.LoadPage(action, 2, StringId.PhoneInfo); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (CheckIfUnbound(btnUserPhoneInfo.Text)) + { + //鏈粦瀹�,璺宠浆鏂扮粦瀹氶〉闈� + var aep = new NewBindAccountPage(); + MainPage.BasePageView.AddChidren(aep); + aep.LoadPage(action, true); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + var aep = new AccountBindInfoPage(); + MainPage.BasePageView.AddChidren(aep); + aep.LoadPage(action, 2, StringId.PhoneInfo); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + + }; btnUserPhoneInfo.MouseUpEventHandler = eventHandler; btnUserPhoneRight.MouseUpEventHandler = eventHandler; @@ -283,7 +326,8 @@ /// </summary> void LoadEvent_SkipModifyPassword() { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { var page = new ResetPasswordOptionPage(); MainPage.BasePageView.AddChidren(page); page.LoadPage(); @@ -294,5 +338,16 @@ resetPasswordView.MouseUpEventHandler = eventHandler; } + /// <summary> + /// + /// </summary> + void GetUserInfo() + { + new System.Threading.Thread(() => + { + new HttpServerRequest().GetUserInfo(); + }) + { IsBackground = true }.Start(); + } } } \ No newline at end of file diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordOptionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordOptionPage.cs index d2e3ef1..84e9419 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordOptionPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordOptionPage.cs @@ -93,7 +93,7 @@ { if (verificationOption == 0) { - if (string.IsNullOrEmpty(MainPage.LoginUser.userMobileInfo)) + if (string.IsNullOrEmpty( UserInfo.Current.userMobileInfo)) { LoadDialog_UnbindTipInfo(verificationOption); } @@ -102,13 +102,13 @@ this.RemoveFromParent(); var vcp = new ResetPasswordVerificationCodePage(); MainPage.BasePageView.AddChidren(vcp); - vcp.LoadPage(StringId.PhoneNumberVerification,2); + vcp.LoadPage(StringId.PhoneNumberVerification, true, UserInfo.Current.userMobileInfo); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } } else { - if (string.IsNullOrEmpty(MainPage.LoginUser.userEmailInfo)) + if (string.IsNullOrEmpty( UserInfo.Current.userEmailInfo)) { LoadDialog_UnbindTipInfo(verificationOption); } @@ -117,7 +117,7 @@ this.RemoveFromParent(); var vcp = new ResetPasswordVerificationCodePage(); MainPage.BasePageView.AddChidren(vcp); - vcp.LoadPage(StringId.EmailVerification,1); + vcp.LoadPage(StringId.EmailVerification, false, UserInfo.Current.userEmailInfo); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } } @@ -134,17 +134,8 @@ dialogView.MouseUpEventHandler = (sender, e) => { dialog.Close(); }; - - Button btnTitleIcon = new Button() - { - X = Application.GetRealWidth(108), - Y = Application.GetRealWidth(152), - Width = Application.GetRealWidth(160), - Height = Application.GetRealWidth(160), - UnSelectedImagePath = "PersonalCenter/ResetPassword/DialogTipTitleIcon.png" - }; - dialogView.AddChidren(btnTitleIcon); - + dialog.AddChidren(dialogView); + FrameLayout contentView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, @@ -156,6 +147,19 @@ }; dialogView.AddChidren(contentView); + Button btnTitleIcon = new Button() + { + X = Application.GetRealWidth(108), + Y = Application.GetRealWidth(152), + Width = Application.GetRealWidth(160), + Height = Application.GetRealWidth(160), + UnSelectedImagePath = "PersonalCenter/ResetPassword/DialogTipTitleIcon.png" + }; + dialogView.AddChidren(btnTitleIcon); + btnTitleIcon.MouseUpEventHandler = (sender, e) => { + dialog.Close(); + }; + Button btnMsg = new Button() { Gravity = Gravity.CenterHorizontal, @@ -164,7 +168,7 @@ Height = Application.GetRealWidth(62), TextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.SubheadingFontSize, - TextID = verificationOption == 0?StringId.UnBindPhoneNumberCannotVerification: StringId.UnBindEmailCannotVerification, + TextID = verificationOption == 0 ? StringId.UnBindPhoneNumberCannotVerification: StringId.UnBindEmailCannotVerification, }; contentView.AddChidren(btnMsg); @@ -177,7 +181,7 @@ TextAlignment = TextAlignment.Center, Radius = (uint)Application.GetRealWidth(22), BackgroundColor = CSS_Color.MainColor, - TextID = StringId.PhoneNumberVerification, + TextID = StringId.GoBind, TextSize = CSS_FontSize.SubheadingFontSize, TextColor = CSS_Color.MainBackgroundColor, }; @@ -187,10 +191,20 @@ { dialog.Close(); Action<string> action = (obj) => { }; - var vcp = new BindAccountPage(); - MainPage.BasePageView.AddChidren(vcp); - vcp.LoadPage(action, verificationOption == 0 ? StringId.BindPhone : StringId.BindEmail); + //var vcp = new BindAccountPage(); + //MainPage.BasePageView.AddChidren(vcp); + //vcp.LoadPage(action, verificationOption == 0 ? StringId.BindPhone : StringId.BindEmail); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + //鏄惁涓烘崲缁戞墜鏈� + var isPhone = verificationOption == 0; + //璺宠浆鏂扮粦瀹氶〉闈� + var aep = new NewBindAccountPage(); + MainPage.BasePageView.AddChidren(aep); + aep.LoadPage(action, isPhone); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }; dialog.Show(); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs index 5597092..ff630c4 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs @@ -2,12 +2,46 @@ using Shared; using HDL_ON.UI.CSS; using HDL_ON.DAL.Server; +using System.Threading; namespace HDL_ON.UI { public partial class ResetPasswordPage : FrameLayout { + /// <summary> + /// 鏄惁鎵嬫満 + /// </summary> + public bool isPhone; + /// <summary> + /// 璐﹀彿 + /// </summary> + public string account; + /// <summary> + /// 楠岃瘉鐮� + /// </summary> + public string verCode; + + #region 鎺т欢View + /// <summary> + /// 瀵嗙爜鏂囨湰妗� + /// </summary> + EditText etPassword; + /// <summary> + /// 纭瀵嗙爜鏂囨湰妗� + /// </summary> + EditText etRepeatPassword; + + /// <summary> + /// 淇敼鎸夐挳 + /// </summary> + Button btnReset; + + /// <summary> + /// + /// </summary> FrameLayout bodyView; + #endregion + public ResetPasswordPage() { bodyView = this; @@ -15,60 +49,267 @@ public void LoadPage() { - bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + bodyView.BackgroundColor = CSS_Color.BackgroundColor; new TopViewDiv(bodyView, Language.StringByID(StringId.ModifyPassword)).LoadTopView(); + #region 鏂板瘑鐮� + FrameLayout rowView = new FrameLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(rowView); + //鏂板瘑鐮� + Button btnTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(180), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = Language.StringByID(StringId.NewPassword) + ":" + }; + rowView.AddChidren(btnTitle); + etPassword = new EditText() + { + Width = Application.GetRealWidth(359), + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + SecureTextEntry = true, + TextAlignment = TextAlignment.CenterRight, + Foucs = true + }; + rowView.AddChidren(etPassword); + var lineView = new LineView(); + rowView.AddChidren(lineView); + lineView.Y = rowView.Height - lineView.Height; + #endregion + + #region 鍐嶆杈撳叆鏂板瘑鐮� + FrameLayout rowView2 = new FrameLayout() + { + Y = rowView.Bottom, + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(rowView2); + + //鍐嶆杈撳叆鏂板瘑鐮� + Button btnTitle2 = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(180), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + //TextID = StringId.NewPasswordAgain, + Text = Language.StringByID(StringId.NewPasswordAgain) + ":" + }; + rowView2.AddChidren(btnTitle2); + + etRepeatPassword = new EditText() + { + Width = Application.GetRealWidth(359), + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + SecureTextEntry = true, + TextAlignment = TextAlignment.CenterRight, + }; + rowView2.AddChidren(etRepeatPassword); + #endregion + + btnReset = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(224), + Width = Application.GetRealWidth(220), + Height = Application.GetRealHeight(44), + Radius = (uint)Application.GetRealHeight(22), + SelectedBackgroundColor = CSS_Color.MainColor, + BackgroundColor = CSS_Color.PromptingColor1, + TextID = StringId.Confirm, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + TextAlignment = TextAlignment.Center, + }; + bodyView.AddChidren(btnReset); + + LoadEvent_Reset(); + LoadEvent_EditTextFcousChange(); } } public partial class ResetPasswordPage { - public void ResetPassword(string password,string repeatPassword ) + + /// <summary> + /// 鎸囧畾鍏抽棴椤甸潰涓暟 + /// </summary> + /// <param name="countPage"></param> + void ClosePageWithCount(int countPage) { + //鍏抽棴澶氬皯涓〉闈� + for (int i = 0; i < countPage; i++) + { + MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + } + } + + /// <summary> + /// + /// </summary> + /// <param name="password"></param> + void ResetPassword(string password) + { + + //鏍¢獙瀵嗙爜鏄惁绗﹀悎瑕佹眰 + if (etPassword.Text.Trim().Length < 6 || etPassword.Text.Trim().Length > 13) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.PasswordIsUnqualified) + }.Show(bodyView); + return; + } + + //鏍¢獙涓ゆ杈撳叆鐨勫瘑鐮佹槸鍚︿竴鑷� + if (etPassword.Text.Trim() != etRepeatPassword.Text.Trim()) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.IncorrectRepeatPassword) + }.Show(bodyView); + + return; + } + var waitPage = new Loading(); waitPage.Start("Please wait..."); - var resetResult = new HttpServerRequest().ResetPassword(MainPage.LoginUser.accountString, password, repeatPassword, 86); - if (resetResult.StateCode.ToUpper() == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - var page = new OperationResultDisPalyPage(); - page.Show(); - page.LoadPage(true, Language.StringByID(StringId.UnbindEmail), Language.StringByID(StringId.UnbindEmailSuccess), ""); - for (int i = 0; i < 2; i++) + new Thread(() => + { + try + { + // 蹇樿瀵嗙爜 + var resultObj = new HttpServerRequest().ForgetPassword(account, password, verCode, isPhone); + if (resultObj.Code == StateCode.SUCCESS) { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + Application.RunOnMainThread(() => + { + Utlis.ShowTip(Language.StringByID(StringId.PasswordChangeSuccessfully)); + ClosePageWithCount(2); + }); } - }); + else + { + // 鎻愮ず閿欒 + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + + } + + /// <summary> + /// 鍔犺浇鏂瑰紡鎸夐挳浜嬩欢 + /// </summary> + void LoadEvent_Reset() + { + btnReset.MouseUpEventHandler += (sender, e) => + { + if (btnReset.IsSelected) + { + ResetPassword(etPassword.Text.ToString()); + } + }; + } + + /// <summary> + /// 鍔犺浇鏂囨湰妗嗙劍鐐瑰彉鍖栦簨浠� + /// </summary> + void LoadEvent_EditTextFcousChange() { + //瀵嗙爜鏂囨湰妗嗙劍鐐瑰彉鍖栦簨浠� + etPassword.FoucsChanged += (sender, e) => + { + if (etPassword.Foucs) + { + + } + else + { + //鏍¢獙瀵嗙爜鏄惁绗﹀悎瑕佹眰 + if (etPassword.Text.Trim().Length < 6 || etPassword.Text.Trim().Length > 13) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.PasswordIsUnqualified) + }.Show(bodyView); + } + else + { + LoadMothed_EnableResetButton(); + } + } + }; + + //纭瀵嗙爜鏂囨湰妗嗙劍鐐瑰彉鍖栦簨浠� + etRepeatPassword.FoucsChanged += (sender, e) => + { + if (etRepeatPassword.Foucs) + { + + } + else + { + //鏍¢獙涓ゆ杈撳叆鐨勫瘑鐮佹槸鍚︿竴鑷� + if (etPassword.Text.Trim() != etRepeatPassword.Text.Trim()) + { + new Tip() + { + CloseTime = 1, + Direction = AMPopTipDirection.None, + Text = Language.StringByID(StringId.IncorrectRepeatPassword) + }.Show(bodyView); + } + else + { + LoadMothed_EnableResetButton(); + } + } + }; + + } + + /// <summary> + /// 浣胯兘淇敼纭畾鎸夐挳 + /// </summary> + void LoadMothed_EnableResetButton() + { + if (!string.IsNullOrEmpty(etPassword.Text) && (etPassword.Text.Trim() == etRepeatPassword.Text.Trim())) + { + btnReset.IsSelected = true; } else { - string erorrInfo = ""; - switch (resetResult.StateCode) - { - case "PwdNoConfirm"://涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷� - erorrInfo = Language.StringByID(StringId.IncorrectRepeatPassword); - break; - case "AccountNoExists"://涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷� - erorrInfo = Language.StringByID(StringId.AccountNotExist); - break; - default: - erorrInfo = "Server error"; - break; - } - Application.RunOnMainThread(() => - { - waitPage.Hide(); - new Tip() - { - CloseTime = 1, - Direction = AMPopTipDirection.None, - Text = erorrInfo, - }.Show(bodyView); - }); + btnReset.IsSelected = false; } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordVerificationCodePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordVerificationCodePage.cs index 812f139..4f3ed20 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordVerificationCodePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordVerificationCodePage.cs @@ -32,25 +32,55 @@ Button btnResend; + /// <summary> + /// + /// </summary> + Button btnTip; + int titleId; + ///// <summary> + ///// 鎿嶄綔绫诲瀷 1:閭锛�2:鎵嬫満 + ///// </summary> + //int optionType; /// <summary> - /// 鎿嶄綔绫诲瀷 1:閭锛�2:鎵嬫満 + /// 鏄惁鎵嬫満 /// </summary> - int optionType; + bool isPhone; + /// <summary> + /// 璐﹀彿 + /// </summary> + string account; + + public ResetPasswordVerificationCodePage() { bodyView = this; } - public void LoadPage(int tId, int ot) + /// <summary> + /// + /// </summary> + /// <param name="tId"></param> + /// <param name="isPhone">鏄惁鎵嬫満</param> + /// <param name="account">璐﹀彿</param> + public void LoadPage(int tId, bool isPhone, string account) { titleId = tId; - optionType = ot; + this.isPhone = isPhone; + this.account = account; bodyView.BackgroundColor = CSS_Color.BackgroundColor; - new TopViewDiv(bodyView, Language.StringByID(tId)).LoadTopView(); - Button btnTip = new Button() + Action backAction = () => + { + Application.HideSoftInput(); + BackConfirmAction(); + }; + new TopViewDiv(bodyView, Language.StringByID(tId), false).LoadTopView(backAction); + + //new TopViewDiv(bodyView, Language.StringByID(tId)).LoadTopView(); + + btnTip = new Button() { Y = Application.GetRealHeight(64), X = Application.GetRealWidth(16), @@ -367,12 +397,12 @@ btnNum4Line.Height = Application.GetRealHeight(1); btnNum5Line.Height = Application.GetRealHeight(1); btnNum6Line.Height = Application.GetRealHeight(1); - btnNum1Line.Text = ""; - btnNum2Line.Text = ""; - btnNum3Line.Text = ""; - btnNum4Line.Text = ""; - btnNum5Line.Text = ""; - btnNum6Line.Text = ""; + btnNum1.Text = ""; + btnNum2.Text = ""; + btnNum3.Text = ""; + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; break; case 1: btnNum2Line.IsSelected = true; @@ -388,11 +418,11 @@ btnNum4Line.Height = Application.GetRealHeight(1); btnNum5Line.Height = Application.GetRealHeight(1); btnNum6Line.Height = Application.GetRealHeight(1); - btnNum2Line.Text = ""; - btnNum3Line.Text = ""; - btnNum4Line.Text = ""; - btnNum5Line.Text = ""; - btnNum6Line.Text = ""; + btnNum2.Text = ""; + btnNum3.Text = ""; + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; break; case 2: btnNum3Line.IsSelected = true; @@ -408,10 +438,10 @@ btnNum4Line.Height = Application.GetRealHeight(1); btnNum5Line.Height = Application.GetRealHeight(1); btnNum6Line.Height = Application.GetRealHeight(1); - btnNum3Line.Text = ""; - btnNum4Line.Text = ""; - btnNum5Line.Text = ""; - btnNum6Line.Text = ""; + btnNum3.Text = ""; + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; break; case 3: btnNum4Line.IsSelected = true; @@ -427,9 +457,9 @@ btnNum4Line.Height = Application.GetRealHeight(2); btnNum5Line.Height = Application.GetRealHeight(1); btnNum6Line.Height = Application.GetRealHeight(1); - btnNum4Line.Text = ""; - btnNum5Line.Text = ""; - btnNum6Line.Text = ""; + btnNum4.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; break; case 4: btnNum5Line.IsSelected = true; @@ -445,8 +475,8 @@ btnNum4Line.Height = Application.GetRealHeight(1); btnNum5Line.Height = Application.GetRealHeight(2); btnNum6Line.Height = Application.GetRealHeight(1); - btnNum5Line.Text = ""; - btnNum6Line.Text = ""; + btnNum5.Text = ""; + btnNum6.Text = ""; break; case 5: btnNum6Line.IsSelected = true; @@ -462,61 +492,74 @@ btnNum4Line.Height = Application.GetRealHeight(1); btnNum5Line.Height = Application.GetRealHeight(1); btnNum6Line.Height = Application.GetRealHeight(2); - btnNum6Line.Text = ""; + btnNum6.Text = ""; break; case 6: btnNum6.Text = etCode.Substring(5, 1); et.Foucs = false; - new Thread(() => - { - bool result = false; - Action act = () => { }; - Application.RunOnMainThread(() => - { - act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); - }); - bool isPhone = optionType == 2; - var resultObj = new HttpServerRequest().ValidatorCode(VerifyType.FIND_PASSWORD, MainPage.LoginUser.userEmailInfo, etCode, isPhone); - if (resultObj.Code == StateCode.SUCCESS) - { - result = true; - } - else - { - //澶辫触鎻愮ず - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Verification_Check, resultObj.Code); - } - Application.RunOnMainThread(() => - { - act(); - }); - if (result) - { - Application.RunOnMainThread(() => - { - new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.ValidationSuccessful), true); - }); - Thread.Sleep(1600); - Application.RunOnMainThread(() => - { - MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - if (titleId == StringId.EmailVerification) - { - - } - else if (titleId == StringId.PhoneNumberVerification) - { - - } - }); - } - }) - { IsBackground = true }.Start(); - + //杈撳叆瀹屾垚 + InputComplete(etCode); break; } }; } + + /// <summary> + /// 杈撳叆瀹屾垚 + /// </summary> + /// <param name="etCode"></param> + void InputComplete(string etCode) + { + new Thread(() => + { + bool result = false; + Action act = () => { }; + Application.RunOnMainThread(() => + { + act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); + }); + + var resultObj = new HttpServerRequest().ValidatorCode(VerifyType.FIND_PASSWORD, account, etCode, isPhone, false); + if (resultObj.Code == StateCode.SUCCESS) + { + result = true; + } + else + { + //澶辫触鎻愮ず + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); + } + Application.RunOnMainThread(() => + { + act(); + }); + if (result) + { + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.ValidationSuccessful), true); + }); + Thread.Sleep(1600); + Application.RunOnMainThread(() => + { + + //MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + this.RemoveFromParent(); + var vcp = new ResetPasswordPage(); + vcp.isPhone = isPhone; + vcp.account = account; + vcp.verCode = etCode; + MainPage.BasePageView.AddChidren(vcp); + vcp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }); + } + }) + { IsBackground = true }.Start(); + } + + /// <summary> /// 閲嶅彂楠岃瘉鐮佺瓑寰呯嚎绋� /// </summary> @@ -524,47 +567,102 @@ { btnResend.IsSelected = false; int time = 60; - - new Thread(() => + try { - if (optionType == 1) + new Thread(() => { - var resultObj = new DAL.Server.HttpServerRequest().VerificationCodeSend(VerifyType.FIND_PASSWORD, MainPage.LoginUser.userEmailInfo); - - } - else if (optionType == 2) - { - var resultObj = new DAL.Server.HttpServerRequest().VerificationCodeSend(VerifyType.FIND_PASSWORD, MainPage.LoginUser.userMobileInfo, true, MainPage.LoginUser.areaCode.ToString() ); - } - }) - { IsBackground = true }.Start(); - new Thread(() => - { - while (time > 0) - { - time--; - Application.RunOnMainThread(() => + //2.2 鑾峰彇楠岃瘉鐮� + ResponsePackNew resultObj; + if (!isPhone) { - btnResend.Text = time.ToString() + "s"; - }); - Thread.Sleep(1000); - } - Application.RunOnMainThread(() => - { - btnResend.IsSelected = true; - btnResend.TextID = StringId.GetVerificationCode; - }); - }) - { IsBackground = true }.Start(); + resultObj = new DAL.Server.HttpServerRequest().VerificationCodeSend(VerifyType.FIND_PASSWORD, account); + } + else + { + resultObj = new DAL.Server.HttpServerRequest().VerificationCodeSend(VerifyType.FIND_PASSWORD, account, true, UserInfo.Current.areaCode.ToString()); + } + + if (resultObj.Code != StateCode.SUCCESS) + { + //鍙戦�佸け璐� + Application.RunOnMainThread(() => + { + btnTip.TextID = StringId.FailedToSendVerificationCode; + }); + //澶辫触鎻愮ず + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); + } + else + { + //鍙戦�佹垚鍔燂紝寮�濮嬪�掕鏃� + Application.RunOnMainThread(() => + { + btnTip.TextID = StringId.VerificationCodePrompt; + }); + + while (time > 0) + { + time--; + Application.RunOnMainThread(() => + { + btnResend.Text = time.ToString() + "s"; + }); + Thread.Sleep(1000); + } + Application.RunOnMainThread(() => + { + btnResend.IsSelected = true; + btnResend.TextID = StringId.GetVerificationCode; + }); + } + }) + { IsBackground = true }.Start(); + } + + catch { } + finally + { + + }; } + /// <summary> /// 閲嶅彂楠岃瘉鐮佷簨浠� /// </summary> void LoadEvent_Resend() { - btnResend.MouseUpEventHandler = (sender, e) => { + btnResend.MouseUpEventHandler = (sender, e) => + { LoadThread_SendVerCode(); }; } + + /// <summary> + /// 杩斿洖浜屾纭浜嬩欢 + /// </summary> + void BackConfirmAction() + { + //楠岃瘉鐮佸彂閫佹垚鍔燂紝浜屾纭閫�鍑� + if (btnTip.TextID == StringId.VerificationCodePrompt) + { + Action cancelAction = () => + { + if (bodyView != null) + { + bodyView.RemoveFromParent(); + } + }; + new ConfirmDialog().ShowDialog(StringId.Tip, StringId.VerificationCodeMayBeDelayed, null, cancelAction, StringId.ReturnStr, StringId.WaitAMoment); + } + else + { + //鐩存帴鍏抽棴 + if (bodyView != null) + { + bodyView.RemoveFromParent(); + } + + } + } } } \ No newline at end of file diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/ResidentialManagePageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/ResidentialManagePageBLL.cs index 0bf95fc..c741f27 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/ResidentialManagePageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/ResidentialManagePageBLL.cs @@ -49,7 +49,7 @@ { Application.RunOnMainThread(() => { - //MainPage.LoginUser.regionList.Find((obj) => obj.Name == btnResidenceName.Text.Trim()).Name = str; + // UserInfo.Current.regionList.Find((obj) => obj.Name == btnResidenceName.Text.Trim()).Name = str; btnResidenceName.Text = str; upateResidenceName(); }); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs index 73c2bd2..901a5ab 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs @@ -279,12 +279,12 @@ { if (optionType == "7") { - MainPage.GoLoginPage(MainPage.LoginUser); + MainPage.GoLoginPage( UserInfo.Current); } else { Action<string> action = (pw) => { - var resultObj = new HttpServerRequest().LoginByPassword(MainPage.LoginUser.accountString, pw); + var resultObj = new HttpServerRequest().LoginByPassword( UserInfo.Current.accountString, pw); if (resultObj.Code == StateCode.SUCCESS) { OnAppConfig.Instance.appUnlockPasswrod = ""; @@ -296,7 +296,7 @@ else { //鐧诲綍澶辫触 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Login, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } }; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs index 0aa9709..4186d06 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs @@ -363,12 +363,12 @@ { if (optionType == "7") { - MainPage.GoLoginPage(MainPage.LoginUser); + MainPage.GoLoginPage( UserInfo.Current); } else { Action<string> action = (pw) => { - var resultObj = new HttpServerRequest().LoginByPassword(MainPage.LoginUser.accountString, pw); + var resultObj = new HttpServerRequest().LoginByPassword( UserInfo.Current.accountString, pw); if (resultObj.Code.ToUpper() == StateCode.SUCCESS) { OnAppConfig.Instance.appUnlockPasswrod = ""; @@ -380,7 +380,7 @@ else { //鐧诲綍澶辫触 - IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Login, resultObj.Code); + IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); } }; -- Gitblit v1.8.0