wei
2020-12-16 5da70456b70dd4b949c6f0fd5e2d354d49f256d3
Merge branch 'NewFilePath' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into NewFilePath
1个文件已修改
131 ■■■■■ 已修改文件
HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
@@ -21,7 +21,8 @@
            LoadEvent_ChangeBindPhone();
            LoadEvent_SkipModifyPassword();
            LoadEvent_MyQRcode();
            GetUserInfo();
            //GetUserInfo();
            RefreshUserInfo();
        }
        /// <summary>
@@ -566,63 +567,95 @@
        }
        ///// <summary>
        ///// 获取用户信息
        ///// </summary>
        ///// <returns></returns>
        //public void GetUserInfoNew()
        //{
        /// <summary>
        /// 2020-12-15 增加刷新用户信息
        /// </summary>
        /// <returns></returns>
        public void RefreshUserInfo()
        {
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
        //    new System.Threading.Thread(() =>
        //    {
        //        try
        //        {
        //            var requestJson = HttpUtil.GetSignRequestJson(new NullObj());
        //            var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfo, requestJson);
        //            if (resultObj.Code == StateCode.SUCCESS)
        //            {
        //                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<MemberInfoRes>(resultObj.Data.ToString());
        //                UserInfo.Current.userEmailInfo = info.memberEmail;
        //                UserInfo.Current.userMobileInfo = info.memberPhone;
        //                UserInfo.Current.userName = info.memberName;
            new Thread(() =>
            {
                try
                {
                    var requestJson = HttpUtil.GetSignRequestJson(new NullObj());
                    var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfo, requestJson);
                    if (resultObj.Code == StateCode.SUCCESS)
                    {
                        var info = Newtonsoft.Json.JsonConvert.DeserializeObject<MemberInfoRes>(resultObj.Data.ToString());
        //                if (!string.IsNullOrEmpty(info.memberPhonePrefix))
        //                {
        //                    UserInfo.Current.areaCode = info.memberPhonePrefix;
        //                }
                        if (!string.IsNullOrEmpty(info.memberPhonePrefix))
                        {
                            UserInfo.Current.areaCode = info.memberPhonePrefix;
                        }
        //                //2020-12-15 修改头像方案
        //                if (!string.IsNullOrEmpty(info.memberHeadIcon))
        //                {
        //                    var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(info.memberHeadIcon);
                        var headImagePagePath = "";
                        //2020-12-15 修改头像方案
                        if (!string.IsNullOrEmpty(info.memberHeadIcon))
                        {
                            var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(info.memberHeadIcon);
        //                    if (headImageBytes != null && headImageBytes.Length > 0)
        //                    {
        //                        UserInfo.Current.headImagePagePath = info.memberHeadIcon;
        //                    }
        //                }
                            if (headImageBytes != null && headImageBytes.Length > 0)
                            {
                                headImagePagePath = info.memberHeadIcon;
                            }
                        }
        //                Application.RunOnMainThread(() =>
        //                {
        //                    btnUserName.Text = str;
        //                    updataUserName();
        //                });
                        Application.RunOnMainThread(() =>
                        {
                            if (UserInfo.Current.userEmailInfo != info.memberEmail)
                            {
                                //更新邮箱
                                UserInfo.Current.userEmailInfo = info.memberEmail;
                                btnUserEmailInfo.Text = GetBindAccountText(UserInfo.Current.userEmailInfo);
                            }
        //                UserInfo.Current.SaveUserInfo();
        //                MainPage.Log("获取用户信息成功。");
                            if (UserInfo.Current.userMobileInfo != info.memberPhone)
                            {
                                //更新手机号
                                UserInfo.Current.userMobileInfo = info.memberPhone;
                                btnUserPhoneInfo.Text = GetBindAccountText(UserInfo.Current.userMobileInfo);
                            }
        //                //userHeadImageView
        //            }
        //        }
        //        catch { }
        //        finally
        //        {
                            if (UserInfo.Current.userName != info.memberName)
                            {
                                //更新用户名字
                                UserInfo.Current.userName = info.memberName;
                                btnUserName.Text = string.IsNullOrEmpty(UserInfo.Current.userName) ? Language.StringByID(StringId.UsersWhoNameIsEmpty) : UserInfo.Current.userName;
                                updataUserName();
                            }
                            if (!string.IsNullOrEmpty(headImagePagePath) && UserInfo.Current.headImagePagePath != headImagePagePath)
                            {
                                //更新头像
                                UserInfo.Current.headImagePagePath = headImagePagePath;
                                userHeadImageView.ImagePath = UserInfo.Current.headImagePagePath;
                                updataHeadImage();
                            }
        //        }
                            UserInfo.Current.SaveUserInfo();
                            Utlis.WriteLine("刷新用户信息成功。");
                        });
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
        //    })
        //    { IsBackground = true }.Start();
        //}
            })
            { IsBackground = true }.Start();
        }
    }
}