Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sunyihao
bkunyun
Commits
437293d4
Commit
437293d4
authored
Jun 11, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完成文件相关接口请求封装
parent
3dda1abf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
148 deletions
+86
-148
package-lock.json
package-lock.json
+1
-1
CloudEController.ts
src/api/fileserver/CloudEController.ts
+85
-147
No files found.
package-lock.json
View file @
437293d4
...
...
@@ -11715,7 +11715,7 @@
},
"webpack-dev-server"
:
{
"version"
:
"4.9.0"
,
"resolved"
:
"https://registry.npm
mirror.com
/webpack-dev-server/-/webpack-dev-server-4.9.0.tgz"
,
"resolved"
:
"https://registry.npm
js.org
/webpack-dev-server/-/webpack-dev-server-4.9.0.tgz"
,
"integrity"
:
"sha512-+Nlb39iQSOSsFv0lWUuUTim3jDQO8nhK3E68f//J2r5rIcp4lULHXz2oZ0UVdEeWXEh5lSzYUlzarZhDAeAVQw=="
,
"requires"
:
{
"@types/bonjour"
:
"^3.5.9"
,
...
...
src/api/fileserver/CloudEController.ts
View file @
437293d4
...
...
@@ -17,42 +17,28 @@ let headers: any = {
class
CloudEController
{
//文件 删除
// static JobOutFileDel(urls, type) {
// if (
// ApiUtils.getAuthorizationHeaders(
// CloudEStore,
// headers,
// Actions.GET_JOB_FILE_DEL
// )
// ) {
// headers["Cache-Control"] = "no-cache";
// headers["delfilepath"] = Base64.stringify(Utf8.parse(urls));
// let url = "";
// if (
// localStorage.getItem(Constants.USER_INFO_TOKEN_KEY) &&
// JSON.parse(localStorage.getItem(Constants.USER_INFO_TOKEN_KEY))
// ) {
// url += urlToken();
// }
// axios
// .get(APIOPTION() + "/delete/" + url, {
// headers: headers,
// })
// .then(function (response) {
// CloudEStore.emitChange(
// Actions.GET_JOB_FILE_DEL,
// true,
// Actions.GET_JOB_FILE_DEL,
// type
// );
// })
// .catch(function (error) {
// console.log(error);
// MessageUtil.handleError(CloudEStore, error);
// CloudEStore.emitChange(Actions.GET_JOB_FILE_DEL, false);
// });
// }
// }
static
JobOutFileDel
(
urls
:
any
,
filetoken
:
string
)
{
if
(
ApiUtils
.
getAuthorizationHeaders
(
headers
)
)
{
headers
[
"Cache-Control"
]
=
"no-cache"
;
headers
[
"delfilepath"
]
=
Base64
.
stringify
(
Utf8
.
parse
(
urls
));
let
url
=
""
;
if
(
getLoaclStorageOfKey
(
"userinfo"
))
{
url
+=
urlToken
(
filetoken
);
}
axios
.
get
(
APIOPTION
()
+
"/delete/"
+
url
,
{
headers
:
headers
,
})
.
then
(
function
(
response
)
{
console
.
log
(
response
)
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
)
});
}
}
// 文件列表
static
JobOutFileList
(
url
:
any
,
...
...
@@ -67,7 +53,7 @@ class CloudEController {
url
+=
urlToken
(
filetoken
);
}
axios
//
修改
查看文件的接口为list(可查看隐藏文件)
// 查看文件的接口为list(可查看隐藏文件)
.
get
(
APIOPTION
()
+
"/list"
+
url
+
"&showhidden="
+
showHide
,
{
headers
:
headers
,
})
...
...
@@ -90,116 +76,68 @@ class CloudEController {
});
}
}
// // 文件列表
// static JobOutFileList(url, showHide = false, items) {
// if (
// ApiUtils.getAuthorizationHeaders(
// CloudEStore,
// headers,
// Actions.JobOutFileList
// )
// ) {
// headers["Cache-Control"] = "no-cache";
// // headers['parentName'] = ''
// if (
// localStorage.getItem(Constants.USER_INFO_TOKEN_KEY) &&
// JSON.parse(localStorage.getItem(Constants.USER_INFO_TOKEN_KEY))
// ) {
// url += urlToken();
// }
// axios
// //修改 查看文件的接口为list(可查看隐藏文件)
// .get(APIOPTION() + "/list" + url + "&showhidden=" + showHide, {
// headers: headers,
// })
// .then(function (response) {
// Array.isArray(response.data)
// ? CloudEStore.setjobOutFileList(response.data)
// : CloudEStore.setjobOutFileList([]);
// CloudEStore.emitChange(
// Actions.JobOutFileList,
// true,
// Actions.JobOutFileList,
// items
// );
// })
// .catch(function (error) {
// console.log(error);
// MessageUtil.handleError(CloudEStore, error);
// CloudEStore.emitChange(Actions.JobOutFileList, false);
// });
// }
// }
// static JobOutFileListMove(url) {
// if (
// ApiUtils.getAuthorizationHeaders(
// CloudEStore,
// headers,
// Actions.JOB_OUT_FILE_LIST_MOVE_NEW
// )
// ) {
// headers["Cache-Control"] = "no-cache";
// if (
// localStorage.getItem(Constants.USER_INFO_TOKEN_KEY) &&
// JSON.parse(localStorage.getItem(Constants.USER_INFO_TOKEN_KEY))
// ) {
// url += urlToken();
// }
// axios
// .get(APIOPTION() + "/download" + url, {
// headers: headers,
// })
// .then(function (response) {
// CloudEStore.setjobOutFileListMove(response.data);
// CloudEStore.emitChange(
// Actions.JOB_OUT_FILE_LIST_MOVE_NEW,
// true,
// Actions.JOB_OUT_FILE_LIST_MOVE_NEW
// );
// })
// .catch(function (error) {
// console.log(error);
// MessageUtil.handleError(CloudEStore, error);
// CloudEStore.emitChange(Actions.JOB_OUT_FILE_LIST_MOVE_NEW, false);
// });
// }
// }
// 文件移动
static
JobOutFileListMove
(
url
:
any
,
filetoken
:
string
)
{
if
(
ApiUtils
.
getAuthorizationHeaders
(
headers
)
)
{
headers
[
"Cache-Control"
]
=
"no-cache"
;
if
(
getLoaclStorageOfKey
(
"userinfo"
))
{
url
+=
urlToken
(
filetoken
);
}
axios
.
get
(
APIOPTION
()
+
"/download"
+
url
,
{
headers
:
headers
,
})
.
then
(
function
(
response
)
{
console
.
log
(
response
)
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
}
}
// // 全局搜索 文件名
// static JobSearchFileList(url, base, showHide = false) {
// if (
// ApiUtils.getAuthorizationHeaders(
// CloudEStore,
// headers,
// Actions.JOB_OUTFILE_LIST_SEARCH
// )
// ) {
// headers["Cache-Control"] = "no-cache";
// if (
// localStorage.getItem(Constants.USER_INFO_TOKEN_KEY) &&
// JSON.parse(localStorage.getItem(Constants.USER_INFO_TOKEN_KEY))
// ) {
// url = urlToken() + "&q=" + url;
// }
// axios
// .get(APIOPTION() + "/search" + base + url + "&showhidden=" + showHide, {
// headers: headers,
// })
// .then(function (response) {
// Array.isArray(response.data)
// ? CloudEStore.setjobOutFileList(response.data)
// : CloudEStore.setjobOutFileList([]);
// CloudEStore.emitChange(
// Actions.JOB_OUTFILE_LIST_SEARCH,
// true,
// Actions.JOB_OUTFILE_LIST_SEARCH
// );
// })
// .catch(function (error) {
// console.log(error);
// MessageUtil.handleError(CloudEStore, error);
// CloudEStore.emitChange(Actions.JOB_OUTFILE_LIST_SEARCH, false);
// });
// }
// }
static
JobSearchFileList
(
url
:
any
,
base
:
any
,
showHide
=
false
,
filetoken
:
string
)
{
if
(
ApiUtils
.
getAuthorizationHeaders
(
headers
)
)
{
headers
[
"Cache-Control"
]
=
"no-cache"
;
if
(
getLoaclStorageOfKey
(
"userinfo"
))
{
url
=
urlToken
(
filetoken
)
+
"&q="
+
url
;
}
axios
.
get
(
APIOPTION
()
+
"/search"
+
base
+
url
+
"&showhidden="
+
showHide
,
{
headers
:
headers
,
})
.
then
(
function
(
response
)
{
console
.
log
(
response
)
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
}
}
// 文件移动
static
JobFileMove
(
url
:
any
,
original_filepath
:
any
,
value
:
any
,
filetoken
:
string
)
{
if
(
ApiUtils
.
getAuthorizationHeaders
(
headers
))
{
url
=
url
+=
urlToken
(
filetoken
)
headers
[
'Content-Type'
]
=
'multipart/form-data'
;
headers
[
'originalfilepath'
]
=
encodeURIComponent
(
original_filepath
)
let
param
=
new
FormData
()
param
.
append
(
''
,
value
)
axios
.
post
(
APIOPTION
()
+
'/rename'
+
url
,
param
,
{
headers
:
headers
})
.
then
(
response
=>
{
console
.
log
(
response
)
})
.
catch
(
error
=>
{
console
.
log
(
error
)
})
}
}
}
export
default
CloudEController
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment