feat: homeNavar 将投资日历从社区页面的右侧导航移到了顶部导航栏

InvestmentCalendar.js 将 loadEventCounts 函数改为使用 useCallback 包装
  - 修复了 useEffect 的依赖数组,添加了 loadEventCounts
  - 为事件列表 Modal 添加了 zIndex={1500}
  - 为内容详情 Drawer 添加了 zIndex={1500}
  - 为相关股票 Modal 添加了 zIndex={1500}
src/views/Community/components/RightSidebar.js

  修改内容:
  - 已删除此文件
This commit is contained in:
zdl
2025-10-24 10:56:43 +08:00
parent 6ad38594bb
commit 34a6c402c4
2 changed files with 52 additions and 4 deletions

View File

@@ -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}
>
<Spin spinning={loading}>
<Tabs defaultActiveKey="event">
@@ -734,6 +735,7 @@ const InvestmentCalendar = () => {
width={600}
onClose={() => setDetailDrawerVisible(false)}
visible={detailDrawerVisible}
zIndex={1500}
>
{selectedDetail?.content?.type === 'citation' ? (
<CitedContent
@@ -770,6 +772,7 @@ const InvestmentCalendar = () => {
关闭
</Button>
}
zIndex={1500}
>
{hasFeatureAccess('related_stocks') ? (
<Table