mirror of
https://github.com/PlayEdu/backend
synced 2025-06-09 03:54:06 +08:00
资源课件上传组件
This commit is contained in:
parent
90d23dc8fa
commit
b66d3f06b7
@ -7,6 +7,10 @@ const GoLogin = () => {
|
|||||||
window.location.href = "/login";
|
window.location.href = "/login";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const GoError = () => {
|
||||||
|
window.location.href = "/error";
|
||||||
|
};
|
||||||
|
|
||||||
export class HttpClient {
|
export class HttpClient {
|
||||||
axios: Axios;
|
axios: Axios;
|
||||||
|
|
||||||
@ -52,13 +56,13 @@ export class HttpClient {
|
|||||||
GoLogin();
|
GoLogin();
|
||||||
} else if (status === 404) {
|
} else if (status === 404) {
|
||||||
// 跳转到404页面
|
// 跳转到404页面
|
||||||
GoLogin();
|
GoError();
|
||||||
} else if (status === 403) {
|
} else if (status === 403) {
|
||||||
// 跳转到无权限页面
|
// 跳转到无权限页面
|
||||||
GoLogin();
|
GoError();
|
||||||
} else if (status === 500) {
|
} else if (status === 500) {
|
||||||
// 跳转到500异常页面
|
// 跳转到500异常页面
|
||||||
GoLogin();
|
GoError();
|
||||||
}
|
}
|
||||||
return Promise.reject(error.response);
|
return Promise.reject(error.response);
|
||||||
}
|
}
|
||||||
|
@ -65,11 +65,23 @@ export const UploadCoursewareButton = (props: PropsInterface) => {
|
|||||||
if (
|
if (
|
||||||
file.type ===
|
file.type ===
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
|
||||||
|
file.type === "application/msword" ||
|
||||||
|
file.type === "application/vnd.ms-word.document.macroEnabled.12" ||
|
||||||
|
file.type === "application/vnd.ms-word.template.macroEnabled.12" ||
|
||||||
file.type === "text/plain" ||
|
file.type === "text/plain" ||
|
||||||
file.type === "application/pdf" ||
|
file.type === "application/pdf" ||
|
||||||
file.type === "application/x-zip-compressed" ||
|
file.type === "application/x-zip-compressed" ||
|
||||||
|
file.type === "application/zip" ||
|
||||||
file.type ===
|
file.type ===
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
|
||||||
|
file.type === "application/vnd.ms-excel" ||
|
||||||
|
file.type ===
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" ||
|
||||||
|
file.type === "application/vnd.ms-excel.sheet.macroEnabled.12" ||
|
||||||
|
file.type === "application/vnd.ms-excel.template.macroEnabled.12" ||
|
||||||
|
file.type === "application/vnd.ms-excel.addin.macroEnabled.12" ||
|
||||||
|
file.type === "application/vnd.ms-excel.sheet.binary.macroEnabled.12" ||
|
||||||
|
file.type === "application/vnd.ms-powerpoint"
|
||||||
) {
|
) {
|
||||||
// 添加到本地待上传
|
// 添加到本地待上传
|
||||||
let data = await getMinioUploadId(extension);
|
let data = await getMinioUploadId(extension);
|
||||||
|
@ -170,6 +170,10 @@ const routes: RouteObject[] = [
|
|||||||
path: "/test",
|
path: "/test",
|
||||||
element: <TestPage />,
|
element: <TestPage />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/error",
|
||||||
|
element: <ErrorPage />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "*",
|
path: "*",
|
||||||
element: <ErrorPage />,
|
element: <ErrorPage />,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user