From a9d1161b1df96e7ddad566335989a1444e433ef5 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 28 三月 2023 11:54:45 +0800
Subject: [PATCH] 2023年03月28日11:52:02

---
 HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorHistoryPage.cs |  131 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 128 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorHistoryPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorHistoryPage.cs
index 0fcca37..1efd6aa 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorHistoryPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorHistoryPage.cs
@@ -1,18 +1,143 @@
 锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DAL.Server;
+using HDL_ON.UI.CSS;
 using Shared;
 namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
 {
     public class VisitorHistoryPage : FrameLayout
     {
-        FrameLayout bodyView;
+        private FrameLayout bodyView;
+        private VerticalScrolViewLayout bodyScrolView;
+        private List<VisitorTempPassword> pwdList;
 
-        public VisitorHistoryPage()
+        Action backAction;// 鍚庨��鎸夐敭锛屽埛鏂癠I
+        Action action;
+
+        public override void RemoveFromParent()
         {
+            backAction?.Invoke();
+            base.RemoveFromParent();
+        }
+
+        public VisitorHistoryPage(Action action)
+        {
+            backAction = action;
             bodyView = this;
         }
+
         public void LoadPage()
         {
+            action = () =>
+            {
+                LoadPage();
+            };
 
+            pwdList = getVisitorPasswordData();
+
+            #region 璁垮璁板綍鎸夐挳
+            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
+            new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorRecord)).LoadTopView();
+            #endregion
+
+            bodyScrolView = new VerticalScrolViewLayout()
+            {
+                Y = Application.GetRealHeight(64),
+                VerticalScrollBarEnabled = false,
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            bodyView.AddChidren(bodyScrolView);
+
+            foreach (VisitorTempPassword temPwd in pwdList)
+            {
+                FrameLayout itemLayout = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(16),
+                    Height = Application.GetRealWidth(50),
+                    Width = Application.GetRealWidth(343),
+                };
+
+                // 璁垮浜岀淮鐮乀ext
+                itemLayout.AddChidren(new Button()
+                {
+                    Height = Application.GetRealWidth(20),
+                    Y = Application.GetRealWidth(6),
+                    Text = Language.StringByID(StringId.VisitorInvitationRecord),
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.text1Color,
+                    TextSize = CSS_FontSize.TextFontSize,
+                });
+
+                // 鏃堕棿Btn
+                string startTime = temPwd.validBeginTime.Replace("-", "/");
+                string endTime = temPwd.validEndTime.Replace("-", "/");
+                itemLayout.AddChidren(new Button()
+                {
+                    Height = Application.GetRealWidth(14),
+                    Y = Application.GetRealWidth(30),
+                    Text = Language.StringByID(StringId.Time) + "锛�" + startTime + " - " + endTime,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.PromptingColor1,
+                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
+                });
+
+                // 鍚庨��
+                itemLayout.AddChidren(new ImageView()
+                {
+                    Width = Application.GetRealWidth(16),
+                    Height = Application.GetRealWidth(16),
+                    Gravity = Gravity.CenterRight,
+                    ImagePath = "Public/Right.png",
+                });
+
+                itemLayout.AddChidren(new Button()
+                {
+                    Height = Application.GetRealWidth(1),
+                    Y = Application.GetRealWidth(49),
+                    BackgroundColor = CSS_Color.DividingLineColor,
+                });
+
+                Button btn = new Button();
+                itemLayout.AddChidren(btn);//+= (sender, e)
+                btn.MouseUpEventHandler += (sender, e) =>
+                {
+#if __IOS__
+#else
+                    VisitorQRCodePage page = new VisitorQRCodePage(action, temPwd);
+                    MainPage.BasePageView.AddChidren(page);
+                    page.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+#endif
+                };
+                bodyScrolView.AddChidren(itemLayout);
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇璁垮涓存椂瀵嗙爜鍒楄〃
+        /// </summary>
+        private List<VisitorTempPassword> getVisitorPasswordData()
+        {
+            List<VisitorTempPassword> dataList = new List<VisitorTempPassword>();
+            Dictionary<string, object> dictionary = new Dictionary<string, object>();
+            dictionary.Add("homeId", Entity.DB_ResidenceData.Instance.CurrentRegion.id);
+            dictionary.Add("pageNo", 1);
+            dictionary.Add("pageSize", 100);
+            dictionary.Add("order", "descending");
+            dictionary.Add("sort", "id");
+
+            var requestJson = HttpUtil.GetSignRequestJson(dictionary);
+            ResponsePackNew pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GET_TEMP_PASSWORD_LIST, requestJson);
+            if (pack != null)
+            {
+                if (pack.Code == StateCode.SUCCESS)
+                {
+                    string json = pack.Data.ToString();
+                    var o = Newtonsoft.Json.JsonConvert.DeserializeObject<GetTempPasswordList>(json);
+                    dataList = o.list;
+                }
+            }
+            return dataList;
         }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0