|
|
@@ -64,7 +64,7 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
// 回调函数
|
|
|
onConfirm?: (songs: VideoItem[]) => void
|
|
|
onCancel?: () => void
|
|
|
-
|
|
|
+
|
|
|
// 添加目录浏览相关状态
|
|
|
@State @Watch('onViewModeChange') viewMode: number[] = [0]; // 0: 全部歌曲, 1: 目录模式
|
|
|
@State currentPath: string = '';
|
|
|
@@ -423,13 +423,13 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
if (this.updateTimer !== -1) {
|
|
|
clearTimeout(this.updateTimer)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 延迟执行计算,避免阻塞主线程
|
|
|
this.updateTimer = setTimeout(() => {
|
|
|
try {
|
|
|
const folderSongs = this.getSongsFromFolders(Array.from(this.selectedFolders))
|
|
|
const merged = this.mergeSongs(
|
|
|
- this.selectedSongs.filter((item: VideoItem) => item.type !== CommonConstants.TYPE_IS_DIR),
|
|
|
+ this.selectedSongs.filter((item: VideoItem) => item.type !== CommonConstants.TYPE_IS_DIR),
|
|
|
folderSongs
|
|
|
)
|
|
|
this.totalSelectedCount = merged.length
|
|
|
@@ -483,7 +483,7 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
LogUtil.info('AddSongsToPlaylistDialog', `全选完成,共选中 ${this.selectedSongs.length} 首歌曲`)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 开始第一批处理
|
|
|
processBatch()
|
|
|
}
|
|
|
@@ -830,18 +830,14 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
}
|
|
|
.scrollBar(BarState.Auto)
|
|
|
.scrollable(ScrollDirection.Vertical)
|
|
|
- .height(300)
|
|
|
+ .height(348)
|
|
|
}
|
|
|
|
|
|
@Builder
|
|
|
getFolderView() {
|
|
|
Column({ space: 12 }) {
|
|
|
Row({ space: 8 }) {
|
|
|
- Text('目录视图')
|
|
|
- .fontSize(16)
|
|
|
- .fontColor(this.isDarkMode ? '#FFFFFF' : $r('app.color.text_color'))
|
|
|
- Blank()
|
|
|
- Button('上一级')
|
|
|
+ Button('返回')
|
|
|
.fontSize(12)
|
|
|
.fontColor(this.isDarkMode ? '#FFFFFF' : $r('app.color.text_color'))
|
|
|
.height(28)
|
|
|
@@ -854,6 +850,12 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
.onClick(() => {
|
|
|
this.navigateToParent()
|
|
|
})
|
|
|
+ Text(this.normalizeLocalPath(this.currentPath) || '未选择路径')
|
|
|
+ .fontSize(12)
|
|
|
+ .fontColor(this.isDarkMode ? '#8E8E93' : '#666666')
|
|
|
+ .maxLines(1)
|
|
|
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
+ .padding({ left: 4, right: 4 })
|
|
|
Button('刷新')
|
|
|
.fontSize(12)
|
|
|
.fontColor(this.isDarkMode ? '#FFFFFF' : $r('app.color.text_color'))
|
|
|
@@ -865,15 +867,11 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
.onClick(() => {
|
|
|
this.loadFile(this.currentPath)
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
.width('100%')
|
|
|
|
|
|
- Text(this.normalizeLocalPath(this.currentPath) || '未选择路径')
|
|
|
- .fontSize(12)
|
|
|
- .fontColor(this.isDarkMode ? '#8E8E93' : '#666666')
|
|
|
- .maxLines(1)
|
|
|
- .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
- .padding({ left: 4, right: 4 })
|
|
|
+
|
|
|
|
|
|
if (this.isFolderLoading) {
|
|
|
Row() {
|
|
|
@@ -940,9 +938,9 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
Checkbox({ name: 'folder_item_' + item.id })
|
|
|
.select((item.type === CommonConstants.TYPE_IS_DIR)
|
|
|
? this.selectedFolders.has(this.normalizeLocalPath(item.filePath))
|
|
|
- : this.selectedSongIds.has(item.id))
|
|
|
+ : this.selectedSongs.some(x => x.filePath === item.filePath))
|
|
|
.selectedColor($r('app.color.theme_color'))
|
|
|
- .onChange(() => {
|
|
|
+ .onClick(()=>{
|
|
|
if (item.type === CommonConstants.TYPE_IS_DIR) {
|
|
|
this.toggleFolderSelection(item.filePath)
|
|
|
} else {
|
|
|
@@ -950,6 +948,7 @@ struct AddSongsToPlaylistDialogContent {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.8 })
|
|
|
.width('100%')
|
|
|
.padding(12)
|
|
|
.backgroundColor(this.isDarkMode ? '#2C2C2E' : '#F8F8F8')
|