From 7415fc8312a1eea6b7e4732937e53606e63dc987 Mon Sep 17 00:00:00 2001 From: wang_yp <357754663@qq.com> Date: Mon, 17 Mar 2025 13:59:07 +0800 Subject: [PATCH] fix(staff) --- src/pages/home/homeBottom/which_video.tsx | 14 +++++++++----- src/util/config.ts | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/home/homeBottom/which_video.tsx b/src/pages/home/homeBottom/which_video.tsx index d6684aa..7765a3b 100644 --- a/src/pages/home/homeBottom/which_video.tsx +++ b/src/pages/home/homeBottom/which_video.tsx @@ -1,6 +1,6 @@ import { Modal } from "antd"; import { inject, observer } from "mobx-react"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import Config from "@/util/config"; import EasyPlayer from "../videoTow"; const WhichVideo = (props) => { @@ -37,12 +37,16 @@ const WhichVideo = (props) => { console.error("Error fetching video URL:", error); } }; - fetchUrl() - timer = setInterval( () => { + fetchUrl(); + timer = setInterval(() => { fetchUrl(); - },35000); - + }, 35000); }; + useEffect(() => { + return () => { + clearInterval(timer); + }; + }, []); return ( <> 视频查看 diff --git a/src/util/config.ts b/src/util/config.ts index 1e36576..96b3e3d 100644 --- a/src/util/config.ts +++ b/src/util/config.ts @@ -1,6 +1,6 @@ class Config { - // static baseUrl = "/"; - static baseUrl = "https://www.hswzct.cn:12016/"; + static baseUrl = "/"; + // static baseUrl = "https://www.hswzct.cn:12016/"; // static baseUrl = "http://127.0.0.1:12214/"; static ws = "wss://www.hswzct.cn:12016/wsadmin?id=admin"; static userStatic = "https://www.hswzct.cn:12016/api/uploads/user/";