黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs
@@ -12,9 +12,9 @@
        #region ■ 变量声明___________________________
        /// <summary>
        /// 0:Bug、1:优化、2:新需求
        /// 1:BUG、2:优化(OPTIMIZE)、3:新需求(REQUIRE)
        /// </summary>
        private int typeMode = 0;
        private string typeMode = string.Empty;
        /// <summary>
        /// 意见反馈剩余次数
        /// </summary>
@@ -54,7 +54,7 @@
            //字数
            var btnFild = new NormalViewControl(150, 60, true);
            btnFild.X = frameInput.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(150);
            btnFild.X = frameInput.Width - HdlControlResourse.XXLeft - Application.GetRealWidth(150);
            btnFild.Y = Application.GetRealHeight(503);
            btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnFild.TextSize = 12;
@@ -64,7 +64,7 @@
            //您的反馈和意见会让我们变得更好
            var txtInput = new EditTextView();
            txtInput.Width = bodyFrameLayout.Width - ControlCommonResourse.XXLeft * 2;
            txtInput.Width = bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2;
            txtInput.Height = Application.GetRealHeight(470);
            txtInput.Y = Application.GetRealHeight(32);
            txtInput.TextAlignment = TextAlignment.TopLeft;
@@ -74,21 +74,35 @@
            txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uYouSuggestionMsg);
            frameInput.AddChidren(txtInput);
            txtInput.InitIosPlaceholderUILabelWithHeight(Application.GetRealHeight(60));
            txtInput.TextChangeEventHandler += (sender, txtvalue) =>
            //输入值改变事件
            Action<View, string> txtInputChangedEvent = (sender, txtValue) =>
            {
                if (this.suggestionCount <= 0)
                {
                    return;
                }
                int length = txtvalue.Length;
                var newValue = txtValue;
                //如果输入的值,已经大于指定的数,则截取
                if (newValue.Length > 500)
                {
                    //截取指定的byte字节
                    newValue = newValue.Substring(0, 500);
                    txtInput.Text = newValue;
                    //将光标至于最后
#if Android
                    txtInput.SetSelectionEnd();
#endif
                }
                int length = newValue.Length;
                if (length == 0)
                {
                    if (btnSubmit.CanClick == true) { btnSubmit.CanClick = false; }
                }
                else
                {
                    if (btnSubmit.CanClick == false)
                    if (btnSubmit.CanClick == false)
                    {
                        //变灰色字体
                        btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
@@ -96,17 +110,8 @@
                    }
                }
                btnFild.Text = (500 - length).ToString();
                if (length > 500)
                {
                    if (btnSubmit.CanClick == true)
                    {
                        btnSubmit.CanClick = false;
                        //变红色字体
                        btnFild.TextColor = Common.ZigbeeColor.Current.GXCTextRed;
                    }
                }
            };
            txtInput.TextChangeEventHandler += txtInputChangedEvent;
            var framType = new FrameLayout();
            framType.Height = Application.GetRealHeight(150);
@@ -120,7 +125,7 @@
            //反馈类型
            var btnType = new NormalViewControl(220, 60, true);
            btnType.X = ControlCommonResourse.XXLeft;
            btnType.X = HdlControlResourse.XXLeft;
            btnType.Gravity = Gravity.CenterVertical;
            btnType.TextID = R.MyInternationalizationString.uSuggestionType;
            framType.AddChidren(btnType);
@@ -149,7 +154,7 @@
                    btnBugIcon.IsSelected = true;
                    btnOptimizationIcon.IsSelected = false;
                    btnDemandIcon.IsSelected = false;
                    this.typeMode = 0;
                    this.typeMode = "BUG";
                }
            };
            //优化
@@ -177,7 +182,7 @@
                    btnBugIcon.IsSelected = false;
                    btnDemandIcon.IsSelected = false;
                    this.typeMode = 1;
                    this.typeMode = "OPTIMIZE";
                }
            };
            //新需求
@@ -205,7 +210,7 @@
                    btnBugIcon.IsSelected = false;
                    btnOptimizationIcon.IsSelected = false;
                    this.typeMode = 2;
                    this.typeMode = "REQUIRE";
                }
            };
@@ -216,7 +221,7 @@
            bodyFrameLayout.AddChidren(frameEmail);
            //联系方式
            var btnContact = new NormalViewControl(220, 60, true);
            btnContact.X = ControlCommonResourse.XXLeft;
            btnContact.X = HdlControlResourse.XXLeft;
            btnContact.Gravity = Gravity.CenterVertical;
            btnContact.TextID = R.MyInternationalizationString.uContactInformation;
            frameEmail.AddChidren(btnContact);
@@ -242,7 +247,7 @@
                this.UploadSuggestion(txtInput.Text, txtEmail.Text);
            };
            var data = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.SuggestionFile);
            var data = HdlFileLogic.Current.ReadFileTextContent(HdlFileNameResourse.SuggestionFile);
            if (data != null)
            {
                var strNowData = DateTime.Now.ToString("yyyyMMdd");
@@ -273,28 +278,23 @@
        {
            HdlThreadLogic.Current.RunThread(() =>
            {
                var pra = new
                var pra = new { contactWay = email, content = strContent, feedbackType = this.typeMode };
                var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("home-wisdom/app/feedback/add", RestSharp.Method.POST, pra);
                //检测状态码
                if (HdlCheckLogic.Current.CheckNetCode(result, ShowNetCodeMode.YES) == false)
                {
                    RequestVersion = Common.CommonPage.RequestVersion,
                    LoginAccessToken = Common.Config.Instance.Token,
                    Content = strContent,
                    OpinionFeedbackType = this.typeMode,
                    Email = email
                };
                var result = UserCenterLogic.GetResultStatuByRequestHttps("App/AddOpinionFeedback", false, pra);
                if (result == true)
                {
                    //保存次数
                    this.suggestionCount--;
                    //写入内容
                    HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SuggestionFile, this.suggestionCount + DateTime.Now.ToString("yyyyMMdd"));
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //显示成功的界面
                        this.ShowSuccessMsg();
                    });
                    return;
                }
                //保存次数
                this.suggestionCount--;
                //写入内容
                HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SuggestionFile, this.suggestionCount + DateTime.Now.ToString("yyyyMMdd"));
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //显示成功的界面
                    this.ShowSuccessMsg();
                });
            });
        }