Esempio n. 1
0
        protected override async Task InitializationAsync()
        {
            UserCenterButtons.Add(new ButtonViewModel()
            {
                ContentText = "我的行程", IconUri = "ms-appx:///Assets/icons/journey_img.png"
            });
            UserCenterButtons.Add(new ButtonViewModel()
            {
                ContentText = "我的钱包", IconUri = "ms-appx:///Assets/icons/wallet_img.png"
            });
            UserCenterButtons.Add(new ButtonViewModel()
            {
                ContentText = "邀请好友", IconUri = "ms-appx:///Assets/icons/invite_img.png"
            });
            UserCenterButtons.Add(new ButtonViewModel()
            {
                ContentText = "我的客服", IconUri = "ms-appx:///Assets/icons/icon_my_service.png"
            });

            var userInfoResult = await OfoApi.GetUserInfoAsync();

            if (await CheckOfoApiResult(userInfoResult))
            {
                UserInfo = userInfoResult.Data;

                //获取头像图片
                await OfoUtility.GetAvatarImageByUrlAsync(UserInfo.AvatarUrl, avatar => Avatar = avatar);
            }
        }
        protected override async Task InitializationAsync()
        {
            Nick     = UserInfo.Name;
            TelPhone = OfoUtility.GetMaskTelPhoneNum(UserInfo.TelPhone);
            if (string.IsNullOrEmpty(Nick))
            {
                Nick = TelPhone;
            }
            InfoButtons[0].ContentText = Nick;

            CreditScoreInfo = $"信用分: {UserInfo.CreditTotal} >";

            //获取头像图片
            OfoUtility.GetAvatarImageByUrlAsync(UserInfo.AvatarUrl, avatar => Avatar = avatar).NoWarning();

            InfoButtons[3].ContentText = UserInfo?.IsBond == 1 ? "认证用户" : "未认证用户";

            var userProfileResult = await OfoApi.GetUserProfileAsync();

            if (await CheckOfoApiResult(userProfileResult))
            {
                UserProfile = userProfileResult.Data;
                InfoButtons[1].ContentText = UserProfile.SexType == 1 ? "男" : UserProfile.SexType == 2 ? "女" : "-";
                if (UserProfile.BirthYear > 0)
                {
                    InfoButtons[2].ContentText = $"{UserProfile.BirthYear} 年 {UserProfile.BirthMonth} 月 {UserProfile.BirthDay} 日";
                }
                else
                {
                    InfoButtons[2].ContentText = "-";
                }
                SchoolInfo = string.IsNullOrEmpty(UserProfile.School) ? "非校园用户" : UserProfile.School;
            }
        }