Skip to content

Commit

Permalink
支持设置新标签页到首页中
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Feb 24, 2024
1 parent b31c4bd commit 0404b4a
Show file tree
Hide file tree
Showing 12 changed files with 315 additions and 250 deletions.
5 changes: 4 additions & 1 deletion src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
<Compile Include="Extensions\QrCodeExtensions.cs" />
<Compile Include="Models\Common\Anime\ISeasonItem.cs" />
<Compile Include="Models\Common\Dynamic\DynamicUgcSeasonCardModel.cs" />
<Compile Include="Models\Common\Home\DefaultHomeNavItems.cs" />
<Compile Include="Models\Common\Live\DefaultPlayUrlSourceOptions.cs" />
<Compile Include="Models\Common\Live\InteractWordModel.cs" />
<Compile Include="Models\Common\Live\LiveMessageHandleActionsMap.cs" />
Expand Down Expand Up @@ -194,6 +195,8 @@
<Compile Include="Models\Requests\Api\BaseApi.cs" />
<Compile Include="Models\Common\Download\DownloadedItem.cs" />
<Compile Include="Models\Common\Download\DownloadedSubItem.cs" />
<Compile Include="Models\Common\Home\HomeNavItem.cs" />
<Compile Include="ViewModels\Home\HomeNavItemViewModel.cs" />
<Compile Include="ViewModels\Download\DownloadingItemViewModel.cs" />
<Compile Include="Player\Controllers\BasePlayerController.cs" />
<Compile Include="Player\Controllers\LivePlayerController.cs" />
Expand Down Expand Up @@ -603,7 +606,7 @@
<Compile Include="ViewModels\Home\AnimePageViewModel.cs" />
<Compile Include="Modules\Home\CinemaVM.cs" />
<Compile Include="ViewModels\Home\DynamicPageViewModel.cs" />
<Compile Include="Modules\Home\HomeVM.cs" />
<Compile Include="ViewModels\Home\HomeViewModel.cs" />
<Compile Include="Modules\Home\HotVM.cs" />
<Compile Include="Modules\IModules.cs" />
<Compile Include="ViewModels\Live\LiveRoomViewModel.cs" />
Expand Down
3 changes: 2 additions & 1 deletion src/BiliLite.UWP/Extensions/MapperExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using Bilibili.App.Dynamic.V2;
using Bilibili.App.Interface.V1;
using Bilibili.Tv.Interfaces.Dm.V1;
using BiliLite.Controls.Dynamic;
using BiliLite.Models.Common;
using BiliLite.Models.Common.Anime;
using BiliLite.Models.Common.Comment;
using BiliLite.Models.Common.Dynamic;
using BiliLite.Models.Common.Home;
using BiliLite.Models.Common.Season;
using BiliLite.Models.Common.User;
using BiliLite.Models.Common.UserDynamic;
Expand Down Expand Up @@ -47,6 +47,7 @@ public static IServiceCollection AddMapper(this IServiceCollection services)
expression.CreateMap<SeasonDetailUserStatusModel, SeasonDetailUserStatusViewModel>();
expression.CreateMap<SeasonDetailModel, SeasonDetailViewModel>();
expression.CreateMap<AnimeFallModel, AnimeFallViewModel>();
expression.CreateMap<HomeNavItem, HomeNavItemViewModel>();

expression.CreateMap<Arc, SubmitVideoItemModel>()
.ForMember(dest => dest.Play, opt => opt.MapFrom(src => src.Archive.Stat.View))
Expand Down
1 change: 1 addition & 0 deletions src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static class ViewModelExtensions
{
public static IServiceCollection AddViewModels(this IServiceCollection services)
{
services.AddSingleton<HomeViewModel>();
services.AddSingleton<DownloadPageViewModel>();
services.AddTransient<DownloadDialogViewModel>();
services.AddTransient<CommentControlViewModel>();
Expand Down
126 changes: 126 additions & 0 deletions src/BiliLite.UWP/Models/Common/Home/DefaultHomeNavItems.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
using System.Collections.Generic;

namespace BiliLite.Models.Common.Home
{
public static class DefaultHomeNavItems
{
public static List<HomeNavItem> GetDefaultHomeNavItems()
{
return new List<HomeNavItem>()
{
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Home,
Page = typeof(Pages.Home.RecommendPage),
Title = "推荐",
NeedLogin = false,
Show = true
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Fire,
Page = typeof(Pages.Home.HotPage),
Title = "热门",
NeedLogin = false,
Show = true
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Heart,
Page = typeof(Pages.Home.UserDynamicPage),
Title = "动态",
NeedLogin = true,
Show = false
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Heart,
Page = typeof(Pages.Home.DynamicPage),
Title = "视频动态",
NeedLogin = true,
Show = false
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Paw,
Page = typeof(Pages.Home.AnimePage),
Title = "番剧",
Parameters = AnimeType.Bangumi,
NeedLogin = false,
Show = true
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Feather,
Page = typeof(Pages.Home.AnimePage),
Title = "国创",
Parameters = AnimeType.GuoChuang,
NeedLogin = false,
Show = true
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Video,
Page = typeof(Pages.Home.LivePage),
Title = "直播",
NeedLogin = false,
Show = true
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Film,
Page = typeof(Pages.Home.MoviePage),
Title = "放映厅",
NeedLogin = false,
Show = true
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Shapes,
Page = typeof(Pages.Home.RegionsPage),
Title = "分区",
NeedLogin = false,
Show = true
},
//new HomeNavItem(){
// Icon=FontAwesome5.EFontAwesomeIcon.Solid_Bars,
// Page=typeof(Pages.Home.ChannelPage),
// Title="频道",
// NeedLogin=false,
// Show=true
//},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Trophy,
Page = typeof(Pages.RankPage),
Title = "排行榜",
NeedLogin = false,
Show = true
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Compass,
Page = typeof(Pages.Other.FindMorePage),
Title = "发现",
NeedLogin = false,
Show = true
}
};
}

public static List<HomeNavItem> GetDefaultHideHomeNavItems()
{
return new List<HomeNavItem>
{
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_File,
Page = typeof(Pages.NewPage),
Title = "新标签页",
NeedLogin = false,
Show = true
}
};
}
}
}
20 changes: 20 additions & 0 deletions src/BiliLite.UWP/Models/Common/Home/HomeNavItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using FontAwesome5;

namespace BiliLite.Models.Common.Home
{
public class HomeNavItem
{
public string Title { get; set; }

public EFontAwesomeIcon Icon { get; set; }

public Type Page { get; set; }

public object Parameters { get; set; }

public bool NeedLogin { get; set; }

public bool Show { get; set; }
}
}
Loading

0 comments on commit 0404b4a

Please sign in to comment.