From b961d0deea95d90aff5bfd23440c7f09aec119a8 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Thu, 16 Nov 2023 21:10:31 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=95=AA=E5=89=A7?= =?UTF-8?q?=E9=A1=B5=E7=82=B9=E5=87=BB=E6=8E=A8=E8=8D=90=E7=95=AA=E5=89=A7?= =?UTF-8?q?=E6=97=A0=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/BiliLite.UWP.csproj | 1 + .../Models/Common/Anime/AnimeRankModel.cs | 2 +- .../Models/Common/Anime/ISeasonItem.cs | 9 ++ src/BiliLite.UWP/Modules/Home/CinemaVM.cs | 52 ++++++---- .../Modules/Season/AnimeTimelineVM.cs | 25 +++-- .../Modules/User/MyFollowSeasonVM.cs | 98 ++++++++----------- .../Pages/Bangumi/TimelinePage.xaml | 8 +- .../Pages/Bangumi/TimelinePage.xaml.cs | 4 +- src/BiliLite.UWP/Pages/Home/AnimePage.xaml | 22 ++--- src/BiliLite.UWP/Pages/Home/MoviePage.xaml | 48 ++++----- src/BiliLite.UWP/Pages/User/FavoritePage.xaml | 16 +-- .../Pages/User/FavoritePage.xaml.cs | 4 +- .../ViewModels/Home/AnimePageViewModel.cs | 8 +- 13 files changed, 158 insertions(+), 139 deletions(-) create mode 100644 src/BiliLite.UWP/Models/Common/Anime/ISeasonItem.cs diff --git a/src/BiliLite.UWP/BiliLite.UWP.csproj b/src/BiliLite.UWP/BiliLite.UWP.csproj index 3c1a3a77..90f5d19d 100644 --- a/src/BiliLite.UWP/BiliLite.UWP.csproj +++ b/src/BiliLite.UWP/BiliLite.UWP.csproj @@ -136,6 +136,7 @@ PackageReference + diff --git a/src/BiliLite.UWP/Models/Common/Anime/AnimeRankModel.cs b/src/BiliLite.UWP/Models/Common/Anime/AnimeRankModel.cs index 91a73425..2526638d 100644 --- a/src/BiliLite.UWP/Models/Common/Anime/AnimeRankModel.cs +++ b/src/BiliLite.UWP/Models/Common/Anime/AnimeRankModel.cs @@ -2,7 +2,7 @@ namespace BiliLite.Models.Common.Anime { - public class AnimeRankModel + public class AnimeRankModel : ISeasonItem { public string Display { get; set; } diff --git a/src/BiliLite.UWP/Models/Common/Anime/ISeasonItem.cs b/src/BiliLite.UWP/Models/Common/Anime/ISeasonItem.cs new file mode 100644 index 00000000..b3397acf --- /dev/null +++ b/src/BiliLite.UWP/Models/Common/Anime/ISeasonItem.cs @@ -0,0 +1,9 @@ +namespace BiliLite.Models.Common.Anime +{ + public interface ISeasonItem + { + public int SeasonId { get; set; } + + public string Title { get; set; } + } +} diff --git a/src/BiliLite.UWP/Modules/Home/CinemaVM.cs b/src/BiliLite.UWP/Modules/Home/CinemaVM.cs index 9b205703..eefeb05e 100644 --- a/src/BiliLite.UWP/Modules/Home/CinemaVM.cs +++ b/src/BiliLite.UWP/Modules/Home/CinemaVM.cs @@ -13,6 +13,8 @@ using BiliLite.Extensions; using BiliLite.Services; using BiliLite.Models.Common; +using BiliLite.Models.Common.Anime; +using Newtonsoft.Json; namespace BiliLite.Modules { @@ -139,8 +141,8 @@ public CinemaHomeModel HomeData public List Entrances { get; set; } public async void SeasonItemClick(object sender, ItemClickEventArgs e) { - var seasonId = e.ClickedItem.GetType().GetProperty("season_id").GetValue(e.ClickedItem, null); - var title = e.ClickedItem.GetType().GetProperty("title").GetValue(e.ClickedItem, null) ?? ""; + var seasonId = e.ClickedItem.GetType().GetProperty(nameof(ISeasonItem.SeasonId)).GetValue(e.ClickedItem, null); + var title = e.ClickedItem.GetType().GetProperty(nameof(ISeasonItem.SeasonId))?.GetValue(e.ClickedItem, null) ?? ""; if (seasonId != null && seasonId.ToInt32() != 0) { MessageCenter.NavigateToPage(sender, new NavigationInfo() @@ -330,27 +332,43 @@ public class CinemaHomeBannerModel public string img { get; set; } public string url { get; set; } } - public class CinemaHomeHotItem + + public class CinemaHomeHotItem : ISeasonItem { - public string hat { get; set; } - public string cover { get; set; } - public string badge { get; set; } - public int badge_type { get; set; } - public bool show_badge + public string Hat { get; set; } + + public string Cover { get; set; } + + public string Badge { get; set; } + + [JsonProperty("badge_type")] + public int BadgeType { get; set; } + + public bool ShowBadge { get { - return !string.IsNullOrEmpty(badge); + return !string.IsNullOrEmpty(Badge); } } - public string desc { get; set; } - public string title { get; set; } - public string link { get; set; } - public int season_id { get; set; } - public int season_type { get; set; } - public string type { get; set; } - public int wid { get; set; } - public CinemaHomeStatModel stat { get; set; } + + public string Desc { get; set; } + + public string Title { get; set; } + + public string Link { get; set; } + + [JsonProperty("season_id")] + public int SeasonId { get; set; } + + [JsonProperty("season_type")] + public int SeasonType { get; set; } + + public string Type { get; set; } + + public int Wid { get; set; } + + public CinemaHomeStatModel Stat { get; set; } } public class CinemaHomeStatModel { diff --git a/src/BiliLite.UWP/Modules/Season/AnimeTimelineVM.cs b/src/BiliLite.UWP/Modules/Season/AnimeTimelineVM.cs index 93455e58..5722e908 100644 --- a/src/BiliLite.UWP/Modules/Season/AnimeTimelineVM.cs +++ b/src/BiliLite.UWP/Modules/Season/AnimeTimelineVM.cs @@ -5,7 +5,9 @@ using BiliLite.Models; using BiliLite.Extensions; using BiliLite.Models.Common; +using BiliLite.Models.Common.Anime; using BiliLite.Models.Requests.Api.Home; +using Newtonsoft.Json; namespace BiliLite.Modules { @@ -126,13 +128,22 @@ public class AnimeTimelineModel public bool is_today { get; set; } public List seasons { get; set; } } - public class AnimeTimelineItemModel + public class AnimeTimelineItemModel : ISeasonItem { - public int season_id { get; set; } - public string cover { get; set; } - public string square_cover { get; set; } - public string pub_index { get; set; } - public string pub_time { get; set; } - public string title { get; set; } + [JsonProperty("season_id")] + public int SeasonId { get; set; } + + public string Cover { get; set; } + + [JsonProperty("square_cover")] + public string SquareCover { get; set; } + + [JsonProperty("pub_index")] + public string PubIndex { get; set; } + + [JsonProperty("pub_time")] + public string PubTime { get; set; } + + public string Title { get; set; } } } diff --git a/src/BiliLite.UWP/Modules/User/MyFollowSeasonVM.cs b/src/BiliLite.UWP/Modules/User/MyFollowSeasonVM.cs index dae6b07f..16ab0f90 100644 --- a/src/BiliLite.UWP/Modules/User/MyFollowSeasonVM.cs +++ b/src/BiliLite.UWP/Modules/User/MyFollowSeasonVM.cs @@ -2,15 +2,13 @@ using BiliLite.Models.Requests.Api.User; using Newtonsoft.Json.Linq; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows.Input; using BiliLite.Extensions; -using BiliLite.Models.Common; +using BiliLite.Models.Common.Anime; using BiliLite.Services; +using Newtonsoft.Json; namespace BiliLite.Modules { @@ -120,7 +118,7 @@ public async Task LoadFollows() { foreach (var item in ls) { - item.status = Status; + item.Status = Status; item.CancelFollowCommand = CancelFollowCommand; item.SetWantWatchCommand = SetWantWatchCommand; item.SetWatchedCommand = SetWatchedCommand; @@ -206,7 +204,7 @@ public async void CancelFollow(object par) var item = par as FollowSeasonModel; try { - var api = followAPI.CancelFollowSeason(item.season_id.ToString()); + var api = followAPI.CancelFollowSeason(item.SeasonId.ToString()); var results = await api.Request(); if (results.status) { @@ -270,7 +268,7 @@ private async Task SetSeasonStatus(FollowSeasonModel item, int status) } try { - var api = followAPI.SetSeasonStatus(item.season_id.ToString(), status); + var api = followAPI.SetSeasonStatus(item.SeasonId.ToString(), status); var results = await api.Request(); if (results.status) { @@ -302,65 +300,47 @@ private async Task SetSeasonStatus(FollowSeasonModel item, int status) } } - public class FollowSeasonModel + + public class FollowSeasonModel : ISeasonItem { public ICommand CancelFollowCommand { get; set; } + public ICommand SetWantWatchCommand { get; set; } + public ICommand SetWatchedCommand { get; set; } + public ICommand SetWatchingCommand { get; set; } - public int status { get; set; } - public bool show_watched - { - get - { - return status != 3; - } - } - public bool show_watching - { - get - { - return status != 2; - } - } - public bool show_want_watch - { - get - { - return status != 1; - } - } - public bool show_badge - { - get - { - return !string.IsNullOrEmpty(badge); - } - } - public string badge { get; set; } - public string square_cover { get; set; } - public string cover { get; set; } - public string title { get; set; } - public int season_id { get; set; } - public string url { get; set; } - public string progress_text - { - get - { - if (progress != null) - { - return progress.index_show; - } - else - { - return "尚未观看"; - } - } - } + public int Status { get; set; } + + public bool ShowWatched => Status != 3; + + public bool ShowWatching => Status != 2; + + public bool ShowWantWatch => Status != 1; + + public bool ShowBadge => !string.IsNullOrEmpty(Badge); + + public string Badge { get; set; } + + [JsonProperty("square_cover")] + public string SquareCover { get; set; } + + public string Cover { get; set; } + + public string Title { get; set; } + + [JsonProperty("season_id")] + public int SeasonId { get; set; } + + public string Url { get; set; } + + public string ProgressText => Progress != null ? Progress.index_show : "尚未观看"; + + [JsonProperty("new_ep")] + public FollowSeasonNewEpModel NewEp { get; set; } - public FollowSeasonNewEpModel new_ep { get; set; } - public FollowSeasonProgressModel progress { get; set; } + public FollowSeasonProgressModel Progress { get; set; } } public class FollowSeasonNewEpModel { diff --git a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml index 10f0795c..2545c784 100644 --- a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml +++ b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml @@ -72,7 +72,7 @@ - + @@ -82,13 +82,13 @@ - + - - + + diff --git a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs index 24baaf76..66624815 100644 --- a/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs +++ b/src/BiliLite.UWP/Pages/Bangumi/TimelinePage.xaml.cs @@ -57,8 +57,8 @@ private void AnimeTimelineItemModelOpen(object sender, AnimeTimelineItemModel it { icon = Symbol.Play, page = typeof(SeasonDetailPage), - title = item.title, - parameters = item.season_id, + title = item.Title, + parameters = item.SeasonId, dontGoTo = dontGoTo }); } diff --git a/src/BiliLite.UWP/Pages/Home/AnimePage.xaml b/src/BiliLite.UWP/Pages/Home/AnimePage.xaml index ae316148..2043e0cc 100644 --- a/src/BiliLite.UWP/Pages/Home/AnimePage.xaml +++ b/src/BiliLite.UWP/Pages/Home/AnimePage.xaml @@ -57,7 +57,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -131,16 +131,16 @@ - + - - + + - - + + @@ -181,7 +181,7 @@ - + @@ -191,13 +191,13 @@ - + - - + + diff --git a/src/BiliLite.UWP/Pages/Home/MoviePage.xaml b/src/BiliLite.UWP/Pages/Home/MoviePage.xaml index 42e98d0b..cfd90810 100644 --- a/src/BiliLite.UWP/Pages/Home/MoviePage.xaml +++ b/src/BiliLite.UWP/Pages/Home/MoviePage.xaml @@ -23,7 +23,7 @@ - + @@ -32,16 +32,16 @@ - + - - + + - - + + @@ -53,7 +53,7 @@ - + @@ -62,16 +62,16 @@ - + - - + + - - + + - - - - - - 房管 - - - - - - - - - - - - + + + + + + + 房管 + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -922,8 +939,8 @@ - - + + @@ -942,8 +959,8 @@ - - + + @@ -1116,7 +1133,26 @@ - + + + + + + + + + + + From 0371d0d9e2bc55d2bc13c59687029e10d5395065 Mon Sep 17 00:00:00 2001 From: GD-Slime <82302542+GD-Slime@users.noreply.github.com> Date: Sun, 19 Nov 2023 14:40:47 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B9=B6=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=B8=83=E5=B1=80=E4=BA=86=E5=8E=86=E5=8F=B2=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=20(#407)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复: 1. 历史记录页面打不开除了普通视频外的内容 2. 历史记录页面有些内容无封面 新增: 1. 历史记录现在有对应的类型和tag显示 更改: 1. 更改了历史记录页面的元素显示 --- .../Models/Common/User/UserHistoryItem.cs | 2 + src/BiliLite.UWP/Modules/User/HistoryVM.cs | 9 +++ src/BiliLite.UWP/Pages/User/HistoryPage.xaml | 62 ++++++++++++------- .../Pages/User/HistoryPage.xaml.cs | 43 ++++++++++++- .../Video/VideoDetailPageViewModel.cs | 1 + 5 files changed, 94 insertions(+), 23 deletions(-) diff --git a/src/BiliLite.UWP/Models/Common/User/UserHistoryItem.cs b/src/BiliLite.UWP/Models/Common/User/UserHistoryItem.cs index 93c5d9af..0a858314 100644 --- a/src/BiliLite.UWP/Models/Common/User/UserHistoryItem.cs +++ b/src/BiliLite.UWP/Models/Common/User/UserHistoryItem.cs @@ -70,6 +70,8 @@ public class UserHistoryItem [JsonProperty("tag_name")] public string TagName { get; set; } + public bool ShowTag => TagName.Length > 0; + [JsonProperty("live_status")] public long LiveStatus { get; set; } } diff --git a/src/BiliLite.UWP/Modules/User/HistoryVM.cs b/src/BiliLite.UWP/Modules/User/HistoryVM.cs index 825a01e3..193c62b8 100644 --- a/src/BiliLite.UWP/Modules/User/HistoryVM.cs +++ b/src/BiliLite.UWP/Modules/User/HistoryVM.cs @@ -65,6 +65,15 @@ public async Task LoadHistory() } Videos = new ObservableCollection(data.data.List); + + // 默认封面如果缺失, 用其他封面替换 + foreach (var item in Videos) + { + if (item.Cover.Length == 0 && item.Covers != null) + { + item.Cover = (string)((JArray)item.Covers)[0]; + } + } } else { diff --git a/src/BiliLite.UWP/Pages/User/HistoryPage.xaml b/src/BiliLite.UWP/Pages/User/HistoryPage.xaml index 4708a58d..0e492a6c 100644 --- a/src/BiliLite.UWP/Pages/User/HistoryPage.xaml +++ b/src/BiliLite.UWP/Pages/User/HistoryPage.xaml @@ -3,29 +3,27 @@ x:Class="BiliLite.Pages.User.HistoryPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:BiliLite.Pages.User" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - xmlns:fa="using:FontAwesome5" xmlns:controls="using:BiliLite.Controls" xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:convert="using:BiliLite.Converters" xmlns:model="using:BiliLite.Modules.User" - xmlns:userModel="using:BiliLite.Models.Common.User" + xmlns:userModel="using:BiliLite.Models.Common.User" d:DataContext="{d:DesignInstance Type=model:HistoryVM}" Background="Transparent"> - + @@ -33,19 +31,36 @@ - - + + + + - - - UP: - - + + + + + + + + + + + + + + + + + + + + - +