update pay function
This commit is contained in:
@@ -11,7 +11,6 @@ import {
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
import { eventService, stockService } from '../../../services/eventService';
|
import { eventService, stockService } from '../../../services/eventService';
|
||||||
import TimelineChartModal from '../../../components/StockChart/TimelineChartModal';
|
|
||||||
import KLineChartModal from '../../../components/StockChart/KLineChartModal';
|
import KLineChartModal from '../../../components/StockChart/KLineChartModal';
|
||||||
import { useSubscription } from '../../../hooks/useSubscription';
|
import { useSubscription } from '../../../hooks/useSubscription';
|
||||||
import SubscriptionUpgradeModal from '../../../components/SubscriptionUpgradeModal';
|
import SubscriptionUpgradeModal from '../../../components/SubscriptionUpgradeModal';
|
||||||
@@ -42,7 +41,6 @@ const InvestmentCalendar = () => {
|
|||||||
const [stockModalVisible, setStockModalVisible] = useState(false);
|
const [stockModalVisible, setStockModalVisible] = useState(false);
|
||||||
const [selectedStocks, setSelectedStocks] = useState([]);
|
const [selectedStocks, setSelectedStocks] = useState([]);
|
||||||
const [stockQuotes, setStockQuotes] = useState({});
|
const [stockQuotes, setStockQuotes] = useState({});
|
||||||
const [timelineModalVisible, setTimelineModalVisible] = useState(false);
|
|
||||||
const [klineModalVisible, setKlineModalVisible] = useState(false);
|
const [klineModalVisible, setKlineModalVisible] = useState(false);
|
||||||
const [selectedStock, setSelectedStock] = useState(null);
|
const [selectedStock, setSelectedStock] = useState(null);
|
||||||
const [selectedEventTime, setSelectedEventTime] = useState(null); // 记录事件时间
|
const [selectedEventTime, setSelectedEventTime] = useState(null); // 记录事件时间
|
||||||
@@ -283,23 +281,26 @@ const InvestmentCalendar = () => {
|
|||||||
return sixDigitCode;
|
return sixDigitCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 显示分时图
|
|
||||||
const showTimeline = (stock, eventTime) => {
|
|
||||||
setSelectedStock({
|
|
||||||
stock_code: addExchangeSuffix(stock[0]), // 添加交易所后缀
|
|
||||||
stock_name: stock[1]
|
|
||||||
});
|
|
||||||
setSelectedEventTime(eventTime);
|
|
||||||
setTimelineModalVisible(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示K线图
|
// 显示K线图
|
||||||
const showKline = (stock, eventTime) => {
|
const showKline = (stock) => {
|
||||||
|
const stockCode = addExchangeSuffix(stock[0]);
|
||||||
|
|
||||||
|
// 将 selectedDate 转换为 YYYY-MM-DD 格式(日K线只需要日期,不需要时间)
|
||||||
|
const formattedEventTime = selectedDate ? selectedDate.format('YYYY-MM-DD') : null;
|
||||||
|
|
||||||
|
console.log('[InvestmentCalendar] 打开K线图:', {
|
||||||
|
originalCode: stock[0],
|
||||||
|
processedCode: stockCode,
|
||||||
|
stockName: stock[1],
|
||||||
|
selectedDate: selectedDate?.format('YYYY-MM-DD'),
|
||||||
|
formattedEventTime: formattedEventTime
|
||||||
|
});
|
||||||
|
|
||||||
setSelectedStock({
|
setSelectedStock({
|
||||||
stock_code: addExchangeSuffix(stock[0]), // 添加交易所后缀
|
stock_code: stockCode, // 添加交易所后缀
|
||||||
stock_name: stock[1]
|
stock_name: stock[1]
|
||||||
});
|
});
|
||||||
setSelectedEventTime(eventTime);
|
setSelectedEventTime(formattedEventTime);
|
||||||
setKlineModalVisible(true);
|
setKlineModalVisible(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -666,26 +667,17 @@ const InvestmentCalendar = () => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: '图表',
|
title: 'K线图',
|
||||||
key: 'charts',
|
key: 'kline',
|
||||||
width: 150,
|
width: 80,
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space size="small">
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
size="small"
|
|
||||||
onClick={() => showTimeline(record, selectedDate?.toISOString())}
|
|
||||||
>
|
|
||||||
分时图
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => showKline(record, selectedDate?.toISOString())}
|
onClick={() => showKline(record)}
|
||||||
>
|
>
|
||||||
日K线
|
查看
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -848,20 +840,6 @@ const InvestmentCalendar = () => {
|
|||||||
)}
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
{/* 分时图弹窗 */}
|
|
||||||
{selectedStock && (
|
|
||||||
<TimelineChartModal
|
|
||||||
isOpen={timelineModalVisible}
|
|
||||||
onClose={() => {
|
|
||||||
setTimelineModalVisible(false);
|
|
||||||
setSelectedStock(null);
|
|
||||||
setSelectedEventTime(null);
|
|
||||||
}}
|
|
||||||
stock={selectedStock}
|
|
||||||
eventTime={selectedEventTime}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* K线图弹窗 */}
|
{/* K线图弹窗 */}
|
||||||
{selectedStock && (
|
{selectedStock && (
|
||||||
<KLineChartModal
|
<KLineChartModal
|
||||||
|
|||||||
Reference in New Issue
Block a user