|
|
@@ -54,6 +54,7 @@ interface FindPlaylistEventData {
|
|
|
startIndex: number
|
|
|
isJump: boolean
|
|
|
songFilePaths: string[]
|
|
|
+ playType?: number
|
|
|
}
|
|
|
|
|
|
interface FindAlbumGroup {
|
|
|
@@ -115,11 +116,16 @@ export struct FindView {
|
|
|
@State private swiperSongs: VideoItem[] = []
|
|
|
@State private hotSongs: VideoItem[] = []
|
|
|
@State private remoteSongs: VideoItem[] = []
|
|
|
+ @State private cloudSectionPages: FindSongPage[] = []
|
|
|
@State private recentSongs: VideoItem[] = []
|
|
|
@State private popularSongs: VideoItem[] = []
|
|
|
+ @State private popularSectionPages: FindSongPage[] = []
|
|
|
@State private favoriteSongs: VideoItem[] = []
|
|
|
+ @State private cloudMoodSongs: VideoItem[] = []
|
|
|
@State private featuredAlbums: FindAlbumGroup[] = []
|
|
|
+ @State private featuredAlbumPages: FindAlbumPage[] = []
|
|
|
@State private cloudAlbums: FindAlbumGroup[] = []
|
|
|
+ @State private cloudAlbumPages: FindAlbumPage[] = []
|
|
|
@State @Watch('syncFindCanBackState') private isSearchMode: boolean = false
|
|
|
@State @Watch('syncFindCanBackState') private isAlbumMode: boolean = false
|
|
|
@State private currentAlbumId: string = ''
|
|
|
@@ -146,7 +152,7 @@ export struct FindView {
|
|
|
@State private maxRefreshingHeight: number = 100
|
|
|
|
|
|
searchController: SearchController = new SearchController()
|
|
|
- @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointTypeEnum.MD
|
|
|
+ @StorageProp('currentBreakpoint') @Watch('onDiscoverBreakpointChange') currentBreakpoint: string = BreakpointTypeEnum.MD
|
|
|
@StorageProp('windowWidth') windowWidth: number = 0
|
|
|
@StorageProp('topSafeHeight') topSafeHeight: number = 0
|
|
|
@StorageProp('bottomSafeHeight') bottomSafeHeight: number = 0
|
|
|
@@ -165,6 +171,10 @@ export struct FindView {
|
|
|
private searchRemoteSongsPool: VideoItem[] = []
|
|
|
private readonly searchHistoryScope: string = 'find_music'
|
|
|
private searchTicket: number = 0
|
|
|
+ private cloudSectionPageVersion: number = 0
|
|
|
+ private featuredAlbumPageVersion: number = 0
|
|
|
+ private cloudAlbumPageVersion: number = 0
|
|
|
+ private popularSectionPageVersion: number = 0
|
|
|
|
|
|
aboutToAppear(): void {
|
|
|
this.initSetting()
|
|
|
@@ -194,6 +204,11 @@ export struct FindView {
|
|
|
this.autoHideTitle = PreferencesUtil.getBooleanSync('autoHideTitle', true)
|
|
|
}
|
|
|
|
|
|
+ private onDiscoverBreakpointChange(): void {
|
|
|
+ Logger.info(TAG, `FindView onDiscoverBreakpointChange breakpoint=${this.currentBreakpoint}, columns=${this.getDiscoverSectionColumns()}`)
|
|
|
+ this.rebuildPagedSectionSources()
|
|
|
+ }
|
|
|
+
|
|
|
private ensureMediaTable(): void {
|
|
|
if (this.mediaTable) {
|
|
|
void this.loadDiscoveryContent(false)
|
|
|
@@ -254,6 +269,7 @@ export struct FindView {
|
|
|
this.searchRemoteSongsPool = []
|
|
|
this.swiperSongs = this.pickRandomSongs(this.coveredSongsPool, SWIPER_MAX_COUNT)
|
|
|
this.hotSongs = this.pickPreferredSongs(this.localSongsPool, HOT_SECTION_COUNT)
|
|
|
+ this.cloudMoodSongs = this.pickPreferredSongs(this.remoteSongsPool, HOT_SECTION_COUNT)
|
|
|
this.remoteSongs = this.pickPreferredSongs(this.remoteSongsPool, CLOUD_SECTION_COUNT)
|
|
|
this.recentSongs = this.pickPreferredSongs(this.recentSongsPool, RECENT_SECTION_COUNT)
|
|
|
this.popularSongs = this.pickPreferredSongs(this.topPlayedSongsPool, POPULAR_SECTION_COUNT)
|
|
|
@@ -262,6 +278,7 @@ export struct FindView {
|
|
|
this.cloudAlbums = this.pickAlbumGroups(this.cloudAlbumsPool, CLOUD_ALBUM_COUNT)
|
|
|
this.swiperIndex = 0
|
|
|
this.resetPagedSectionIndices()
|
|
|
+ this.rebuildPagedSectionSources()
|
|
|
this.refreshText = ''
|
|
|
|
|
|
Logger.info(
|
|
|
@@ -273,9 +290,12 @@ export struct FindView {
|
|
|
Logger.error(TAG, `发现页加载失败: ${message}`)
|
|
|
this.swiperSongs = []
|
|
|
this.hotSongs = []
|
|
|
+ this.cloudMoodSongs = []
|
|
|
this.remoteSongs = []
|
|
|
+ this.cloudSectionPages = []
|
|
|
this.recentSongs = []
|
|
|
this.popularSongs = []
|
|
|
+ this.popularSectionPages = []
|
|
|
this.favoriteSongs = []
|
|
|
this.localSongsPool = []
|
|
|
this.coveredSongsPool = []
|
|
|
@@ -287,7 +307,9 @@ export struct FindView {
|
|
|
this.cloudAlbumsPool = []
|
|
|
this.searchRemoteSongsPool = []
|
|
|
this.featuredAlbums = []
|
|
|
+ this.featuredAlbumPages = []
|
|
|
this.cloudAlbums = []
|
|
|
+ this.cloudAlbumPages = []
|
|
|
this.refreshText = '推荐加载失败,请下拉重试'
|
|
|
} finally {
|
|
|
this.isRefreshing = false
|
|
|
@@ -718,7 +740,8 @@ export struct FindView {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
- private emitPlaylistPlay(playlistId: string, playlistName: string, songs: VideoItem[], startIndex: number): void {
|
|
|
+ private emitPlaylistPlay(playlistId: string, playlistName: string, songs: VideoItem[], startIndex: number,
|
|
|
+ playType?: number): void {
|
|
|
if (songs.length === 0) {
|
|
|
ToastUtil.showToast('暂无可播放歌曲')
|
|
|
return
|
|
|
@@ -734,31 +757,58 @@ export struct FindView {
|
|
|
songCount: songs.length,
|
|
|
startIndex: safeIndex,
|
|
|
isJump: false,
|
|
|
- songFilePaths: songs.map((item: VideoItem): string => item.filePath)
|
|
|
+ songFilePaths: songs.map((item: VideoItem): string => item.filePath),
|
|
|
+ playType
|
|
|
}
|
|
|
emitter.emit(eventPlaylistPlay, { data: playlistData })
|
|
|
}
|
|
|
|
|
|
- private handleActionButtonTap(type: string): void {
|
|
|
+ private async getFullLocalSongsPool(): Promise<VideoItem[]> {
|
|
|
+ if (this.localSongsPool.length > 0) {
|
|
|
+ return this.localSongsPool
|
|
|
+ }
|
|
|
+ if (!this.mediaTable) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ const localSongs = await this.mediaTable.queryAllVideos()
|
|
|
+ this.localSongsPool = this.filterUniqueSongs(localSongs)
|
|
|
+ return this.localSongsPool
|
|
|
+ }
|
|
|
+
|
|
|
+ private async getFullRemoteSongsPool(): Promise<VideoItem[]> {
|
|
|
+ if (this.searchRemoteSongsPool.length > 0) {
|
|
|
+ return this.searchRemoteSongsPool
|
|
|
+ }
|
|
|
+ if (!this.mediaTable) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ const remoteSongs = await this.mediaTable.queryRemoteSongsAsync()
|
|
|
+ this.searchRemoteSongsPool = this.filterUniqueSongs(remoteSongs)
|
|
|
+ return this.searchRemoteSongsPool
|
|
|
+ }
|
|
|
+
|
|
|
+ private async handleActionButtonTap(type: string): Promise<void> {
|
|
|
if (type === 'top') {
|
|
|
this.emitPlaylistPlay('find-top-played', '最近爱听', this.topPlayedSongsPool, 0)
|
|
|
return
|
|
|
}
|
|
|
if (type === 'local-random') {
|
|
|
- if (this.localSongsPool.length === 0) {
|
|
|
+ const allLocalSongs = await this.getFullLocalSongsPool()
|
|
|
+ if (allLocalSongs.length === 0) {
|
|
|
ToastUtil.showToast('本地歌曲为空')
|
|
|
return
|
|
|
}
|
|
|
- const startIndex = Math.floor(Math.random() * this.localSongsPool.length)
|
|
|
- this.emitPlaylistPlay('find-local-random-all', '随心所欲', this.localSongsPool, startIndex)
|
|
|
+ const startIndex = Math.floor(Math.random() * allLocalSongs.length)
|
|
|
+ this.emitPlaylistPlay('find-local-random-all', '随心所欲', allLocalSongs, startIndex, 3)
|
|
|
return
|
|
|
}
|
|
|
- if (this.remoteSongsPool.length === 0) {
|
|
|
+ const allRemoteSongs = await this.getFullRemoteSongsPool()
|
|
|
+ if (allRemoteSongs.length === 0) {
|
|
|
ToastUtil.showToast('需要先配置网盘并加载歌曲后才能播放')
|
|
|
return
|
|
|
}
|
|
|
- const startIndex = Math.floor(Math.random() * this.remoteSongsPool.length)
|
|
|
- this.emitPlaylistPlay('find-random-cloud', '云端漫游', this.remoteSongsPool, startIndex)
|
|
|
+ const startIndex = Math.floor(Math.random() * allRemoteSongs.length)
|
|
|
+ this.emitPlaylistPlay('find-random-cloud', '云端漫游', allRemoteSongs, startIndex, 3)
|
|
|
}
|
|
|
|
|
|
private handleSwiperTap(index: number): void {
|
|
|
@@ -773,6 +823,10 @@ export struct FindView {
|
|
|
this.emitPlaylistPlay('find-local-random', '本地随机', this.hotSongs, index)
|
|
|
}
|
|
|
|
|
|
+ private handleCloudMoodSongTap(index: number): void {
|
|
|
+ this.emitPlaylistPlay('find-cloud-mood', '云卷云舒', this.cloudMoodSongs, index)
|
|
|
+ }
|
|
|
+
|
|
|
private handleRecentSongTap(index: number): void {
|
|
|
this.emitPlaylistPlay('find-recent', '最近播放', this.recentSongs, index)
|
|
|
}
|
|
|
@@ -789,10 +843,21 @@ export struct FindView {
|
|
|
this.hotSongs = this.pickDifferentPreferredSongs(this.localSongsPool, HOT_SECTION_COUNT, this.hotSongs)
|
|
|
}
|
|
|
|
|
|
+ private refreshCloudMoodSongs(): void {
|
|
|
+ this.cloudMoodSongs = this.pickDifferentPreferredSongs(this.remoteSongsPool, HOT_SECTION_COUNT, this.cloudMoodSongs)
|
|
|
+ }
|
|
|
+
|
|
|
private refreshCloudSongs(): void {
|
|
|
+ const current = this.remoteSongs.slice()
|
|
|
const next = this.pickDifferentPreferredSongs(this.remoteSongsPool, CLOUD_SECTION_COUNT, this.remoteSongs)
|
|
|
- this.remoteSongs = this.ensureDifferentLeadingSongs(next, this.remoteSongs)
|
|
|
+ const updated = this.ensureDifferentLeadingSongs(next, this.remoteSongs)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView refreshCloudSongs pool=${this.remoteSongsPool.length}, current=${this.buildSongSelectionLog(current)}, next=${this.buildSongSelectionLog(next)}, updated=${this.buildSongSelectionLog(updated)}`
|
|
|
+ )
|
|
|
+ this.remoteSongs = updated
|
|
|
this.cloudSectionPageIndex = 0
|
|
|
+ this.updateCloudSectionPages()
|
|
|
}
|
|
|
|
|
|
private refreshRecentSongs(): void {
|
|
|
@@ -801,32 +866,69 @@ export struct FindView {
|
|
|
}
|
|
|
|
|
|
private refreshPopularSongs(): void {
|
|
|
+ const current = this.popularSongs.slice()
|
|
|
const next = this.pickDifferentPreferredSongs(this.topPlayedSongsPool, POPULAR_SECTION_COUNT, this.popularSongs)
|
|
|
- this.popularSongs = this.ensureDifferentLeadingSongs(next, this.popularSongs)
|
|
|
+ const updated = this.ensureDifferentLeadingSongs(next, this.popularSongs)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView refreshPopularSongs pool=${this.topPlayedSongsPool.length}, current=${this.buildSongSelectionLog(current)}, next=${this.buildSongSelectionLog(next)}, updated=${this.buildSongSelectionLog(updated)}`
|
|
|
+ )
|
|
|
+ this.popularSongs = updated
|
|
|
this.popularSectionPageIndex = 0
|
|
|
+ this.updatePopularSectionPages()
|
|
|
}
|
|
|
|
|
|
private refreshFeaturedAlbums(): void {
|
|
|
+ const current = this.featuredAlbums.slice()
|
|
|
const next = this.pickDifferentAlbumGroups(this.featuredAlbumsPool, FEATURED_ALBUM_COUNT, this.featuredAlbums)
|
|
|
- this.featuredAlbums = this.ensureDifferentLeadingAlbums(next, this.featuredAlbums)
|
|
|
+ const updated = this.ensureDifferentLeadingAlbums(next, this.featuredAlbums)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView refreshFeaturedAlbums pool=${this.featuredAlbumsPool.length}, current=${this.buildAlbumSelectionLog(current)}, next=${this.buildAlbumSelectionLog(next)}, updated=${this.buildAlbumSelectionLog(updated)}`
|
|
|
+ )
|
|
|
+ this.featuredAlbums = updated
|
|
|
this.featuredAlbumPageIndex = 0
|
|
|
+ this.updateFeaturedAlbumPages()
|
|
|
}
|
|
|
|
|
|
private refreshCloudAlbums(): void {
|
|
|
+ const current = this.cloudAlbums.slice()
|
|
|
const next = this.pickDifferentAlbumGroups(this.cloudAlbumsPool, CLOUD_ALBUM_COUNT, this.cloudAlbums)
|
|
|
- this.cloudAlbums = this.ensureDifferentLeadingAlbums(next, this.cloudAlbums)
|
|
|
+ const updated = this.ensureDifferentLeadingAlbums(next, this.cloudAlbums)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView refreshCloudAlbums pool=${this.cloudAlbumsPool.length}, current=${this.buildAlbumSelectionLog(current)}, next=${this.buildAlbumSelectionLog(next)}, updated=${this.buildAlbumSelectionLog(updated)}`
|
|
|
+ )
|
|
|
+ this.cloudAlbums = updated
|
|
|
this.cloudAlbumPageIndex = 0
|
|
|
+ this.updateCloudAlbumPages()
|
|
|
}
|
|
|
|
|
|
private openLocalSpecialList(target: string): void {
|
|
|
- this.mType = 0
|
|
|
- this.isShowDrawer = false
|
|
|
- this.offsetX = 0
|
|
|
- emitter.emit({ eventId: EventConstants.EVENT_OPEN_LOCAL_SPECIAL_LIST }, {
|
|
|
- data: {
|
|
|
- target: target
|
|
|
- }
|
|
|
- })
|
|
|
+ if (target === 'recent') {
|
|
|
+ this.openSongCollectionDetail('find-recent-collection', '最近播放', '', this.recentSongsPool)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (target === 'favorite') {
|
|
|
+ this.openSongCollectionDetail('find-favorite-collection', '我的收藏', '', this.favoriteSongsPool)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private openSongCollectionDetail(id: string, title: string, sourceLabel: string, songs: VideoItem[]): void {
|
|
|
+ if (songs.length === 0) {
|
|
|
+ ToastUtil.showToast('暂无可展示歌曲')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const coverSong = this.pickAlbumCoverSong(songs)
|
|
|
+ this.currentAlbumId = id
|
|
|
+ this.currentAlbumTitle = title
|
|
|
+ this.currentAlbumArtist = ''
|
|
|
+ this.currentAlbumCoverPath = coverSong?.pixelMapPath ?? ''
|
|
|
+ this.currentAlbumSourceLabel = sourceLabel
|
|
|
+ this.currentAlbumSongs = songs.slice()
|
|
|
+ this.isAlbumMode = true
|
|
|
+ this.isSearchMode = false
|
|
|
}
|
|
|
|
|
|
private openAlbumDetail(album: FindAlbumGroup): void {
|
|
|
@@ -850,34 +952,37 @@ export struct FindView {
|
|
|
this.currentAlbumSongs = []
|
|
|
}
|
|
|
|
|
|
- private playCurrentAlbum(startIndex: number): void {
|
|
|
- if (this.currentAlbumSongs.length === 0) {
|
|
|
+ private playCurrentAlbum(startIndex: number, songs: VideoItem[] = this.currentAlbumSongs): void {
|
|
|
+ if (songs.length === 0) {
|
|
|
ToastUtil.showToast('专辑里还没有歌曲')
|
|
|
return
|
|
|
}
|
|
|
this.emitPlaylistPlay(
|
|
|
'find-album-playlist',
|
|
|
this.currentAlbumTitle.length > 0 ? this.currentAlbumTitle : '专辑',
|
|
|
- this.currentAlbumSongs,
|
|
|
+ songs,
|
|
|
startIndex
|
|
|
)
|
|
|
}
|
|
|
|
|
|
- private handleAlbumPlayAll(): void {
|
|
|
- this.playCurrentAlbum(0)
|
|
|
+ private handleAlbumPlayAll(songs?: VideoItem[]): void {
|
|
|
+ const targetSongs = songs && songs.length > 0 ? songs : this.currentAlbumSongs
|
|
|
+ this.playCurrentAlbum(0, targetSongs)
|
|
|
}
|
|
|
|
|
|
- private handleAlbumRandomPlay(): void {
|
|
|
- if (this.currentAlbumSongs.length === 0) {
|
|
|
+ private handleAlbumRandomPlay(songs?: VideoItem[]): void {
|
|
|
+ const targetSongs = songs && songs.length > 0 ? songs : this.currentAlbumSongs
|
|
|
+ if (targetSongs.length === 0) {
|
|
|
ToastUtil.showToast('专辑里还没有歌曲')
|
|
|
return
|
|
|
}
|
|
|
- const startIndex = Math.floor(Math.random() * this.currentAlbumSongs.length)
|
|
|
- this.playCurrentAlbum(startIndex)
|
|
|
+ const startIndex = Math.floor(Math.random() * targetSongs.length)
|
|
|
+ this.playCurrentAlbum(startIndex, targetSongs)
|
|
|
}
|
|
|
|
|
|
- private handleAlbumSongTap(index: number): void {
|
|
|
- this.playCurrentAlbum(index)
|
|
|
+ private handleAlbumSongTap(index: number, songs?: VideoItem[]): void {
|
|
|
+ const targetSongs = songs && songs.length > 0 ? songs : this.currentAlbumSongs
|
|
|
+ this.playCurrentAlbum(index, targetSongs)
|
|
|
}
|
|
|
|
|
|
private loadSearchHistory(): void {
|
|
|
@@ -1021,6 +1126,30 @@ export struct FindView {
|
|
|
return Math.min(Math.max(currentIndex, 0), pageCount - 1)
|
|
|
}
|
|
|
|
|
|
+ private buildSongSelectionLog(items: VideoItem[], limit: number = 4): string {
|
|
|
+ if (items.length === 0) {
|
|
|
+ return '[]'
|
|
|
+ }
|
|
|
+ const parts: string[] = []
|
|
|
+ const maxCount = Math.min(limit, items.length)
|
|
|
+ for (let i = 0; i < maxCount; i++) {
|
|
|
+ parts.push(this.getSongTitle(items[i]))
|
|
|
+ }
|
|
|
+ return `[${parts.join(', ')}](${items.length})`
|
|
|
+ }
|
|
|
+
|
|
|
+ private buildAlbumSelectionLog(items: FindAlbumGroup[], limit: number = 4): string {
|
|
|
+ if (items.length === 0) {
|
|
|
+ return '[]'
|
|
|
+ }
|
|
|
+ const parts: string[] = []
|
|
|
+ const maxCount = Math.min(limit, items.length)
|
|
|
+ for (let i = 0; i < maxCount; i++) {
|
|
|
+ parts.push(items[i].title)
|
|
|
+ }
|
|
|
+ return `[${parts.join(', ')}](${items.length})`
|
|
|
+ }
|
|
|
+
|
|
|
private buildSongPages(prefix: string, items: VideoItem[], columns: number): FindSongPage[] {
|
|
|
const pages: FindSongPage[] = []
|
|
|
const pageSize = this.getSectionPageSize(columns)
|
|
|
@@ -1045,24 +1174,64 @@ export struct FindView {
|
|
|
return pages
|
|
|
}
|
|
|
|
|
|
- private getCloudSectionPages(): FindSongPage[] {
|
|
|
- return this.buildSongPages('find_cloud_section', this.remoteSongs, this.getDiscoverSectionColumns())
|
|
|
+ private rebuildPagedSectionSources(): void {
|
|
|
+ this.updateCloudSectionPages()
|
|
|
+ this.updateFeaturedAlbumPages()
|
|
|
+ this.updateCloudAlbumPages()
|
|
|
+ this.updatePopularSectionPages()
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView rebuildPagedSectionSources columns=${this.getDiscoverSectionColumns()}, cloudPages=${this.cloudSectionPages.length}, featuredAlbumPages=${this.featuredAlbumPages.length}, cloudAlbumPages=${this.cloudAlbumPages.length}, popularPages=${this.popularSectionPages.length}`
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
- private getFeaturedAlbumPages(): FindAlbumPage[] {
|
|
|
- return this.buildAlbumPages('find_featured_album_section', this.featuredAlbums, this.getDiscoverSectionColumns())
|
|
|
+ private updateCloudSectionPages(): void {
|
|
|
+ this.cloudSectionPageVersion++
|
|
|
+ this.cloudSectionPages =
|
|
|
+ this.buildSongPages(`find_cloud_section_${this.cloudSectionPageVersion}`, this.remoteSongs, this.getDiscoverSectionColumns())
|
|
|
+ this.cloudSectionPageIndex = this.getSafeSectionPageIndex(this.cloudSectionPages.length, this.cloudSectionPageIndex)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView updateCloudSectionPages version=${this.cloudSectionPageVersion}, pageIndex=${this.cloudSectionPageIndex}, pages=${this.cloudSectionPages.length}, songs=${this.buildSongSelectionLog(this.remoteSongs)}`
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
- private getCloudAlbumPages(): FindAlbumPage[] {
|
|
|
- return this.buildAlbumPages('find_cloud_album_section', this.cloudAlbums, this.getDiscoverSectionColumns())
|
|
|
+ private updateFeaturedAlbumPages(): void {
|
|
|
+ this.featuredAlbumPageVersion++
|
|
|
+ this.featuredAlbumPages =
|
|
|
+ this.buildAlbumPages(`find_featured_album_section_${this.featuredAlbumPageVersion}`, this.featuredAlbums,
|
|
|
+ this.getDiscoverSectionColumns())
|
|
|
+ this.featuredAlbumPageIndex = this.getSafeSectionPageIndex(this.featuredAlbumPages.length, this.featuredAlbumPageIndex)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView updateFeaturedAlbumPages version=${this.featuredAlbumPageVersion}, pageIndex=${this.featuredAlbumPageIndex}, pages=${this.featuredAlbumPages.length}, albums=${this.buildAlbumSelectionLog(this.featuredAlbums)}`
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
- private getRecentSectionPages(): FindSongPage[] {
|
|
|
- return this.buildSongPages('find_recent_section', this.recentSongs, this.getDiscoverSectionColumns())
|
|
|
+ private updateCloudAlbumPages(): void {
|
|
|
+ this.cloudAlbumPageVersion++
|
|
|
+ this.cloudAlbumPages =
|
|
|
+ this.buildAlbumPages(`find_cloud_album_section_${this.cloudAlbumPageVersion}`, this.cloudAlbums, this.getDiscoverSectionColumns())
|
|
|
+ this.cloudAlbumPageIndex = this.getSafeSectionPageIndex(this.cloudAlbumPages.length, this.cloudAlbumPageIndex)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView updateCloudAlbumPages version=${this.cloudAlbumPageVersion}, pageIndex=${this.cloudAlbumPageIndex}, pages=${this.cloudAlbumPages.length}, albums=${this.buildAlbumSelectionLog(this.cloudAlbums)}`
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ private updatePopularSectionPages(): void {
|
|
|
+ this.popularSectionPageVersion++
|
|
|
+ this.popularSectionPages =
|
|
|
+ this.buildSongPages(`find_popular_section_${this.popularSectionPageVersion}`, this.popularSongs, this.getDiscoverSectionColumns())
|
|
|
+ this.popularSectionPageIndex = this.getSafeSectionPageIndex(this.popularSectionPages.length, this.popularSectionPageIndex)
|
|
|
+ Logger.info(
|
|
|
+ TAG,
|
|
|
+ `FindView updatePopularSectionPages version=${this.popularSectionPageVersion}, pageIndex=${this.popularSectionPageIndex}, pages=${this.popularSectionPages.length}, songs=${this.buildSongSelectionLog(this.popularSongs)}`
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
- private getPopularSectionPages(): FindSongPage[] {
|
|
|
- return this.buildSongPages('find_popular_section', this.popularSongs, this.getDiscoverSectionColumns())
|
|
|
+ private getRecentSectionPages(): FindSongPage[] {
|
|
|
+ return this.buildSongPages('find_recent_section', this.recentSongs, this.getDiscoverSectionColumns())
|
|
|
}
|
|
|
|
|
|
private getFavoriteSectionPages(): FindSongPage[] {
|
|
|
@@ -1539,7 +1708,7 @@ export struct FindView {
|
|
|
ForEach(this.swiperSongs, (item: VideoItem, index: number) => {
|
|
|
PointLightContentButton({
|
|
|
pointColor: this.themeColor,
|
|
|
- buttonRadius: 24,
|
|
|
+ buttonRadius: 0,
|
|
|
pointLightHeight: 180,
|
|
|
builder: () => {
|
|
|
this.buildSwiperCardContent(item)
|
|
|
@@ -1581,7 +1750,7 @@ export struct FindView {
|
|
|
})
|
|
|
.layoutWeight(1)
|
|
|
.onClick(() => {
|
|
|
- this.handleActionButtonTap('top')
|
|
|
+ void this.handleActionButtonTap('top')
|
|
|
})
|
|
|
|
|
|
PointLightActionButton({
|
|
|
@@ -1593,7 +1762,7 @@ export struct FindView {
|
|
|
})
|
|
|
.layoutWeight(1)
|
|
|
.onClick(() => {
|
|
|
- this.handleActionButtonTap('local-random')
|
|
|
+ void this.handleActionButtonTap('local-random')
|
|
|
})
|
|
|
|
|
|
PointLightActionButton({
|
|
|
@@ -1605,7 +1774,7 @@ export struct FindView {
|
|
|
})
|
|
|
.layoutWeight(1)
|
|
|
.onClick(() => {
|
|
|
- this.handleActionButtonTap('cloud-random')
|
|
|
+ void this.handleActionButtonTap('cloud-random')
|
|
|
})
|
|
|
}
|
|
|
.width('100%')
|
|
|
@@ -1659,9 +1828,10 @@ export struct FindView {
|
|
|
private buildCloudSection() {
|
|
|
ConfigTitle({
|
|
|
text: '漫步云端',
|
|
|
- indicatorCount: this.getCloudSectionPages().length,
|
|
|
- indicatorIndex: this.getSafeSectionPageIndex(this.getCloudSectionPages().length, this.cloudSectionPageIndex),
|
|
|
+ indicatorCount: this.cloudSectionPages.length,
|
|
|
+ indicatorIndex: this.getSafeSectionPageIndex(this.cloudSectionPages.length, this.cloudSectionPageIndex),
|
|
|
onActionClick: () => {
|
|
|
+ Logger.info(TAG, `FindView clickChange cloudSection current=${this.buildSongSelectionLog(this.remoteSongs)}`)
|
|
|
this.refreshCloudSongs()
|
|
|
}
|
|
|
})
|
|
|
@@ -1669,7 +1839,7 @@ export struct FindView {
|
|
|
this.buildSectionEmptyState('还没有网盘歌曲', '先去网盘页或远程音乐页加载歌曲,这里会自动展示', false)
|
|
|
} else {
|
|
|
Swiper() {
|
|
|
- ForEach(this.getCloudSectionPages(), (page: FindSongPage, pageIndex: number) => {
|
|
|
+ ForEach(this.cloudSectionPages, (page: FindSongPage, pageIndex: number) => {
|
|
|
GridRow({ columns: this.getDiscoverSectionColumns(), gutter: 8 }) {
|
|
|
ForEach(page.items, (item: VideoItem, itemIndex: number) => {
|
|
|
GridCol() {
|
|
|
@@ -1756,9 +1926,10 @@ export struct FindView {
|
|
|
private buildFeaturedAlbumSection() {
|
|
|
ConfigTitle({
|
|
|
text: '精选专辑',
|
|
|
- indicatorCount: this.getFeaturedAlbumPages().length,
|
|
|
- indicatorIndex: this.getSafeSectionPageIndex(this.getFeaturedAlbumPages().length, this.featuredAlbumPageIndex),
|
|
|
+ indicatorCount: this.featuredAlbumPages.length,
|
|
|
+ indicatorIndex: this.getSafeSectionPageIndex(this.featuredAlbumPages.length, this.featuredAlbumPageIndex),
|
|
|
onActionClick: () => {
|
|
|
+ Logger.info(TAG, `FindView clickChange featuredAlbums current=${this.buildAlbumSelectionLog(this.featuredAlbums)}`)
|
|
|
this.refreshFeaturedAlbums()
|
|
|
}
|
|
|
})
|
|
|
@@ -1766,7 +1937,7 @@ export struct FindView {
|
|
|
this.buildSectionEmptyState('还没有可展示的专辑', '带专辑信息的本地歌曲会自动整理到这里', false)
|
|
|
} else {
|
|
|
Swiper() {
|
|
|
- ForEach(this.getFeaturedAlbumPages(), (page: FindAlbumPage) => {
|
|
|
+ ForEach(this.featuredAlbumPages, (page: FindAlbumPage) => {
|
|
|
GridRow({ columns: this.getDiscoverSectionColumns(), gutter: 8 }) {
|
|
|
ForEach(page.items, (album: FindAlbumGroup) => {
|
|
|
GridCol() {
|
|
|
@@ -1800,9 +1971,10 @@ export struct FindView {
|
|
|
private buildCloudAlbumSection() {
|
|
|
ConfigTitle({
|
|
|
text: '云端专辑',
|
|
|
- indicatorCount: this.getCloudAlbumPages().length,
|
|
|
- indicatorIndex: this.getSafeSectionPageIndex(this.getCloudAlbumPages().length, this.cloudAlbumPageIndex),
|
|
|
+ indicatorCount: this.cloudAlbumPages.length,
|
|
|
+ indicatorIndex: this.getSafeSectionPageIndex(this.cloudAlbumPages.length, this.cloudAlbumPageIndex),
|
|
|
onActionClick: () => {
|
|
|
+ Logger.info(TAG, `FindView clickChange cloudAlbums current=${this.buildAlbumSelectionLog(this.cloudAlbums)}`)
|
|
|
this.refreshCloudAlbums()
|
|
|
}
|
|
|
})
|
|
|
@@ -1810,7 +1982,7 @@ export struct FindView {
|
|
|
this.buildSectionEmptyState('云端歌曲还没有专辑信息', '网盘歌曲带有专辑标签后,这里会自动汇总', false)
|
|
|
} else {
|
|
|
Swiper() {
|
|
|
- ForEach(this.getCloudAlbumPages(), (page: FindAlbumPage) => {
|
|
|
+ ForEach(this.cloudAlbumPages, (page: FindAlbumPage) => {
|
|
|
GridRow({ columns: this.getDiscoverSectionColumns(), gutter: 8 }) {
|
|
|
ForEach(page.items, (album: FindAlbumGroup) => {
|
|
|
GridCol() {
|
|
|
@@ -1886,7 +2058,7 @@ export struct FindView {
|
|
|
@Builder
|
|
|
private buildLocalRandomSection() {
|
|
|
ConfigTitle({
|
|
|
- text: '本地随机',
|
|
|
+ text: '今日夜曲',
|
|
|
onActionClick: () => {
|
|
|
this.refreshLocalRandomSongs()
|
|
|
}
|
|
|
@@ -1920,6 +2092,43 @@ export struct FindView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Builder
|
|
|
+ private buildCloudMoodSection() {
|
|
|
+ ConfigTitle({
|
|
|
+ text: '云卷云舒',
|
|
|
+ onActionClick: () => {
|
|
|
+ this.refreshCloudMoodSongs()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (this.cloudMoodSongs.length === 0) {
|
|
|
+ this.buildSectionEmptyState('网盘随机还没有内容', '网盘歌曲加载完成后,这里会随机展示歌曲', false)
|
|
|
+ } else {
|
|
|
+ List({ space: 8 }) {
|
|
|
+ ForEach(this.cloudMoodSongs, (item: VideoItem, index: number) => {
|
|
|
+ ListItem() {
|
|
|
+ PointLightContentButton({
|
|
|
+ pointColor: this.themeColor,
|
|
|
+ buttonRadius: 16,
|
|
|
+ builder: () => {
|
|
|
+ this.buildHotSongCardContent(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .onClick(() => {
|
|
|
+ this.handleCloudMoodSongTap(index)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .margin({
|
|
|
+ left: index === 0 ? 2 : 0,
|
|
|
+ right: index === this.cloudMoodSongs.length - 1 ? 2 : 0
|
|
|
+ })
|
|
|
+ }, getFindSongKey)
|
|
|
+ }
|
|
|
+ .listDirection(Axis.Horizontal)
|
|
|
+ .scrollBar(BarState.Off)
|
|
|
+ .edgeEffect(EdgeEffect.Spring, { alwaysEnabled: true })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Builder
|
|
|
private buildRecentSongCardContent(item: VideoItem) {
|
|
|
Column({ space: 6 }) {
|
|
|
@@ -2054,9 +2263,10 @@ export struct FindView {
|
|
|
private buildPopularSection() {
|
|
|
ConfigTitle({
|
|
|
text: '热门歌曲',
|
|
|
- indicatorCount: this.getPopularSectionPages().length,
|
|
|
- indicatorIndex: this.getSafeSectionPageIndex(this.getPopularSectionPages().length, this.popularSectionPageIndex),
|
|
|
+ indicatorCount: this.popularSectionPages.length,
|
|
|
+ indicatorIndex: this.getSafeSectionPageIndex(this.popularSectionPages.length, this.popularSectionPageIndex),
|
|
|
onActionClick: () => {
|
|
|
+ Logger.info(TAG, `FindView clickChange popularSongs current=${this.buildSongSelectionLog(this.popularSongs)}`)
|
|
|
this.refreshPopularSongs()
|
|
|
}
|
|
|
})
|
|
|
@@ -2064,7 +2274,7 @@ export struct FindView {
|
|
|
this.buildSectionEmptyState('热门歌曲还没生成', '播放次数高的歌曲会优先展示在这里', false)
|
|
|
} else {
|
|
|
Swiper() {
|
|
|
- ForEach(this.getPopularSectionPages(), (page: FindSongPage, pageIndex: number) => {
|
|
|
+ ForEach(this.popularSectionPages, (page: FindSongPage, pageIndex: number) => {
|
|
|
GridRow({ columns: this.getDiscoverSectionColumns(), gutter: 8 }) {
|
|
|
ForEach(page.items, (item: VideoItem, itemIndex: number) => {
|
|
|
GridCol() {
|
|
|
@@ -2214,6 +2424,7 @@ export struct FindView {
|
|
|
this.buildActionButtons()
|
|
|
this.buildLocalRandomSection()
|
|
|
this.buildFavoriteSection()
|
|
|
+ this.buildCloudMoodSection()
|
|
|
this.buildCloudSection()
|
|
|
this.buildFeaturedAlbumSection()
|
|
|
if (this.remoteSongsPool.length > 0 || this.cloudAlbumsPool.length > 0 || this.cloudAlbums.length > 0) {
|
|
|
@@ -2289,14 +2500,14 @@ export struct FindView {
|
|
|
topSafeHeight: this.topSafeHeight,
|
|
|
bottomSafeHeight: this.bottomSafeHeight,
|
|
|
themeColor: this.themeColor,
|
|
|
- onPlayAll: () => {
|
|
|
- this.handleAlbumPlayAll()
|
|
|
+ onPlayAll: (songs?: VideoItem[]) => {
|
|
|
+ this.handleAlbumPlayAll(songs)
|
|
|
},
|
|
|
- onRandomPlay: () => {
|
|
|
- this.handleAlbumRandomPlay()
|
|
|
+ onRandomPlay: (songs?: VideoItem[]) => {
|
|
|
+ this.handleAlbumRandomPlay(songs)
|
|
|
},
|
|
|
- onSongTap: (index: number) => {
|
|
|
- this.handleAlbumSongTap(index)
|
|
|
+ onSongTap: (index: number, songs?: VideoItem[]) => {
|
|
|
+ this.handleAlbumSongTap(index, songs)
|
|
|
}
|
|
|
})
|
|
|
} else {
|