Skip to content

Let's use AI to Earn!

平台热点

daoyian6249ab9fc387
diff --git a/package.json b/package.json
index a5098acc..8edfa946 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,6 @@
"react-sortablejs": "^6.1.4",
"sass": "^1.59.2",
"sortablejs": "^1.15.6",
- "tailwindcss": "^4.1.7",
"zustand": "^5.0.5"
},
"devDependencies": {
diff --git a/src/api/hot.ts b/src/api/hot.ts
index 2868e9a8..6f08e066 100644
--- a/src/api/hot.ts
+++ b/src/api/hot.ts
@@ -83,28 +83,35 @@ export interface Stats {
}
export interface RankingContent {
- _id: string;
id: string;
- platformId: string;
- rankingId: string;
- originalId: string;
title: string;
- type: 'article' | 'video';
- category: string;
- url: string;
cover: string;
- description: string;
- author: Author;
- stats: Stats;
- status: number;
- shareCount: number;
- collectCount: number;
- publishTime: string;
- sort: number;
+ url: string;
rankingPosition: number;
- platform: Platform;
- ranking: PlatformRanking;
- anaAdd: any;
+ category: string;
+ publishTime: string;
+ author: {
+ name: string;
+ avatar: string;
+ fansCount: number;
+ };
+ stats: Stats;
+ anaAdd: {
+ addCollectedCunt: number;
+ addCommentCount: number;
+ addInteractiveCount: number;
+ addLikeCount: number;
+ addShareCount: number;
+ addViewCount: number | null;
+ collectedCount: number;
+ interactiveCount: number;
+ pred_readnum: number;
+ useCollectCount: number;
+ useCommentCount: number;
+ useLikeCount: number;
+ useShareCount: number;
+ useViewCount: number | null;
+ };
}
export interface PaginationMeta {
@@ -184,7 +191,7 @@ export const platformApi = {
});
},
- // 获取所有热点事件
+ // 获取八大平台热点事件
getAllHotTopics() {
return request<{
platform: Platform;
diff --git a/src/app/[lng]/hot-content-new/page.css b/src/app/[lng]/hot-content-new/page.css
index 09fb837e..9218fc83 100644
--- a/src/app/[lng]/hot-content-new/page.css
+++ b/src/app/[lng]/hot-content-new/page.css
@@ -4,11 +4,13 @@
}
.main-content {
+ flex-grow: 1;
margin: 24px;
- padding: 24px;
- background: #fff;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
+ padding: 0;
+ background: none;
+ box-shadow: none;
+ display: flex;
+ flex-direction: column;
}
/* 预览弹窗样式 */
@@ -32,7 +34,6 @@
@media screen and (max-width: 768px) {
.main-content {
margin: 12px;
- padding: 12px;
}
.preview-modal {
@@ -46,4 +47,264 @@
.preview-modal .ant-modal-content {
border-radius: 0;
}
+}
+
+/* 热点事件样式 */
+.hot-events-container {
+ width: 100%;
+ flex-grow: 1;
+ min-height: calc(100vh - 48px);
+ padding: 24px;
+ background: #f0f2f5;
+ border-radius: 8px;
+ display: flex;
+ flex-direction: column;
+}
+
+.hot-events-container .grid {
+ width: 100%;
+ flex-grow: 1;
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+ gap: 16px;
+}
+
+.hot-topic-card {
+ display: flex;
+ flex-direction: column;
+ height: auto;
+ min-height: 400px;
+ background: white;
+ border-radius: 8px;
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
+ transition: all 0.3s ease;
+ overflow: hidden;
+}
+
+.hot-topic-card:hover {
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+ transform: translateY(-2px);
+}
+
+.hot-topic-item {
+ display: flex;
+ align-items: center;
+ padding: 8px 0;
+ border-bottom: 1px solid #f7f7f7;
+ transition: background-color 0.2s ease;
+ cursor: pointer;
+}
+
+.hot-topic-item:hover {
+ background-color: #f9fafb;
+}
+
+.hot-topic-item:last-child {
+ border-bottom: none;
+}
+
+.hot-topic-details {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ flex: 1;
+ min-width: 0;
+}
+
+.hot-value-trend {
+ flex-shrink: 0;
+ width: 40px;
+ height: 16px;
+}
+
+.hot-value-trend svg {
+ width: 100%;
+ height: 100%;
+}
+
+.hot-value-trend polyline {
+ stroke: #ff4d4f;
+ stroke-width: 1.5;
+ fill: none;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ transition: stroke 0.3s ease;
+}
+
+.hot-topic-item:hover .hot-value-trend polyline {
+ stroke: #ff7875;
+}
+
+.platform-header {
+ display: flex;
+ align-items: center;
+ padding: 12px 16px;
+ border-bottom: 1px solid #f0f0f0;
+ background-color: #ffffff;
+ border-radius: 8px 8px 0 0;
+ flex-shrink: 0;
+}
+
+.platform-icon {
+ width: 20px;
+ height: 20px;
+ border-radius: 4px;
+ margin-right: 8px;
+ object-fit: contain;
+}
+
+.platform-name {
+ font-size: 15px;
+ font-weight: 500;
+ color: #1f2937;
+}
+
+.hot-topic-content {
+ flex: 1;
+ padding: 8px 16px;
+ overflow-y: auto;
+ min-height: 0;
+}
+
+.hot-topic-rank {
+ flex-shrink: 0;
+ width: 24px;
+ text-align: center;
+ font-size: 14px;
+ font-weight: 500;
+ color: #6b7280;
+}
+
+.hot-topic-rank.top-3 {
+ color: #ff4d4f;
+}
+
+.hot-topic-title {
+ flex: 1;
+ margin: 0 12px 0 8px;
+ font-size: 14px;
+ color: #333;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.hot-topic-metrics {
+ display: flex;
+ align-items: center;
+ flex-shrink: 0;
+ gap: 8px;
+}
+
+.hot-topic-value {
+ font-size: 13px;
+ color: #ff4d4f;
+ font-weight: 500;
+ white-space: nowrap;
+}
+
+.hot-topic-trend {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+}
+
+.hot-topic-trend.up {
+ color: #ff4d4f;
+}
+
+.hot-topic-trend.down {
+ color: #52c41a;
+}
+
+/* 加载状态样式 */
+.loading-container,
+.empty-state {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ flex-grow: 1;
+ min-height: 200px;
+ width: 100%;
+}
+
+.loading-text,
+.empty-state-text {
+ color: #6b7280;
+ font-size: 14px;
+}
+
+.empty-state-icon {
+ font-size: 40px;
+ margin-bottom: 12px;
+ color: #d1d5db;
+}
+
+/* 响应式布局调整 */
+@media screen and (max-width: 768px) {
+ .hot-events-container {
+ padding: 12px;
+ min-height: calc(100vh - 24px);
+ }
+
+ .main-content {
+ margin: 12px;
+ }
+
+ .hot-topic-card {
+ min-height: 350px;
+ }
+
+ .hot-topic-content {
+ padding: 8px 12px;
+ }
+
+ .platform-header {
+ padding: 10px 12px;
+ }
+
+ .platform-name {
+ font-size: 14px;
+ }
+
+ .hot-topic-rank {
+ font-size: 13px;
+ }
+
+ .hot-topic-title {
+ font-size: 13px;
+ margin: 0 8px;
+ }
+
+ .hot-topic-value {
+ font-size: 12px;
+ }
+
+ .hot-value-trend {
+ width: 30px;
+ }
+}
+
+/* 热点事件样式 */
+.custom-scrollbar {
+ scrollbar-width: thin;
+ scrollbar-color: #d1d5db transparent;
+}
+
+.custom-scrollbar::-webkit-scrollbar {
+ width: 4px;
+}
+
+.custom-scrollbar::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+.custom-scrollbar::-webkit-scrollbar-thumb {
+ background-color: #d1d5db;
+ border-radius: 2px;
+}
+
+.custom-scrollbar::-webkit-scrollbar-thumb:hover {
+ background-color: #9ca3af;
}
\ No newline at end of file
diff --git a/src/app/[lng]/hot-content-new/page.tsx b/src/app/[lng]/hot-content-new/page.tsx
index 248855ba..b9373811 100644
--- a/src/app/[lng]/hot-content-new/page.tsx
+++ b/src/app/[lng]/hot-content-new/page.tsx
@@ -8,6 +8,112 @@ import { platformApi } from '@/api/hot';
import SideMenu from '@/components/hot-content/SideMenu';
import HotContent from '@/components/hot-content/HotContent';
import './page.css';
+import { HotTopic } from '@/api/types/hotTopic';
+
+// 添加必要的类型定义
+interface ResponseType<T> {
+ data: T;
+ code: number;
+ message: string;
+}
+
+interface TopicContent {
+ id: string;
+ title: string;
+ type: string;
+ description: string | null;
+ msgType: string;
+ category: string;
+ subCategory: string | null;
+ author: string;
+ avatar: string;
+ cover: string;
+ authorId: string;
+ fans: number;
+ topics: string[];
+ rank: number;
+ shareCount: number;
+ likeCount: number;
+ watchingCount: number | null;
+ readCount: number;
+ publishTime: string;
+ url: string;
+ platformId: {
+ id: string;
+ name: string;
+ icon: string;
+ };
+ hotValue?: number;
+ commentCount: number;
+ collectCount: number;
+}
+
+interface PaginationMeta {
+ currentPage: number;
+ itemsPerPage: number;
+ totalItems: number;
+ totalPages: number;
+ itemCount: number;
+}
+
+interface ApiViralTitle {
+ id: string;
+ title: string;
+ category: string;
+ platform: string;
+ timeType: string;
+ engagement: number;
+ url: string;
+}
+
+interface PlatformHotTopics {
+ platform: {
+ id: string;
+ name: string;
+ icon: string;
+ type: string;
+ };
+ topics: {
+ id: string;
+ title: string;
+ hotValue: number;
+ url: string;
+ rank: number;
+ rankChange: number;
+ isRising: boolean;
+ hotValueHistory: {
+ hotValue: number;
+ timestamp: string;
+ }[];
+ }[];
+}
+
+interface HotValueHistoryItem {
+ hotValue: number | string;
+ sentence?: string;
+ updateTime: string;
+}
+
+interface HotTopicItem {
+ _id: string;
+ originalId: string;
+ title: string;
+ hotValue: string;
+ url: string;
+ rank: number;
+ rankChange: number;
+ hotValueHistory: HotValueHistoryItem[];
+ plat_name: string;
+ platformId: string;
+ createdAt: string;
+ updatedAt: string;
+ fetchTime: string;
+}
+
+interface ApiResponse {
+ platform: Platform;
+ hotTopic: HotTopic;
+}
const { Content } = Layout;
@@ -27,13 +133,52 @@ const HotContentNew: React.FC = () => {
});
const [categories, setCategories] = useState<string[]>([]);
const [selectedCategory, setSelectedCategory] = useState<string>('全部');
- const [isExpanded, setIsExpanded] = useState(false);
+ const [expandedStates, setExpandedStates] = useState({
+ topic: false,
+ hotEvent: false,
+ viralTitle: false,
+ talk: false,
+ hotPlatform: false
+ });
+ const [contentExpanded, setContentExpanded] = useState(true);
+ const [categoryListExpanded, setCategoryListExpanded] = useState(true);
const [selectedDate, setSelectedDate] = useState(dayjs().format('YYYY-MM-DD'));
const [rankingMinDate, setRankingMinDate] = useState('');
const [rankingMaxDate, setRankingMaxDate] = useState('');
const [previewVisible, setPreviewVisible] = useState(false);
const [previewUrl, setPreviewUrl] = useState('');
const [previewTitle, setPreviewTitle] = useState('');
+ const [msgTypeList, setMsgTypeList] = useState<string[]>([]);
+ const [selectedMsgType, setSelectedMsgType] = useState<string>('');
+ const [topicTypes, setTopicTypes] = useState<string[]>([]);
+ const [selectedTopicType, setSelectedTopicType] = useState<string>('');
+ const [timeTypes, setTimeTypes] = useState<string[]>([]);
+ const [selectedTimeType, setSelectedTimeType] = useState<string>('');
+ const [topicContents, setTopicContents] = useState<TopicContent[]>([]);
+ const [topicLoading, setTopicLoading] = useState(false);
+ const [topicPagination, setTopicPagination] = useState<PaginationMeta>({
+ currentPage: 1,
+ itemsPerPage: 10,
+ totalItems: 0,
+ totalPages: 1,
+ itemCount: 0
+ });
+ const [viralTitlePlatforms, setViralTitlePlatforms] = useState<Platform[]>([]);
+ const [selectedViralPlatform, setSelectedViralPlatform] = useState<Platform | null>(null);
+ const [viralTitleCategories, setViralTitleCategories] = useState<string[]>([]);
+ const [selectedViralCategory, setSelectedViralCategory] = useState<string>('');
+ const [viralTitleData, setViralTitleData] = useState<ApiViralTitle[]>([]);
+ const [viralTitleLoading, setViralTitleLoading] = useState(false);
+ const [viralTitlePagination, setViralTitlePagination] = useState<PaginationMeta>({
+ currentPage: 1,
+ itemsPerPage: 10,
+ totalItems: 0,
+ totalPages: 1,
+ itemCount: 0
+ });
+ const [hotTopics, setHotTopics] = useState<PlatformHotTopics[]>([]);
+ const [hotTopicLoading, setHotTopicLoading] = useState(false);
+ const [imgErrors, setImgErrors] = useState<Record<string, boolean>>({});
// 获取平台列表
useEffect(() => {
@@ -100,7 +245,6 @@ const HotContentNew: React.FC = () => {
// 获取日期范围
const datesResponse:any = await platformApi.getRankingDates(selectedRanking.id);
- console.log('获取榜单日历列表——datesResponse:',datesResponse)
if (datesResponse && datesResponse.data && datesResponse.data.length > 0) {
setSelectedDate(datesResponse.data[0].queryDate);
setRankingMaxDate(datesResponse.data[0].queryDate);
@@ -123,6 +267,221 @@ const HotContentNew: React.FC = () => {
fetchRankingContents();
}, [selectedRanking, selectedDate, pagination.currentPage, selectedCategory]);
+ // 获取专题分类和时间类型
+ useEffect(() => {
+ const fetchTopicData = async () => {
+ try {
+ const topicData = await platformApi.getMsgType();
+ if (topicData?.data) {
+ setMsgTypeList(topicData.data);
+ if (topicData.data.length > 0) {
+ setSelectedMsgType(topicData.data[0]);
+ fetchTopicTimeTypes(topicData.data[0]);
+ }
+ }
+ } catch (error) {
+ console.error('获取专题分类失败:', error);
+ }
+ };
+
+ fetchTopicData();
+ }, []);
+
+ // 获取专题时间类型
+ const fetchTopicTimeTypes = async (msgType: string) => {
+ try {
+ const timeTypeData = await platformApi.getTopicTimeTypes(msgType);
+ if (timeTypeData?.data) {
+ setTimeTypes(timeTypeData.data);
+ if (timeTypeData.data.length > 0) {
+ setSelectedTimeType(timeTypeData.data[0]);
+ }
+ }
+ } catch (error) {
+ console.error('获取专题时间类型失败:', error);
+ setTimeTypes([]);
+ }
+ };
+
+ // 获取专题类型
+ const fetchTopicTypes = async () => {
+ try {
+ const response = await platformApi.getTopics();
+ if (response?.data && Array.isArray(response.data)) {
+ setTopicTypes(response.data);
+ if (response.data.length > 0) {
+ setSelectedTopicType(response.data[0]);
+ }
+ }
+ } catch (error) {
+ console.error('获取专题类型失败:', error);
+ }
+ };
+
+ // 获取时间类型
+ const fetchTimeTypes = async () => {
+ try {
+ const response = await platformApi.getViralTitleTimeTypes();
+ if (response?.data && Array.isArray(response.data)) {
+ setTimeTypes(response.data);
+ if (response.data.length > 0) {
+ setSelectedTimeType(response.data[0]);
+ }
+ }
+ } catch (error) {
+ console.error('获取时间类型失败:', error);
+ }
+ };
+
+ // 获取专题内容
+ const fetchTopicContents = async (page: number = 1) => {
+ if (!selectedTopicType) return;
+
+ setTopicLoading(true);
+ try {
+ const response = await platformApi.getAllTopics({
+ page,
+ pageSize: 10,
+ type: selectedTopicType
+ });
+
+ if (response?.data) {
+ const { items, meta } = response.data;
+ if (Array.isArray(items)) {
+ const formattedItems = items.map(item => ({
+ id: item._id || '',
+ title: item.title,
+ type: selectedTopicType,
+ description: item.description || null,
+ msgType: selectedMsgType,
+ category: item.category,
+ subCategory: item.subCategory || null,
+ author: item.author || '',
+ avatar: '',
+ cover: item.coverUrl || '',
+ authorId: '',
+ fans: 0,
+ topics: item.topics || [],
+ rank: item.rank,
+ shareCount: item.shareCount,
+ likeCount: item.likeCount,
+ watchingCount: item.watchingCount,
+ readCount: item.readCount,
+ publishTime: item.publishTime?.toISOString() || '',
+ url: item.url,
+ platformId: {
+ id: '',
+ name: '',
+ icon: ''
+ },
+ hotValue: 0,
+ commentCount: 0,
+ collectCount: 0
+ }));
+ setTopicContents(formattedItems);
+ }
+ if (meta) {
+ setTopicPagination({
+ currentPage: meta.currentPage || 1,
+ itemsPerPage: meta.itemsPerPage || 10,
+ totalItems: meta.totalItems || 0,
+ totalPages: meta.totalPages || 1,
+ itemCount: meta.itemCount || 0
+ });
+ }
+ }
+ } catch (error) {
+ console.error('获取专题内容失败:', error);
+ } finally {
+ setTopicLoading(false);
+ }
+ };
+
+ // 获取爆款标题平台
+ const fetchViralTitlePlatforms = async () => {
+ try {
+ const [platformsResponse, timeTypeResponse] = await Promise.all([
+ platformApi.findPlatformsWithData(),
+ platformApi.getViralTitleTimeTypes()
+ ]);
+
+ const platforms = platformsResponse?.data || [];
+ const timeTypeData = timeTypeResponse?.data || [];
+
+ setViralTitlePlatforms(platforms);
+ if (platforms.length > 0) {
+ setSelectedViralPlatform(platforms[0]);
+ fetchViralTitleCategories(platforms[0].id);
+ if (timeTypeData.length > 0) {
+ fetchViralTitleContents(platforms[0].id, timeTypeData[0]);
+ }
+ }
+ } catch (error) {
+ console.error('获取爆款标题平台失败:', error);
+ setViralTitlePlatforms([]);
+ }
+ };
+
+ // 获取爆款标题分类
+ const fetchViralTitleCategories = async (platformId: string) => {
+ try {
+ const response = await platformApi.findCategoriesByPlatform(platformId);
+ const categories = response?.data || [];
+ setViralTitleCategories(categories);
+ if (categories.length > 0) {
+ setSelectedViralCategory('');
+ }
+ } catch (error) {
+ console.error('获取爆款标题分类失败:', error);
+ setViralTitleCategories([]);
+ }
+ };
+
+ // 获取爆款标题内容
+ const fetchViralTitleContents = async (platformId: string, timeType: string) => {
+ setViralTitleLoading(true);
+ try {
+ const response = await platformApi.findTopByPlatformAndCategories(platformId, timeType);
+ if (response?.data) {
+ const titles = response.data.flatMap(item => item.titles.map(title => ({
+ id: title._id || '',
+ title: title.title,
+ category: item.category,
+ platform: platformId,
+ timeType: timeType,
+ engagement: title.engagement || 0,
+ url: title.url || ''
+ })));
+ setViralTitleData(titles);
+ } else {
+ setViralTitleData([]);
+ }
+ } catch (error) {
+ console.error('获取爆款标题内容失败:', error);
+ setViralTitleData([]);
+ } finally {
+ setViralTitleLoading(false);
+ }
+ };
+
+ // 获取八大平台热点
+ const fetchHotTopics = async () => {
+ setHotTopicLoading(true);
+ try {
+ const response:any = await platformApi.getAllHotTopics();
+ if (response?.data && Array.isArray(response.data)) {
+ setHotTopics(response?.data);
+ } else {
+ setHotTopics([]);
+ }
+ } catch (error) {
+ console.error('获取热点事件失败:', error);
+ setHotTopics([]);
+ } finally {
+ setHotTopicLoading(false);
+ }
+ };
+
// 处理平台选择
const handlePlatformSelect = (platform: Platform) => {
setSelectedPlatform(platform);
@@ -161,9 +520,22 @@ const HotContentNew: React.FC = () => {
setPreviewVisible(true);
};
- // 处理展开/收起
- const handleExpandToggle = () => {
- setIsExpanded(!isExpanded);
+ // 处理左侧菜单展开/收起
+ const handleMenuExpandToggle = (section: keyof typeof expandedStates) => {
+ setExpandedStates(prev => ({
+ ...prev,
+ [section]: !prev[section]
+ }));
+ };
+
+ // 处理右侧内容区域展开/收起
+ const handleContentExpandToggle = () => {
+ setContentExpanded(prev => !prev);
+ };
+
+ // 处理分类列表展开/收起
+ const handleCategoryListExpandToggle = () => {
+ setCategoryListExpanded(prev => !prev);
};
// 获取图片URL
@@ -172,61 +544,247 @@ const HotContentNew: React.FC = () => {
};
// 格式化数字
- const formatNumber = (num: number) => {
+ const formatNumber = (num: number | null) => {
+ if (num === null) return '0';
return num >= 10000 ? `${(num / 10000).toFixed(1)}w` : num.toString();
};
+ // 处理热门专题点击
+ const handleTopicExpandClick = async () => {
+ const newTopicExpanded = !expandedStates.topic;
+ setExpandedStates(prev => ({
+ ...prev,
+ topic: newTopicExpanded,
+ hotEvent: false,
+ viralTitle: false,
+ talk: false,
+ hotPlatform: false
+ }));
+ setContentExpanded(false);
+
+ if (newTopicExpanded && msgTypeList.length > 0) {
+ if (!selectedMsgType && msgTypeList.length > 0) {
+ setSelectedMsgType(msgTypeList[0]);
+ }
+ const msgType = selectedMsgType || msgTypeList[0];
+ await fetchTopicTimeTypes(msgType);
+ }
+ };
+
+ // 处理爆款标题点击
+ const handleViralTitleExpandClick = async () => {
+ const newViralTitleExpanded = !expandedStates.viralTitle;
+ setExpandedStates(prev => ({
+ ...prev,
+ viralTitle: newViralTitleExpanded,
+ topic: false,
+ hotEvent: false,
+ talk: false,
+ hotPlatform: false
+ }));
+ setContentExpanded(false);
+
+ if (newViralTitleExpanded) {
+ await fetchViralTitlePlatforms();
+ }
+ };
+
+ // 处理热点事件点击
+ const handleHotEventExpandClick = async () => {
+ const newHotEventExpanded = !expandedStates.hotEvent;
+ setExpandedStates(prev => ({
+ ...prev,
+ hotEvent: newHotEventExpanded,
+ topic: false,
+ viralTitle: false,
+ talk: false,
+ hotPlatform: false
+ }));
+ setContentExpanded(false);
+
+ if (newHotEventExpanded) {
+ await fetchHotTopics();
+ }
+ };
+
+ // 处理图片加载错误
+ const handleImageError = (key: string) => {
+ setImgErrors(prev => ({
+ ...prev,
+ [key]: true
+ }));
+ };
+
+ // 处理爆款标题平台选择
+ const handleViralPlatformSelect = (platform: Platform) => {
+ setSelectedViralPlatform(platform);
+ fetchViralTitleCategories(platform.id);
+ platformApi.getViralTitleTimeTypes().then(response => {
+ if (response?.data && response.data.length > 0) {
+ fetchViralTitleContents(platform.id, response.data[0]);
+ }
+ });
+ };
+
return (
- <Layout className="hot-content-layout" style={{ flexDirection: 'row' }}>
+ <div className="hot-content-layout" style={{ display: 'flex', flexDirection: 'row' }}>
<SideMenu
platforms={platforms}
selectedPlatform={selectedPlatform}
loading={rankingLoading}
- contentExpanded={isExpanded}
- topicExpanded={false}
- hotEventExpanded={false}
- viralTitleExpanded={false}
- talkExpanded={false}
- hotPlatformExpanded={false}
- viralTitleLoading={false}
- viralTitlePlatforms={[]}
- selectedViralPlatform={null}
- msgTypeList={[]}
- selectedMsgType=""
+ contentExpanded={contentExpanded}
+ topicExpanded={expandedStates.topic}
+ hotEventExpanded={expandedStates.hotEvent}
+ viralTitleExpanded={expandedStates.viralTitle}
+ talkExpanded={expandedStates.talk}
+ hotPlatformExpanded={expandedStates.hotPlatform}
+ viralTitleLoading={viralTitleLoading}
+ viralTitlePlatforms={viralTitlePlatforms}
+ selectedViralPlatform={selectedViralPlatform}
+ msgTypeList={msgTypeList}
+ selectedMsgType={selectedMsgType}
onPlatformSelect={handlePlatformSelect}
- onContentExpand={handleExpandToggle}
- onTopicExpand={() => {}}
- onHotEventExpand={() => {}}
- onViralTitleExpand={() => {}}
- onTalkExpand={() => {}}
- onHotPlatformExpand={() => {}}
- onViralPlatformSelect={() => {}}
- onMsgTypeClick={() => {}}
+ onContentExpand={handleContentExpandToggle}
+ onTopicExpand={handleTopicExpandClick}
+ onHotEventExpand={handleHotEventExpandClick}
+ onViralTitleExpand={handleViralTitleExpandClick}
+ onTalkExpand={() => handleMenuExpandToggle('talk')}
+ onHotPlatformExpand={() => handleMenuExpandToggle('hotPlatform')}
+ onViralPlatformSelect={handleViralPlatformSelect}
+ onMsgTypeClick={(type) => {
+ setSelectedMsgType(type);
+ fetchTopicTimeTypes(type);
+ }}
getImageUrl={getImageUrl}
/>
- <Content className="main-content">
- <HotContent
- rankingList={rankingList}
- selectedRanking={selectedRanking}
- rankingContents={rankingContents}
- rankingLoading={rankingLoading}
- pagination={pagination}
- categories={categories}
- selectedCategory={selectedCategory}
- isExpanded={isExpanded}
- selectedDate={selectedDate}
- rankingMinDate={rankingMinDate}
- rankingMaxDate={rankingMaxDate}
- onRankingSelect={handleRankingSelect}
- onCategorySelect={handleCategorySelect}
- onDateChange={handleDateChange}
- onPageChange={handlePageChange}
- onContentClick={handleContentClick}
- onExpandToggle={handleExpandToggle}
- getImageUrl={getImageUrl}
- formatNumber={formatNumber}
- />
- </Content>
+ <div className="main-content">
+ {!expandedStates.hotEvent ? (
+ <HotContent
+ rankingList={rankingList}
+ selectedRanking={selectedRanking}
+ rankingContents={rankingContents}
+ rankingLoading={rankingLoading}
+ pagination={pagination}
+ categories={categories}
+ selectedCategory={selectedCategory}
+ isExpanded={categoryListExpanded}
+ selectedDate={selectedDate}
+ rankingMinDate={rankingMinDate}
+ rankingMaxDate={rankingMaxDate}
+ onRankingSelect={handleRankingSelect}
+ onCategorySelect={handleCategorySelect}
+ onDateChange={handleDateChange}
+ onPageChange={handlePageChange}
+ onContentClick={handleContentClick}
+ onExpandToggle={handleCategoryListExpandToggle}
+ getImageUrl={getImageUrl}
+ formatNumber={formatNumber}
+ />
+ ) : (
+ <div className="hot-events-container">
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
+ {hotTopicLoading ? (
+ <div className="loading-container col-span-full">
+ <span className="loading-text">加载中...</span>
+ </div>
+ ) : hotTopics && hotTopics.length > 0 ? (
+ hotTopics.map((platformData) => (
+ <div
+ key={platformData.platform.id}
+ className="hot-topic-card h-full"
+ >
+ {/* 平台标题 */}
+ <div className="platform-header">
+ <div className="flex items-center space-x-2">
+ {platformData.platform.icon && !imgErrors[`platform-${platformData.platform.id}`] ? (
+ <img
+ src={getImageUrl(platformData.platform.icon)}
+ alt={platformData.platform.name}
+ className="platform-icon"
+ onError={() => handleImageError(`platform-${platformData.platform.id}`)}
+ />
+ ) : (
+ <div className="platform-icon bg-[#fff1f0] flex items-center justify-center">
+ <span className="text-[#ff4d4f]">
+ {platformData.platform.name?.charAt(0)?.toUpperCase() || '?'}
+ </span>
+ </div>
+ )}
+ <span className="platform-name">
+ {platformData.platform.name} · 热点
+ </span>
+ </div>
+ </div>
+
+ {/* 热点列表 */}
+ <div className="hot-topic-content">
+ <div className="space-y-2">
+ {platformData.topics && platformData.topics.length > 0 ? (
+ platformData.topics.map((topic, index) => (
+ <div
+ key={topic.id || index}
+ className="hot-topic-item"
+ onClick={() => topic.url && handleContentClick(topic.url, topic.title)}
+ >
+ {/* 排名 */}
+ <div className="hot-topic-rank">
+ <span className={index < 3 ? 'top-3' : ''}>
+ {index + 1}
+ </span>
+ </div>
+
+ {/* 标题和热度 */}
+ <div className="hot-topic-details">
+ <div className="hot-topic-title">
+ {topic.title}
+ </div>
+ <div className="hot-topic-metrics">
+ {topic.isRising && (
+ <span className="text-xs text-[#ff4d4f] bg-[#fff1f0] px-1 rounded">
+ 热
+ </span>
+ )}
+ <span className="hot-topic-value">
+ {(topic.hotValue / 10000).toFixed(1)}w
+ </span>
+ <div className="hot-value-trend">
+ <svg width="100%" height="100%" viewBox="0 0 100 20" preserveAspectRatio="none">
+ <polyline
+ points={topic.hotValueHistory?.map((item, i) => {
+ const x = (i / (topic.hotValueHistory.length - 1)) * 100 || 0;
+ const maxHot = Math.max(...topic.hotValueHistory.map(h => h.hotValue));
+ const minHot = Math.min(...topic.hotValueHistory.map(h => h.hotValue));
+ const range = maxHot - minHot;
+ const y = range === 0 ? 10 : 20 - ((item.hotValue - minHot) / range) * 20;
+ return `${x},${y}`;
+ }).join(' ')}
+ />
+ </svg>
+ </div>
+ </div>
+ </div>
+ </div>
+ ))
+ ) : (
+ <div className="empty-state">
+ <div className="empty-state-icon">📊</div>
+ <div className="empty-state-text">暂无热点数据</div>
+ </div>
+ )}
+ </div>
+ </div>
+ </div>
+ ))
+ ) : (
+ <div className="empty-state col-span-full">
+ <div className="empty-state-icon">📊</div>
+ <div className="empty-state-text">暂无热点事件数据</div>
+ </div>
+ )}
+ </div>
+ </div>
+ )}
+ </div>
{/* 预览弹窗 */}
<Modal
@@ -243,7 +801,7 @@ const HotContentNew: React.FC = () => {
title="内容预览"
/>
</Modal>
- </Layout>
+ </div>
);
};
diff --git a/src/app/[lng]/hot-content/page.tsx b/src/app/[lng]/hot-content/page.tsx
index decbbb3e..74579ded 100644
--- a/src/app/[lng]/hot-content/page.tsx
+++ b/src/app/[lng]/hot-content/page.tsx
@@ -2873,7 +2873,7 @@ const Trending: React.FC = () => {
<div className="flex items-center text-sm">
<div className="w-32 text-gray-500">
- <span>{item.category}</span>
+ <span>{item.category} {selectedPlatform}</span>
{/* <span className="ml-2">{item.type}</span> */}
</div>
diff --git a/src/components/hot-content/HotContent.css b/src/components/hot-content/HotContent.css
index ad8cade7..b3efb3c3 100644
--- a/src/components/hot-content/HotContent.css
+++ b/src/components/hot-content/HotContent.css
@@ -176,7 +176,8 @@
.header-right {
display: flex;
gap: 16px;
- width: 400px;
+ min-width: 500px;
+ align-items: center;
}
.rank-column {
@@ -189,17 +190,23 @@
}
.category-column {
- width: 100px;
+ width: 120px;
+ color: #666;
+ font-size: 14px;
+ padding-left: 16px;
}
.stats-columns {
display: flex;
gap: 16px;
+ min-width: 400px;
}
.stat-column {
- width: 60px;
+ width: 80px;
text-align: center;
+ color: #666;
+ font-size: 14px;
}
.content-item {
@@ -225,6 +232,7 @@
display: flex;
gap: 16px;
flex: 1;
+ margin-left: 16px;
}
.thumbnail {
@@ -232,6 +240,7 @@
height: 120px;
border-radius: 4px;
overflow: hidden;
+ flex-shrink: 0;
}
.cover-image {
@@ -254,14 +263,19 @@
flex: 1;
display: flex;
flex-direction: column;
- gap: 8px;
+ justify-content: space-between;
}
.title {
- margin: 0;
+ margin: 0 0 8px 0;
font-size: 16px;
font-weight: 500;
color: #333;
+ text-align: left;
+}
+
+.title:hover {
+ color: #1890ff;
}
.author-info {
@@ -272,47 +286,75 @@
}
.avatar {
- width: 24px;
- height: 24px;
+ width: 20px;
+ height: 20px;
border-radius: 50%;
}
.author-name {
color: #1890ff;
+ font-size: 14px;
}
.fans-count {
color: #999;
+ font-size: 12px;
}
.publish-time {
color: #999;
+ font-size: 12px;
}
.content-stats {
display: flex;
- flex-direction: column;
- gap: 8px;
- width: 400px;
+ align-items: center;
+ min-width: 500px;
}
.category {
- width: 100px;
+ width: 128px;
color: #666;
+ font-size: 14px;
+ text-align: left;
}
.stats {
display: flex;
- gap: 16px;
+ gap: 48px;
+ flex: 1;
+ justify-content: flex-end;
}
.stat {
- width: 60px;
+ width: 96px;
text-align: center;
}
-.value {
- color: #666;
+.stat-total {
+ color: #a66ae4;
+ font-size: 14px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.stat-add {
+ color: #a66ae4;
+ font-size: 12px;
+ border: 1px solid #a66ae4;
+ border-radius: 15px;
+ padding: 2px;
+ margin-top: 6px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.stat-add .arrow {
+ color: #ff4d4f;
+ margin-right: 4px;
+ font-weight: bold;
}
/* 加载状态样式 */
@@ -352,4 +394,52 @@
.data-info-popover .ant-popover-inner-content {
padding: 12px;
+}
+
+.data-statistics {
+ background: #fff;
+ border-radius: 8px;
+ padding: 20px;
+ margin-bottom: 20px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
+}
+
+.statistics-section {
+ margin-bottom: 20px;
+}
+
+.statistics-section:last-child {
+ margin-bottom: 0;
+}
+
+.statistics-section h3 {
+ font-size: 16px;
+ color: #333;
+ margin-bottom: 16px;
+ font-weight: 500;
+}
+
+.statistics-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+ gap: 16px;
+}
+
+.stat-item {
+ background: #f8f9fa;
+ padding: 12px;
+ border-radius: 6px;
+ text-align: center;
+}
+
+.stat-label {
+ font-size: 14px;
+ color: #666;
+ margin-bottom: 8px;
+}
+
+.stat-value {
+ font-size: 18px;
+ color: #333;
+ font-weight: 500;
}
\ No newline at end of file
diff --git a/src/components/hot-content/HotContent.tsx b/src/components/hot-content/HotContent.tsx
index 2c0d68a5..5ca4b938 100644
--- a/src/components/hot-content/HotContent.tsx
+++ b/src/components/hot-content/HotContent.tsx
@@ -25,7 +25,24 @@ interface HotContentProps {
onContentClick: (url: string, title: string) => void;
onExpandToggle: () => void;
getImageUrl: (path: string) => string;
- formatNumber: (num: number) => string;
+ formatNumber: (num: number | null) => string;
+ anaAdd?: {
+ addCollectedCunt: number;
+ addCommentCount: number;
+ addLikeCount: number;
+ addShareCount: number;
+ addViewCount: number | null;
+ addInteractiveCount: number | null;
+ addCollectCount: number | null;
+ collectedCount: number;
+ interactiveCount: number;
+ pred_readnum: number;
+ useCollectCount: number;
+ useCommentCount: number;
+ useLikeCount: number;
+ useShareCount: number;
+ useViewCount: number | null;
+ };
}
const DataInfoContent: React.FC<{ ranking: PlatformRanking }> = ({ ranking }) => (
@@ -78,6 +95,7 @@ const HotContent: React.FC<HotContentProps> = ({
}) => {
return (
<div className="hot-content">
+
{/* 榜单选择 */}
{rankingList.length > 1 && (
<div className="ranking-selector">
@@ -210,10 +228,47 @@ const HotContent: React.FC<HotContentProps> = ({
<div className="header-right">
<div className="category-column">作品分类</div>
<div className="stats-columns">
- <div className="stat-column">点赞</div>
- <div className="stat-column">评论</div>
- <div className="stat-column">分享</div>
- <div className="stat-column">收藏</div>
+ {/* 快手增量榜单 */}
+ {selectedRanking?.name.includes('增量') && selectedRanking?.platform?.id === 'ks' && (
+ <>
+ <div className="stat-column">互动增量</div>
+ <div className="stat-column">新增播放</div>
+ <div className="stat-column">新增分享</div>
+ <div className="stat-column">新增评论</div>
+ </>
+ )}
+
+ {/* 其他平台增量榜单 */}
+ {selectedRanking?.name.includes('增量') && selectedRanking?.platform?.id !== 'ks' && (
+ <>
+ <div className="stat-column">互动增量</div>
+ <div className="stat-column">新增收藏</div>
+ <div className="stat-column">新增分享</div>
+ <div className="stat-column">新增评论</div>
+ </>
+ )}
+
+ {/* 阅读榜和低粉爆文榜 */}
+ {(selectedRanking?.name.includes('阅读榜') || selectedRanking?.name.includes('低粉爆文榜')) && (
+ <>
+ <div className="stat-column">在看数</div>
+ <div className="stat-column">阅读数</div>
+ <div className="stat-column">点赞数</div>
+ <div className="stat-column">转发数</div>
+ </>
+ )}
+
+ {/* 默认榜单 */}
+ {!selectedRanking?.name.includes('增量') &&
+ !selectedRanking?.name.includes('阅读榜') &&
+ !selectedRanking?.name.includes('低粉爆文榜') && (
+ <>
+ <div className="stat-column">点赞</div>
+ <div className="stat-column">评论</div>
+ <div className="stat-column">分享</div>
+ <div className="stat-column">收藏</div>
+ </>
+ )}
</div>
</div>
</div>
@@ -268,24 +323,145 @@ const HotContent: React.FC<HotContentProps> = ({
<div className="content-stats">
<div className="category">{item.category}</div>
<div className="stats">
- <div className="stat">
- <span className="value">{item.stats.likeCount || '-'}</span>
- </div>
- <div className="stat">
- <span className="value">
- {item.stats.commentCount || '-'}
- </span>
- </div>
- <div className="stat">
- <span className="value">
- {(item as any).shareCount || '-'}
- </span>
- </div>
- <div className="stat">
- <span className="value">
- {(item as any).collectCount || '-'}
- </span>
- </div>
+ {/* 快手增量榜单 */}
+ {selectedRanking?.name.includes('增量') && selectedRanking?.platform?.id === 'ks' && (
+ <>
+ <div className="stat">
+ <div className="stat-total">
+ {item.anaAdd?.addInteractiveCount ? (
+ <>
+ <span className="arrow">↑</span>
+ {formatNumber(item.anaAdd.addInteractiveCount)}
+ </>
+ ) : '-'}
+ </div>
+ <div className="stat-add">
+ {item.anaAdd?.interactiveCount ? (
+ <>
+ <span className="arrow">↑</span>
+ 总{formatNumber(item.anaAdd.interactiveCount)}
+ </>
+ ) : '-'}
+ </div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">
+ <span className="arrow">↑</span>
+ {item.anaAdd?.addViewCount ? formatNumber(item.anaAdd.addViewCount) : '-'}
+ </div>
+ <div className="stat-add">
+ 总{item.anaAdd?.useViewCount ? formatNumber(item.anaAdd.useViewCount) : '-'}
+ </div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">
+ <span className="arrow">↑</span>
+ {item.anaAdd?.addShareCount ? formatNumber(item.anaAdd.addShareCount) : '-'}
+ </div>
+ <div className="stat-add">
+ 总{item.anaAdd?.useShareCount ? formatNumber(item.anaAdd.useShareCount) : '-'}
+ </div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">
+ <span className="arrow">↑</span>
+ {item.anaAdd?.addCommentCount ? formatNumber(item.anaAdd.addCommentCount) : '-'}
+ </div>
+ <div className="stat-add">
+ 总{item.anaAdd?.useCommentCount ? formatNumber(item.anaAdd.useCommentCount) : '-'}
+ </div>
+ </div>
+ </>
+ )}
+
+ {/* 其他平台增量榜单 */}
+ {selectedRanking?.name.includes('增量') && selectedRanking?.platform?.id !== 'ks' && (
+ <>
+ <div className="stat">
+ <div className="stat-total">
+ {item.anaAdd?.addInteractiveCount ? (
+ <>
+ <span className="arrow">↑</span>
+ {formatNumber(item.anaAdd.addInteractiveCount)}
+ </>
+ ) : '-'}
+ </div>
+ <div className="stat-add">
+ {item.anaAdd?.interactiveCount ? (
+ <>
+ <span className="arrow">↑</span>
+ 总{formatNumber(item.anaAdd.interactiveCount)}
+ </>
+ ) : '-'}
+ </div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">
+ <span className="arrow">↑</span>
+ {item.anaAdd?.addCollectedCunt ? formatNumber(item.anaAdd.addCollectedCunt) : '-'}
+ </div>
+ <div className="stat-add">
+ 总{item.anaAdd?.collectedCount ? formatNumber(item.anaAdd.collectedCount) : '-'}
+ </div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">
+ <span className="arrow">↑</span>
+ {item.anaAdd?.addShareCount ? formatNumber(item.anaAdd.addShareCount) : '-'}
+ </div>
+ <div className="stat-add">
+ 总{item.anaAdd?.useShareCount ? formatNumber(item.anaAdd.useShareCount) : '-'}
+ </div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">
+ <span className="arrow">↑</span>
+ {item.anaAdd?.addCommentCount ? formatNumber(item.anaAdd.addCommentCount) : '-'}
+ </div>
+ <div className="stat-add">
+ 总{item.anaAdd?.useCommentCount ? formatNumber(item.anaAdd.useCommentCount) : '-'}
+ </div>
+ </div>
+ </>
+ )}
+
+ {/* 阅读榜和低粉爆文榜 */}
+ {(selectedRanking?.name.includes('阅读榜') || selectedRanking?.name.includes('低粉爆文榜')) && (
+ <>
+ <div className="stat">
+ <div className="stat-total">{item.stats.watchCount || '-'}</div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">{item.stats.viewCount || '-'}</div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">{item.stats.likeCount || '-'}</div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">{(item as any).shareCount || '-'}</div>
+ </div>
+ </>
+ )}
+
+ {/* 默认榜单 */}
+ {!selectedRanking?.name.includes('增量') &&
+ !selectedRanking?.name.includes('阅读榜') &&
+ !selectedRanking?.name.includes('低粉爆文榜') && (
+ <>
+ <div className="stat">
+ <div className="stat-total">{item.stats.likeCount || '-'}</div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">{item.stats.commentCount || '-'}</div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">{(item as any).shareCount || '-'}</div>
+ </div>
+ <div className="stat">
+ <div className="stat-total">{(item as any).collectCount || '-'}</div>
+ </div>
+ </>
+ )}
</div>
</div>
</div>