update pay function
This commit is contained in:
@@ -17,8 +17,8 @@ import {
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
FaBuilding, FaMapMarkerAlt, FaChartLine, FaLightbulb, FaRocket,
|
FaBuilding, FaMapMarkerAlt, FaChartLine, FaLightbulb, FaRocket,
|
||||||
FaNetworkWired, FaChevronDown, FaChevronUp, FaCog, FaTrophy,
|
FaNetworkWired, FaChevronDown, FaChevronUp, FaChevronLeft, FaChevronRight,
|
||||||
FaShieldAlt, FaBrain, FaChartPie, FaHistory, FaCheckCircle,
|
FaCog, FaTrophy, FaShieldAlt, FaBrain, FaChartPie, FaHistory, FaCheckCircle,
|
||||||
FaExclamationCircle, FaArrowUp, FaArrowDown, FaLink, FaStar,
|
FaExclamationCircle, FaArrowUp, FaArrowDown, FaLink, FaStar,
|
||||||
FaUserTie, FaIndustry, FaDollarSign, FaBalanceScale, FaChartBar,
|
FaUserTie, FaIndustry, FaDollarSign, FaBalanceScale, FaChartBar,
|
||||||
FaEye, FaFlask, FaHandshake, FaUsers, FaClock, FaCalendarAlt,
|
FaEye, FaFlask, FaHandshake, FaUsers, FaClock, FaCalendarAlt,
|
||||||
@@ -26,7 +26,7 @@ import {
|
|||||||
FaUniversity, FaGraduationCap, FaVenusMars, FaPassport, FaFileAlt,
|
FaUniversity, FaGraduationCap, FaVenusMars, FaPassport, FaFileAlt,
|
||||||
FaNewspaper, FaBullhorn, FaUserShield, FaShareAlt, FaSitemap,
|
FaNewspaper, FaBullhorn, FaUserShield, FaShareAlt, FaSitemap,
|
||||||
FaSearch, FaDownload, FaExternalLinkAlt, FaInfoCircle, FaCrown,
|
FaSearch, FaDownload, FaExternalLinkAlt, FaInfoCircle, FaCrown,
|
||||||
FaCertificate, FaAward, FaExpandAlt, FaCompressAlt
|
FaCertificate, FaAward, FaExpandAlt, FaCompressAlt, FaGavel, FaFire
|
||||||
} from 'react-icons/fa';
|
} from 'react-icons/fa';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -797,6 +797,14 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
const [newsEvents, setNewsEvents] = useState([]);
|
const [newsEvents, setNewsEvents] = useState([]);
|
||||||
const [newsLoading, setNewsLoading] = useState(false);
|
const [newsLoading, setNewsLoading] = useState(false);
|
||||||
const [newsSearchQuery, setNewsSearchQuery] = useState('');
|
const [newsSearchQuery, setNewsSearchQuery] = useState('');
|
||||||
|
const [newsPagination, setNewsPagination] = useState({
|
||||||
|
page: 1,
|
||||||
|
per_page: 10,
|
||||||
|
total: 0,
|
||||||
|
pages: 0,
|
||||||
|
has_next: false,
|
||||||
|
has_prev: false
|
||||||
|
});
|
||||||
|
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
|
|
||||||
@@ -886,38 +894,53 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
}, [stockCode]);
|
}, [stockCode]);
|
||||||
|
|
||||||
// 加载新闻事件
|
// 加载新闻事件
|
||||||
const loadNewsEvents = async (searchQuery = '') => {
|
const loadNewsEvents = async (page = 1, searchQuery = '') => {
|
||||||
setNewsLoading(true);
|
setNewsLoading(true);
|
||||||
try {
|
try {
|
||||||
// 构建查询参数
|
// 构建查询参数
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
per_page: '20',
|
page: page.toString(),
|
||||||
|
per_page: '10',
|
||||||
sort: 'new',
|
sort: 'new',
|
||||||
include_creator: 'false',
|
include_creator: 'true',
|
||||||
include_stats: 'true'
|
include_stats: 'true'
|
||||||
});
|
});
|
||||||
|
|
||||||
// 如果有搜索关键词,添加搜索参数
|
// 搜索关键词优先级:
|
||||||
if (searchQuery) {
|
// 1. 用户输入的搜索关键词
|
||||||
params.append('q', searchQuery);
|
// 2. 股票简称
|
||||||
params.append('search_fields', 'title,description,content');
|
const queryText = searchQuery || basicInfo?.SECNAME || '';
|
||||||
}
|
if (queryText) {
|
||||||
|
params.append('q', queryText);
|
||||||
// 如果有股票代码,添加相关筛选(这里假设事件表有stock_code字段)
|
|
||||||
// 如果没有直接的stock_code字段,可以通过tags或keywords搜索
|
|
||||||
if (basicInfo?.SECNAME) {
|
|
||||||
params.append('keywords', basicInfo.SECNAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`${API_BASE_URL}/api/events?${params.toString()}`);
|
const response = await fetch(`${API_BASE_URL}/api/events?${params.toString()}`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
// API可能返回 data.data.events 或 data.events
|
// API返回 data.data.events
|
||||||
const events = data.data?.events || data.events || [];
|
const events = data.data?.events || data.events || [];
|
||||||
|
const pagination = data.data?.pagination || {
|
||||||
|
page: 1,
|
||||||
|
per_page: 10,
|
||||||
|
total: 0,
|
||||||
|
pages: 0,
|
||||||
|
has_next: false,
|
||||||
|
has_prev: false
|
||||||
|
};
|
||||||
|
|
||||||
setNewsEvents(events);
|
setNewsEvents(events);
|
||||||
|
setNewsPagination(pagination);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('CompanyOverview', 'loadNewsEvents', err, { stockCode, searchQuery });
|
logger.error('CompanyOverview', 'loadNewsEvents', err, { stockCode, searchQuery, page });
|
||||||
setNewsEvents([]);
|
setNewsEvents([]);
|
||||||
|
setNewsPagination({
|
||||||
|
page: 1,
|
||||||
|
per_page: 10,
|
||||||
|
total: 0,
|
||||||
|
pages: 0,
|
||||||
|
has_next: false,
|
||||||
|
has_prev: false
|
||||||
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setNewsLoading(false);
|
setNewsLoading(false);
|
||||||
}
|
}
|
||||||
@@ -926,13 +949,20 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
// 当基本信息加载完成后,加载新闻事件
|
// 当基本信息加载完成后,加载新闻事件
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (basicInfo) {
|
if (basicInfo) {
|
||||||
loadNewsEvents();
|
loadNewsEvents(1);
|
||||||
}
|
}
|
||||||
}, [basicInfo]);
|
}, [basicInfo]);
|
||||||
|
|
||||||
// 处理搜索
|
// 处理搜索
|
||||||
const handleNewsSearch = () => {
|
const handleNewsSearch = () => {
|
||||||
loadNewsEvents(newsSearchQuery);
|
loadNewsEvents(1, newsSearchQuery);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理分页
|
||||||
|
const handleNewsPageChange = (newPage) => {
|
||||||
|
loadNewsEvents(newPage, newsSearchQuery);
|
||||||
|
// 滚动到新闻列表顶部
|
||||||
|
document.getElementById('news-list-top')?.scrollIntoView({ behavior: 'smooth' });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 管理层职位分类
|
// 管理层职位分类
|
||||||
@@ -2183,11 +2213,13 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
|
|
||||||
{/* 新闻动态标签页 */}
|
{/* 新闻动态标签页 */}
|
||||||
<TabPanel p={0} pt={6}>
|
<TabPanel p={0} pt={6}>
|
||||||
|
<VStack spacing={4} align="stretch">
|
||||||
<Card bg={cardBg} shadow="md">
|
<Card bg={cardBg} shadow="md">
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<VStack spacing={4} align="stretch">
|
<VStack spacing={4} align="stretch">
|
||||||
{/* 搜索框 */}
|
{/* 搜索框和统计信息 */}
|
||||||
<HStack>
|
<HStack justify="space-between" flexWrap="wrap">
|
||||||
|
<HStack flex={1} minW="300px">
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<InputLeftElement pointerEvents="none">
|
<InputLeftElement pointerEvents="none">
|
||||||
<SearchIcon color="gray.400" />
|
<SearchIcon color="gray.400" />
|
||||||
@@ -2203,20 +2235,34 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
colorScheme="blue"
|
colorScheme="blue"
|
||||||
onClick={handleNewsSearch}
|
onClick={handleNewsSearch}
|
||||||
isLoading={newsLoading}
|
isLoading={newsLoading}
|
||||||
|
minW="80px"
|
||||||
>
|
>
|
||||||
搜索
|
搜索
|
||||||
</Button>
|
</Button>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
|
{newsPagination.total > 0 && (
|
||||||
|
<HStack spacing={2}>
|
||||||
|
<Icon as={FaNewspaper} color="blue.500" />
|
||||||
|
<Text fontSize="sm" color="gray.600">
|
||||||
|
共找到 <Text as="span" fontWeight="bold" color="blue.600">{newsPagination.total}</Text> 条新闻
|
||||||
|
</Text>
|
||||||
|
</HStack>
|
||||||
|
)}
|
||||||
|
</HStack>
|
||||||
|
|
||||||
|
<div id="news-list-top" />
|
||||||
|
|
||||||
{/* 新闻列表 */}
|
{/* 新闻列表 */}
|
||||||
{newsLoading ? (
|
{newsLoading ? (
|
||||||
<Center h="300px">
|
<Center h="400px">
|
||||||
<VStack spacing={3}>
|
<VStack spacing={3}>
|
||||||
<Spinner size="xl" color="blue.500" thickness="4px" />
|
<Spinner size="xl" color="blue.500" thickness="4px" />
|
||||||
<Text>正在加载新闻...</Text>
|
<Text color="gray.600">正在加载新闻...</Text>
|
||||||
</VStack>
|
</VStack>
|
||||||
</Center>
|
</Center>
|
||||||
) : newsEvents.length > 0 ? (
|
) : newsEvents.length > 0 ? (
|
||||||
|
<>
|
||||||
<VStack spacing={3} align="stretch">
|
<VStack spacing={3} align="stretch">
|
||||||
{newsEvents.map((event, idx) => {
|
{newsEvents.map((event, idx) => {
|
||||||
const importanceColor = {
|
const importanceColor = {
|
||||||
@@ -2226,108 +2272,148 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
'C': 'green'
|
'C': 'green'
|
||||||
}[event.importance] || 'gray';
|
}[event.importance] || 'gray';
|
||||||
|
|
||||||
|
const eventTypeIcon = {
|
||||||
|
'企业公告': FaBullhorn,
|
||||||
|
'政策': FaGavel,
|
||||||
|
'技术突破': FaFlask,
|
||||||
|
'企业融资': FaDollarSign,
|
||||||
|
'政策监管': FaShieldAlt,
|
||||||
|
'政策动态': FaFileAlt,
|
||||||
|
'行业事件': FaIndustry
|
||||||
|
}[event.event_type] || FaNewspaper;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={idx}
|
key={event.id || idx}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
_hover={{ bg: useColorModeValue('gray.50', 'gray.700'), shadow: 'md', borderColor: 'blue.300' }}
|
||||||
cursor="pointer"
|
|
||||||
_hover={{ bg: 'gray.50', shadow: 'md' }}
|
|
||||||
transition="all 0.2s"
|
transition="all 0.2s"
|
||||||
>
|
>
|
||||||
<CardBody p={4}>
|
<CardBody p={4}>
|
||||||
<VStack align="stretch" spacing={3}>
|
<VStack align="stretch" spacing={3}>
|
||||||
|
{/* 标题栏 */}
|
||||||
<HStack justify="space-between" align="start">
|
<HStack justify="space-between" align="start">
|
||||||
<VStack align="start" spacing={1} flex={1}>
|
<VStack align="start" spacing={2} flex={1}>
|
||||||
<HStack>
|
<HStack>
|
||||||
<Icon as={FaNewspaper} color="blue.500" boxSize={4} />
|
<Icon as={eventTypeIcon} color="blue.500" boxSize={5} />
|
||||||
<Text fontWeight="bold" fontSize="md" noOfLines={2}>
|
<Text fontWeight="bold" fontSize="lg" lineHeight="1.3">
|
||||||
{event.title}
|
{event.title}
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
|
{/* 标签栏 */}
|
||||||
<HStack spacing={2} flexWrap="wrap">
|
<HStack spacing={2} flexWrap="wrap">
|
||||||
{event.importance && (
|
{event.importance && (
|
||||||
<Badge colorScheme={importanceColor} size="sm">
|
<Badge colorScheme={importanceColor} variant="solid" px={2}>
|
||||||
重要度: {event.importance}
|
{event.importance}级
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
{event.event_type && (
|
{event.event_type && (
|
||||||
<Badge colorScheme="blue" size="sm">
|
<Badge colorScheme="blue" variant="outline">
|
||||||
{event.event_type}
|
{event.event_type}
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
{event.tags && event.tags.length > 0 && (
|
{event.invest_score && (
|
||||||
|
<Badge colorScheme="purple" variant="subtle">
|
||||||
|
投资分: {event.invest_score}
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
{event.keywords && event.keywords.length > 0 && (
|
||||||
<>
|
<>
|
||||||
{event.tags.slice(0, 3).map((tag, tidx) => (
|
{event.keywords.slice(0, 4).map((keyword, kidx) => (
|
||||||
<Tag key={tidx} size="sm" variant="subtle">
|
<Tag key={kidx} size="sm" colorScheme="cyan" variant="subtle">
|
||||||
{tag}
|
{keyword}
|
||||||
</Tag>
|
</Tag>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</HStack>
|
</HStack>
|
||||||
</VStack>
|
</VStack>
|
||||||
<VStack align="end" spacing={1}>
|
|
||||||
|
{/* 右侧信息栏 */}
|
||||||
|
<VStack align="end" spacing={1} minW="100px">
|
||||||
<Text fontSize="xs" color="gray.500">
|
<Text fontSize="xs" color="gray.500">
|
||||||
{event.created_at ? new Date(event.created_at).toLocaleDateString('zh-CN') : ''}
|
{event.created_at ? new Date(event.created_at).toLocaleDateString('zh-CN', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit'
|
||||||
|
}) : ''}
|
||||||
</Text>
|
</Text>
|
||||||
{event.view_count && (
|
<HStack spacing={3}>
|
||||||
|
{event.view_count !== undefined && (
|
||||||
<HStack spacing={1}>
|
<HStack spacing={1}>
|
||||||
<Icon as={FaEye} boxSize={3} color="gray.400" />
|
<Icon as={FaEye} boxSize={3} color="gray.400" />
|
||||||
<Text fontSize="xs" color="gray.500">
|
<Text fontSize="xs" color="gray.500">{event.view_count}</Text>
|
||||||
{event.view_count}
|
|
||||||
</Text>
|
|
||||||
</HStack>
|
</HStack>
|
||||||
)}
|
)}
|
||||||
|
{event.hot_score !== undefined && (
|
||||||
|
<HStack spacing={1}>
|
||||||
|
<Icon as={FaFire} boxSize={3} color="orange.400" />
|
||||||
|
<Text fontSize="xs" color="gray.500">{event.hot_score.toFixed(1)}</Text>
|
||||||
|
</HStack>
|
||||||
|
)}
|
||||||
|
</HStack>
|
||||||
|
{event.creator && (
|
||||||
|
<Text fontSize="xs" color="gray.400">
|
||||||
|
@{event.creator.username}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
|
{/* 描述 */}
|
||||||
{event.description && (
|
{event.description && (
|
||||||
<Text fontSize="sm" color="gray.600" noOfLines={2}>
|
<Text fontSize="sm" color="gray.700" lineHeight="1.6">
|
||||||
{event.description}
|
{event.description}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* 收益率数据 */}
|
||||||
{(event.related_avg_chg !== null || event.related_max_chg !== null || event.related_week_chg !== null) && (
|
{(event.related_avg_chg !== null || event.related_max_chg !== null || event.related_week_chg !== null) && (
|
||||||
<HStack spacing={4} pt={2} borderTop="1px" borderColor="gray.200">
|
<Box pt={2} borderTop="1px" borderColor="gray.200">
|
||||||
<Text fontSize="xs" color="gray.500">相关涨跌:</Text>
|
<HStack spacing={6} flexWrap="wrap">
|
||||||
|
<HStack spacing={1}>
|
||||||
|
<Icon as={FaChartLine} boxSize={3} color="gray.500" />
|
||||||
|
<Text fontSize="xs" color="gray.500" fontWeight="medium">相关涨跌:</Text>
|
||||||
|
</HStack>
|
||||||
{event.related_avg_chg !== null && event.related_avg_chg !== undefined && (
|
{event.related_avg_chg !== null && event.related_avg_chg !== undefined && (
|
||||||
<HStack spacing={1}>
|
<HStack spacing={1}>
|
||||||
<Text fontSize="xs" color="gray.500">平均:</Text>
|
<Text fontSize="xs" color="gray.500">平均</Text>
|
||||||
<Text
|
<Text
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
fontWeight="bold"
|
fontWeight="bold"
|
||||||
color={event.related_avg_chg > 0 ? 'red.500' : 'green.500'}
|
color={event.related_avg_chg > 0 ? 'red.500' : 'green.500'}
|
||||||
>
|
>
|
||||||
{event.related_avg_chg > 0 ? '+' : ''}{event.related_avg_chg}%
|
{event.related_avg_chg > 0 ? '+' : ''}{event.related_avg_chg.toFixed(2)}%
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
)}
|
)}
|
||||||
{event.related_max_chg !== null && event.related_max_chg !== undefined && (
|
{event.related_max_chg !== null && event.related_max_chg !== undefined && (
|
||||||
<HStack spacing={1}>
|
<HStack spacing={1}>
|
||||||
<Text fontSize="xs" color="gray.500">最大:</Text>
|
<Text fontSize="xs" color="gray.500">最大</Text>
|
||||||
<Text
|
<Text
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
fontWeight="bold"
|
fontWeight="bold"
|
||||||
color={event.related_max_chg > 0 ? 'red.500' : 'green.500'}
|
color={event.related_max_chg > 0 ? 'red.500' : 'green.500'}
|
||||||
>
|
>
|
||||||
{event.related_max_chg > 0 ? '+' : ''}{event.related_max_chg}%
|
{event.related_max_chg > 0 ? '+' : ''}{event.related_max_chg.toFixed(2)}%
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
)}
|
)}
|
||||||
{event.related_week_chg !== null && event.related_week_chg !== undefined && (
|
{event.related_week_chg !== null && event.related_week_chg !== undefined && (
|
||||||
<HStack spacing={1}>
|
<HStack spacing={1}>
|
||||||
<Text fontSize="xs" color="gray.500">周涨幅:</Text>
|
<Text fontSize="xs" color="gray.500">周</Text>
|
||||||
<Text
|
<Text
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
fontWeight="bold"
|
fontWeight="bold"
|
||||||
color={event.related_week_chg > 0 ? 'red.500' : 'green.500'}
|
color={event.related_week_chg > 0 ? 'red.500' : 'green.500'}
|
||||||
>
|
>
|
||||||
{event.related_week_chg > 0 ? '+' : ''}{event.related_week_chg}%
|
{event.related_week_chg > 0 ? '+' : ''}{event.related_week_chg.toFixed(2)}%
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
)}
|
)}
|
||||||
</HStack>
|
</HStack>
|
||||||
|
</Box>
|
||||||
)}
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
@@ -2335,11 +2421,101 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</VStack>
|
</VStack>
|
||||||
|
|
||||||
|
{/* 分页控件 */}
|
||||||
|
{newsPagination.pages > 1 && (
|
||||||
|
<Box pt={4}>
|
||||||
|
<HStack justify="space-between" align="center" flexWrap="wrap">
|
||||||
|
{/* 分页信息 */}
|
||||||
|
<Text fontSize="sm" color="gray.600">
|
||||||
|
第 {newsPagination.page} / {newsPagination.pages} 页
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
{/* 分页按钮 */}
|
||||||
|
<HStack spacing={2}>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
onClick={() => handleNewsPageChange(1)}
|
||||||
|
isDisabled={!newsPagination.has_prev || newsLoading}
|
||||||
|
leftIcon={<Icon as={FaChevronLeft} />}
|
||||||
|
>
|
||||||
|
首页
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
onClick={() => handleNewsPageChange(newsPagination.page - 1)}
|
||||||
|
isDisabled={!newsPagination.has_prev || newsLoading}
|
||||||
|
>
|
||||||
|
上一页
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
{/* 页码按钮 */}
|
||||||
|
{(() => {
|
||||||
|
const currentPage = newsPagination.page;
|
||||||
|
const totalPages = newsPagination.pages;
|
||||||
|
const pageButtons = [];
|
||||||
|
|
||||||
|
// 显示当前页及前后各2页
|
||||||
|
let startPage = Math.max(1, currentPage - 2);
|
||||||
|
let endPage = Math.min(totalPages, currentPage + 2);
|
||||||
|
|
||||||
|
// 如果开始页大于1,显示省略号
|
||||||
|
if (startPage > 1) {
|
||||||
|
pageButtons.push(
|
||||||
|
<Text key="start-ellipsis" fontSize="sm" color="gray.400">...</Text>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = startPage; i <= endPage; i++) {
|
||||||
|
pageButtons.push(
|
||||||
|
<Button
|
||||||
|
key={i}
|
||||||
|
size="sm"
|
||||||
|
variant={i === currentPage ? 'solid' : 'outline'}
|
||||||
|
colorScheme={i === currentPage ? 'blue' : 'gray'}
|
||||||
|
onClick={() => handleNewsPageChange(i)}
|
||||||
|
isDisabled={newsLoading}
|
||||||
|
>
|
||||||
|
{i}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果结束页小于总页数,显示省略号
|
||||||
|
if (endPage < totalPages) {
|
||||||
|
pageButtons.push(
|
||||||
|
<Text key="end-ellipsis" fontSize="sm" color="gray.400">...</Text>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageButtons;
|
||||||
|
})()}
|
||||||
|
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
onClick={() => handleNewsPageChange(newsPagination.page + 1)}
|
||||||
|
isDisabled={!newsPagination.has_next || newsLoading}
|
||||||
|
>
|
||||||
|
下一页
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
onClick={() => handleNewsPageChange(newsPagination.pages)}
|
||||||
|
isDisabled={!newsPagination.has_next || newsLoading}
|
||||||
|
rightIcon={<Icon as={FaChevronRight} />}
|
||||||
|
>
|
||||||
|
末页
|
||||||
|
</Button>
|
||||||
|
</HStack>
|
||||||
|
</HStack>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Center h="300px">
|
<Center h="400px">
|
||||||
<VStack spacing={3}>
|
<VStack spacing={3}>
|
||||||
<Icon as={FaNewspaper} boxSize={16} color="gray.300" />
|
<Icon as={FaNewspaper} boxSize={16} color="gray.300" />
|
||||||
<Text color="gray.500">暂无相关新闻</Text>
|
<Text color="gray.500" fontSize="lg" fontWeight="medium">暂无相关新闻</Text>
|
||||||
<Text fontSize="sm" color="gray.400">
|
<Text fontSize="sm" color="gray.400">
|
||||||
{newsSearchQuery ? '尝试修改搜索关键词' : '该公司暂无新闻动态'}
|
{newsSearchQuery ? '尝试修改搜索关键词' : '该公司暂无新闻动态'}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -2349,6 +2525,7 @@ const CompanyAnalysisComplete = ({ stockCode: propStockCode }) => {
|
|||||||
</VStack>
|
</VStack>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
</Card>
|
</Card>
|
||||||
|
</VStack>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabPanels>
|
</TabPanels>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
Reference in New Issue
Block a user