chendeben 10 месяцев назад
Родитель
Сommit
3a3ba8b091

+ 51 - 51
entry/src/main/ets/common/util/PlaylistTable.ets

@@ -39,9 +39,9 @@ export default class PlaylistTable {
       // 创建表
       await this.createTables();
 
-      Logger.info('PlaylistTable', '数据库初始化成功');
+      Logger.info('heanup PlaylistTable', '数据库初始化成功');
     } catch (error) {
-      Logger.error('PlaylistTable', `初始化数据库失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `初始化数据库失败: ${error.message}`);
     }
   }
 
@@ -60,9 +60,9 @@ export default class PlaylistTable {
       // 创建歌单歌曲关联表
       await this.rdbStore.executeSql(RdbUtils.PLAYLIST_SONG_TABLE.sqlCreate);
       
-      Logger.info('PlaylistTable', '数据库表创建成功');
+      Logger.info('heanup PlaylistTable', '数据库表创建成功');
     } catch (error) {
-      Logger.error('PlaylistTable', `创建表失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `创建表失败: ${error.message}`);
     }
   }
 
@@ -80,7 +80,7 @@ export default class PlaylistTable {
     await this.ensureInitialized();
 
     if (!this.rdbStore) {
-      Logger.error('PlaylistTable', '数据库未初始化');
+      Logger.error('heanup PlaylistTable', '数据库未初始化');
       return false;
     }
 
@@ -91,10 +91,10 @@ export default class PlaylistTable {
       const params = [id, name, coverPath || null, description || null, now, now, 0, 0];
 
       await this.rdbStore.executeSql(sql, params);
-      Logger.info('PlaylistTable', `歌单创建成功: ${name}`);
+      Logger.info('heanup PlaylistTable', `歌单创建成功: ${name}`);
       return true;
     } catch (error) {
-      Logger.error('PlaylistTable', `创建歌单失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `创建歌单失败: ${error.message}`);
       return false;
     }
   }
@@ -116,10 +116,10 @@ export default class PlaylistTable {
       const deletePlaylistSql = 'DELETE FROM playlistTable WHERE id = ?';
       await this.rdbStore.executeSql(deletePlaylistSql, [playlistId]);
       
-      Logger.info('PlaylistTable', `歌单删除成功: ${playlistId}`);
+      Logger.info('heanup PlaylistTable', `歌单删除成功: ${playlistId}`);
       return true;
     } catch (error) {
-      Logger.error('PlaylistTable', `删除歌单失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `删除歌单失败: ${error.message}`);
       return false;
     }
   }
@@ -157,10 +157,10 @@ export default class PlaylistTable {
       const sql = `UPDATE playlistTable SET ${updates.join(', ')} WHERE id = ?`;
       await this.rdbStore.executeSql(sql, params);
       
-      Logger.info('PlaylistTable', `歌单更新成功: ${playlistId}`);
+      Logger.info('heanup PlaylistTable', `歌单更新成功: ${playlistId}`);
       return true;
     } catch (error) {
-      Logger.error('PlaylistTable', `更新歌单失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `更新歌单失败: ${error.message}`);
       return false;
     }
   }
@@ -172,13 +172,13 @@ export default class PlaylistTable {
     await this.ensureInitialized();
 
     if (!this.rdbStore) {
-      Logger.error('PlaylistTable', '数据库未初始化');
+      Logger.error('heanup PlaylistTable', '数据库未初始化');
       return [];
     }
 
     try {
       const sql = 'SELECT * FROM playlistTable ORDER BY sortOrder ASC, createTime DESC';
-      Logger.info('PlaylistTable', '开始查询所有歌单');
+      Logger.info('heanup PlaylistTable', '开始查询所有歌单');
       const resultSet = await this.rdbStore.querySql(sql);
       
       const playlists: Playlist[] = [];
@@ -199,10 +199,10 @@ export default class PlaylistTable {
       }
       
       resultSet.close();
-      Logger.info('PlaylistTable', `查询到 ${playlists.length} 个歌单`);
+      Logger.info('heanup PlaylistTable', `查询到 ${playlists.length} 个歌单`);
       return playlists;
     } catch (error) {
-      Logger.error('PlaylistTable', `查询歌单失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `查询歌单失败: ${error.message}`);
       return [];
     }
   }
@@ -237,7 +237,7 @@ export default class PlaylistTable {
       resultSet.close();
       return null;
     } catch (error) {
-      Logger.error('PlaylistTable', `查询歌单失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `查询歌单失败: ${error.message}`);
       return null;
     }
   }
@@ -249,17 +249,17 @@ export default class PlaylistTable {
     await this.ensureInitialized();
 
     if (!this.rdbStore) {
-      Logger.error('PlaylistTable', '数据库未初始化');
+      Logger.error('heanup PlaylistTable', '数据库未初始化');
       return false;
     }
 
     try {
-      Logger.info('PlaylistTable', `开始添加歌曲到歌单: playlistId=${playlistId}, songFilePath=${songFilePath}`);
+      Logger.info('heanup PlaylistTable', `开始添加歌曲到歌单: playlistId=${playlistId}, songFilePath=${songFilePath}`);
 
       // 检查歌曲是否已在歌单中
       const isInPlaylist = await this.isSongInPlaylist(playlistId, songFilePath);
       if (isInPlaylist) {
-        Logger.info('PlaylistTable', '歌曲已在歌单中');
+        Logger.info('heanup PlaylistTable', '歌曲已在歌单中');
         return false;
       }
 
@@ -268,18 +268,18 @@ export default class PlaylistTable {
       const sql = 'INSERT INTO playlistSongTable (id, playlistId, songFilePath, addTime, sortOrder) VALUES (?, ?, ?, ?, ?)';
       const params = [id, playlistId, songFilePath, addTime, 0];
 
-      Logger.info('PlaylistTable', `执行SQL插入: ${sql}`);
+      Logger.info('heanup PlaylistTable', `执行SQL插入: ${sql}`);
       await this.rdbStore.executeSql(sql, params);
-      Logger.info('PlaylistTable', '歌曲插入成功');
+      Logger.info('heanup PlaylistTable', '歌曲插入成功');
 
       // 更新歌单歌曲数量
-      Logger.info('PlaylistTable', '开始更新歌单歌曲数量');
+      Logger.info('heanup PlaylistTable', '开始更新歌单歌曲数量');
       await this.updatePlaylistSongCount(playlistId);
 
-      Logger.info('PlaylistTable', `歌曲添加到歌单成功: ${songFilePath}`);
+      Logger.info('heanup PlaylistTable', `歌曲添加到歌单成功: ${songFilePath}`);
       return true;
     } catch (error) {
-      Logger.error('PlaylistTable', `添加歌曲到歌单失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `添加歌曲到歌单失败: ${error.message}`);
       return false;
     }
   }
@@ -291,17 +291,17 @@ export default class PlaylistTable {
     await this.ensureInitialized();
 
     if (!this.rdbStore) {
-      Logger.error('PlaylistTable', '数据库未初始化');
+      Logger.error('heanup PlaylistTable', '数据库未初始化');
       return false;
     }
 
     if (!songFilePaths || songFilePaths.length === 0) {
-      Logger.error('PlaylistTable', '歌曲路径列表为空');
+      Logger.error('heanup PlaylistTable', '歌曲路径列表为空');
       return false;
     }
 
     try {
-      Logger.info('PlaylistTable', `开始批量添加歌曲到歌单: playlistId=${playlistId}, 歌曲数量=${songFilePaths.length}`);
+      Logger.info('heanup PlaylistTable', `开始批量添加歌曲到歌单: playlistId=${playlistId}, 歌曲数量=${songFilePaths.length}`);
 
       let successCount = 0;
       for (const songFilePath of songFilePaths) {
@@ -309,7 +309,7 @@ export default class PlaylistTable {
           // 检查歌曲是否已在歌单中
           const isInPlaylist = await this.isSongInPlaylist(playlistId, songFilePath);
           if (isInPlaylist) {
-            Logger.info('PlaylistTable', `歌曲已在歌单中,跳过: ${songFilePath}`);
+            Logger.info('heanup PlaylistTable', `歌曲已在歌单中,跳过: ${songFilePath}`);
             continue;
           }
 
@@ -320,20 +320,20 @@ export default class PlaylistTable {
 
           await this.rdbStore.executeSql(sql, params);
           successCount++;
-          Logger.info('PlaylistTable', `成功添加歌曲: ${songFilePath}`);
+          Logger.info('heanup PlaylistTable', `成功添加歌曲: ${songFilePath}`);
         } catch (error) {
-          Logger.error('PlaylistTable', `添加歌曲失败: ${songFilePath}, 错误: ${error.message}`);
+          Logger.error('heanup PlaylistTable', `添加歌曲失败: ${songFilePath}, 错误: ${error.message}`);
         }
       }
 
       // 更新歌单歌曲数量
-      Logger.info('PlaylistTable', '开始更新歌单歌曲数量');
+      Logger.info('heanup PlaylistTable', '开始更新歌单歌曲数量');
       await this.updatePlaylistSongCount(playlistId);
 
-      Logger.info('PlaylistTable', `批量添加歌曲完成,成功添加 ${successCount} 首,共 ${songFilePaths.length} 首`);
+      Logger.info('heanup PlaylistTable', `批量添加歌曲完成,成功添加 ${successCount} 首,共 ${songFilePaths.length} 首`);
       return successCount > 0;
     } catch (error) {
-      Logger.error('PlaylistTable', `批量添加歌曲到歌单失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `批量添加歌曲到歌单失败: ${error.message}`);
       return false;
     }
   }
@@ -353,10 +353,10 @@ export default class PlaylistTable {
       // 更新歌单歌曲数量
       await this.updatePlaylistSongCount(playlistId);
       
-      Logger.info('PlaylistTable', `歌曲从歌单移除成功: ${songFilePath}`);
+      Logger.info('heanup PlaylistTable', `歌曲从歌单移除成功: ${songFilePath}`);
       return true;
     } catch (error) {
-      Logger.error('PlaylistTable', `从歌单移除歌曲失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `从歌单移除歌曲失败: ${error.message}`);
       return false;
     }
   }
@@ -368,21 +368,21 @@ export default class PlaylistTable {
     await this.ensureInitialized();
 
     if (!this.rdbStore) {
-      Logger.error('PlaylistTable', '数据库未初始化');
+      Logger.error('heanup PlaylistTable', '数据库未初始化');
       return [];
     }
 
     try {
       const sql = 'SELECT * FROM playlistSongTable WHERE playlistId = ? ORDER BY sortOrder ASC, addTime ASC';
-      Logger.info('PlaylistTable', `queryPlaylistSongs: 开始查询歌单歌曲, playlistId=${playlistId}`);
-      Logger.info('PlaylistTable', `queryPlaylistSongs: SQL=${sql}`);
+      Logger.info('heanup PlaylistTable', `queryPlaylistSongs: 开始查询歌单歌曲, playlistId=${playlistId}`);
+      Logger.info('heanup PlaylistTable', `queryPlaylistSongs: SQL=${sql}`);
       
       const resultSet = await this.rdbStore.querySql(sql, [playlistId]);
-      Logger.info('PlaylistTable', `queryPlaylistSongs: 查询执行完成, rowCount=${resultSet.rowCount}`);
+      Logger.info('heanup PlaylistTable', `queryPlaylistSongs: 查询执行完成, rowCount=${resultSet.rowCount}`);
       
       const songs: PlaylistSong[] = [];
       if (resultSet.goToFirstRow()) {
-        Logger.info('PlaylistTable', 'queryPlaylistSongs: 移动到第一行成功');
+        Logger.info('heanup PlaylistTable', 'queryPlaylistSongs: 移动到第一行成功');
         do {
           const song = new PlaylistSong(
             resultSet.getString(resultSet.getColumnIndex('id')),
@@ -392,18 +392,18 @@ export default class PlaylistTable {
             resultSet.getLong(resultSet.getColumnIndex('sortOrder'))
           );
           songs.push(song);
-          Logger.info('PlaylistTable', `queryPlaylistSongs: 添加歌曲, songFilePath=${song.songFilePath}`);
+          Logger.info('heanup PlaylistTable', `queryPlaylistSongs: 添加歌曲, songFilePath=${song.songFilePath}`);
         } while (resultSet.goToNextRow());
       } else {
-        Logger.info('PlaylistTable', 'queryPlaylistSongs: 没有数据,无法移动到第一行');
+        Logger.info('heanup PlaylistTable', 'queryPlaylistSongs: 没有数据,无法移动到第一行');
       }
       
       resultSet.close();
-      Logger.info('PlaylistTable', `queryPlaylistSongs: 查询到 ${songs.length} 首歌曲`);
+      Logger.info('heanup PlaylistTable', `queryPlaylistSongs: 查询到 ${songs.length} 首歌曲`);
       return songs;
     } catch (error) {
-      Logger.error('PlaylistTable', `queryPlaylistSongs: 查询歌单歌曲失败: ${error.message}`);
-      Logger.error('PlaylistTable', `queryPlaylistSongs: 错误堆栈: ${error.stack || '无堆栈信息'}`);
+      Logger.error('heanup PlaylistTable', `queryPlaylistSongs: 查询歌单歌曲失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `queryPlaylistSongs: 错误堆栈: ${error.stack || '无堆栈信息'}`);
       return [];
     }
   }
@@ -429,7 +429,7 @@ export default class PlaylistTable {
       resultSet.close();
       return isInPlaylist;
     } catch (error) {
-      Logger.error('PlaylistTable', `检查歌曲是否在歌单中失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `检查歌曲是否在歌单中失败: ${error.message}`);
       return false;
     }
   }
@@ -456,7 +456,7 @@ export default class PlaylistTable {
       const updateTime = new Date().toISOString();
       await this.rdbStore.executeSql(updateSql, [count, updateTime, playlistId]);
     } catch (error) {
-      Logger.error('PlaylistTable', `更新歌单歌曲数量失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `更新歌单歌曲数量失败: ${error.message}`);
     }
   }
 
@@ -473,10 +473,10 @@ export default class PlaylistTable {
       const sql = 'UPDATE playlistTable SET sortOrder = ?, updateTime = ? WHERE id = ?';
       await this.rdbStore.executeSql(sql, [sortOrder, updateTime, playlistId]);
       
-      Logger.info('PlaylistTable', `歌单排序更新成功: ${playlistId}`);
+      Logger.info('heanup PlaylistTable', `歌单排序更新成功: ${playlistId}`);
       return true;
     } catch (error) {
-      Logger.error('PlaylistTable', `更新歌单排序失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `更新歌单排序失败: ${error.message}`);
       return false;
     }
   }
@@ -493,10 +493,10 @@ export default class PlaylistTable {
       const sql = 'UPDATE playlistSongTable SET sortOrder = ? WHERE playlistId = ? AND songFilePath = ?';
       await this.rdbStore.executeSql(sql, [sortOrder, playlistId, songFilePath]);
       
-      Logger.info('PlaylistTable', `歌单歌曲排序更新成功: ${songFilePath}`);
+      Logger.info('heanup PlaylistTable', `歌单歌曲排序更新成功: ${songFilePath}`);
       return true;
     } catch (error) {
-      Logger.error('PlaylistTable', `更新歌单歌曲排序失败: ${error.message}`);
+      Logger.error('heanup PlaylistTable', `更新歌单歌曲排序失败: ${error.message}`);
       return false;
     }
   }

+ 1 - 0
entry/src/main/ets/pages/NewIndex.ets

@@ -1060,6 +1060,7 @@ struct NewIndex {
               .height(22)
               .margin({ left: 25 })
               .borderRadius(4)
+              .fillColor(this.themeColor)
               .clip(true)
             
             Column() {

+ 15 - 6
entry/src/main/ets/pages/PlaylistDetailPage.ets

@@ -721,7 +721,7 @@ export struct PlaylistDetailPage {
                       Text(song.name || song.fileName || '')
                         .fontSize(16)
                         .fontColor(this.isPlaying && this.curIndex === index ? $r('app.color.theme_color') : $r('app.color.text_color'))
-                        .fontWeight(this.isPlaying && this.curIndex === index ? FontWeight.Medium : FontWeight.Normal)
+                        .fontWeight(this.isPlaying && this.curIndex === index ? FontWeight.Bold : FontWeight.Normal)
                         .maxLines(1)
                         .textOverflow({ overflow: TextOverflow.Ellipsis })
                         .width('100%')
@@ -733,27 +733,29 @@ export struct PlaylistDetailPage {
                           Text(song.artist)
                             .fontSize(13)
                             .fontColor(this.isPlaying && this.curIndex === index ? $r('app.color.theme_color') : $r('app.color.text_color'))
+                            .fontWeight(this.isPlaying && this.curIndex === index ? FontWeight.Medium : FontWeight.Normal)
                             .maxLines(1)
                             .textOverflow({ overflow: TextOverflow.Ellipsis })
                             .layoutWeight(1)
-                            .opacity(0.8)
+                            .opacity(this.isPlaying && this.curIndex === index ? 1.0 : 0.8)
                         }
 
                         if (song.artist && song.album) {
                           Text('·')
                             .fontSize(13)
-                            .fontColor($r('app.color.text_color'))
-                            .opacity(0.6)
+                            .fontColor(this.isPlaying && this.curIndex === index ? $r('app.color.theme_color') : $r('app.color.text_color'))
+                            .opacity(this.isPlaying && this.curIndex === index ? 0.8 : 0.6)
                         }
 
                         if (song.album) {
                           Text(song.album)
                             .fontSize(13)
                             .fontColor(this.isPlaying && this.curIndex === index ? $r('app.color.theme_color') : $r('app.color.text_color'))
+                            .fontWeight(this.isPlaying && this.curIndex === index ? FontWeight.Medium : FontWeight.Normal)
                             .maxLines(1)
                             .textOverflow({ overflow: TextOverflow.Ellipsis })
                             .layoutWeight(1)
-                            .opacity(0.8)
+                            .opacity(this.isPlaying && this.curIndex === index ? 1.0 : 0.8)
                         }
 
                         Blank()
@@ -763,7 +765,8 @@ export struct PlaylistDetailPage {
                           Text(this.formatDuration(song.duration))
                             .fontSize(13)
                             .fontColor(this.isPlaying && this.curIndex === index ? $r('app.color.theme_color') : $r('app.color.text_color'))
-                            .opacity(0.7)
+                            .fontWeight(this.isPlaying && this.curIndex === index ? FontWeight.Medium : FontWeight.Normal)
+                            .opacity(this.isPlaying && this.curIndex === index ? 1.0 : 0.7)
                             .margin({ right: 20 })
                         }
                       }
@@ -810,6 +813,12 @@ export struct PlaylistDetailPage {
                     .backgroundColor('#f1f3f5')
                   }
                 })
+                // 当前播放歌曲的背景高亮
+                .backgroundColor(this.isPlaying && this.curIndex === index ? '#f0f8ff' : Color.Transparent)
+                .border({
+                  width: { left: this.isPlaying && this.curIndex === index ? 3 : 0 },
+                  color: $r('app.color.theme_color')
+                })
                 .opacity(this.pageOpacity)
                 .translate({ x: 0, y: this.showContent ? 0 : 20 })
                 .transition(TransitionEffect.OPACITY.animation({