diff --git a/Cunkebao/src/components/UpdateNotification/index.tsx b/Cunkebao/src/components/UpdateNotification/index.tsx index 371b3d8a..d7169da7 100644 --- a/Cunkebao/src/components/UpdateNotification/index.tsx +++ b/Cunkebao/src/components/UpdateNotification/index.tsx @@ -1,22 +1,22 @@ import React, { useState, useEffect } from "react"; import { Button } from "antd-mobile"; import { updateChecker } from "@/utils/updateChecker"; -import { - ReloadOutlined, - CloudDownloadOutlined, - RocketOutlined, -} from "@ant-design/icons"; +import { ReloadOutlined } from "@ant-design/icons"; interface UpdateNotificationProps { position?: "top" | "bottom"; autoReload?: boolean; showToast?: boolean; + forceShow?: boolean; + onClose?: () => void; } const UpdateNotification: React.FC = ({ position = "top", autoReload = false, showToast = true, + forceShow = false, + onClose, }) => { const [hasUpdate, setHasUpdate] = useState(false); const [isVisible, setIsVisible] = useState(false); @@ -51,7 +51,19 @@ const UpdateNotification: React.FC = ({ updateChecker.forceReload(); }; - if (!isVisible || !hasUpdate) { + const handleLater = () => { + setIsVisible(false); + onClose?.(); + // 10分钟后再次检查 + setTimeout( + () => { + updateChecker.start(); + }, + 10 * 60 * 1000, + ); + }; + + if ((!isVisible || !hasUpdate) && !forceShow) { return null; } @@ -62,110 +74,134 @@ const UpdateNotification: React.FC = ({ top: 0, left: 0, right: 0, - bottom: 0, zIndex: 99999, - background: "linear-gradient(135deg, #1890ff 0%, #096dd9 100%)", + background: "linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%)", color: "white", - display: "flex", - flexDirection: "column", - alignItems: "center", - justifyContent: "center", - padding: "20px", - textAlign: "center", + padding: "16px 16px", + boxShadow: "0 4px 20px rgba(0, 0, 0, 0.5)", + borderBottom: "1px solid rgba(255, 255, 255, 0.1)", + animation: "slideDownBar 0.3s ease-out", }} > - {/* 背景装饰 */}
- -
- - {/* 主要内容 */} -
- {/* 图标 */} + {/* 左侧内容 */}
- + {/* 更新图标 */} +
+ +
+ {/* 文本信息 */} +
+
+ 发现新版本 +
+
+ 建议立即更新获得更好体验 +
+
- {/* 标题 */} + {/* 右侧按钮组 */}
- 发现新版本 -
- - {/* 描述 */} -
- 为了给您提供更好的体验,请更新到最新版本 -
- - {/* 更新按钮 */} - - - {/* 提示文字 */} -
- 更新将自动重启应用 + +
{/* 动画样式 */}