diff --git a/src/api/internal/httpClient.ts b/src/api/internal/httpClient.ts index 0b29793..8c75dee 100644 --- a/src/api/internal/httpClient.ts +++ b/src/api/internal/httpClient.ts @@ -7,6 +7,10 @@ const GoLogin = () => { window.location.href = "/login"; }; +const GoError = () => { + window.location.href = "/error"; +}; + export class HttpClient { axios: Axios; @@ -52,13 +56,13 @@ export class HttpClient { GoLogin(); } else if (status === 404) { // 跳转到404页面 - GoLogin(); + GoError(); } else if (status === 403) { // 跳转到无权限页面 - GoLogin(); + GoError(); } else if (status === 500) { // 跳转到500异常页面 - GoLogin(); + GoError(); } return Promise.reject(error.response); } diff --git a/src/compenents/upload-courseware-button/index.tsx b/src/compenents/upload-courseware-button/index.tsx index b8d393b..e376a5b 100644 --- a/src/compenents/upload-courseware-button/index.tsx +++ b/src/compenents/upload-courseware-button/index.tsx @@ -65,11 +65,23 @@ export const UploadCoursewareButton = (props: PropsInterface) => { if ( file.type === "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 === "application/pdf" || file.type === "application/x-zip-compressed" || + file.type === "application/zip" || 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); diff --git a/src/routes/index.tsx b/src/routes/index.tsx index e1e6fdb..de42930 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -170,6 +170,10 @@ const routes: RouteObject[] = [ path: "/test", element: , }, + { + path: "/error", + element: , + }, { path: "*", element: ,