From b66d3f06b7892b51d83a3e138b862053731626f2 Mon Sep 17 00:00:00 2001
From: unknown <18119604035@163.com>
Date: Fri, 28 Jul 2023 17:21:20 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=AF=BE=E4=BB=B6=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/internal/httpClient.ts | 10 +++++++---
src/compenents/upload-courseware-button/index.tsx | 14 +++++++++++++-
src/routes/index.tsx | 4 ++++
3 files changed, 24 insertions(+), 4 deletions(-)
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: ,