diff --git a/src/components/masonry/index.tsx b/src/components/masonry/index.tsx
index 6583a97..5cd4871 100644
--- a/src/components/masonry/index.tsx
+++ b/src/components/masonry/index.tsx
@@ -2,7 +2,7 @@ import { FC, useState, useEffect, useCallback } from "react";
import { Masonry as Masonic_masonry } from "masonic";
import Image from "@components/image";
import { SingleRun, concurrencyRequest } from "@utils/index";
-import { fetchPhotos, fetchVideos } from "@utils/fetch";
+import { fetchPhotos } from "@utils/fetch";
import { nanoid } from "nanoid";
import { getImageSize } from "../image/tool";
export default function Masonry() {
diff --git a/src/index.less b/src/index.less
index 6c1b571..6c8d898 100644
--- a/src/index.less
+++ b/src/index.less
@@ -47,4 +47,8 @@
body,
html {
font-family: 'Proxima Soft', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
+}
+
+body {
+ overflow-y: scroll;
}
\ No newline at end of file
diff --git a/src/routers/layout/logo/index.tsx b/src/routers/layout/logo/index.tsx
index 70822d0..710cbc7 100644
--- a/src/routers/layout/logo/index.tsx
+++ b/src/routers/layout/logo/index.tsx
@@ -126,18 +126,17 @@ const RouterListAndQA = () => {
return (
{RouterList.slice(0, 2).map((item) => (
-
+
))}
);
diff --git a/src/routers/layout/nav/index.tsx b/src/routers/layout/nav/index.tsx
index a4caea0..d9f6f5f 100644
--- a/src/routers/layout/nav/index.tsx
+++ b/src/routers/layout/nav/index.tsx
@@ -230,9 +230,7 @@ const NavTagChipItem: FC = memo(
= memo(
}
);
+/**
+ *
+${
+ loading ? "cursor-wait pointer-events-none" : "cursor-pointer"
+ }
+ */
+
const handleSetSpecialProps = (
query: string,
defaultColor: string,
diff --git a/src/utils/fetch/fetchtype.ts b/src/utils/fetch/fetchtype.ts
index d5ab7fe..238986a 100644
--- a/src/utils/fetch/fetchtype.ts
+++ b/src/utils/fetch/fetchtype.ts
@@ -171,7 +171,7 @@ type CustomFetchRes = {
/**
* @example 0
*/
- code: 0 | 400 | 500;
+ code: 0 | 400 | 500 | 403;
/**
* @example "ok"
*/
diff --git a/src/utils/fetch/index.ts b/src/utils/fetch/index.ts
index 30b2043..38a872d 100644
--- a/src/utils/fetch/index.ts
+++ b/src/utils/fetch/index.ts
@@ -1,4 +1,4 @@
-import axios from "axios";
+import axios, { AxiosError } from "axios";
import JSONBigInt from "json-bigint";
/**
* 类型文件导入
@@ -37,14 +37,21 @@ BackEndAxios.interceptors.request.use((config) => {
return config;
});
+let VideoSource: AbortController | null = null;
+
/**
* video视频数据获取接口
*/
export async function fetchVideos(
params: IFetchVideoParams
): Promise {
+ if (VideoSource) {
+ VideoSource.abort();
+ }
+ VideoSource = new AbortController();
try {
const res = await BackEndAxios.get("/video-interface/advanced-search", {
+ signal: VideoSource.signal,
params: {
order: params.order || "score",
page: params.page,
@@ -53,9 +60,23 @@ export async function fetchVideos(
tname: params.tname,
},
});
+ VideoSource = null;
return res.data;
- } catch (e) {
- // console.log({ e });
+ } catch (err) {
+ if (axios.isAxiosError(err)) {
+ if (err.code === "ERR_CANCELED") {
+ return {
+ code: 403,
+ message: "已取消",
+ ttl: 0,
+ data: {
+ page: 0,
+ numResults: 0,
+ result: [],
+ },
+ };
+ }
+ }
return {
code: 500,
message: "网络请求错误,您似乎处于断网状态",
@@ -68,19 +89,39 @@ export async function fetchVideos(
};
}
}
+let PhotoSource: AbortController | null = null;
/**
* photo图片数据获取接口
*/
export async function fetchPhotos(
params: IFetchPhotoParams
): Promise {
- // console.log({ params });
+ if (PhotoSource) {
+ PhotoSource.abort();
+ }
+ PhotoSource = new AbortController();
try {
const res = await BackEndAxios.get(`/pic/${params.type}`, {
+ signal: PhotoSource.signal,
params: Omit(params, "type"),
});
+ PhotoSource.abort();
return res.data;
- } catch (e) {
+ } catch (err) {
+ if (axios.isAxiosError(err)) {
+ if (err.code === "ERR_CANCELED") {
+ return {
+ code: 403,
+ message: "已取消",
+ ttl: 0,
+ data: {
+ page: 0,
+ total: 0,
+ result: [],
+ },
+ };
+ }
+ }
return {
code: 500,
message: "网络请求错误,您似乎处于断网状态",