From 4b36040f39cf27db30b15d8a5ad198c98226b33d Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 23 Oct 2022 11:03:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E7=94=A8=E6=88=B7=E5=85=B3?= =?UTF-8?q?=E6=B3=A8=E5=92=8C=E7=B2=89=E4=B8=9D=E7=9A=84=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Users/Models/RelationFollowInfo.cs | 2 + .../Friends/ViewFollowerViewModel.cs | 64 +------------ .../Friends/ViewFollowingViewModel.cs | 93 ++++++++++++++++++- DownKyi/ViewModels/ViewFriendsViewModel.cs | 4 +- DownKyi/Views/Friends/ViewFollower.xaml | 43 +-------- DownKyi/Views/Friends/ViewFollowing.xaml | 48 +++++++++- 6 files changed, 140 insertions(+), 114 deletions(-) diff --git a/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs b/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs index 0548df8..23710c2 100644 --- a/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs +++ b/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs @@ -23,7 +23,9 @@ namespace DownKyi.Core.BiliApi.Users.Models public string Face { get; set; } [JsonProperty("sign")] public string Sign { get; set; } + // face_nft // official_verify // vip + // nft_icon } } diff --git a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs index b344def..2e337a9 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs @@ -1,8 +1,4 @@ -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.ObjectModel; +using Prism.Events; namespace DownKyi.ViewModels.Friends { @@ -12,76 +8,18 @@ namespace DownKyi.ViewModels.Friends #region 页面属性申明 - private ObservableCollection tabHeaders; - public ObservableCollection TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - #endregion public ViewFollowerViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { #region 属性初始化 - TabHeaders = new ObservableCollection(); - - int i = TabHeaders.Count; #endregion } #region 命令申明 - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - //NavigationParameters param = new NavigationParameters(); - - //switch (tabHeader.Id) - //{ - // case 0: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, param); - // break; - // case 1: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewDelogoViewModel.Tag, param); - // break; - // case 2: - // regionManager.RequestNavigate("ToolboxContentRegion", ViewExtractMediaViewModel.Tag, param); - // break; - //} - } - #endregion - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 进入设置页面时显示的设置项 - SelectTabId = 0; - - } - } } diff --git a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs index 5998adc..a4c5b1b 100644 --- a/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs +++ b/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs @@ -1,9 +1,12 @@ -using Prism.Events; -using System; +using DownKyi.Core.BiliApi.Users; +using DownKyi.Core.BiliApi.Users.Models; +using DownKyi.Utils; +using DownKyi.ViewModels.PageViewModels; +using Prism.Commands; +using Prism.Events; +using Prism.Regions; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.ObjectModel; namespace DownKyi.ViewModels.Friends { @@ -11,8 +14,88 @@ namespace DownKyi.ViewModels.Friends { public const string Tag = "PageFriendsFollowing"; + #region 页面属性申明 + + private ObservableCollection tabHeaders; + public ObservableCollection TabHeaders + { + get => tabHeaders; + set => SetProperty(ref tabHeaders, value); + } + + private int selectTabId; + public int SelectTabId + { + get => selectTabId; + set => SetProperty(ref selectTabId, value); + } + + #endregion + public ViewFollowingViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { + #region 属性初始化 + List followingGroup = UserRelation.GetFollowingGroup(); + + TabHeaders = new ObservableCollection() + { + //new TabHeader{Id = 0, Title = DictionaryResource.GetString("FriendFollowing") }, + new TabHeader{Id = -1, Title = "全部关注" }, + new TabHeader{Id = -2, Title = "悄悄关注" }, + }; + + foreach (FollowingGroup tag in followingGroup) + { + TabHeaders.Add(new TabHeader { Id = tag.TagId, Title = tag.Name, SubTitle = tag.Count.ToString() }); + } + + #endregion } + + #region 命令申明 + + // 左侧tab点击事件 + private DelegateCommand leftTabHeadersCommand; + public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); + + /// + /// 左侧tab点击事件 + /// + /// + private void ExecuteLeftTabHeadersCommand(object parameter) + { + if (!(parameter is TabHeader tabHeader)) { return; } + + //NavigationParameters param = new NavigationParameters(); + + //switch (tabHeader.Id) + //{ + // case 0: + // regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, param); + // break; + // case 1: + // regionManager.RequestNavigate("ToolboxContentRegion", ViewDelogoViewModel.Tag, param); + // break; + // case 2: + // regionManager.RequestNavigate("ToolboxContentRegion", ViewExtractMediaViewModel.Tag, param); + // break; + //} + } + + #endregion + + /// + /// 导航到页面时执行 + /// + /// + public override void OnNavigatedTo(NavigationContext navigationContext) + { + base.OnNavigatedTo(navigationContext); + + // 进入设置页面时显示的设置项 + SelectTabId = 0; + + } + } } diff --git a/DownKyi/ViewModels/ViewFriendsViewModel.cs b/DownKyi/ViewModels/ViewFriendsViewModel.cs index f1138f5..f949d7d 100644 --- a/DownKyi/ViewModels/ViewFriendsViewModel.cs +++ b/DownKyi/ViewModels/ViewFriendsViewModel.cs @@ -117,10 +117,10 @@ namespace DownKyi.ViewModels switch (id) { case 0: - regionManager.RequestNavigate("FriendContentRegion", ViewFollowerViewModel.Tag, param); + regionManager.RequestNavigate("FriendContentRegion", ViewFollowingViewModel.Tag, param); break; case 1: - regionManager.RequestNavigate("FriendContentRegion", ViewFollowingViewModel.Tag, param); + regionManager.RequestNavigate("FriendContentRegion", ViewFollowerViewModel.Tag, param); break; } } diff --git a/DownKyi/Views/Friends/ViewFollower.xaml b/DownKyi/Views/Friends/ViewFollower.xaml index 52309c1..b426740 100644 --- a/DownKyi/Views/Friends/ViewFollower.xaml +++ b/DownKyi/Views/Friends/ViewFollower.xaml @@ -12,47 +12,6 @@ - - - - - - - - - - - - - - - - - - - - + diff --git a/DownKyi/Views/Friends/ViewFollowing.xaml b/DownKyi/Views/Friends/ViewFollowing.xaml index de15d36..a58b943 100644 --- a/DownKyi/Views/Friends/ViewFollowing.xaml +++ b/DownKyi/Views/Friends/ViewFollowing.xaml @@ -2,13 +2,57 @@ x:Class="DownKyi.Views.Friends.ViewFollowing" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converter="clr-namespace:DownKyi.Converter" xmlns:custom="clr-namespace:DownKyi.CustomControl" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:prism="http://prismlibrary.com/" prism:ViewModelLocator.AutoWireViewModel="True"> - + + + - + + + + + + + + + + + + + + + + + + + +