Merge branch 'feature_bugfix/251201_py_h5_ui' of https://git.valuefrontier.cn/vf/vf_react into feature_bugfix/251201_py_h5_ui

This commit is contained in:
2025-12-15 18:28:43 +08:00

View File

@@ -65,6 +65,21 @@ const shimmerAnimation = keyframes`
100% { transform: translateX(100%); } 100% { transform: translateX(100%); }
`; `;
// 格式化URL确保有协议前缀
const formatUrl = (url) => {
if (!url) return null;
// 如果已经有协议前缀,直接返回
if (url.startsWith('http://') || url.startsWith('https://')) {
return url;
}
// 如果是 // 开头的协议相对URL
if (url.startsWith('//')) {
return 'https:' + url;
}
// 否则添加 https:// 前缀
return 'https://' + url;
};
import { getApiBase } from '@utils/apiConfig'; import { getApiBase } from '@utils/apiConfig';
// API配置 - 生产环境通过 api.valuefrontier.cn 代理 // API配置 - 生产环境通过 api.valuefrontier.cn 代理
@@ -1376,7 +1391,27 @@ const ConceptTimelineModal = ({
bg="whiteAlpha.100" bg="whiteAlpha.100"
color="white" color="white"
leftIcon={<ExternalLinkIcon />} leftIcon={<ExternalLinkIcon />}
onClick={() => window.open(selectedReport.content_url, '_blank')} onClick={() => {
const url = formatUrl(selectedReport.content_url);
if (url) {
const newWindow = window.open(url, '_blank');
if (!newWindow) {
toast({
title: '请允许弹窗',
description: '浏览器可能阻止了新窗口,请检查地址栏',
status: 'warning',
duration: 3000,
});
}
} else {
toast({
title: '链接无效',
description: '该研报暂无有效原文链接',
status: 'error',
duration: 3000,
});
}
}}
_hover={{ bg: 'whiteAlpha.200' }} _hover={{ bg: 'whiteAlpha.200' }}
> >
查看原文 查看原文