Quellcode durchsuchen

设置网盘播放的时候 是否弹出播放页

onecold vor 9 Monaten
Ursprung
Commit
09aaab4f24

+ 4 - 2
entry/src/main/ets/pages/WebDavMainPage.ets

@@ -29,6 +29,7 @@ interface PlaylistEventData {
   playlistName: string;
   songCount: number;
   startIndex: number;
+  isJump: boolean;
   songFilePaths: string[];
   // 移除webDavAuthInfo,现在直接使用videoItems中的webdav_account_id
 }
@@ -477,7 +478,7 @@ export struct WebDavMainPage {
   }
 
   // 播放WebDAV歌曲
-  private playSong(song: VideoItem, index: number,isJump?:boolean): void {
+  private playSong(song: VideoItem, index: number,isJump:boolean=false): void {
     try {
       Logger.info(TAG, `heanup === WebDAV playSong 方法被调用 ===`);
       Logger.info(TAG, 'heanup 播放指定歌曲: ' + song.name + ', 索引: ' + index);
@@ -517,6 +518,7 @@ export struct WebDavMainPage {
         playlistName: `${getRemoteDriveDisplayLabel(this.selectedAccount?.webType)} - ${this.selectedAccount?.name || '未知账户'}`,
         songCount: this.songs.length,
         startIndex: index,
+        isJump: isJump,//设置true会弹出播放页
         songFilePaths: songFilePaths
       };
 
@@ -531,7 +533,7 @@ export struct WebDavMainPage {
 
       Logger.info(TAG, `heanup 发送WebDAV播放事件,只传递索引: ${index}`);
 
-      if(!this.isNoJumpToHome||isJump){
+      if(!this.isNoJumpToHome){
         // 跳转到首页播放器
         this.getUIContext()?.animateTo({ duration: 555 }, () => {
           this.mType = 0

+ 11 - 4
entry/src/main/ets/view/LocalMusic.ets

@@ -138,6 +138,7 @@ interface PlaylistEventData {
   songCount: number;
   startIndex: number;
   songFilePaths: string[];
+  isJump: boolean;
   webDavAuthInfo?: WebDavAuthItem; // 新增WebDAV认证信息
 }
 
@@ -1126,6 +1127,7 @@ export struct LocalMusic {
           playlistName: data.playlistName as string,
           songCount: data.songCount as number,
           startIndex: data.startIndex as number,
+          isJump: data.isJump as boolean,
           songFilePaths: data.songFilePaths as string[]
         }
 
@@ -1133,7 +1135,8 @@ export struct LocalMusic {
           playlistData.playlistId,
           playlistData.playlistName,
           playlistData.songFilePaths,
-          playlistData.startIndex
+          playlistData.startIndex,
+          playlistData.isJump,
         )
         return
       }
@@ -15135,7 +15138,7 @@ export struct LocalMusic {
    * 处理歌单播放请求
    */
   private async handlePlaylistPlayRequest(playlistId: string, playlistName:
-    string, songFilePaths: string[], startIndex: number) {
+    string, songFilePaths: string[], startIndex: number,isJump: boolean) {
     try {
       Logger.info(`heanup 处理歌单播放请求: ${playlistName}, 歌曲数量: ${songFilePaths.length}, 开始索引: ${startIndex}`)
 
@@ -15153,7 +15156,9 @@ export struct LocalMusic {
           // 验证webdav_account_id设置情况
           const accountIds = videoItems.map(item => item.webdav_account_id).filter(id => id);
           Logger.info(`heanup 有 ${accountIds.length}/${videoItems.length} 首歌曲设置了webdav_account_id`)
-          this.setShowPlayTrue()//显示播放页
+          if(isJump){
+            this.setShowPlayTrue()//显示播放页
+          }
           this.finishLoadingPlaylist(videoItems, currentPlayIndex, playlistName)
           return
         } else {
@@ -15167,7 +15172,9 @@ export struct LocalMusic {
         const currentPlayIndex = getNavidromeCurrentPlayIndex();
         Logger.info(`heanup Navidrome歌曲列表长度: ${videoItems.length}`);
         if (videoItems && videoItems.length > 0) {
-          this.setShowPlayTrue()//显示播放页
+          if(isJump){
+            this.setShowPlayTrue()//显示播放页
+          }
           this.finishLoadingPlaylist(videoItems, currentPlayIndex, playlistName);
           return;
         } else {

+ 4 - 2
entry/src/main/ets/view/NavidromePage.ets

@@ -26,6 +26,7 @@ interface PlaylistEventData {
   playlistName: string;
   songCount: number;
   startIndex: number;
+  isJump: boolean;
   songFilePaths: string[];
 }
 
@@ -521,7 +522,7 @@ export struct NavidromePage {
     this.filterLabel = '';
   }
 
-  private playSong(song: VideoItem, index: number,isJump?:boolean): void {
+  private playSong(song: VideoItem, index: number,isJump:boolean = false): void {
     try {
       if (!this.allVideos || this.allVideos.length === 0) {
         ToastUtil.showToast('暂无可播放的歌曲');
@@ -541,12 +542,13 @@ export struct NavidromePage {
         playlistName: `Navidrome - ${account.name ?? '未知账户'}`,
         songCount: this.allVideos.length,
         startIndex,
+        isJump: isJump,//设置true会弹出播放页
         songFilePaths: this.allVideos.map(item => item.filePath)
       };
       const eventPlaylistPlay: emitter.InnerEvent = { eventId: EventConstants.EVENT_PLAYLIST_PLAY };
       emitter.emit(eventPlaylistPlay, { data: playlistData });
       Logger.info('heanup', `Navidrome 发送播放事件,歌曲数: ${this.allVideos.length}, 起始: ${index}`);
-      if(!this.isNoJumpToHome||isJump){
+      if(!this.isNoJumpToHome){
         // 跳转到首页播放器
         this.getUIContext()?.animateTo({ duration: 555 }, () => {
           this.mType = 0