From f788a1e320b8505435ed66e2456ddb2d0a838f76 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 19 十一月 2020 19:58:14 +0800
Subject: [PATCH] 2020-11-19 1.优化绑定和解绑页面。2.修改密码功能实现,UI界面实现,接口实现。

---
 HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs |  138 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 97 insertions(+), 41 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
index 90f7720..ebbec1e 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using HDL_ON.DAL.Server;
 using HDL_ON.Entity;
 using Shared;
 
@@ -18,6 +19,7 @@
             LoadEvent_ChangeBindEmail();
             LoadEvent_ChangeBindPhone();
             LoadEvent_SkipModifyPassword();
+            GetUserInfo();
         }
 
         /// <summary>
@@ -38,10 +40,39 @@
         {
             btnLogout.MouseUpEventHandler += (sender, e) =>
             {
+                #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
+
                 MainPage.LoginUser.lastTime = DateTime.MinValue;
                 MainPage.LoginUser.SaveUserInfo();
                 MainPage.GoLoginPage(MainPage.LoginUser);
-                FileUtils.DeleteAllFile();
                 DB_ResidenceData.residenceData.EixtAccount();
             };
         }
@@ -55,7 +86,8 @@
             {
                 baseView.RemoveFromParent();
             };
-            baseView.MouseUpEventHandler = (sender, e) => {
+            baseView.MouseUpEventHandler = (sender, e) =>
+            {
                 baseView.RemoveFromParent();
             };
             btnCancel.MouseUpEventHandler = (sender, e) =>
@@ -88,6 +120,7 @@
                     }
                 }), pid.ToString(), 1, 1);
                 pictureOptionView.RemoveFromParent();
+                baseView.RemoveFromParent();
             };
 
             btnAlbum.MouseUpEventHandler = (sender, e) =>
@@ -116,6 +149,7 @@
                     }
                 }, pid.ToString(), 1, 1);
                 pictureOptionView.RemoveFromParent();
+                baseView.RemoveFromParent();
             };
         }
 
@@ -132,13 +166,13 @@
                     {
                         new Tip()
                         {
-                            CloseTime = 3,
+                            CloseTime = 1,
                             Text = Language.StringByID(StringId.UesrNameCannotBeEmpty),
                             Direction = AMPopTipDirection.None,
                         }.Show(bodyView);
                         return;
                     }
-                    if(str == MainPage.LoginUser.userName)
+                    if (str == MainPage.LoginUser.userName)
                     {
                         return;
                     }
@@ -148,8 +182,8 @@
                     {
                         try
                         {
-                            var responsePack = new DAL.Server.HttpServerRequest().EditUserName(str);
-                            if (responsePack.StateCode.ToUpper() == "SUCCESS")
+                            var resultObj = new HttpServerRequest().EditUserName(str);
+                            if (resultObj.Code == StateCode.SUCCESS)
                             {
                                 MainPage.LoginUser.userName = str;
                                 MainPage.LoginUser.SaveUserInfo();
@@ -161,27 +195,8 @@
                             }
                             else
                             {
-                                var tipStr = "Server erorr";
-                                switch (responsePack.StateCode)
-                                {
-                                    case "NoLogin":
-                                        tipStr = Language.StringByID(StringId.InvalidLoginCertificate);
-                                        break;
-                                    case "AccountNoExists":
-                                        tipStr = "";
-                                        break;
-                                }
-                                Application.RunOnMainThread(() =>
-                                {
-                                    //鎻愮ず鍘熷洜
-                                    var tip = new Tip()
-                                    {
-                                        Text = tipStr,
-                                        CloseTime = 3,
-                                        Direction = AMPopTipDirection.None
-                                    };
-                                    tip.Show(bodyView);
-                                });
+                                //澶辫触鎻愮ず
+                                IMessageCommon.Current.ShowErrorInfoAlter(NewAPI.API_POST_Member_UpdateMemberInfo, resultObj.Code);
                             }
                         }
                         catch (Exception ex)
@@ -198,7 +213,7 @@
                     })
                     { IsBackground = true }.Start();
                 };
-                new PublicAssmebly().LoadDialog_EditParater(StringId.UesrName, MainPage.LoginUser.userName, callBack, StringId.UesrNameCannotBeEmpty, 0, new System.Collections.Generic.List<string>());
+                new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, MainPage.LoginUser.userName, callBack, StringId.UesrNameCannotBeEmpty, 0, new System.Collections.Generic.List<string>());
             };
             btnUserName.MouseUpEventHandler = eventHandler;
             btnEditUserNameIcon.MouseUpEventHandler = eventHandler;
@@ -210,36 +225,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;
@@ -270,7 +314,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();
@@ -281,5 +326,16 @@
             resetPasswordView.MouseUpEventHandler = eventHandler;
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        void GetUserInfo()
+        {
+            new System.Threading.Thread(() =>
+            {
+                new HttpServerRequest().GetUserInfo();
+            })
+            { IsBackground = true }.Start();
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0