From d3a0b05910d15874db37b0579981abd7a15501fb Mon Sep 17 00:00:00 2001 From: zhaoweijie Date: Tue, 26 Aug 2025 09:15:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(VideoPlayer):=20=E9=9A=90=E8=97=8F=20logo?= =?UTF-8?q?=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 hideLogo 的 useMemo 计算,根据 localStorage 的值决定是否隐藏 logo - 修改 logo 渲染逻辑,根据 hideLogo 的值确定是否显示- 更新视频资源路径,从 assets 改为 public --- src/components/Option/Sidebar.tsx | 2 +- src/components/Option/VideoPlayer/index.tsx | 18 ++++++++++++------ src/{assets => public}/video.mp4 | Bin 3 files changed, 13 insertions(+), 7 deletions(-) rename src/{assets => public}/video.mp4 (100%) diff --git a/src/components/Option/Sidebar.tsx b/src/components/Option/Sidebar.tsx index d2cb7a6..48d99c4 100644 --- a/src/components/Option/Sidebar.tsx +++ b/src/components/Option/Sidebar.tsx @@ -149,7 +149,7 @@ export const Sidebar = ({ const db = new PageAssitDatabase() const history = await db.getChatHistory(chat.id) setHistoryId(chat.id) - setCurrentMessageId() + setCurrentMessageId("") setHistory(formatToChatHistory(history)) setMessages(formatToMessage(history)) stopStreamingRequest() diff --git a/src/components/Option/VideoPlayer/index.tsx b/src/components/Option/VideoPlayer/index.tsx index 29e496c..b647823 100644 --- a/src/components/Option/VideoPlayer/index.tsx +++ b/src/components/Option/VideoPlayer/index.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useRef, useState } from "react" -import iodVideo from "@/assets/video.mp4" +import React, { useEffect, useMemo, useRef, useState } from "react" +import iodVideo from "@/public/video.mp4" import { useOptionLayoutContext } from "@/components/Layouts/Layout.tsx" import { ExpandOutlined, @@ -313,6 +313,11 @@ const VideoPlayer = () => { // 计算进度条百分比 const progressPercent = duration ? (currentTime / duration) * 100 : 0 + // 是否隐藏logo + const hideLogo = useMemo(() => { + return localStorage.getItem("hideLogo") === "true" + }, []) + return (
{
)} - {/* 控制栏 - 使用与原始HTML相同的类名和行为 */}
-
- {logo} +
+ {!hideLogo && logo}

数联网科创智能体

@@ -368,7 +374,7 @@ const VideoPlayer = () => { className="bg-transparent border-none text-white text-lg cursor-pointer p-1 rounded-full w-12 h-12 flex items-center justify-center hover:bg-white hover:bg-opacity-20 transition-colors" onClick={togglePlayPause}> {isPlaying ? ( - + ) : ( )} diff --git a/src/assets/video.mp4 b/src/public/video.mp4 similarity index 100% rename from src/assets/video.mp4 rename to src/public/video.mp4