update pay promo
This commit is contained in:
@@ -29,10 +29,10 @@ const EventDescriptionSection = ({ description }) => {
|
|||||||
<Box bg={sectionBg} p={3} borderRadius="md">
|
<Box bg={sectionBg} p={3} borderRadius="md">
|
||||||
{/* 事件描述 */}
|
{/* 事件描述 */}
|
||||||
<Box>
|
<Box>
|
||||||
<Heading size="sm" color={headingColor} mb={2}>
|
<Heading size="md" color={headingColor} mb={2}>
|
||||||
事件描述
|
事件描述
|
||||||
</Heading>
|
</Heading>
|
||||||
<Text fontSize="sm" color={textColor} lineHeight="tall">
|
<Text fontSize="md" color={textColor} lineHeight="tall">
|
||||||
{description}
|
{description}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -103,14 +103,14 @@ const EventHeaderInfo = ({ event, importance, isFollowing, followerCount, onTogg
|
|||||||
<Flex align="left" mb={3} gap={4}>
|
<Flex align="left" mb={3} gap={4}>
|
||||||
{/* 浏览数 */}
|
{/* 浏览数 */}
|
||||||
<HStack spacing={1}>
|
<HStack spacing={1}>
|
||||||
<Icon as={Eye} boxSize={4} color="gray.400" />
|
<Icon as={Eye} boxSize={5} color="gray.400" />
|
||||||
<Text fontSize="sm" color="gray.400" whiteSpace="nowrap">
|
<Text fontSize="md" color="gray.400" whiteSpace="nowrap">
|
||||||
{(event.view_count || 0).toLocaleString()}次浏览
|
{(event.view_count || 0).toLocaleString()}次浏览
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
{/* 日期 */}
|
{/* 日期 */}
|
||||||
<Text fontSize="sm" color="red.500" fontWeight="medium" whiteSpace="nowrap">
|
<Text fontSize="md" color="red.500" fontWeight="medium" whiteSpace="nowrap">
|
||||||
{dayjs(event.created_at).format('YYYY年MM月DD日')}
|
{dayjs(event.created_at).format('YYYY年MM月DD日')}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -146,8 +146,8 @@ const StockListItem = ({
|
|||||||
<VStack
|
<VStack
|
||||||
align="stretch"
|
align="stretch"
|
||||||
spacing={1}
|
spacing={1}
|
||||||
minW="95px"
|
minW="110px"
|
||||||
maxW="110px"
|
maxW="130px"
|
||||||
justify="center"
|
justify="center"
|
||||||
flexShrink={0}
|
flexShrink={0}
|
||||||
>
|
>
|
||||||
@@ -157,11 +157,11 @@ const StockListItem = ({
|
|||||||
hasArrow
|
hasArrow
|
||||||
bg="blue.600"
|
bg="blue.600"
|
||||||
color="white"
|
color="white"
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
>
|
>
|
||||||
<VStack spacing={0} align="stretch">
|
<VStack spacing={0} align="stretch">
|
||||||
<Text
|
<Text
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
color={codeColor}
|
color={codeColor}
|
||||||
noOfLines={1}
|
noOfLines={1}
|
||||||
cursor="pointer"
|
cursor="pointer"
|
||||||
@@ -171,7 +171,7 @@ const StockListItem = ({
|
|||||||
{stock.stock_code}
|
{stock.stock_code}
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
fontWeight="bold"
|
fontWeight="bold"
|
||||||
color={nameColor}
|
color={nameColor}
|
||||||
noOfLines={1}
|
noOfLines={1}
|
||||||
@@ -322,13 +322,13 @@ const StockListItem = ({
|
|||||||
transition="background 0.2s"
|
transition="background 0.2s"
|
||||||
position="relative"
|
position="relative"
|
||||||
>
|
>
|
||||||
<Collapse in={isDescExpanded} startingHeight={56}>
|
<Collapse in={isDescExpanded} startingHeight={60}>
|
||||||
{/* 渲染 query_part,每句带来源悬停提示 */}
|
{/* 渲染 query_part,每句带来源悬停提示 */}
|
||||||
<Text
|
<Text
|
||||||
as="span"
|
as="span"
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
color={nameColor}
|
color={nameColor}
|
||||||
lineHeight="1.5"
|
lineHeight="1.6"
|
||||||
>
|
>
|
||||||
{Array.isArray(stock.relation_desc?.data) && stock.relation_desc.data.filter(item => item.query_part).map((item, index) => (
|
{Array.isArray(stock.relation_desc?.data) && stock.relation_desc.data.filter(item => item.query_part).map((item, index) => (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@@ -380,10 +380,10 @@ const StockListItem = ({
|
|||||||
{/* 引用来源 - 浅色显示在最后 */}
|
{/* 引用来源 - 浅色显示在最后 */}
|
||||||
{isDescExpanded && (
|
{isDescExpanded && (
|
||||||
<Text
|
<Text
|
||||||
fontSize="10px"
|
fontSize="xs"
|
||||||
color="gray.500"
|
color="gray.500"
|
||||||
mt={2}
|
mt={2}
|
||||||
lineHeight="1.4"
|
lineHeight="1.5"
|
||||||
>
|
>
|
||||||
来源:{Array.isArray(stock.relation_desc?.data) &&
|
来源:{Array.isArray(stock.relation_desc?.data) &&
|
||||||
[...new Set(stock.relation_desc.data
|
[...new Set(stock.relation_desc.data
|
||||||
@@ -421,11 +421,11 @@ const StockListItem = ({
|
|||||||
position="relative"
|
position="relative"
|
||||||
>
|
>
|
||||||
{/* 去掉"关联描述"标题 */}
|
{/* 去掉"关联描述"标题 */}
|
||||||
<Collapse in={isDescExpanded} startingHeight={56}>
|
<Collapse in={isDescExpanded} startingHeight={60}>
|
||||||
<Text
|
<Text
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
color={nameColor}
|
color={nameColor}
|
||||||
lineHeight="1.5"
|
lineHeight="1.6"
|
||||||
>
|
>
|
||||||
{relationText}
|
{relationText}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -434,7 +434,7 @@ const StockListItem = ({
|
|||||||
{/* 提示信息 */}
|
{/* 提示信息 */}
|
||||||
{isDescExpanded && (
|
{isDescExpanded && (
|
||||||
<Text
|
<Text
|
||||||
fontSize="xs"
|
fontSize="sm"
|
||||||
color="gray.500"
|
color="gray.500"
|
||||||
mt={2}
|
mt={2}
|
||||||
fontStyle="italic"
|
fontStyle="italic"
|
||||||
|
|||||||
@@ -96,24 +96,30 @@ export const useSubscription = () => {
|
|||||||
|
|
||||||
// 检查是否有指定功能的权限
|
// 检查是否有指定功能的权限
|
||||||
const hasFeatureAccess = (featureName) => {
|
const hasFeatureAccess = (featureName) => {
|
||||||
// Max 用户解锁所有功能
|
// 获取功能所需的权限级别
|
||||||
if (user?.subscription_type === 'max' || subscriptionInfo.type === 'max') {
|
const requiredLevel = FEATURE_REQUIREMENTS[featureName];
|
||||||
|
|
||||||
|
// 如果功能不需要特定权限(不在列表中),默认允许
|
||||||
|
if (!requiredLevel) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!subscriptionInfo.is_active) {
|
// 获取当前用户的订阅类型
|
||||||
return false;
|
const currentType = (subscriptionInfo.type || 'free').toLowerCase();
|
||||||
|
|
||||||
|
// Max 用户解锁所有功能
|
||||||
|
if (currentType === 'max' || user?.subscription_type === 'max') {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const requiredLevel = FEATURE_REQUIREMENTS[featureName];
|
// Pro 用户可以访问 free 和 pro 级别的功能
|
||||||
if (!requiredLevel) {
|
if (currentType === 'pro') {
|
||||||
return true; // 如果功能不需要特定权限,默认允许
|
return requiredLevel === 'free' || requiredLevel === 'pro';
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentLevel = getSubscriptionLevel();
|
// Free 用户只能访问 free 级别的功能
|
||||||
const requiredLevelNum = getSubscriptionLevel(requiredLevel);
|
// 由于 deep_analysis 和 concept_sector 需要 pro,Free 用户无法访问
|
||||||
|
return requiredLevel === 'free';
|
||||||
return currentLevel >= requiredLevelNum;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 检查是否达到指定订阅级别
|
// 检查是否达到指定订阅级别
|
||||||
|
|||||||
@@ -28,11 +28,15 @@ export const fetchSubscriptionInfo = createAsyncThunk(
|
|||||||
|
|
||||||
if (data.success && data.data) {
|
if (data.success && data.data) {
|
||||||
// 数据标准化处理
|
// 数据标准化处理
|
||||||
|
const subType = (data.data.type || data.data.subscription_type || 'free').toLowerCase();
|
||||||
|
// Free 用户的 is_active 应为 false,Pro/Max 用户根据实际状态判断
|
||||||
|
const isActive = subType === 'free' ? false : (data.data.is_active === true);
|
||||||
|
|
||||||
const normalizedData = {
|
const normalizedData = {
|
||||||
type: (data.data.type || data.data.subscription_type || 'free').toLowerCase(),
|
type: subType,
|
||||||
status: data.data.status || 'active',
|
status: data.data.status || 'active',
|
||||||
days_left: data.data.days_left || 0,
|
days_left: data.data.days_left || 0,
|
||||||
is_active: data.data.is_active !== false,
|
is_active: isActive,
|
||||||
end_date: data.data.end_date || null
|
end_date: data.data.end_date || null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user