Browse Source

优化一些ui问题

onecold 7 months ago
parent
commit
4ff0e3f9ec

+ 1 - 0
entry/src/main/ets/common/network/EmbyApi.ets

@@ -117,6 +117,7 @@ export interface EmbyArtist {
   id: string;
   id: string;
   name: string;
   name: string;
   albumCount?: number;
   albumCount?: number;
+  songCount?: number;
 }
 }
 
 
 export interface EmbyAlbum {
 export interface EmbyAlbum {

+ 1 - 0
entry/src/main/ets/common/network/JellyfinApi.ets

@@ -113,6 +113,7 @@ export interface JellyfinArtist {
   id: string;
   id: string;
   name: string;
   name: string;
   albumCount?: number;
   albumCount?: number;
+  songCount?: number;
 }
 }
 
 
 export interface JellyfinAlbum {
 export interface JellyfinAlbum {

+ 11 - 0
entry/src/main/ets/view/NavidromePage.ets

@@ -918,6 +918,8 @@ export struct NavidromePage {
       const restArtist: NavidromeRestArtist = {
       const restArtist: NavidromeRestArtist = {
         id: artist.id,
         id: artist.id,
         name: artist.name,
         name: artist.name,
+        albumCount: artist.albumCount,
+        songCount: artist.songCount,
         coverUrl: coverUrl
         coverUrl: coverUrl
       };
       };
       results.push(restArtist);
       results.push(restArtist);
@@ -933,6 +935,8 @@ export struct NavidromePage {
       const restArtist: NavidromeRestArtist = {
       const restArtist: NavidromeRestArtist = {
         id: artist.id,
         id: artist.id,
         name: artist.name,
         name: artist.name,
+        albumCount: artist.albumCount,
+        songCount: artist.songCount,
         coverUrl: coverUrl
         coverUrl: coverUrl
       };
       };
       results.push(restArtist);
       results.push(restArtist);
@@ -1901,6 +1905,7 @@ export struct NavidromePage {
             .opacity(0.6)
             .opacity(0.6)
             .maxLines(1)
             .maxLines(1)
             .textOverflow({ overflow: TextOverflow.Ellipsis })
             .textOverflow({ overflow: TextOverflow.Ellipsis })
+            .visibility((artist.albumCount ?? 0) === 0 && (artist.songCount ?? 0) === 0 ? Visibility.None : Visibility.Visible)
         }
         }
         .alignItems(HorizontalAlign.Start)
         .alignItems(HorizontalAlign.Start)
         .padding({ right: 20 })
         .padding({ right: 20 })
@@ -2044,6 +2049,12 @@ export struct NavidromePage {
     const albumCount = artist.albumCount ?? 0;
     const albumCount = artist.albumCount ?? 0;
     const songCount = artist.songCount ?? 0;
     const songCount = artist.songCount ?? 0;
     const playCount = artist.playCount ?? 0;
     const playCount = artist.playCount ?? 0;
+
+    // 如果专辑和歌曲数都为0,不显示元数据信息
+    if (albumCount === 0 && songCount === 0) {
+      return '';
+    }
+
     return `专辑 ${albumCount} · 歌曲 ${songCount} `;
     return `专辑 ${albumCount} · 歌曲 ${songCount} `;
   }
   }