|
|
@@ -3,7 +3,7 @@ import { WebDavAccount } from '../viewmodel/WebDavAccount';
|
|
|
import { Song } from '../viewmodel/Song';
|
|
|
import { RemoteDriveManagerStates } from '../common/enums/RemoteDriveManagerStates';
|
|
|
import Logger from '../common/util/Logger';
|
|
|
-import { promptAction, SymbolGlyphModifier, router, window } from '@kit.ArkUI';
|
|
|
+import { promptAction, SymbolGlyphModifier, router, window, curves } from '@kit.ArkUI';
|
|
|
import { CommonConstants } from '../common/constants/CommonConstants';
|
|
|
import { VideoItem } from '../viewmodel/VideoItem';
|
|
|
import { GlobalContext } from '../common/util/GlobalContext';
|
|
|
@@ -23,6 +23,7 @@ import { Utility } from '../common/util/Utility';
|
|
|
import { SettingPage } from './SettingPage';
|
|
|
import { getCloudDiskIcon } from '../dialog/RemoteDriveAccountDialog';
|
|
|
import { CreateFolderDialog } from '../dialog/CreateFolderDialog';
|
|
|
+import { UploadMusicPage } from './UploadMusicPage';
|
|
|
|
|
|
/**
|
|
|
* 歌单播放事件数据
|
|
|
@@ -78,6 +79,7 @@ function decodeUrlEncodedString(encodedStr: string): string {
|
|
|
@Entry
|
|
|
@Component
|
|
|
export struct WebDavMainPage {
|
|
|
+ @State isShowUploadFile: boolean = false
|
|
|
@State isShowTitleBar: boolean = true //是否显示分类导航条
|
|
|
private prevOffsetY: number = 0; // 记录上一次的Y轴偏移量
|
|
|
@State autoHideTitle: boolean = true //滚动自动隐藏标题栏
|
|
|
@@ -317,6 +319,7 @@ export struct WebDavMainPage {
|
|
|
await this.webdavManager.loadFilesInfoFromAccount(this.selectedAccount, this.webdavManager.currentPath);
|
|
|
this.exitMultiSelect();
|
|
|
this.getUIContext().getPromptAction().showToast({ message: '删除成功' });
|
|
|
+ this.exitMultiSelect()
|
|
|
} catch (error) {
|
|
|
const err = error as Error;
|
|
|
this.getUIContext().getPromptAction().showToast({ message: `删除失败: ${err.message}` });
|
|
|
@@ -828,24 +831,6 @@ export struct WebDavMainPage {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 导航到上传页面
|
|
|
- private navigateToUploadPage(): void {
|
|
|
- if (!this.selectedAccount || !this.selectedAccount.id) {
|
|
|
- this.getUIContext().getPromptAction().showToast({ message: '请先选择账户' });
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- Logger.info(TAG, '导航到上传页面,账户ID: ' + this.selectedAccount.id);
|
|
|
- this.getUIContext().getRouter().pushUrl({
|
|
|
- url: 'pages/UploadMusicPage',
|
|
|
- params: {
|
|
|
- accountId: this.selectedAccount.id
|
|
|
- }
|
|
|
- }).catch((error: Error) => {
|
|
|
- Logger.error(TAG, '导航到上传页面失败: ' + error.message);
|
|
|
- this.getUIContext().getPromptAction().showToast({ message: '打开上传页面失败' });
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
@Builder
|
|
|
MoreMenuBuilder() {
|
|
|
@@ -863,7 +848,8 @@ export struct WebDavMainPage {
|
|
|
content: $r('app.string.upload_music_file')
|
|
|
})
|
|
|
.onClick(async () => {
|
|
|
- this.navigateToUploadPage();
|
|
|
+ // this.navigateToUploadPage();
|
|
|
+ this.isShowUploadFile = !this.isShowUploadFile
|
|
|
})
|
|
|
|
|
|
MenuItem({
|
|
|
@@ -1107,6 +1093,9 @@ export struct WebDavMainPage {
|
|
|
.bindMenu(this.MoreMenuBuilder)
|
|
|
.attributeModifier(new ShadowModifier())
|
|
|
.zIndex(0)
|
|
|
+ .bindContentCover($$this.isShowUploadFile, this.UploadFielBuilder(), {
|
|
|
+ transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
+ })
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -1119,6 +1108,26 @@ export struct WebDavMainPage {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Builder
|
|
|
+ UploadFielBuilder() {
|
|
|
+ Scroll() {
|
|
|
+ Column() {
|
|
|
+ UploadMusicPage({
|
|
|
+ accountId: this.selectedAccount.id,
|
|
|
+ isShowUploadFile:this.isShowUploadFile,
|
|
|
+ onResult:(result:boolean)=>{
|
|
|
+ console.info("heanup onResult,上传成功,刷新列表")
|
|
|
+ if(result){
|
|
|
+ // 上传文件成功后刷新当前路径的列表
|
|
|
+ this.refreshFileListAfterUpload()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('100%')
|
|
|
+ }
|
|
|
//搜索功能的实现
|
|
|
@State searchText: string = ''; // 用户输入内容
|
|
|
@State filteredList: Array<VideoItem> = []; // 过滤后的歌曲结果
|
|
|
@@ -1610,6 +1619,44 @@ export struct WebDavMainPage {
|
|
|
this.createFolderDialogController.open();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 上传成功后刷新文件列表
|
|
|
+ */
|
|
|
+ private async refreshFileListAfterUpload(): Promise<void> {
|
|
|
+ if (!this.selectedAccount) {
|
|
|
+ Logger.warn(TAG, '刷新失败:未选择账户');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ Logger.info(TAG, 'heanup 开始刷新上传后的文件列表');
|
|
|
+
|
|
|
+ // 显示加载状态
|
|
|
+ this.isLoading = true;
|
|
|
+
|
|
|
+ // 重新加载当前账户的文件信息
|
|
|
+ await this.webdavManager.loadFilesInfoFromAccount(this.selectedAccount, this.webdavManager.currentPath);
|
|
|
+
|
|
|
+ // 显示成功提示
|
|
|
+ this.getUIContext().getPromptAction().showToast({
|
|
|
+ message: '文件上传成功,列表已刷新'
|
|
|
+ });
|
|
|
+
|
|
|
+ Logger.info(TAG, 'heanup 文件列表刷新完成');
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ const err = error as Error;
|
|
|
+ Logger.error(TAG, `heanup 刷新文件列表失败: ${err.message}`);
|
|
|
+
|
|
|
+ // 显示错误提示
|
|
|
+ this.getUIContext().getPromptAction().showToast({
|
|
|
+ message: `刷新失败: ${err.message}`
|
|
|
+ });
|
|
|
+ } finally {
|
|
|
+ this.isLoading = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 创建文件夹的实际方法
|
|
|
* @param folderName 文件夹名称
|