-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
241 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,39 @@ | ||
import { request } from '@/utils' | ||
import { http } from '@/utils' | ||
|
||
export default { | ||
// 创建文件/文件夹 | ||
create: (path: string, dir: boolean): any => request.post('/file/create', { path, dir }), | ||
create: (path: string, dir: boolean): any => http.Post('/file/create', { path, dir }), | ||
// 获取文件内容 | ||
content: (path: string): any => request.get('/file/content', { params: { path } }), | ||
content: (path: string): any => http.Get('/file/content', { params: { path } }), | ||
// 保存文件 | ||
save: (path: string, content: string): any => request.post('/file/save', { path, content }), | ||
save: (path: string, content: string): any => http.Post('/file/save', { path, content }), | ||
// 删除文件 | ||
delete: (path: string): any => request.post('/file/delete', { path }), | ||
delete: (path: string): any => http.Post('/file/delete', { path }), | ||
// 上传文件 | ||
upload: (path: string, formData: FormData, onProgress: any): any => { | ||
formData.append('path', path) | ||
return request.post('/file/upload', formData, { | ||
headers: { 'Content-Type': 'multipart/form-data' }, | ||
onUploadProgress: (progressEvent: any) => { | ||
onProgress({ percent: Math.ceil((progressEvent.loaded / progressEvent.total) * 100) }) | ||
} | ||
}) | ||
}, | ||
upload: (formData: FormData): any => http.Post('/file/upload', formData), | ||
// 检查文件是否存在 | ||
exist: (paths: string[]): any => request.post('/file/exist', paths), | ||
exist: (paths: string[]): any => http.Post('/file/exist', paths), | ||
// 移动文件 | ||
move: (paths: any[]): any => request.post('/file/move', paths), | ||
move: (paths: any[]): any => http.Post('/file/move', paths), | ||
// 复制文件 | ||
copy: (paths: any[]): any => request.post('/file/copy', paths), | ||
copy: (paths: any[]): any => http.Post('/file/copy', paths), | ||
// 远程下载 | ||
remoteDownload: (path: string, url: string): any => | ||
request.post('/file/remoteDownload', { path, url }), | ||
http.Post('/file/remoteDownload', { path, url }), | ||
// 获取文件信息 | ||
info: (path: string): any => request.get('/file/info', { params: { path } }), | ||
info: (path: string): any => http.Get('/file/info', { params: { path } }), | ||
// 修改文件权限 | ||
permission: (path: string, mode: string, owner: string, group: string): any => | ||
request.post('/file/permission', { path, mode, owner, group }), | ||
http.Post('/file/permission', { path, mode, owner, group }), | ||
// 压缩文件 | ||
compress: (dir: string, paths: string[], file: string): any => | ||
request.post('/file/compress', { dir, paths, file }), | ||
http.Post('/file/compress', { dir, paths, file }), | ||
// 解压文件 | ||
unCompress: (file: string, path: string): any => request.post('/file/unCompress', { file, path }), | ||
unCompress: (file: string, path: string): any => http.Post('/file/unCompress', { file, path }), | ||
// 搜索文件 | ||
search: (path: string, keyword: string, sub: boolean, page: number, limit: number): any => | ||
request.get('/file/search', { params: { path, keyword, sub, page, limit } }), | ||
http.Get('/file/search', { params: { path, keyword, sub, page, limit } }), | ||
// 获取文件列表 | ||
list: (path: string, page: number, limit: number, sort: string): any => | ||
request.get('/file/list', { params: { path, page, limit, sort } }) | ||
http.Get('/file/list', { params: { path, page, limit, sort } }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.