From 34a6c402c4b120aad65ad8c3a3dee8053149bce3 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 24 Oct 2025 10:56:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20homeNavar=20=E5=B0=86=E6=8A=95=E8=B5=84?= =?UTF-8?q?=E6=97=A5=E5=8E=86=E4=BB=8E=E7=A4=BE=E5=8C=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=8F=B3=E4=BE=A7=E5=AF=BC=E8=88=AA=E7=A7=BB=E5=88=B0?= =?UTF-8?q?=E4=BA=86=E9=A1=B6=E9=83=A8=E5=AF=BC=E8=88=AA=E6=A0=8F=20Invest?= =?UTF-8?q?mentCalendar.js=20=E5=B0=86=20loadEventCounts=20=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8=20useCallback=20?= =?UTF-8?q?=E5=8C=85=E8=A3=85=20=20=20-=20=E4=BF=AE=E5=A4=8D=E4=BA=86=20us?= =?UTF-8?q?eEffect=20=E7=9A=84=E4=BE=9D=E8=B5=96=E6=95=B0=E7=BB=84?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86=20loadEventCounts=20=20=20?= =?UTF-8?q?-=20=E4=B8=BA=E4=BA=8B=E4=BB=B6=E5=88=97=E8=A1=A8=20Modal=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=20zIndex=3D{1500}=20=20=20-=20?= =?UTF-8?q?=E4=B8=BA=E5=86=85=E5=AE=B9=E8=AF=A6=E6=83=85=20Drawer=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=20zIndex=3D{1500}=20=20=20-=20?= =?UTF-8?q?=E4=B8=BA=E7=9B=B8=E5=85=B3=E8=82=A1=E7=A5=A8=20Modal=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=20zIndex=3D{1500}=20src/views/Commu?= =?UTF-8?q?nity/components/RightSidebar.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改内容: - 已删除此文件 --- src/components/Navbars/HomeNavbar.js | 45 +++++++++++++++++++ .../components/InvestmentCalendar.js | 11 +++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/components/Navbars/HomeNavbar.js b/src/components/Navbars/HomeNavbar.js index dd3e0a05..def40305 100644 --- a/src/components/Navbars/HomeNavbar.js +++ b/src/components/Navbars/HomeNavbar.js @@ -32,6 +32,12 @@ import { useColorModeValue, useToast, Tooltip, + Modal, + ModalOverlay, + ModalContent, + ModalHeader, + ModalBody, + ModalCloseButton, } from '@chakra-ui/react'; import { ChevronDownIcon, HamburgerIcon, SunIcon, MoonIcon } from '@chakra-ui/icons'; import { FiStar, FiCalendar, FiUser, FiSettings, FiHome, FiLogOut } from 'react-icons/fi'; @@ -44,6 +50,7 @@ import { getApiBase } from '../../utils/apiConfig'; import SubscriptionButton from '../Subscription/SubscriptionButton'; import SubscriptionModal from '../Subscription/SubscriptionModal'; import { CrownIcon, TooltipContent } from '../Subscription/CrownTooltip'; +import InvestmentCalendar from '../../views/Community/components/InvestmentCalendar'; /** 二级导航栏组件 - 显示当前一级菜单下的所有二级菜单项 */ const SecondaryNav = ({ showCompletenessAlert }) => { @@ -526,6 +533,9 @@ export default function HomeNavbar() { const WATCHLIST_PAGE_SIZE = 10; const EVENTS_PAGE_SIZE = 8; + // 投资日历 Modal 状态 + const [calendarModalOpen, setCalendarModalOpen] = useState(false); + // 用户信息完整性状态 const [profileCompleteness, setProfileCompleteness] = useState(null); const [showCompletenessAlert, setShowCompletenessAlert] = useState(false); @@ -894,6 +904,20 @@ export default function HomeNavbar() { ) : isAuthenticated && user ? ( // 已登录状态 - 用户菜单 + 功能菜单排列 + {/* 投资日历 - 仅大屏显示 */} + {isDesktop && ( + + )} + {/* 自选股 - 仅大屏显示 */} {isDesktop && ( @@ -1160,6 +1184,11 @@ export default function HomeNavbar() { + {/* 投资日历 */} + } onClick={() => navigate('/community')}> + 投资日历 + + {/* 自选股 */} } onClick={() => navigate('/home/center')}> @@ -1521,6 +1550,22 @@ export default function HomeNavbar() { {/* 二级导航栏 - 显示当前页面所属的二级菜单 */} {!isMobile && } + + {/* 投资日历 Modal */} + setCalendarModalOpen(false)} + size="6xl" + > + + + 投资日历 + + + + + + ); } \ No newline at end of file diff --git a/src/views/Community/components/InvestmentCalendar.js b/src/views/Community/components/InvestmentCalendar.js index cac3d1f9..44dd765f 100644 --- a/src/views/Community/components/InvestmentCalendar.js +++ b/src/views/Community/components/InvestmentCalendar.js @@ -1,5 +1,5 @@ // src/views/Community/components/InvestmentCalendar.js -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useCallback } from 'react'; import { Card, Calendar, Badge, Modal, Table, Tabs, Tag, Button, List, Spin, Empty, Drawer, Typography, Divider, Space, Tooltip, message, Alert @@ -48,7 +48,7 @@ const InvestmentCalendar = () => { const [expandedReasons, setExpandedReasons] = useState({}); // 跟踪每个股票关联理由的展开状态 // 加载月度事件统计 - const loadEventCounts = async (date) => { + const loadEventCounts = useCallback(async (date) => { try { const year = date.year(); const month = date.month() + 1; @@ -63,7 +63,7 @@ const InvestmentCalendar = () => { month: date.month() + 1 }); } - }; + }, []); // eventService 是外部导入的稳定引用,不需要作为依赖 // 加载指定日期的事件 const loadDateEvents = async (date) => { @@ -131,7 +131,7 @@ const InvestmentCalendar = () => { useEffect(() => { loadEventCounts(currentMonth); - }, [currentMonth]); + }, [currentMonth, loadEventCounts]); // 自定义日期单元格渲染 const dateCellRender = (value) => { @@ -700,6 +700,7 @@ const InvestmentCalendar = () => { width={1200} footer={null} bodyStyle={{ padding: '24px' }} + zIndex={1500} > @@ -734,6 +735,7 @@ const InvestmentCalendar = () => { width={600} onClose={() => setDetailDrawerVisible(false)} visible={detailDrawerVisible} + zIndex={1500} > {selectedDetail?.content?.type === 'citation' ? ( { 关闭 } + zIndex={1500} > {hasFeatureAccess('related_stocks') ? (