JLChen
2021-04-20 23f3b7a482ef167b6192365e75749af1ca1a6c52
HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs
@@ -11,8 +11,7 @@
        {
            Tag = "Logic";
        }
        public  Action<PushConfigs> action;
        public void Show(PushConfigs pushConfigs)
        public void Show()
        {
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
@@ -41,7 +40,7 @@
                Height = Application.GetRealHeight(152),
                TextAlignment = TextAlignment.TopLeft,
                Radius=(uint)Application.GetRealHeight(12),
                Text= pushConfigs.pushContent,
                Text= Logic.currlogic.noticeConfig.noticeContent,
                TextSize = LogicView.TextSize.text14,
                TextColor= CSS.CSS_Color.textColor,
                PlaceholderText =Language.StringByID(StringId.xianzhichangdu),//"(100字以内)",
@@ -61,7 +60,6 @@
#endif
                }
                pushConfigs.pushContent = textBox.Text.Trim();
            };
            #endregion
@@ -72,10 +70,11 @@
            appPush.btnText.TextID = StringId.apptuisong;
            appPush.btnText.X = Application.GetRealWidth(12);
            viewLayout.AddChidren(appPush.FLayoutView());
            //定义一个局部账号列表用来记录选中数据;
            List<string> selectedAccountList = new List<string>();
            appPush.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                //定义一个局部账号列表用来记录选中数据;
                List<string> accountList = new List<string>();
                var userList = new List<HDL_ON.Entity.ResidenceMemberInfo>();
                Loading loading = new Loading();
                this.AddChidren(loading);
                loading.Start();
@@ -83,12 +82,8 @@
                {
                    try
                    {
                        var userList = Send.GetResidenceMemberAccount();
                        for (int i = 0; i < userList.Count; i++)
                        {
                            var user = userList[i];
                            accountList.Add(user.Account);
                        }
                         userList = Send.GetResidenceMemberAccount();
                    }
                    catch { }
                    finally
@@ -96,21 +91,49 @@
                        Application.RunOnMainThread(() =>
                        {
                            loading.Hide();
                            if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo))
                            userList.Add(new Entity.ResidenceMemberInfo { childAccountId = UserInfo.Current.ID, childAccountPhone = UserInfo.Current.userMobileInfo, childAccountEmail = UserInfo.Current.userEmailInfo });
                            //住宅子账号列表
                            List<string> accountList = new List<string>();
                            //之前状态列表
                            List<string> stateList = new List<string>();
                            for (int i = 0; i < userList.Count; i++)
                            {
                                //默认推送当前账号
                                accountList.Insert(0, UserInfo.Current.userMobileInfo);
                                var user = userList[i];
                                accountList.Add(user.Account);
                            }
                            else
                            if (Logic.currlogic.pushConfigs.Count > 0)
                            {
                                //默认推送当前账号
                                accountList.Insert(0, UserInfo.Current.userEmailInfo);
                                var list = Logic.currlogic.pushConfigs[0].pushTarget;
                                for (int i = 0;i< userList.Count; i++)
                                {
                                    var user = userList[i];
                                    if (list.Contains(user.childAccountId))
                                    {
                                        stateList.Add(user.Account);
                                    }
                                }
                            }
                            PublicInterface view = new PublicInterface();
                            view.FrameOrVvList(this, accountList, pushConfigs.pushTarget, StringId.zhanghaoxuanze
                            view.FrameOrVvList(this, accountList, stateList, StringId.zhanghaoxuanze
                               , (list) =>
                               {
                                   pushConfigs.pushTarget = list;
                                   //清空旧数据列表
                                   selectedAccountList.Clear();
                                   for (int i = 0;i<userList.Count; i++)
                                   {
                                       var user = userList[i];
                                       if (list.Contains(user.Account))
                                       {
                                           selectedAccountList.Add(user.childAccountId);
                                       }
                                   }
                               });
                        });
                    }
@@ -127,18 +150,38 @@
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                action(pushConfigs);
                RemoveFromParent();
              this.RemoveFromParent();
            };
            saveView.btnClick.MouseUpEventHandler += (e, sen) =>
            {
                action(pushConfigs);
                RemoveFromParent();
                Logic.currlogic.noticeConfig.noticeContent = textBox.Text.Trim();
                Logic.currlogic.pushConfigs.Clear();//清空旧数据列表
                Logic.currlogic.pushConfigs.Add(new PushConfigs { pushTarget = selectedAccountList });
                this.RemoveFromParent();
            };
            #endregion
        }
        /// <summary>
        /// 手机账号为先,手机账号为空,其次到邮箱账号
        /// </summary>
        private string Account
        {
            get
            {
                ///手机账号为先,手机账号为空,其次到邮箱账号;
                if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo))
                {
                    //默认推送当前手机账号
                    return UserInfo.Current.userMobileInfo;
                }
                else
                {
                    //默认推送当前邮箱账号
                    return UserInfo.Current.userEmailInfo;
                }
            }
        }
    }
}