From 7c4da83c338c9b34c51bb60820c5a82f33258fc4 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 16 九月 2021 09:25:19 +0800 Subject: [PATCH] 2021-09-16 1.新增物业公告对接,增加物业公告详情页面 --- HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs | 186 ++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 169 insertions(+), 17 deletions(-) diff --git a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs index 152714a..b2635af 100644 --- a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs @@ -194,15 +194,15 @@ systemMenuButton.SelectAction = systemAction; #endregion - #region 鐗╀笟閫氱煡 + #region 鐗╀笟閫氱煡 2021-09-15澧炲姞 propertyMenuButton = new MenuButton() { X = systemMenuButton.Right, Y = Application.GetRealWidth(16), }; - menuView.AddChidren(propertyMenuButton); //鍏堝睆钄� - propertyMenuButton.ImageButton.SelectedImagePath = "Collection/MesCenter/SystemOn.png"; - propertyMenuButton.ImageButton.UnSelectedImagePath = "Collection/MesCenter/System.png"; + menuView.AddChidren(propertyMenuButton); + propertyMenuButton.ImageButton.SelectedImagePath = "Collection/MesCenter/PropertyOn.png"; + propertyMenuButton.ImageButton.UnSelectedImagePath = "Collection/MesCenter/Property.png"; propertyMenuButton.TextButton.TextID = StringId.Propertynotice; propertyMenuButton.TextButton.IsMoreLines = true; Action propertyAction = () => @@ -212,7 +212,6 @@ propertyMenuButton.SelectAction = propertyAction; #endregion - //鍏堝睆钄� //鍙硃addingView menuView.AddChidren(new Button() { @@ -408,14 +407,15 @@ btnDatetime.Text = GetUnixToDateTime(pushMessageInfo.createTime); - //2020-12-23 鍘绘帀鐐瑰嚮寮圭獥浜嬩欢 - //EventHandler<MouseEventArgs> eventHandler = (sender, e) => - //{ - // new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show(); - //}; - //rowView.MouseUpEventHandler = eventHandler; - //btnTilte.MouseUpEventHandler = eventHandler; - //btnSubtitle.MouseUpEventHandler = eventHandler; + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + OnClickPushMessageInfo(pushMessageInfo); + //new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show(); + }; + rowView.MouseUpEventHandler = eventHandler; + btnTilte.MouseUpEventHandler = eventHandler; + btnSubtitle.MouseUpEventHandler = eventHandler; } @@ -624,6 +624,106 @@ } } + /// <summary> + /// 鑾峰彇鐗╀笟閫氱煡璇︽儏 + /// </summary> + /// <param name="noticeId"></param> + void GetPropertyNoticeDetails(string noticeId) + { + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + + new Thread(() => + { + try + { + var result = new HttpServerRequest().GetPropertyNoticeDetails(noticeId); + if (result.Code == StateCode.SUCCESS) + { + var mPushNoticeInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<PushNoticeInfo>(result.Data.ToString()); + if (mPushNoticeInfo != null) + { + Application.RunOnMainThread(() => + { + new WebViewDialog().LoadPageWithHtmlStr(mPushNoticeInfo.title, mPushNoticeInfo.content); + }); + } + } + } + catch (Exception ex) + { + } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 閫氱煡淇℃伅鐐瑰嚮浜嬩欢 + /// </summary> + /// <param name="pushMessageInfo"></param> + void OnClickPushMessageInfo(PushMessageInfo pushMessageInfo) + { + + if (pushMessageInfo.pushType == PushType.Notice.ToString()) + { + //Utlis.WriteLine("鐗╀笟閫氱煡"); + string noticeId = GetNoticeId(pushMessageInfo.messageExpand); + if (!string.IsNullOrEmpty(noticeId)) + { + GetPropertyNoticeDetails(noticeId); + } + else + { + Utlis.WriteLine("noticeId null"); + } + } + else + { + Utlis.WriteLine("鍏跺畠閫氱煡绫诲瀷"); + } + } + + /// <summary> + /// 瑙f瀽messageExpand 鎻愬彇targetId + /// </summary> + /// <param name="messageExpand"></param> + /// <returns></returns> + string GetNoticeId(string messageExpand) + { + try + { + if (!string.IsNullOrEmpty(messageExpand)) + { + var mMessageExpandInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageExpandInfo>(messageExpand); + if (mMessageExpandInfo != null) + { + var mExpantContentInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ExpantContentInfo>(mMessageExpandInfo.expantContent); + if(mExpantContentInfo != null) + { + return mExpantContentInfo.targetId; + } + } + } + return null; + } + catch + { + return null; + } + } + #region 娴嬭瘯 #if DEBUG /// <summary> @@ -789,10 +889,10 @@ /// 娑堟伅鍐呭 /// </summary> public string messageContent; - ///// <summary> - ///// 鎵╁睍鏁版嵁 - ///// </summary> - //public string messageExpand; + /// <summary> + /// 鎵╁睍鏁版嵁 + /// </summary> + public string messageExpand; ///// <summary> ///// 娑堟伅绫诲瀷锛�0锛氭彁绀猴紱1锛氭姤璀︼紱2锛氫赴鏋楀彲鏄璁插懠鍙紱3锛氬己鍒朵笅绾挎帹閫� ///// </summary> @@ -817,4 +917,56 @@ } + + /// <summary> + /// 鐗╀笟鍏憡璇︽儏 + /// </summary> + [System.Serializable] + public class PushNoticeInfo + { + /// <summary> + /// 娑堟伅ID + /// </summary> + public string noticeId; + /// <summary> + /// 娑堟伅鏍囬 + /// </summary> + public string title; + /// <summary> + /// 瀵屾枃鏈唴瀹� + /// </summary> + public string content; + } + + /// <summary> + /// 鎺ㄩ�佹墿灞曚俊鎭� + /// </summary> + [System.Serializable] + public class MessageExpandInfo + { + /// <summary> + /// expantContent + /// </summary> + public string expantContent; + + } + + /// <summary> + /// 鎺ㄩ�佹墿灞曚俊鎭� + /// </summary> + [System.Serializable] + public class ExpantContentInfo + { + /// <summary> + /// targetId + /// </summary> + public string targetId; + /// <summary> + /// messageType + /// </summary> + public string messageType; + + } + + } -- Gitblit v1.8.0