Commit 437293d4 authored by chenshouchao's avatar chenshouchao

feat: 完成文件相关接口请求封装

parent 3dda1abf
......@@ -11715,7 +11715,7 @@
},
"webpack-dev-server": {
"version": "4.9.0",
"resolved": "https://registry.npmmirror.com/webpack-dev-server/-/webpack-dev-server-4.9.0.tgz",
"resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.9.0.tgz",
"integrity": "sha512-+Nlb39iQSOSsFv0lWUuUTim3jDQO8nhK3E68f//J2r5rIcp4lULHXz2oZ0UVdEeWXEh5lSzYUlzarZhDAeAVQw==",
"requires": {
"@types/bonjour": "^3.5.9",
......
......@@ -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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment