fix(remote): 上传下载现在使用文件面板当前选择的路径

This commit is contained in:
2026-03-09 19:48:15 +08:00
parent 4c18edf74f
commit 4273b3d43b
7 changed files with 35 additions and 145 deletions

View File

@@ -10,6 +10,7 @@ interface RemoteFilePanelProps {
selectedFile: RemoteFileItem | null
onSelect: (file: RemoteFileItem | null) => void
onDownload: () => void
onPathChange?: (path: string) => void
disabled?: boolean
}
@@ -20,6 +21,7 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
selectedFile,
onSelect,
onDownload,
onPathChange,
disabled,
}) => {
const [currentPath, setCurrentPath] = useState('')
@@ -71,6 +73,7 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
setPathHistory(newHistory)
setCurrentPath(prevPath)
onSelect(null)
onPathChange?.(prevPath)
} else {
loadDrives()
}
@@ -82,11 +85,13 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
setPathHistory(['', newPath])
setCurrentPath(newPath)
loadFiles(newPath)
onPathChange?.(newPath)
} else {
const newPath = currentPath ? `${currentPath}\\${file.name}` : file.name
setPathHistory([...pathHistory, newPath])
setCurrentPath(newPath)
loadFiles(newPath)
onPathChange?.(newPath)
}
onSelect(null)
}
@@ -104,6 +109,7 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
setCurrentPath('')
loadDrives()
onSelect(null)
onPathChange?.('')
}
const getDisplayPath = () => {