feat: 添加复制相关逻辑,修复文件夹剪切无法正常执行的错误
This commit is contained in:
1 parent
089dc68419
commit
cb8198d1bb
12 files changed
+418
-5
No files matched your search
@@ -9,7 +9,8 @@ import {
|
||||
renameOption,
|
||||
cutOption,
|
||||
mkdirOption,
|
||||
getFileOption
|
||||
getFileOption,
|
||||
copyOption
|
||||
} from '@/types/fetch'
|
||||
import Config from '@/config'
|
||||
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||
@@ -270,6 +271,35 @@ const miaoFetchApi = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 复制文件或文件夹
|
||||
*/
|
||||
copy(
|
||||
target: VirtualFile | VirtualDirectory,
|
||||
to: VirtualDirectory,
|
||||
option?: copyOption
|
||||
) {
|
||||
const newPath = to.path
|
||||
const { baseUrl, api } = Config
|
||||
const url = `${baseUrl}${api.copy}${target.path}`
|
||||
const retry = option?.retry ?? 0
|
||||
const { miaoFetch } = useMiaoFetch({
|
||||
retry
|
||||
})
|
||||
return {
|
||||
response: new Promise<{
|
||||
eventId: number
|
||||
}>(async (resolve) => {
|
||||
const response = await miaoFetch({
|
||||
url,
|
||||
method: 'post',
|
||||
data: { newPath }
|
||||
})
|
||||
resolve(response.data)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询服务端操作事件的进展
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user