|
@@ -12,7 +12,7 @@ import { FileInfo } from '../viewmodel/FileInfo';
|
|
|
import { emitter } from '@kit.BasicServicesKit';
|
|
import { emitter } from '@kit.BasicServicesKit';
|
|
|
import { EventConstants } from '../common/constants/EventConstants';
|
|
import { EventConstants } from '../common/constants/EventConstants';
|
|
|
import { LazyDataSource } from '../common/util/LazyDataSource';
|
|
import { LazyDataSource } from '../common/util/LazyDataSource';
|
|
|
-import { PreferencesUtil } from '@pura/harmony-utils';
|
|
|
|
|
|
|
+import { PreferencesUtil, StrUtil } from '@pura/harmony-utils';
|
|
|
import { ButtonFancyModifier,
|
|
import { ButtonFancyModifier,
|
|
|
MenuModifier,
|
|
MenuModifier,
|
|
|
ShadowModifier, SymbolGlyphFancyModifier } from '../common/util/AttributeModifierUtil';
|
|
ShadowModifier, SymbolGlyphFancyModifier } from '../common/util/AttributeModifierUtil';
|
|
@@ -66,6 +66,8 @@ function decodeUrlEncodedString(encodedStr: string): string {
|
|
|
@Entry
|
|
@Entry
|
|
|
@Component
|
|
@Component
|
|
|
export struct WebDavMainPage {
|
|
export struct WebDavMainPage {
|
|
|
|
|
+ @StorageProp('bottomSafeHeight') bottomSafeHeight: number = 0;
|
|
|
|
|
+ searchController: SearchController = new SearchController()
|
|
|
@StorageProp('animationState') animationState: AnimationStatus= AnimationStatus.Running
|
|
@StorageProp('animationState') animationState: AnimationStatus= AnimationStatus.Running
|
|
|
@State isNoJumpToHome: boolean = false //网盘播放不跳转首页
|
|
@State isNoJumpToHome: boolean = false //网盘播放不跳转首页
|
|
|
@State isSearchMode: boolean = false
|
|
@State isSearchMode: boolean = false
|
|
@@ -111,12 +113,11 @@ export struct WebDavMainPage {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
updateListData(mList:Array<VideoItem>, noSort?: boolean){
|
|
updateListData(mList:Array<VideoItem>, noSort?: boolean){
|
|
|
- this.songs = mList;
|
|
|
|
|
if (!noSort) {
|
|
if (!noSort) {
|
|
|
this.sortType = PreferencesUtil.getNumberSync('webDavSortType', 0)
|
|
this.sortType = PreferencesUtil.getNumberSync('webDavSortType', 0)
|
|
|
this.doSortType(this.sortType)
|
|
this.doSortType(this.sortType)
|
|
|
}
|
|
}
|
|
|
- this.dataSource.pushArrayData(this.songs)
|
|
|
|
|
|
|
+ this.dataSource.pushArrayData(mList)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 更新可见文件夹列表
|
|
// 更新可见文件夹列表
|
|
@@ -529,7 +530,6 @@ export struct WebDavMainPage {
|
|
|
.onClick(async () => {
|
|
.onClick(async () => {
|
|
|
this.doSortType(0)
|
|
this.doSortType(0)
|
|
|
PreferencesUtil.put("webDavSortType", 0)
|
|
PreferencesUtil.put("webDavSortType", 0)
|
|
|
- this.updateListData(this.songs, true)
|
|
|
|
|
})
|
|
})
|
|
|
MenuItem({
|
|
MenuItem({
|
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.text_and_arrow_down')),
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.text_and_arrow_down')),
|
|
@@ -538,53 +538,93 @@ export struct WebDavMainPage {
|
|
|
.onClick(async () => {
|
|
.onClick(async () => {
|
|
|
this.doSortType(1)
|
|
this.doSortType(1)
|
|
|
PreferencesUtil.put("webDavSortType", 1)
|
|
PreferencesUtil.put("webDavSortType", 1)
|
|
|
- this.updateListData(this.songs, true)
|
|
|
|
|
})
|
|
})
|
|
|
MenuItem({
|
|
MenuItem({
|
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.clock')),
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.clock')),
|
|
|
- content: $r('app.string.sort_by_time')
|
|
|
|
|
|
|
+ content:'按时间升序'
|
|
|
})
|
|
})
|
|
|
.onClick(async () => {
|
|
.onClick(async () => {
|
|
|
this.doSortType(2)
|
|
this.doSortType(2)
|
|
|
PreferencesUtil.put("webDavSortType", 2)
|
|
PreferencesUtil.put("webDavSortType", 2)
|
|
|
- this.updateListData(this.songs, true)
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
MenuItem({
|
|
MenuItem({
|
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.timer')),
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.timer')),
|
|
|
- content: '按添加时间降序'
|
|
|
|
|
|
|
+ content: '按时间降序'
|
|
|
})
|
|
})
|
|
|
.onClick(async () => {
|
|
.onClick(async () => {
|
|
|
this.doSortType(3)
|
|
this.doSortType(3)
|
|
|
PreferencesUtil.put("webDavSortType", 3)
|
|
PreferencesUtil.put("webDavSortType", 3)
|
|
|
- this.updateListData(this.songs, true)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.clock')),
|
|
|
|
|
+ content:'按大小升序'
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(async () => {
|
|
|
|
|
+ this.doSortType(4)
|
|
|
|
|
+ PreferencesUtil.put("webDavSortType", 4)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.timer')),
|
|
|
|
|
+ content: '按大小降序'
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(async () => {
|
|
|
|
|
+ this.doSortType(5)
|
|
|
|
|
+ PreferencesUtil.put("webDavSortType", 5)
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
}.attributeModifier(new MenuModifier())
|
|
}.attributeModifier(new MenuModifier())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
doSortType(index: number) {
|
|
doSortType(index: number) {
|
|
|
|
|
+ // 对歌曲列表进行排序
|
|
|
switch (index) {
|
|
switch (index) {
|
|
|
case 0:
|
|
case 0:
|
|
|
Utility.doSortListAscending(this.songs,this.isShowFileName)
|
|
Utility.doSortListAscending(this.songs,this.isShowFileName)
|
|
|
|
|
+ this.visibleFoldersState.sort((a, b) => {
|
|
|
|
|
+ return a.fileName.localeCompare(b.fileName);
|
|
|
|
|
+ });
|
|
|
break;
|
|
break;
|
|
|
case 1:
|
|
case 1:
|
|
|
Utility.doSortListDescending(this.songs,this.isShowFileName)
|
|
Utility.doSortListDescending(this.songs,this.isShowFileName)
|
|
|
|
|
+
|
|
|
|
|
+ this.visibleFoldersState.sort((a, b) => {
|
|
|
|
|
+ return b.fileName.localeCompare(a.fileName);
|
|
|
|
|
+ });
|
|
|
break;
|
|
break;
|
|
|
case 2:
|
|
case 2:
|
|
|
this.songs.sort((a, b) => {
|
|
this.songs.sort((a, b) => {
|
|
|
- // If types are the same, sort by cTime in ascending order
|
|
|
|
|
return a.cTime.localeCompare(b.cTime);
|
|
return a.cTime.localeCompare(b.cTime);
|
|
|
});
|
|
});
|
|
|
|
|
+ this.visibleFoldersState.sort((a, b) => {
|
|
|
|
|
+ return a.time-b.time;
|
|
|
|
|
+ });
|
|
|
break;
|
|
break;
|
|
|
case 3:
|
|
case 3:
|
|
|
this.songs.sort((a, b) => {
|
|
this.songs.sort((a, b) => {
|
|
|
- // If types are the same, sort by cTime in descending order
|
|
|
|
|
return b.cTime.localeCompare(a.cTime);
|
|
return b.cTime.localeCompare(a.cTime);
|
|
|
});
|
|
});
|
|
|
|
|
+ this.visibleFoldersState.sort((a, b) => {
|
|
|
|
|
+ return b.time-a.time;
|
|
|
|
|
+ });
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ this.songs.sort((a, b) => {
|
|
|
|
|
+ return a.videoSize - b.videoSize;
|
|
|
|
|
+ });
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 5:
|
|
|
|
|
+ this.songs.sort((a, b) => {
|
|
|
|
|
+ return b.videoSize - a.videoSize;
|
|
|
|
|
+ });
|
|
|
break;
|
|
break;
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ this.updateListData(this.songs,true)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -625,10 +665,9 @@ export struct WebDavMainPage {
|
|
|
//左侧搜索返回按钮
|
|
//左侧搜索返回按钮
|
|
|
Button({ type: ButtonType.Circle, stateEffect: true }) {
|
|
Button({ type: ButtonType.Circle, stateEffect: true }) {
|
|
|
SymbolGlyph($r('sys.symbol.chevron_left'))
|
|
SymbolGlyph($r('sys.symbol.chevron_left'))
|
|
|
- .attributeModifier(new SymbolGlyphFancyModifier(25, '', ''))
|
|
|
|
|
|
|
+ .attributeModifier(new SymbolGlyphFancyModifier(24, '', ''))
|
|
|
}
|
|
}
|
|
|
.attributeModifier(new ButtonFancyModifier(40, 40))
|
|
.attributeModifier(new ButtonFancyModifier(40, 40))
|
|
|
- .margin({bottom:5})
|
|
|
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
|
.animation({ duration: 300, curve: Curve.Ease })
|
|
.animation({ duration: 300, curve: Curve.Ease })
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
@@ -640,7 +679,37 @@ export struct WebDavMainPage {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //搜索框
|
|
|
|
|
+ Search({ controller: this.searchController,value: this.searchText, placeholder: '搜索标题、艺术家...' })
|
|
|
|
|
+ .searchButton('搜索',{fontColor:this.themeColor})
|
|
|
|
|
+ .searchIcon({
|
|
|
|
|
+ src: $r('sys.media.ohos_ic_public_search_filled')
|
|
|
|
|
+ })
|
|
|
|
|
+ .cancelButton({
|
|
|
|
|
+ style: CancelButtonStyle.CONSTANT,
|
|
|
|
|
+ icon: {
|
|
|
|
|
+ src: $r('sys.media.ohos_ic_public_cancel_filled')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .layoutWeight(1)
|
|
|
|
|
+ .height(35)
|
|
|
|
|
+ .maxLength(20)
|
|
|
|
|
+ .backgroundColor(this.isDarkMode?Color.Black:'#F5F5F5')
|
|
|
|
|
+ .placeholderColor(Color.Grey)
|
|
|
|
|
+ .placeholderFont({ size: 14, weight: 400 })
|
|
|
|
|
+ .textFont({ size: 14, weight: 400 })
|
|
|
|
|
+ .onSubmit((value: string) => {
|
|
|
|
|
+ console.log('onecold onSubmit ='+value)
|
|
|
|
|
+ this.searchController.stopEditing()
|
|
|
|
|
+ this.onSearchInput(this.searchText);
|
|
|
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ .onChange((value: string) => {
|
|
|
|
|
+ console.log('onecold onChange ='+value)
|
|
|
|
|
+ this.onSearchInput(value);
|
|
|
|
|
+ })
|
|
|
|
|
+ .visibility(this.isSearchMode?Visibility.Visible:Visibility.None)
|
|
|
|
|
+ .animation({ duration: 300, curve: Curve.Ease })
|
|
|
|
|
|
|
|
|
|
|
|
|
//搜索按钮
|
|
//搜索按钮
|
|
@@ -655,6 +724,7 @@ export struct WebDavMainPage {
|
|
|
.attributeModifier(new ShadowModifier())
|
|
.attributeModifier(new ShadowModifier())
|
|
|
.zIndex(0)
|
|
.zIndex(0)
|
|
|
.onClick(()=>{
|
|
.onClick(()=>{
|
|
|
|
|
+ this.filteredFolderList = [...this.visibleFoldersState]; // 显示所有文件夹
|
|
|
this.isSearchMode = true
|
|
this.isSearchMode = true
|
|
|
})
|
|
})
|
|
|
//排序按钮
|
|
//排序按钮
|
|
@@ -695,9 +765,11 @@ export struct WebDavMainPage {
|
|
|
|
|
|
|
|
//搜索功能的实现
|
|
//搜索功能的实现
|
|
|
@State searchText: string = ''; // 用户输入内容
|
|
@State searchText: string = ''; // 用户输入内容
|
|
|
- @State filteredList: Array<VideoItem> = []; // 过滤后的结果
|
|
|
|
|
|
|
+ @State filteredList: Array<VideoItem> = []; // 过滤后的歌曲结果
|
|
|
|
|
+ @State filteredFolderList: Array<FileInfo> = []; // 过滤后的文件夹结果
|
|
|
|
|
|
|
|
// 实时搜索逻辑(带防抖)
|
|
// 实时搜索逻辑(带防抖)
|
|
|
|
|
+// 实时搜索逻辑(带防抖)
|
|
|
private onSearchInput(value: string) {
|
|
private onSearchInput(value: string) {
|
|
|
this.searchText = value.trim();
|
|
this.searchText = value.trim();
|
|
|
let mSearchList: Array<VideoItem> = []
|
|
let mSearchList: Array<VideoItem> = []
|
|
@@ -706,6 +778,7 @@ export struct WebDavMainPage {
|
|
|
// 新增条件判断:空输入时显示所有数据
|
|
// 新增条件判断:空输入时显示所有数据
|
|
|
if (this.searchText === '') {
|
|
if (this.searchText === '') {
|
|
|
this.filteredList = [...mSearchList]; // 创建新数组以触发状态更新
|
|
this.filteredList = [...mSearchList]; // 创建新数组以触发状态更新
|
|
|
|
|
+ this.filteredFolderList = [...this.visibleFoldersState]; // 显示所有文件夹
|
|
|
} else {
|
|
} else {
|
|
|
this.filteredList = mSearchList.filter((item: VideoItem) => {
|
|
this.filteredList = mSearchList.filter((item: VideoItem) => {
|
|
|
//支持模糊匹配和艺术家 专辑匹配
|
|
//支持模糊匹配和艺术家 专辑匹配
|
|
@@ -715,29 +788,93 @@ export struct WebDavMainPage {
|
|
|
regex.test(item.artist?.toLowerCase() ?? "") ||
|
|
regex.test(item.artist?.toLowerCase() ?? "") ||
|
|
|
regex.test(item.album?.toLowerCase() ?? "")
|
|
regex.test(item.album?.toLowerCase() ?? "")
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ // 对文件夹进行过滤
|
|
|
|
|
+ this.filteredFolderList = this.visibleFoldersState.filter((folder: FileInfo) => {
|
|
|
|
|
+ const regex = new RegExp(this.searchText.toLowerCase().replace(/\s+/g, '.*'), 'i');
|
|
|
|
|
+ return regex.test(folder.fileName?.toLowerCase() ?? "") ||
|
|
|
|
|
+ regex.test(decodeUrlEncodedString(folder.fileName?.replace('/', '') ?? "").toLowerCase());
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.updateListData(this.filteredList);
|
|
this.updateListData(this.filteredList);
|
|
|
- // this.isSearchMode = false; // 根据业务需求决定是否启用
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
build() {
|
|
|
- Column() {
|
|
|
|
|
- // 顶部安全区和标题栏
|
|
|
|
|
- this.topTitleBar()
|
|
|
|
|
-
|
|
|
|
|
- // 内容区域
|
|
|
|
|
|
|
+ Stack() {
|
|
|
if (this.accounts.length === 0) {
|
|
if (this.accounts.length === 0) {
|
|
|
this.buildEmptyView();
|
|
this.buildEmptyView();
|
|
|
} else {
|
|
} else {
|
|
|
this.buildContentView();
|
|
this.buildContentView();
|
|
|
}
|
|
}
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ this.topTitleBar()
|
|
|
|
|
+ this.breaker()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+ .alignContent(Alignment.Top)
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height('100%')
|
|
.height('100%')
|
|
|
- .backgroundColor($r('app.color.start_window_background'))
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ breaker() {
|
|
|
|
|
+ // 加载按钮和面包屑导航
|
|
|
|
|
+ Column({ space: 8 }) {
|
|
|
|
|
+
|
|
|
|
|
+ // 面包屑导航
|
|
|
|
|
+ if (this.webdavManager.currentPath !== '') {
|
|
|
|
|
+ Row({ space: 8 }) {
|
|
|
|
|
+ Button({ type: ButtonType.Circle }) {
|
|
|
|
|
+ Image(this.webdavManager.canGoBack()?$r('app.media.back'):this.selectedAccount.coverPath)
|
|
|
|
|
+ .width(15)
|
|
|
|
|
+ .height(15)
|
|
|
|
|
+ .borderRadius(10)
|
|
|
|
|
+ .alt($r('app.media.cloudDisk'))
|
|
|
|
|
+ .fillColor(Color.White)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width(20)
|
|
|
|
|
+ .height(20)
|
|
|
|
|
+ .margin({left:5})
|
|
|
|
|
+ .backgroundColor(this.themeColor)
|
|
|
|
|
+ .onClick(() => this.goBack())
|
|
|
|
|
+
|
|
|
|
|
+ Row({ space: 4 }) {
|
|
|
|
|
+ ForEach(this.breadcrumbs, (crumb: string, index: number) => {
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ Text(crumb)
|
|
|
|
|
+ .fontSize(15)
|
|
|
|
|
+ .fontColor(this.themeColor)
|
|
|
|
|
+ .maxLines(1)
|
|
|
|
|
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
|
|
+ }
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.navigateToBreadcrumb(index);
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 添加分隔符(除了最后一个元素)
|
|
|
|
|
+ if (index < this.breadcrumbs.length - 1) {
|
|
|
|
|
+ Text('/')
|
|
|
|
|
+ .fontSize(15)
|
|
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
+ .opacity(0.6)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ .layoutWeight(1)
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .padding({ left: 4, right: 4 })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .padding({ left: 12, right: 12,top: 10,bottom: 5 })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 空状态视图
|
|
// 空状态视图
|
|
|
@Builder
|
|
@Builder
|
|
|
buildEmptyView() {
|
|
buildEmptyView() {
|
|
@@ -755,6 +892,7 @@ export struct WebDavMainPage {
|
|
|
}
|
|
}
|
|
|
.justifyContent(FlexAlign.Center)
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
|
|
+ .padding({top: this.topSafeHeight+50})
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -763,87 +901,6 @@ export struct WebDavMainPage {
|
|
|
buildContentView() {
|
|
buildContentView() {
|
|
|
Column() {
|
|
Column() {
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- // 加载按钮和面包屑导航
|
|
|
|
|
- Column({ space: 8 }) {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // 面包屑导航
|
|
|
|
|
- if (this.webdavManager.currentPath !== '') {
|
|
|
|
|
- Row({ space: 8 }) {
|
|
|
|
|
- Button({ type: ButtonType.Circle }) {
|
|
|
|
|
- Image(this.webdavManager.canGoBack()?$r('app.media.back'):this.selectedAccount.coverPath)
|
|
|
|
|
- .width(15)
|
|
|
|
|
- .height(15)
|
|
|
|
|
- .borderRadius(10)
|
|
|
|
|
- .alt($r('app.media.cloudDisk'))
|
|
|
|
|
- .fillColor(Color.White)
|
|
|
|
|
- }
|
|
|
|
|
- .width(20)
|
|
|
|
|
- .height(20)
|
|
|
|
|
- .backgroundColor(this.themeColor)
|
|
|
|
|
- .onClick(() => this.goBack())
|
|
|
|
|
-
|
|
|
|
|
- Row({ space: 4 }) {
|
|
|
|
|
- ForEach(this.breadcrumbs, (crumb: string, index: number) => {
|
|
|
|
|
- Row() {
|
|
|
|
|
- Text(crumb)
|
|
|
|
|
- .fontSize(15)
|
|
|
|
|
- .fontColor(this.themeColor)
|
|
|
|
|
- .maxLines(1)
|
|
|
|
|
- .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
|
|
- }
|
|
|
|
|
- .onClick(() => {
|
|
|
|
|
- this.navigateToBreadcrumb(index);
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- // 添加分隔符(除了最后一个元素)
|
|
|
|
|
- if (index < this.breadcrumbs.length - 1) {
|
|
|
|
|
- Text('/')
|
|
|
|
|
- .fontSize(15)
|
|
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
- .opacity(0.6)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- .layoutWeight(1)
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- .width('100%')
|
|
|
|
|
- .padding({ left: 4, right: 4 })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 统计信息
|
|
|
|
|
- // if (this.webDavFiles.length > 0) {
|
|
|
|
|
- // Row() {
|
|
|
|
|
- // Text(this.visibleFoldersState.length + ' 个文件夹, ' + this.songs.length + ' 首歌曲')
|
|
|
|
|
- // .fontSize(13)
|
|
|
|
|
- // .fontColor($r('app.color.index_tab_font_color'))
|
|
|
|
|
- // .opacity(0.6)
|
|
|
|
|
- // .layoutWeight(1)
|
|
|
|
|
- // .textAlign(TextAlign.Start)
|
|
|
|
|
- // Blank()
|
|
|
|
|
- // Button('一键创建歌单',{ type: ButtonType.Capsule, stateEffect: true })
|
|
|
|
|
- // .type(ButtonType.Normal)
|
|
|
|
|
- // .fontSize(12)
|
|
|
|
|
- // .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.8 })
|
|
|
|
|
- // .backgroundColor(this.themeColor)
|
|
|
|
|
- // .fontColor(Color.White)
|
|
|
|
|
- // .padding({ left: 12, right: 12, top: 6, bottom: 6 })
|
|
|
|
|
- // .borderRadius(16)
|
|
|
|
|
- // .visibility(this.songs.length > 0 ? Visibility.Visible : Visibility.None)
|
|
|
|
|
- // .onClick(() => {
|
|
|
|
|
- // Logger.info(TAG, 'heanup 点击一键创建歌单按钮');
|
|
|
|
|
- // this.createPlaylistFromCurrentWebDav();
|
|
|
|
|
- // })
|
|
|
|
|
- // }
|
|
|
|
|
- // .padding({ left: 4, right: 4 })
|
|
|
|
|
- // }
|
|
|
|
|
- }
|
|
|
|
|
- .width('100%')
|
|
|
|
|
- .padding(12)
|
|
|
|
|
- .margin({ top: 8 })
|
|
|
|
|
-
|
|
|
|
|
// 加载状态
|
|
// 加载状态
|
|
|
|
|
|
|
|
Row() {
|
|
Row() {
|
|
@@ -856,7 +913,7 @@ export struct WebDavMainPage {
|
|
|
.fontColor($r('app.color.index_tab_font_color'))
|
|
.fontColor($r('app.color.index_tab_font_color'))
|
|
|
.margin({ left: 12 })
|
|
.margin({ left: 12 })
|
|
|
}
|
|
}
|
|
|
- .padding(20)
|
|
|
|
|
|
|
+ .padding({top: this.topSafeHeight + 180, bottom: 20, left: 20, right: 20})
|
|
|
.visibility(this.isLoading?Visibility.Visible:Visibility.None)
|
|
.visibility(this.isLoading?Visibility.Visible:Visibility.None)
|
|
|
.opacity(this.isLoading ? 1 : 0)
|
|
.opacity(this.isLoading ? 1 : 0)
|
|
|
.animation({
|
|
.animation({
|
|
@@ -869,14 +926,14 @@ export struct WebDavMainPage {
|
|
|
if (this.webDavFiles.length > 0) {
|
|
if (this.webDavFiles.length > 0) {
|
|
|
List({ space: 0 }) {
|
|
List({ space: 0 }) {
|
|
|
// 显示文件夹 - 只显示当前目录下的直接子文件夹
|
|
// 显示文件夹 - 只显示当前目录下的直接子文件夹
|
|
|
- ForEach(this.visibleFoldersState, (folder: FileInfo) => {
|
|
|
|
|
|
|
+ ForEach(this.isSearchMode ? this.filteredFolderList : this.visibleFoldersState, (folder: FileInfo) => {
|
|
|
ListItem() {
|
|
ListItem() {
|
|
|
this.buildFolderItem(folder)
|
|
this.buildFolderItem(folder)
|
|
|
}
|
|
}
|
|
|
.transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 600 }),
|
|
.transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 600 }),
|
|
|
TransitionEffect.scale({ x: 0, y: 0 })))
|
|
TransitionEffect.scale({ x: 0, y: 0 })))
|
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
|
- })
|
|
|
|
|
|
|
+ }, (folder: FileInfo) => folder.name+folder.fileName)
|
|
|
|
|
|
|
|
// 显示歌曲
|
|
// 显示歌曲
|
|
|
LazyForEach(this.dataSource, (song: VideoItem, index: number) => {
|
|
LazyForEach(this.dataSource, (song: VideoItem, index: number) => {
|
|
@@ -886,10 +943,12 @@ export struct WebDavMainPage {
|
|
|
.transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 600 }),
|
|
.transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 600 }),
|
|
|
TransitionEffect.scale({ x: 0, y: 0 })))
|
|
TransitionEffect.scale({ x: 0, y: 0 })))
|
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
|
- })
|
|
|
|
|
|
|
+ }, (item: VideoItem) => item.filePath)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ .contentStartOffset(this.topSafeHeight + 80)
|
|
|
|
|
+ .contentEndOffset(this.bottomSafeHeight)
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
- .divider({ strokeWidth: 1, color: this.isDarkMode ? '#333333' :'#EEEEEE' })
|
|
|
|
|
.margin({ top: 4 })
|
|
.margin({ top: 4 })
|
|
|
} else if (!this.isLoading) {
|
|
} else if (!this.isLoading) {
|
|
|
Column() {
|
|
Column() {
|
|
@@ -897,7 +956,7 @@ export struct WebDavMainPage {
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
.fontColor($r('app.color.index_tab_font_color'))
|
|
.fontColor($r('app.color.index_tab_font_color'))
|
|
|
.opacity(0.6)
|
|
.opacity(0.6)
|
|
|
- Text('点击"加载文件列表"按钮加载')
|
|
|
|
|
|
|
+ Text('点击"左侧菜单"网盘加载')
|
|
|
.fontSize(12)
|
|
.fontSize(12)
|
|
|
.fontColor($r('app.color.index_tab_font_color'))
|
|
.fontColor($r('app.color.index_tab_font_color'))
|
|
|
.opacity(0.4)
|
|
.opacity(0.4)
|
|
@@ -908,6 +967,7 @@ export struct WebDavMainPage {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 文件夹列表项
|
|
// 文件夹列表项
|
|
@@ -973,7 +1033,6 @@ export struct WebDavMainPage {
|
|
|
.textOverflow({ overflow: this.isLongNameRoLL?TextOverflow.MARQUEE:TextOverflow.Ellipsis })//超长滚动
|
|
.textOverflow({ overflow: this.isLongNameRoLL?TextOverflow.MARQUEE:TextOverflow.Ellipsis })//超长滚动
|
|
|
.fontColor(this.currentSong?.filePath==song.filePath?this.themeColor:$r('app.color.index_tab_font_color'))
|
|
.fontColor(this.currentSong?.filePath==song.filePath?this.themeColor:$r('app.color.index_tab_font_color'))
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
- .margin({ right: 20 })
|
|
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
|
|
|
|
|
Row(){
|
|
Row(){
|
|
@@ -991,9 +1050,16 @@ export struct WebDavMainPage {
|
|
|
.opacity(0.6)
|
|
.opacity(0.6)
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
|
|
+ Text(song.cTime)
|
|
|
|
|
+ .fontSize(13)
|
|
|
|
|
+ .fontColor(this.currentSong?.filePath==song.filePath?this.themeColor:
|
|
|
|
|
+ $r('app.color.index_tab_font_color'))
|
|
|
|
|
+ .opacity(0.6)
|
|
|
|
|
+ .maxLines(1)
|
|
|
|
|
+ .visibility(StrUtil.isNotEmpty(song.artist)?Visibility.None:Visibility.Visible)
|
|
|
|
|
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
}
|
|
}
|
|
|
- .padding({ right: 20 })
|
|
|
|
|
-
|
|
|
|
|
|
|
+ .width('90%')
|
|
|
}
|
|
}
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
.layoutWeight(1)
|
|
.layoutWeight(1)
|