Skip to content

Let's use AI to Earn!

feat(热门内容): 删除

gaoSirb23288c0969a
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9dcbe4b1..ef76d6c2 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,14 +4,15 @@
<option name="autoReloadType" value="NONE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(数据统计): 优化">
+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(数据统计): 添加昨日新增">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/@types/resources.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/@types/resources.d.ts" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/components/DataStatisticsDetails/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/components/DataStatisticsDetails/index.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/useDataStatistics.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/useDataStatistics.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/i18n/locales/en/dataStatistics.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/i18n/locales/en/dataStatistics.json" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/i18n/locales/zh-CN/dataStatistics.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/i18n/locales/zh-CN/dataStatistics.json" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/hot-content/page.css" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/hot-content/page.tsx" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/layout/routerData.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/layout/routerData.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/hot-content/HotContent.css" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/hot-content/HotContent.tsx" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/hot-content/SideMenu.css" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/hot-content/SideMenu.tsx" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -35,7 +36,7 @@
<option name="PUSH_AUTO_UPDATE" value="true" />
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
- <entry key="$PROJECT_DIR$" value="hot" />
+ <entry key="$PROJECT_DIR$" value="main" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -54,7 +55,7 @@
}
}</component>
<component name="ProblemsViewState">
- <option name="selectedTabId" value="ProjectErrors" />
+ <option name="selectedTabId" value="CurrentFile" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 4
@@ -67,48 +68,48 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
- <component name="PropertiesComponent">{
- &quot;keyToString&quot;: {
- &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatOrder0&quot;: &quot;0&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatOrder1&quot;: &quot;1&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatOrder2&quot;: &quot;2&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatOrder3&quot;: &quot;3&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatWidth0&quot;: &quot;450&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatWidth1&quot;: &quot;450&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatWidth2&quot;: &quot;450&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_flatWidth3&quot;: &quot;449&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeOrder0&quot;: &quot;0&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeOrder1&quot;: &quot;1&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeOrder2&quot;: &quot;2&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeOrder3&quot;: &quot;3&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeWidth0&quot;: &quot;450&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeWidth1&quot;: &quot;450&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeWidth2&quot;: &quot;450&quot;,
- &quot;FileHistory.git4idea.history.GitHistoryProvider_treeWidth3&quot;: &quot;449&quot;,
- &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
- &quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
- &quot;RunOnceActivity.readMode.enableVisualFormatting&quot;: &quot;true&quot;,
- &quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
- &quot;cidr.known.project.marker&quot;: &quot;true&quot;,
- &quot;dart.analysis.tool.window.visible&quot;: &quot;false&quot;,
- &quot;git-widget-placeholder&quot;: &quot;main&quot;,
- &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
- &quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
- &quot;last_opened_file_path&quot;: &quot;E:/project-dev/web/艺咖/aitoearn-web/src/app/i18n/locales/zh-CN&quot;,
- &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
- &quot;node.js.detected.package.standard&quot;: &quot;true&quot;,
- &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
- &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
- &quot;node.js.selected.package.standard&quot;: &quot;&quot;,
- &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
- &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
- &quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
- &quot;show.migrate.to.gradle.popup&quot;: &quot;false&quot;,
- &quot;ts.external.directory.path&quot;: &quot;E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib&quot;,
- &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
+ <component name="PropertiesComponent"><![CDATA[{
+ "keyToString": {
+ "ASKED_ADD_EXTERNAL_FILES": "true",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder0": "0",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder1": "1",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder2": "2",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder3": "3",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth0": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth1": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth2": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth3": "449",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder0": "0",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder1": "1",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder2": "2",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder3": "3",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth0": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth1": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth2": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth3": "449",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.cidr.known.project.marker": "true",
+ "RunOnceActivity.readMode.enableVisualFormatting": "true",
+ "cf.first.check.clang-format": "false",
+ "cidr.known.project.marker": "true",
+ "dart.analysis.tool.window.visible": "false",
+ "git-widget-placeholder": "hot",
+ "ignore.virus.scanning.warn.message": "true",
+ "kotlin-language-version-configured": "true",
+ "last_opened_file_path": "E:/project-dev/web/艺咖/aitoearn-web/src/app/i18n/locales/zh-CN",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.standard": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.standard": "",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "settings.editor.selected.configurable": "preferences.pluginManager",
+ "show.migrate.to.gradle.popup": "false",
+ "ts.external.directory.path": "E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib",
+ "vue.rearranger.settings.migration": "true"
}
-}</component>
+}]]></component>
<component name="ReactBuddySettings">
<option name="extensionsIgnore" value="true" />
</component>
@@ -213,31 +214,7 @@
<workItem from="1757647784882" duration="2426000" />
<workItem from="1757656251307" duration="25699000" />
<workItem from="1757687709611" duration="2478000" />
- <workItem from="1757902659875" duration="5176000" />
- </task>
- <task id="LOCAL-00008" summary="fix(日历): 解决一个诡异的bug,日历,拖动发布记录时,拖到比当前时间小的日历正常显示,拖到比当前时间大的日历时间会盖住发布记录。">
- <option name="closed" value="true" />
- <created>1752137830379</created>
- <option name="number" value="00008" />
- <option name="presentableId" value="LOCAL-00008" />
- <option name="project" value="LOCAL" />
- <updated>1752137830379</updated>
- </task>
- <task id="LOCAL-00009" summary="fix: 快手授权修改完成,改为任务">
- <option name="closed" value="true" />
- <created>1752145461148</created>
- <option name="number" value="00009" />
- <option name="presentableId" value="LOCAL-00009" />
- <option name="project" value="LOCAL" />
- <updated>1752145461148</updated>
- </task>
- <task id="LOCAL-00010" summary="feat: 删除不需要的文件">
- <option name="closed" value="true" />
- <created>1752146202309</created>
- <option name="number" value="00010" />
- <option name="presentableId" value="LOCAL-00010" />
- <option name="project" value="LOCAL" />
- <updated>1752146202309</updated>
+ <workItem from="1757902659875" duration="8213000" />
</task>
<task id="LOCAL-00011" summary="feat(日历): 删除任务、修改任务时间接入API,删除任务完成">
<option name="closed" value="true" />
@@ -607,7 +584,31 @@
<option name="project" value="LOCAL" />
<updated>1757925767099</updated>
</task>
- <option name="localTasksCounter" value="57" />
+ <task id="LOCAL-00057" summary="feat(数据统计): 国际化处理完成">
+ <option name="closed" value="true" />
+ <created>1757927088404</created>
+ <option name="number" value="00057" />
+ <option name="presentableId" value="LOCAL-00057" />
+ <option name="project" value="LOCAL" />
+ <updated>1757927088404</updated>
+ </task>
+ <task id="LOCAL-00058" summary="feat(数据统计): 1. echarts图优化。 2. 平台名称进行国际化。">
+ <option name="closed" value="true" />
+ <created>1757928966674</created>
+ <option name="number" value="00058" />
+ <option name="presentableId" value="LOCAL-00058" />
+ <option name="project" value="LOCAL" />
+ <updated>1757928966674</updated>
+ </task>
+ <task id="LOCAL-00059" summary="feat(数据统计): 添加昨日新增">
+ <option name="closed" value="true" />
+ <created>1757929872003</created>
+ <option name="number" value="00059" />
+ <option name="presentableId" value="LOCAL-00059" />
+ <option name="project" value="LOCAL" />
+ <updated>1757929872003</updated>
+ </task>
+ <option name="localTasksCounter" value="60" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -670,9 +671,6 @@
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
- <MESSAGE value="fix(发布): usePubParamsVerify参数校验优化" />
- <MESSAGE value="fix(seo): 站点地图修复" />
- <MESSAGE value="fix(日历):发布时间格式修复" />
<MESSAGE value="fix: 账号过滤不支持的三个平台:视频号、小红书、抖音" />
<MESSAGE value="feat: password 密码登录、重置密码,添加md5加密" />
<MESSAGE value="fix: 将之前转发的逻辑改为直连" />
@@ -695,6 +693,9 @@
<MESSAGE value="feat(数据统计): 数据大体完成" />
<MESSAGE value="feat(数据统计): 1. 添加账号搜索功能。 2. 添加账号离线状态和重新登录。" />
<MESSAGE value="feat(数据统计): 优化" />
- <option name="LAST_COMMIT_MESSAGE" value="feat(数据统计): 优化" />
+ <MESSAGE value="feat(数据统计): 国际化处理完成" />
+ <MESSAGE value="feat(数据统计): 1. echarts图优化。 2. 平台名称进行国际化。" />
+ <MESSAGE value="feat(数据统计): 添加昨日新增" />
+ <option name="LAST_COMMIT_MESSAGE" value="feat(数据统计): 添加昨日新增" />
</component>
</project>
\ No newline at end of file
diff --git a/src/app/[lng]/hot-content/page.css b/src/app/[lng]/hot-content/page.css
deleted file mode 100644
index a5b9d3e6..00000000
--- a/src/app/[lng]/hot-content/page.css
+++ /dev/null
@@ -1,962 +0,0 @@
-.hot-content-layout {
- background: #f0f2f5;
- height: 100%;
- min-height: 0;
-}
-
-.main-content {
- flex-grow: 1;
- margin: 24px;
- padding: 0;
- background: none;
- box-shadow: none;
- display: flex;
- flex-direction: column;
-}
-
-/* 预览弹窗样式 */
-.preview-modal .ant-modal-content {
- padding: 0;
- border-radius: 8px;
- overflow: hidden;
-}
-
-.preview-modal .ant-modal-header {
- margin: 0;
- padding: 16px 24px;
- border-bottom: 1px solid #f0f0f0;
-}
-
-.preview-modal .ant-modal-body {
- padding: 0;
-}
-
-/* 响应式布局 */
-@media screen and (max-width: 768px) {
- .main-content {
- margin: 12px;
- }
-
- .preview-modal {
- width: 100% !important;
- max-width: 100%;
- margin: 0;
- top: 0;
- padding: 0;
- }
-
- .preview-modal .ant-modal-content {
- border-radius: 0;
- }
-}
-
-/* 热点事件样式 */
-.hot-events-container {
- width: 100%;
- flex-grow: 1;
- padding: 24px;
- background: #f0f2f5;
- border-radius: 8px;
- display: flex;
- flex-direction: column;
-}
-
-.hot-events-container .grid {
- width: 100%;
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
- gap: 16px;
-}
-
-.hot-topic-card {
- display: flex;
- flex-direction: column;
- height: auto;
- height: 451px;
- 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;
-}
-
-.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;
-}
-
-/* 标题列表容器 */
-.viral-title-list {
- display: flex;
- flex-direction: column;
- background: #fff;
- border-radius: 8px;
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
- overflow: hidden;
-}
-
-/* 列表项 */
-.viral-title-list-item {
- display: flex;
- align-items: center;
- padding: 12px 16px;
- border-bottom: 1px solid #f0f0f0;
- cursor: pointer;
- transition: background-color 0.2s ease;
-}
-
-.viral-title-list-item:last-child {
- border-bottom: none;
-}
-
-.viral-title-list-item:hover {
- background-color: #f9fafb;
-}
-
-.list-item-rank {
- font-size: 16px;
- font-weight: bold;
- width: 40px; /* 固定宽度 */
- text-align: center;
- flex-shrink: 0;
-}
-
-.list-item-rank.top {
- color: #a66ae4;
-}
-
-.list-item-details {
- flex-grow: 1;
- display: flex;
- align-items: center;
- min-width: 0; /* 允许flex项缩小 */
-}
-
-.list-item-category {
- font-size: 14px;
- color: #666;
- margin-right: 12px;
- flex-shrink: 0;
-}
-
-.list-item-title {
- font-size: 15px;
- color: #333;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap; /* 标题不换行 */
- flex-grow: 1;
- margin-right: 12px;
-}
-
-.list-item-engagement {
- font-size: 14px;
- color: #a66ae4; /* 互动量使用主题色 */
- font-weight: 500;
- flex-shrink: 0;
- white-space: nowrap;
-}
-
-/* 查看更多按钮 */
-.view-more-button {
- display: flex;
- justify-content: center;
- margin-top: 24px;
-}
-
-.view-more-btn {
- padding: 8px 24px;
- font-size: 14px;
- font-weight: 500;
- color: #a66ae4;
- border: 1px solid #a66ae4;
- border-radius: 6px;
- background: transparent;
- cursor: pointer;
- transition: all 0.3s;
-}
-
-.view-more-btn:hover {
- background: #a66ae4;
- color: #fff;
-}
-
-/* 加载和空状态 */
-.loading-state,
-.empty-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 32px;
- color: #666;
-}
-
-.empty-state-icon {
- font-size: 32px;
- margin-bottom: 8px;
-}
-
-/* 筛选区域 */
-.viral-title-filter {
- background: #fff;
- border-radius: 8px;
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
- padding: 16px;
- margin-bottom: 16px;
-}
-
-.filter-section {
- margin-bottom: 16px;
-}
-
-.filter-section:last-child {
- margin-bottom: 0;
-}
-
-.filter-label {
- color: #666;
- font-size: 14px;
- margin-right: 12px;
-}
-
-.filter-buttons {
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
-}
-
-.filter-button {
- padding: 8px 16px;
- font-size: 14px;
- border-radius: 6px;
- cursor: pointer;
- transition: all 0.3s;
- border: none;
- background: #f5f5f5;
- color: #333;
-}
-
-.filter-button.active {
- background: #a66ae4;
- color: #fff;
-}
-
-.filter-button:hover {
- background: #e6e6e6;
-}
-
-.filter-button.active:hover {
- background: #8f5bc4;
-}
-
-/* 分类标题样式 */
-.category-title {
- font-size: 18px;
- font-weight: 600;
- color: #333;
- margin: 16px 0;
- padding: 0 16px;
- display: flex;
- align-items: center;
- justify-content: space-between;
-}
-
-.category-title::after {
- content: '';
- flex: 1;
- height: 1px;
- background: #e8e8e8;
- margin-left: 16px;
-}
-
-/* 热门专题样式 */
-.topic-container {
- width: 100%;
- flex-grow: 1;
- padding: 24px;
- background: #f0f2f5;
- border-radius: 8px;
- display: flex;
- flex-direction: column;
-}
-
-.topic-filter-container {
- padding: 16px;
- margin-bottom: 16px;
- background: white;
- border-radius: 8px;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
-}
-
-.topic-filter-options {
- display: flex;
- flex-direction: column;
- gap: 16px;
-}
-
-.topic-filter-group {
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
-}
-
-.topic-filter-section {
- display: flex;
- align-items: center;
-}
-
-.topic-filter-label {
- margin-right: 12px;
- font-size: 14px;
- color: #6b7280;
-}
-
-.topic-filter-buttons {
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
-}
-
-.topic-filter-button {
- padding: 8px 16px;
- border-radius: 6px;
- font-size: 14px;
- transition: all 0.2s ease;
- border: none;
- outline: none;
- cursor: pointer;
-}
-
-.topic-filter-button.active {
- background-color: #a66ae4;
- color: white;
-}
-
-.topic-filter-button:not(.active):hover {
- background-color: #f3e8ff;
- color: #a66ae4;
-}
-
-.topic-list-container {
- background: white;
- border-radius: 8px;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
-}
-
-.topic-loading-state,
-.topic-empty-state {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding: 32px;
- color: #6b7280;
- font-size: 14px;
-}
-
-.topic-loading-text,
-.topic-empty-state-text {
- margin-top: 12px;
-}
-
-.topic-list-header {
- display: grid;
- grid-template-columns: 60px 100px auto 80px repeat(4, 80px);
- padding: 16px;
- font-size: 14px;
- color: #6b7280;
- background-color: #f9fafb;
- border-bottom: 1px solid #f3f4f6;
-}
-
-.topic-header-col {
- text-align: center;
-}
-
-.topic-header-col.rank-col {
- text-align: center;
-}
-
-.topic-header-col.cover-col {
- text-align: left;
- padding-left: 8px;
-}
-
-.topic-header-col.info-col {
- text-align: left;
- padding-left: 8px;
-}
-
-.topic-header-col.category-col {
- text-align: center;
-}
-
-.topic-header-col.stats-col {
- text-align: center;
-}
-
-.topic-list-item {
- display: grid;
- grid-template-columns: 60px 100px auto 80px repeat(4, 80px);
- align-items: center;
- padding: 20px 16px;
- border-bottom: 1px solid #f3f4f6;
- cursor: pointer;
- transition: background-color 0.2s ease;
-}
-
-.topic-list-item:hover {
- background-color: #f9fafb;
-}
-
-.topic-item-col {
- text-align: center;
-}
-
-.topic-item-col.rank-col {
- font-size: 18px;
- font-weight: bold;
- color: #f97316; /* Orange 500 */
- text-align: center;
-}
-
-.topic-item-col.cover-col {
- text-align: left;
- padding-left: 8px;
-}
-
-.topic-item-cover-wrapper {
- position: relative;
- width: 90px; /* Adjusted width */
- height: 50px; /* Adjusted height */
- overflow: hidden;
- background-color: #e5e7eb; /* Gray 100 */
- border-radius: 8px; /* Large rounded corners */
-}
-
-.topic-item-cover-image {
- object-fit: cover;
- width: 100%;
- height: 100%;
-}
-
-.topic-item-cover-placeholder {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
- text-align: center;
- color: #9ca3af; /* Gray 400 */
- font-size: 12px;
-}
-
-.topic-item-cover-video-tag {
- position: absolute;
- bottom: 8px;
- right: 8px;
- padding: 4px 8px;
- font-size: 10px; /* Adjusted font size */
- color: white;
- background-color: rgba(0, 0, 0, 0.6);
- border-radius: 4px;
-}
-
-.topic-item-col.info-col {
- text-align: left;
- padding-left: 16px; /* Increased padding */
-}
-
-.topic-item-title {
- font-size: 16px; /* Base font size */
- font-weight: 500; /* Medium font weight */
- /* max-height: 40px; /* Limit title height to 2 lines */
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2; /* Limit to 2 lines */
- -webkit-box-orient: vertical;
- text-align: left; /* Ensure text aligns left */
- margin-bottom: 8px; /* Space below title */
-}
-
-.topic-item-title:hover {
- color: #a66ae4; /* Primary color on hover */
-}
-
-.topic-item-author-info {
- display: flex;
- align-items: center;
- margin-top: 8px;
-}
-
-.topic-author-details {
- display: flex;
- align-items: center;
-}
-
-.topic-author-avatar {
- width: 20px; /* Avatar size */
- height: 20px; /* Avatar size */
- margin-right: 4px; /* Space after avatar */
- border-radius: 50%; /* Circular avatar */
-}
-
-.topic-author-avatar-placeholder {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 20px;
- height: 20px;
- margin-right: 4px;
- background-color: #e5e7eb;
- border-radius: 50%;
-}
-
-.topic-author-name {
- margin-right: 8px; /* Space after author name */
- font-size: 14px; /* Author name font size */
- color: #4b5563; /* Gray 600 */
-}
-
-.topic-author-fans,
-.topic-publish-time {
- font-size: 12px; /* Smaller font size for fans and time */
- color: #9ca3af; /* Gray 400 */
-}
-
-.topic-author-fans {
- margin-right: 8px;
-}
-
-.topic-item-col.category-col {
- text-align: center;
-}
-
-.topic-item-category {
- font-size: 14px;
- color: #4b5563; /* Gray 600 */
-}
-
-.topic-item-subcategory {
- margin-top: 4px;
- font-size: 12px;
- color: #9ca3af; /* Gray 400 */
-}
-
-.topic-item-col.stats-col {
- text-align: center;
-}
-
-.topic-stat-value {
- font-size: 16px; /* Larger font for stats */
- font-weight: 500;
- color: #a66ae4; /* Primary color */
-}
-
-.topic-stat-label {
- font-size: 12px;
- color: #9ca3af; /* Gray 400 */
- margin-top: 4px;
-}
-
-.topic-pagination-container {
- display: flex;
- justify-content: center;
- padding: 24px;
-}
-
-/* 热门专题响应式调整 */
-@media screen and (max-width: 1200px) {
- .topic-list-header,
- .topic-list-item {
- grid-template-columns: 40px 80px auto 60px repeat(4, 60px); /* Adjusted grid columns */
- }
-
- .topic-header-col.rank-col,
- .topic-item-col.rank-col {
- width: 40px;
- font-size: 16px;
- }
-
- .topic-header-col.cover-col,
- .topic-item-col.cover-col {
- width: 80px;
- padding-left: 4px;
- }
-
- .topic-item-cover-wrapper {
- width: 70px; /* Adjusted width */
- height: 40px; /* Adjusted height */
- }
-
- .topic-header-col.info-col,
- .topic-item-col.info-col {
- padding-left: 12px; /* Adjusted padding */
- }
-
- .topic-item-title {
- font-size: 14px; /* Adjusted font size */
- }
-
- .topic-header-col.category-col,
- .topic-item-col.category-col {
- width: 60px;
- }
-
- .topic-header-col.stats-col,
- .topic-item-col.stats-col {
- width: 60px;
- }
-
- .topic-stat-value {
- font-size: 14px;
- }
-}
-
-@media screen and (max-width: 768px) {
- .topic-container {
- padding: 12px;
- }
-
- .topic-filter-container {
- padding: 12px;
- }
-
- .topic-filter-options {
- gap: 12px;
- }
-
- .topic-filter-group {
- gap: 6px;
- }
-
- .topic-filter-label {
- margin-right: 8px;
- font-size: 12px;
- }
-
- .topic-filter-button {
- padding: 6px 12px;
- font-size: 12px;
- }
-
- .topic-list-header,
- .topic-list-item {
- grid-template-columns: 30px 60px auto 50px repeat(4, 50px); /* Further adjusted grid columns */
- }
-
- .topic-header-col.rank-col,
- .topic-item-col.rank-col {
- width: 30px;
- font-size: 14px;
- }
-
- .topic-header-col.cover-col,
- .topic-item-col.cover-col {
- width: 60px;
- padding-left: 2px;
- }
-
- .topic-item-cover-wrapper {
- width: 50px;
- height: 30px;
- border-radius: 4px;
- }
-
- .topic-item-cover-placeholder {
- font-size: 10px;
- }
-
- .topic-item-cover-video-tag {
- bottom: 4px;
- right: 4px;
- padding: 2px 4px;
- font-size: 8px;
- border-radius: 2px;
- }
-
- .topic-header-col.info-col,
- .topic-item-col.info-col {
- padding-left: 8px;
- }
-
- .topic-item-title {
- font-size: 12px;
- margin-bottom: 4px;
- }
-
- .topic-item-author-info {
- margin-top: 4px;
- }
-
- .topic-author-avatar,
- .topic-author-avatar-placeholder {
- width: 16px;
- height: 16px;
- margin-right: 2px;
- }
-
- .topic-author-name,
- .topic-author-fans,
- .topic-publish-time {
- font-size: 10px;
- }
-
- .topic-author-name {
- margin-right: 4px;
- }
-
- .topic-header-col.category-col,
- .topic-item-col.category-col {
- width: 50px;
- }
-
- .topic-item-category {
- font-size: 12px;
- }
-
- .topic-item-subcategory {
- font-size: 10px;
- }
-
- .topic-header-col.stats-col,
- .topic-item-col.stats-col {
- width: 50px;
- }
-
- .topic-stat-value {
- font-size: 12px;
- }
-
- .topic-stat-label {
- font-size: 10px;
- margin-top: 2px;
- }
-
- .topic-pagination-container {
- padding: 16px;
- }
-}
\ No newline at end of file
diff --git a/src/app/[lng]/hot-content/page.tsx b/src/app/[lng]/hot-content/page.tsx
deleted file mode 100644
index 56b69883..00000000
--- a/src/app/[lng]/hot-content/page.tsx
+++ /dev/null
@@ -1,1766 +0,0 @@
-'use client';
-
-import React, { useState, useEffect } from 'react';
-import { Layout, Modal, Pagination } from 'antd';
-import dayjs from 'dayjs';
-import { PlatformRanking, RankingContent, Platform } from '@/api/hot';
-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';
-import { useTransClient } from '@/app/i18n/client';
-
-// 添加必要的类型定义
-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;
-
-const buttonStyles = {
- base: 'px-4 py-2 text-sm font-medium rounded-lg transition-colors duration-200',
- primary: 'bg-[#a66ae4] text-white hover:bg-[#8f5bc4]',
- secondary: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
-};
-
-const HotContentNew: React.FC = () => {
- const { t } = useTransClient('hot-content');
- // 状态管理
- const [platforms, setPlatforms] = useState<Platform[]>([]);
- const [selectedPlatform, setSelectedPlatform] = useState<Platform | null>(null);
- const [rankingList, setRankingList] = useState<PlatformRanking[]>([]);
- const [selectedRanking, setSelectedRanking] = useState<PlatformRanking | null>(null);
- const [rankingContents, setRankingContents] = useState<RankingContent[]>([]);
- const [rankingLoading, setRankingLoading] = useState(false);
- const [pagination, setPagination] = useState({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 0,
- });
- const [categories, setCategories] = useState<string[]>([]);
- const [selectedCategory, setSelectedCategory] = useState<string>('全部');
- 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<Record<string, 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(() => {
- const fetchPlatforms = async () => {
- try {
- const response = await platformApi.getPlatformList();
- if (response && response.data) {
- setPlatforms(response.data);
- if (response.data.length > 0) {
- setSelectedPlatform(response.data[0]);
- }
- }
- } catch (error) {
- console.error('获取平台列表失败:', error);
- }
- };
-
- fetchPlatforms();
- }, []);
-
- // 获取平台榜单数据
- useEffect(() => {
- const fetchPlatformRankings = async () => {
- if (!selectedPlatform) return;
-
- try {
- const response = await platformApi.getPlatformRanking(selectedPlatform.id);
- if (response && response.data) {
- setRankingList(response.data);
- if (response.data.length > 0) {
- setSelectedRanking(response.data[0]);
- }
- }
- } catch (error) {
- console.error('获取平台榜单失败:', error);
- }
- };
-
- fetchPlatformRankings();
- }, [selectedPlatform]);
-
- // 获取榜单内容数据
- useEffect(() => {
- const fetchRankingContents = async () => {
- if (!selectedRanking) return;
-
- setRankingLoading(true);
- try {
- const response = await platformApi.getRankingContents(
- selectedRanking.id,
- pagination.currentPage,
- pagination.itemsPerPage,
- selectedCategory === '全部' ? undefined : selectedCategory,
- selectedDate
- );
-
- if (response && response.data) {
- setRankingContents(response.data.items);
- setPagination({
- ...pagination,
- totalItems: response.data.meta.totalItems,
- totalPages: response.data.meta.totalPages,
- });
-
- // 获取日期范围
- const datesResponse:any = await platformApi.getRankingDates(selectedRanking.id);
- if (datesResponse && datesResponse.data && datesResponse.data.length > 0) {
- setSelectedDate(datesResponse.data[0].queryDate);
- setRankingMaxDate(datesResponse.data[0].queryDate);
- setRankingMinDate(datesResponse.data[datesResponse.data.length - 1].queryDate);
- }
-
- // 获取分类列表
- const categoriesResponse = await platformApi.getRankingLabel(selectedRanking.id);
- if (categoriesResponse && categoriesResponse.data) {
- setCategories(['全部', ...categoriesResponse.data]);
- }
- }
- } catch (error) {
- console.error('获取榜单内容失败:', error);
- } finally {
- setRankingLoading(false);
- }
- };
-
- 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 (msgType: string) => {
- console.log('fetchTopicTypes called with msgType:', msgType); // 添加日志
- try {
- const response = await platformApi.getTopicLabels(msgType);
- console.log('getTopicLabels response for', msgType, ':', response); // 添加日志
- if (response?.data) {
- setTopicTypes(response.data);
- console.log('获取到的分类数据:', 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 (
- msgType: string,
- page: number = 1,
- timeType: string = '',
- platformId?: string,
- topicType?: string,
- ) => {
- if (!msgType) return;
-
- setTopicLoading(true);
- try {
- // 构建查询参数
- const params: any = {
- msgType,
- page,
- limit: 20,
- };
-
- // 添加平台ID参数
- if (platformId) {
- params.platformId = platformId;
- }
-
- // 添加专题类型参数
- if (topicType) {
- params.type = topicType;
- }
-
- // 添加时间类型参数
- if (timeType) {
- params.timeType = timeType;
- }
-
- const response = await platformApi.getAllTopics(params);
- if (response?.data) {
- const formattedItems = response.data.items.map((item: any) => ({
- id: item._id || '',
- title: item.title || '',
- type: item.type || '',
- description: item.description || null,
- msgType: item.msgType || '',
- category: item.category || '',
- subCategory: item.subCategory || null,
- author: item.author || '',
- avatar: item.avatar || '',
- cover: item.coverUrl || '',
- authorId: item.authorId || '',
- fans: item.fans || 0,
- topics: item.topics || [],
- rank: item.rank || 0,
- shareCount: item.shareCount || 0,
- likeCount: item.likeCount || 0,
- watchingCount: item.watchingCount || null,
- readCount: item.readCount || 0,
- publishTime: item.publishTime || '',
- url: item.url || '',
- platformId: {
- id: item.platformId?.id || '',
- name: item.platformId?.name || '',
- icon: item.platformId?.icon || '',
- },
- hotValue: item.hotValue || 0,
- commentCount: item.commentCount || 0,
- collectCount: item.collectCount || 0,
- }));
- setTopicContents(formattedItems);
-
- // 转换分页数据
- const meta = response.data.meta;
- if (meta) {
- setTopicPagination({
- currentPage: meta.currentPage || 1,
- itemsPerPage: meta.itemsPerPage || 20,
- totalItems: meta.totalItems || 0,
- totalPages: meta.totalPages || 1,
- itemCount: meta.itemCount || 0,
- });
- }
- } else {
- setTopicContents([]);
- setTopicPagination({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 1,
- itemCount: 0,
- });
- }
- } catch (error) {
- console.error('获取专题内容失败:', error);
- setTopicContents([]);
- setTopicPagination({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 1,
- itemCount: 0,
- });
- } 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) {
- setTimeTypes(timeTypeData);
- setSelectedTimeType(timeTypeData[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);
- console.log('原始爆款标题数据:', response?.data); // 添加日志
- if (response?.data) {
- // response.data 已经是按分类分组的数据
- // 转换为方便处理的格式
- const categorizedTitles = response.data.reduce<Record<string, ApiViralTitle[]>>((acc, item) => {
- if (item.category) {
- acc[item.category] = item.titles.map(title => ({
- id: title._id || '',
- title: title.title,
- category: item.category,
- platform: platformId,
- timeType: timeType,
- engagement: title.engagement || 0,
- url: title.url || ''
- }));
- }
- return acc;
- }, {});
-
- setViralTitleData(categorizedTitles);
-
- // 提取所有分类用于筛选按钮
- const categories = Object.keys(categorizedTitles);
- setViralTitleCategories(categories);
-
- } else {
- setViralTitleData({});
- setViralTitleCategories([]);
- }
- } catch (error) {
- console.error('获取爆款标题内容失败:', error);
- setViralTitleData({});
- setViralTitleCategories([]);
- } 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);
- setPagination({ ...pagination, currentPage: 1 });
- };
-
- // 处理榜单选择
- const handleRankingSelect = (ranking: PlatformRanking) => {
- setSelectedRanking(ranking);
- setPagination({ ...pagination, currentPage: 1 });
- };
-
- // 处理分类选择
- const handleCategorySelect = (category: string) => {
- setSelectedCategory(category);
- setPagination({ ...pagination, currentPage: 1 });
- };
-
- // 处理日期变化
- const handleDateChange = (date: dayjs.Dayjs | null) => {
- if (date) {
- setSelectedDate(date.format('YYYY-MM-DD'));
- setPagination({ ...pagination, currentPage: 1 });
- }
- };
-
- // 处理页码变化
- const handlePageChange = (page: number) => {
- setPagination({ ...pagination, currentPage: page });
- };
-
- // 处理内容点击
- const handleContentClick = (url: string, title: string) => {
- setPreviewUrl(url);
- setPreviewTitle(title);
- setPreviewVisible(true);
- };
-
- // 处理左侧菜单展开/收起
- const handleMenuExpandToggle = (section: keyof typeof expandedStates) => {
- setExpandedStates(prev => {
- const newState = { ...prev };
- // 如果点击的是当前已经展开的项,则收起
- if (newState[section]) {
- newState[section] = false;
- } else {
- // 展开点击的项,同时收起其他所有项
- Object.keys(newState).forEach(key => {
- (newState as any)[key] = key === section;
- });
- }
- return newState;
- });
- // setContentExpanded(false); // 移除这行,让expandedStates控制主内容显示
- };
-
- // 处理右侧内容区域展开/收起
- const handleContentExpandToggle = () => {
- setContentExpanded(prev => !prev);
- };
-
- // 处理分类列表展开/收起
- const handleCategoryListExpandToggle = () => {
- setCategoryListExpanded(prev => !prev);
- };
-
- // 获取图片URL
- const getImageUrl = (path: string) => {
- return path.startsWith('http') ? path : `${process.env.NEXT_PUBLIC_HOST_URL}/api/${path}`;
- };
-
- // 格式化数字
- const formatNumber = (num: number | null) => {
- if (num === null || num === undefined) return '-';
- if (num >= 10000) {
- return `${(num / 10000).toFixed(1)}w`;
- }
- return num.toLocaleString();
- };
-
- // 处理热门专题点击
- const handleTopicExpandClick = async () => {
- const newTopicExpanded = !expandedStates.topic;
- console.log('切换热门专题展开状态:', newTopicExpanded);
-
- // 更新展开状态
- setExpandedStates(prev => ({
- ...prev,
- topic: newTopicExpanded,
- hotEvent: false,
- viralTitle: false,
- talk: false,
- hotPlatform: false
- }));
- setContentExpanded(false);
-
- // 如果是展开热门专题,并且有消息类型,则加载数据
- if (newTopicExpanded && msgTypeList.length > 0) {
- console.log('准备加载热门专题数据');
-
- // 如果没有选择消息类型,则自动选择第一个
- if (!selectedMsgType && msgTypeList.length > 0) {
- setSelectedMsgType(msgTypeList[0]);
- }
-
- // 使用当前选择的消息类型或第一个消息类型
- const msgType = selectedMsgType || msgTypeList[0];
-
- // 获取时间类型
- await fetchTopicTimeTypes(msgType);
-
- // 获取分类数据
- try {
- const response = await platformApi.getTopicLabels(msgType);
- if (response?.data) {
- setTopicTypes(response.data);
- console.log('获取到的分类数据:', response.data);
- } else {
- setTopicTypes([]);
- }
- } catch (error) {
- console.error('获取专题分类失败:', error);
- setTopicTypes([]);
- }
-
- // 如果没有选择平台,则使用第一个平台
- if (!selectedPlatform?.id && platforms.length > 0) {
- setSelectedPlatform(platforms[0]);
- }
-
- // 调用处理函数获取数据
- setTopicLoading(true);
- try {
- // 获取专题数据 - 使用时间类型参数和当前选择的平台
- const response = await platformApi.getAllTopics({
- msgType: msgType,
- platformId: selectedPlatform?.id || (platforms.length > 0 ? platforms[0].id : undefined),
- timeType: selectedTimeType || selectedTimeType,
- });
-
- if (response?.data) {
- const { items, meta } = response.data;
- // 类型转换,确保类型兼容
- setTopicContents(items as unknown as TopicContent[]);
- if (meta) {
- setTopicPagination({
- currentPage: meta.currentPage || 1,
- totalPages: meta.totalPages || 1,
- totalItems: meta.totalItems || 0,
- itemCount: meta.itemCount || 0,
- itemsPerPage: meta.itemsPerPage || 20,
- });
- }
- } else {
- setTopicContents([]);
- }
- } catch (error) {
- console.error('获取专题数据失败:', error);
- setTopicContents([]);
- } finally {
- setTopicLoading(false);
- }
- }
- };
-
- // 处理爆款标题点击
- 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) {
- setTimeTypes(response.data);
- setSelectedTimeType(response.data[0]);
- fetchViralTitleContents(platform.id, response.data[0]);
- }
- });
- };
-
- // 重置所有展开状态
- const handleResetExpandedStates = () => {
- setExpandedStates({
- topic: false,
- hotEvent: false,
- viralTitle: false,
- talk: false,
- hotPlatform: false,
- });
- };
-
- // 处理筛选变化
- const handleFilterChange = async (platformId?: string) => {
- if (!selectedMsgType) return;
-
- console.log('handleFilterChange called'); // 添加日志
- setTopicLoading(true);
- try {
- const currentPlatformId = platformId || selectedPlatform?.id;
- const params: any = {
- msgType: selectedMsgType,
- timeType: selectedTimeType,
- page: 1,
- limit: 20,
- };
-
- if (currentPlatformId) {
- params.platformId = currentPlatformId;
- }
-
- if (selectedTopicType) {
- params.type = selectedTopicType;
- }
-
- console.log('Fetching topics with params:', params); // 添加日志
- const response = await platformApi.getAllTopics(params);
- console.log('getAllTopics response:', response); // 添加日志
-
- if (response?.data) {
- const formattedItems = response.data.items.map((item: any) => ({
- id: item._id || '',
- title: item.title || '',
- type: item.type || '',
- description: item.description || null,
- msgType: item.msgType || '',
- category: item.category || '',
- subCategory: item.subCategory || null,
- author: item.author || '',
- avatar: item.avatar || '',
- cover: item.coverUrl || '',
- authorId: item.authorId || '',
- fans: item.fans || 0,
- topics: item.topics || [],
- rank: item.rank || 0,
- shareCount: item.shareCount || 0,
- likeCount: item.likeCount || 0,
- watchingCount: item.watchingCount || null,
- readCount: item.readCount || 0,
- publishTime: item.publishTime || '',
- url: item.url || '',
- platformId: {
- id: item.platformId?.id || '',
- name: item.platformId?.name || '',
- icon: item.platformId?.icon || '',
- },
- hotValue: item.hotValue || 0,
- commentCount: item.commentCount || 0,
- collectCount: item.collectCount || 0,
- }));
- setTopicContents(formattedItems);
-
- // 转换分页数据
- const meta = response.data.meta;
- if (meta) {
- setTopicPagination({
- currentPage: meta.currentPage || 1,
- itemsPerPage: meta.itemsPerPage || 20,
- totalItems: meta.totalItems || 0,
- totalPages: meta.totalPages || 1,
- itemCount: meta.itemCount || 0,
- });
- }
- } else {
- setTopicContents([]);
- setTopicPagination({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 1,
- itemCount: 0,
- });
- }
- } catch (error) {
- console.error('筛选专题数据失败:', error);
- setTopicContents([]);
- setTopicPagination({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 1,
- itemCount: 0,
- });
- } finally {
- setTopicLoading(false);
- }
- };
-
- // 处理时间范围变化
- const handleTimeRangeChange = async (timeRange: string) => {
- if (!selectedMsgType) return;
-
- console.log('handleTimeRangeChange called with timeRange:', timeRange); // 添加日志
- setSelectedTimeType(timeRange);
- setTopicLoading(true);
- try {
- const params: any = {
- msgType: selectedMsgType,
- timeType: timeRange,
- page: 1,
- limit: 20,
- };
-
- if (selectedPlatform?.id) {
- params.platformId = selectedPlatform.id;
- }
-
- if (selectedTopicType) {
- params.type = selectedTopicType;
- }
-
- console.log('Fetching topics with params:', params); // 添加日志
- const response = await platformApi.getAllTopics(params);
- console.log('getAllTopics response:', response); // 添加日志
-
- if (response?.data) {
- const formattedItems = response.data.items.map((item: any) => ({
- id: item._id || '',
- title: item.title || '',
- type: item.type || '',
- description: item.description || null,
- msgType: item.msgType || '',
- category: item.category || '',
- subCategory: item.subCategory || null,
- author: item.author || '',
- avatar: item.avatar || '',
- cover: item.coverUrl || '',
- authorId: item.authorId || '',
- fans: item.fans || 0,
- topics: item.topics || [],
- rank: item.rank || 0,
- shareCount: item.shareCount || 0,
- likeCount: item.likeCount || 0,
- watchingCount: item.watchingCount || null,
- readCount: item.readCount || 0,
- publishTime: item.publishTime || '',
- url: item.url || '',
- platformId: {
- id: item.platformId?.id || '',
- name: item.platformId?.name || '',
- icon: item.platformId?.icon || '',
- },
- hotValue: item.hotValue || 0,
- commentCount: item.commentCount || 0,
- collectCount: item.collectCount || 0,
- }));
- setTopicContents(formattedItems);
-
- // 转换分页数据
- const meta = response.data.meta;
- if (meta) {
- setTopicPagination({
- currentPage: meta.currentPage || 1,
- itemsPerPage: meta.itemsPerPage || 20,
- totalItems: meta.totalItems || 0,
- totalPages: meta.totalPages || 1,
- itemCount: meta.itemCount || 0,
- });
- }
- } else {
- setTopicContents([]);
- setTopicPagination({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 1,
- itemCount: 0,
- });
- }
- } catch (error) {
- console.error('筛选专题数据失败:', error);
- setTopicContents([]);
- setTopicPagination({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 1,
- itemCount: 0,
- });
- } finally {
- setTopicLoading(false);
- }
- };
-
- // 处理专题分页变化
- const handleTopicPageChange = async (page: number) => {
- if (!selectedMsgType || page === topicPagination?.currentPage) return;
-
- setTopicLoading(true);
- try {
- const params: any = {
- msgType: selectedMsgType,
- timeType: selectedTimeType,
- page,
- limit: 20,
- };
-
- if (selectedPlatform?.id) {
- params.platformId = selectedPlatform.id;
- }
-
- if (selectedTopicType) {
- params.type = selectedTopicType;
- }
-
- const response = await platformApi.getAllTopics(params);
- if (response?.data) {
- const formattedItems = response.data.items.map((item: any) => ({
- id: item._id || '',
- title: item.title || '',
- type: item.type || '',
- description: item.description || null,
- msgType: item.msgType || '',
- category: item.category || '',
- subCategory: item.subCategory || null,
- author: item.author || '',
- avatar: item.avatar || '',
- cover: item.coverUrl || '',
- authorId: item.authorId || '',
- fans: item.fans || 0,
- topics: item.topics || [],
- rank: item.rank || 0,
- shareCount: item.shareCount || 0,
- likeCount: item.likeCount || 0,
- watchingCount: item.watchingCount || null,
- readCount: item.readCount || 0,
- publishTime: item.publishTime || '',
- url: item.url || '',
- platformId: {
- id: item.platformId?.id || '',
- name: item.platformId?.name || '',
- icon: item.platformId?.icon || '',
- },
- hotValue: item.hotValue || 0,
- commentCount: item.commentCount || 0,
- collectCount: item.collectCount || 0,
- }));
- setTopicContents(formattedItems);
-
- // 转换分页数据
- const meta = response.data.meta;
- if (meta) {
- setTopicPagination({
- currentPage: meta.currentPage || 1,
- itemsPerPage: meta.itemsPerPage || 20,
- totalItems: meta.totalItems || 0,
- totalPages: meta.totalPages || 1,
- itemCount: meta.itemCount || 0,
- });
- }
-
- // 滚动到顶部
- window.scrollTo({
- top: 0,
- behavior: 'smooth',
- });
- }
- } catch (error) {
- console.error('获取专题数据失败:', error);
- setTopicContents([]);
- setTopicPagination({
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: 0,
- totalPages: 1,
- itemCount: 0,
- });
- } finally {
- setTopicLoading(false);
- }
- };
-
- // 处理爆款标题分类选择
- const handleViralTitleCategorySelect = async (category: string) => {
- if (!selectedViralPlatform) return;
-
- setViralTitleLoading(true);
- try {
- // 调用获取某个平台某个分类全部标题的API
- const response = await platformApi.findByPlatformAndCategory(
- selectedViralPlatform.id,
- { category: category }
- );
-
- if (response?.data && Array.isArray(response.data.items)) {
- // 更新状态,显示该分类的全部数据
- setViralTitleData(prevData => ({
- ...prevData,
- [category]: response.data.items.map((title: any) => ({
- id: title._id || '',
- title: title.title,
- category: title.category,
- platform: selectedViralPlatform.id,
- timeType: selectedTimeType,
- engagement: title.engagement || 0,
- url: title.url || ''
- }))
- }));
- } else {
- // 如果没有数据,清空该分类的数据
- setViralTitleData(prevData => ({
- ...prevData,
- [category]: []
- }));
- }
- // 设置当前选中的分类
- setSelectedViralCategory(category);
- } catch (error) {
- console.error(`获取分类 ${category} 爆款标题详情失败:`, error);
- // 出错时也清空该分类的数据
- setViralTitleData(prevData => ({
- ...prevData,
- [category]: []
- }));
- setSelectedViralCategory(category);
- } finally {
- setViralTitleLoading(false);
- }
- };
-
- // 处理查看更多点击
- const handleViewMoreClick = async (category: string) => {
- if (!selectedViralPlatform) return;
-
- setViralTitleLoading(true);
- try {
- // 调用获取某个平台某个分类全部标题的API
- const response = await platformApi.findByPlatformAndCategory(
- selectedViralPlatform.id,
- { category: category }
- );
-
- if (response?.data && Array.isArray(response.data.items)) {
- // 更新状态,显示该分类的全部数据
- // 将获取到的该分类的全部数据覆盖viralTitleData中该分类的数据
- setViralTitleData(prevData => ({
- ...prevData,
- [category]: response.data.items.map((title: any) => ({
- id: title._id || '',
- title: title.title,
- category: title.category,
- platform: selectedViralPlatform.id,
- timeType: selectedTimeType,
- engagement: title.engagement || 0,
- url: title.url || ''
- }))
- }));
- // 设置当前选中的分类,触发详情视图的渲染
- setSelectedViralCategory(category);
- } else {
- // 如果没有数据,清空该分类的数据并切换到该分类视图
- setViralTitleData(prevData => ({
- ...prevData,
- [category]: []
- }));
- setSelectedViralCategory(category);
- }
- } catch (error) {
- console.error(`获取分类 ${category} 爆款标题详情失败:`, error);
- // 出错时也尝试切换到该分类视图,但数据可能为空或旧数据
- setViralTitleData(prevData => ({
- ...prevData,
- [category]: []
- }));
- setSelectedViralCategory(category);
- } finally {
- setViralTitleLoading(false);
- }
- };
-
- // 添加消息类型点击处理函数
- const handleMsgTypeClick = async (type: string) => {
- setSelectedMsgType(type);
- setTopicLoading(true);
- setContentExpanded(false);
- setSelectedTopicType('');
-
- try {
- // 获取该分类的时间类型
- await fetchTopicTimeTypes(type);
-
- // 获取专题数据 - 传递当前的筛选条件
- await fetchTopicContents(
- type, // msgType
- 1, // page
- selectedTimeType, // timeType
- selectedPlatform?.id, // platformId
- '' // topicType,因为切换msgType时清空了专题类型
- );
-
- } catch (error) {
- console.error('获取专题数据失败:', error);
- setTopicContents([]);
- } finally {
- setTopicLoading(false);
- }
- };
-
- // 分页组件类型定义
- interface PaginationProps {
- current: number;
- total: number;
- pageSize: number;
- showSizeChanger?: boolean;
- showQuickJumper?: boolean;
- showTotal?: (total: number) => string;
- onChange?: (page: number) => void;
- }
-
- return (
- <div className="hot-content-layout" style={{ display: 'flex', flexDirection: 'row' }}>
- <SideMenu
- platforms={platforms}
- selectedPlatform={selectedPlatform}
- loading={rankingLoading}
- 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={handleContentExpandToggle}
- onTopicExpand={handleTopicExpandClick}
- onHotEventExpand={handleHotEventExpandClick}
- onViralTitleExpand={handleViralTitleExpandClick}
- onTalkExpand={() => handleMenuExpandToggle('talk')}
- onHotPlatformExpand={() => handleMenuExpandToggle('hotPlatform')}
- onViralPlatformSelect={handleViralPlatformSelect}
- onMsgTypeClick={handleMsgTypeClick}
- onHotContentClick={handleResetExpandedStates}
- onViralTitleCategorySelect={handleViralTitleCategorySelect}
- // getImageUrl={getImageUrl}
- />
- <div className="main-content">
- {!expandedStates.topic && !expandedStates.hotEvent && !expandedStates.viralTitle && !expandedStates.talk && !expandedStates.hotPlatform ? (
- <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}
- />
- ) : expandedStates.viralTitle ? (
- <div className="viral-title-container">
- {/* 顶部筛选区 */}
- <div className="viral-title-filter">
- {/* 分类筛选 */}
- <div className="filter-section">
- <span className="filter-label">{t('category')}:</span>
- <div className="filter-buttons">
- <button
- className={`filter-button ${selectedViralCategory === '' ? 'active' : ''}`}
- onClick={() => {
- if (selectedViralPlatform) {
- fetchViralTitleContents(selectedViralPlatform.id, selectedTimeType);
- setSelectedViralCategory('');
- }
- }}
- >
- {t('all')}
- </button>
- {viralTitleCategories.map((category) => (
- <button
- key={category}
- className={`filter-button ${selectedViralCategory === category ? 'active' : ''}`}
- onClick={() => handleViralTitleCategorySelect(category)}
- >
- {category}
- </button>
- ))}
- </div>
- </div>
-
- {/* 时间筛选 */}
- <div className="filter-section">
- <span className="filter-label">{t('timeRange')}:</span>
- <div className="filter-buttons">
- {timeTypes.map((timeRange) => (
- <button
- key={timeRange}
- className={`filter-button ${selectedTimeType === timeRange ? 'active' : ''}`}
- onClick={() => handleTimeRangeChange(timeRange)}
- >
- {timeRange}
- </button>
- ))}
- </div>
- </div>
- </div>
-
- {/* 爆款标题内容 */}
- <div className="viral-title-content">
- {viralTitleLoading ? (
- <div className="loading-state">
- <span>{t('loading')}</span>
- </div>
- ) : Object.keys(viralTitleData).length > 0 ? (
- selectedViralCategory === '' ? (
- Object.keys(viralTitleData).map(category => (
- <div key={category} className="category-section">
- <h3 className="category-title">{category}</h3>
- <div className="viral-title-list">
- {viralTitleData[category].slice(0,5).map((title, index) => (
- <div
- key={title.id || index}
- className="viral-title-list-item"
- onClick={() => title.url && handleContentClick(title.url, title.title)}
- >
- <span className={`list-item-rank ${index < 3 ? 'top' : ''}`}>
- {index + 1}
- </span>
- <div className="list-item-details">
- <div className="list-item-title">{title.title}</div>
- <span className="list-item-engagement">
- {t('engagement')}: {formatNumber(title.engagement)}
- </span>
- </div>
- </div>
- ))}
- </div>
- <div className="view-more-button">
- <button
- className="view-more-btn"
- onClick={() => handleViewMoreClick(category)}
- >
- {t('viewMore')}
- </button>
- </div>
- </div>
- ))
- ) : (
- <div className="category-section">
- <h3 className="category-title">{selectedViralCategory}</h3>
- <div className="viral-title-list">
- {viralTitleData[selectedViralCategory]?.map((title, index) => (
- <div
- key={title.id || index}
- className="viral-title-list-item"
- onClick={() => title.url && handleContentClick(title.url, title.title)}
- >
- <span className={`list-item-rank ${index < 3 ? 'top' : ''}`}>
- {index + 1}
- </span>
- <div className="list-item-details">
- <span className="list-item-category">{title.category}</span>
- <div className="list-item-title">{title.title}</div>
- <span className="list-item-engagement">
- {t('engagement')}: {formatNumber(title.engagement)}
- </span>
- </div>
- </div>
- ))}
- </div>
- </div>
- )
- ) : (
- <div className="empty-state">
- <div className="empty-state-icon">📝</div>
- <div>{t('noViralTitles')}</div>
- </div>
- )}
- </div>
- </div>
- ) : expandedStates.topic ? (
- <div className="topic-container">
- {/* 顶部筛选区 */}
- <div className="topic-filter-container">
- {/* 平台筛选 */}
- <div className="topic-filter-options">
- <div className="topic-filter-group">
- {platforms.map((platform) => (
- <button
- key={platform.id}
- className={`topic-filter-button ${
- selectedPlatform?.id === platform.id ? 'active' : ''
- }`}
- onClick={() => {
- const platformId = platform.id;
- setSelectedPlatform(platform);
- handleFilterChange(platformId);
- }}
- >
- <div className="flex items-center space-x-2">
- {platform.icon && !imgErrors[`platform-${platform.id}`] ? (
- <img
- src={getImageUrl(platform.icon)}
- alt={platform.name}
- className="w-4 h-4"
- onError={() => handleImageError(`platform-${platform.id}`)}
- />
- ) : (
- <div className="flex items-center justify-center w-4 h-4 bg-gray-200 rounded">
- <span className="text-xs text-gray-500">
- {platform.name?.charAt(0)?.toUpperCase() || '?'}
- </span>
- </div>
- )}
- <span>{platform.name}</span>
- </div>
- </button>
- ))}
- </div>
-
- {/* 时间筛选 */}
- <div className="topic-filter-section">
- <span className="topic-filter-label">{t('timeRange')}:</span>
- <div className="topic-filter-buttons">
- {timeTypes.map((timeRange) => (
- <button
- key={timeRange}
- className={`topic-filter-button ${selectedTimeType === timeRange ? 'active' : ''}`}
- onClick={() => handleTimeRangeChange(timeRange)}
- >
- {timeRange}
- </button>
- ))}
- </div>
- </div>
-
- {/* 分类筛选 */}
- {selectedMsgType === 'aigc' && topicTypes.length > 1 && (
- <div className="topic-filter-section">
- <span className="topic-filter-label">{t('category')}:</span>
- <div className="topic-filter-buttons">
- {topicTypes.map((type) => (
- <button
- key={type}
- className={`topic-filter-button ${selectedTopicType === type ? 'active' : ''}`}
- onClick={() => {
- setSelectedTopicType(type === selectedTopicType ? '' : type);
- handleFilterChange();
- }}
- >
- {type}
- </button>
- ))}
- </div>
- </div>
- )}
- </div>
- </div>
-
- {/* 专题内容列表 */}
- <div className="topic-list-container">
- {topicLoading ? (
- <div className="topic-loading-state">
- <span className="topic-loading-text">{t('loading')}</span>
- </div>
- ) : topicContents.length > 0 ? (
- <>
- {/* 表头 */}
- <div className="topic-list-header">
- <div className="topic-header-col topic-header-col.rank-col">{t('rank')}</div>
- <div className="topic-header-col topic-header-col.cover-col">{t('cover')}</div>
- <div className="topic-header-col topic-header-col.info-col">{t('title')}/{t('author')}</div>
- <div className="topic-header-col topic-header-col.category-col">{t('category')}</div>
- <div className="topic-header-col topic-header-col.stats-col">{t('likes')}</div>
- <div className="topic-header-col topic-header-col.stats-col">{t('shares')}</div>
- <div className="topic-header-col topic-header-col.stats-col">{t('comments')}</div>
- <div className="topic-header-col topic-header-col.stats-col">{t('collections')}</div>
- </div>
-
- {/* 内容列表 */}
- {topicContents.map((item, index) => (
- <div
- key={item.id}
- className="topic-list-item"
- onClick={() => handleContentClick(item.url, item.title)}
- >
- {/* 排名 */}
- <div className="topic-item-col topic-item-col.rank-col">
- {((topicPagination?.currentPage || 1) - 1) *
- (topicPagination?.itemsPerPage || 20) +
- index +
- 1}
- </div>
-
- {/* 封面 */}
- <div className="topic-item-col topic-item-col.cover-col">
- <div className="topic-item-cover-wrapper">
- {item.cover && !imgErrors[item.id as string] ? (
- <img
- src={getImageUrl(item.cover)}
- alt={item.title}
- className="topic-item-cover-image"
- onError={() =>
- handleImageError(item.id as string)
- }
- />
- ) : (
- <div className="topic-item-cover-placeholder">
- {t('noImage')}
- </div>
- )}
- {item.type === 'video' && (
- <div className="topic-item-cover-video-tag">
- {t('video')}
- </div>
- )}
- </div>
- </div>
-
- {/* 标题和作者信息 */}
- <div className="topic-item-col topic-item-col.info-col">
- <h3 className="topic-item-title">
- {item.title}
- </h3>
- <div className="topic-item-author-info">
- <div className="topic-author-details">
- {item.avatar &&
- !imgErrors[`avatar-${item.id}`] ? (
- <img
- src={getImageUrl(item.avatar)}
- alt={item.author}
- className="topic-author-avatar"
- onError={() =>
- handleImageError(`avatar-${item.id}`)
- }
- />
- ) : (
- <div className="topic-author-avatar-placeholder">
- <span className="text-xs text-gray-500">
- {item.author?.charAt(0)?.toUpperCase() ||
- '?'}
- </span>
- </div>
- )}
- <span className="topic-author-name">
- {item.author}
- </span>
- {item.fans > 0 && (
- <span className="topic-author-fans">
- {item.fans >= 10000
- ? `${(item.fans / 10000).toFixed(1)}万${t('fans')}`
- : `${item.fans}${t('fans')}`}
- </span>
- )}
- <span className="topic-publish-time">
- {t('publishTime')}{' '}
- {dayjs(item.publishTime).format(
- 'YYYY-MM-DD HH:mm',
- )}
- </span>
- </div>
- </div>
- </div>
-
- {/* 分类信息 */}
- <div className="topic-item-col topic-item-col.category-col">
- <div className="topic-item-category">{item.category}</div>
- {item.subCategory && (
- <div className="topic-item-subcategory">
- {item.subCategory}
- </div>
- )}
- </div>
-
- {/* 点赞数 */}
- <div className="topic-item-col topic-item-col.stats-col">
- <div className="topic-stat-value">
- {item.likeCount >= 10000
- ? `${(item.likeCount / 10000).toFixed(1)}w`
- : item.likeCount}
- </div>
- <div className="topic-stat-label">{t('likes')}</div>
- </div>
-
- {/* 分享数 */}
- <div className="topic-item-col topic-item-col.stats-col">
- <div className="topic-stat-value">
- {item.shareCount >= 10000
- ? `${(item.shareCount / 10000).toFixed(1)}w`
- : item.shareCount}
- </div>
- <div className="topic-stat-label">{t('shares')}</div>
- </div>
-
- {/* 评论数 */}
- <div className="topic-item-col topic-item-col.stats-col">
- <div className="topic-stat-value">
- {item.commentCount
- ? item.commentCount >= 10000
- ? `${(item.commentCount / 10000).toFixed(1)}w`
- : item.commentCount
- : '-'}
- </div>
- <div className="topic-stat-label">{t('comments')}</div>
- </div>
-
- {/* 收藏数 */}
- <div className="topic-item-col topic-item-col.stats-col">
- <div className="topic-stat-value">
- {item.collectCount
- ? item.collectCount >= 10000
- ? `${(item.collectCount / 10000).toFixed(1)}w`
- : item.collectCount
- : '-'}
- </div>
- <div className="topic-stat-label">{t('collections')}</div>
- </div>
- </div>
- ))}
-
- {/* 分页组件 */}
- {topicPagination && topicPagination.totalPages > 1 && (
- <div className="topic-pagination-container">
- <Pagination
- current={topicPagination.currentPage}
- total={topicPagination.totalItems}
- pageSize={topicPagination.itemsPerPage}
- showSizeChanger={false}
- showQuickJumper
- showTotal={(total) => `${t('total')} ${total} ${t('items')}`}
- onChange={handleTopicPageChange}
- />
- </div>
- )}
- </>
- ) : (
- <div className="topic-empty-state">
- {t('noTopicData')}
- </div>
- )}
- </div>
- </div>
- ) : (
- <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">{t('loading')}</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} · {t('hotTopics')}
- </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">
- {t('rising')}
- </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">{t('noHotTopics')}</div>
- </div>
- )}
- </div>
- </div>
- </div>
- ))
- ) : (
- <div className="empty-state col-span-full">
- <div className="empty-state-icon">📊</div>
- <div className="empty-state-text">{t('noHotTopics')}</div>
- </div>
- )}
- </div>
- </div>
- )}
- </div>
-
- {/* 预览弹窗 */}
- <Modal
- title={previewTitle}
- open={previewVisible}
- onCancel={() => setPreviewVisible(false)}
- footer={null}
- width={800}
- className="preview-modal"
- >
- <iframe
- src={previewUrl}
- style={{ width: '100%', height: '600px', border: 'none' }}
- title={t('hotContent')}
- />
- </Modal>
- </div>
- );
-};
-
-export default HotContentNew;
\ No newline at end of file
diff --git a/src/app/layout/routerData.ts b/src/app/layout/routerData.ts
index 81b953e4..d0d02b73 100644
--- a/src/app/layout/routerData.ts
+++ b/src/app/layout/routerData.ts
@@ -30,7 +30,7 @@ export const routerData: IRouterDataItem[] = [
{
name: "热门内容",
translationKey: "hotContent",
- path: "/hot-content",
+ path: "/hotContent",
},
{
name: "AI工具",
diff --git a/src/components/hot-content/HotContent.css b/src/components/hot-content/HotContent.css
deleted file mode 100644
index b3efb3c3..00000000
--- a/src/components/hot-content/HotContent.css
+++ /dev/null
@@ -1,445 +0,0 @@
-.hot-content {
- flex: 1;
- padding: 20px;
- background: #fff;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
-}
-
-/* 榜单选择器样式 */
-.ranking-selector {
- margin-bottom: 20px;
-}
-
-.ranking-list {
- display: flex;
- gap: 12px;
- flex-wrap: wrap;
-}
-
-.ranking-button {
- padding: 8px 16px;
- border: 1px solid #e8e8e8;
- border-radius: 4px;
- background: #fff;
- cursor: pointer;
- transition: all 0.3s;
-}
-
-.ranking-button:hover {
- border-color: #1890ff;
- color: #1890ff;
-}
-
-.ranking-button.active {
- background: #1890ff;
- border-color: #1890ff;
- color: #fff;
-}
-
-/* 筛选区域样式 */
-.filter-section {
- margin-bottom: 24px;
-}
-
-.category-filter {
- margin-bottom: 16px;
-}
-
-.category-grid {
- display: flex;
- align-items: center;
- gap: 16px;
-}
-
-.category-list {
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
-}
-
-.category-button {
- padding: 6px 12px;
- border: 1px solid #e8e8e8;
- border-radius: 4px;
- background: #fff;
- cursor: pointer;
- transition: all 0.3s;
-}
-
-.category-button:hover {
- border-color: #1890ff;
- color: #1890ff;
-}
-
-.category-button.active {
- background: #1890ff;
- border-color: #1890ff;
- color: #fff;
-}
-
-.expand-button {
- display: flex;
- align-items: center;
- gap: 4px;
- padding: 6px 12px;
- border: 1px solid #e8e8e8;
- border-radius: 4px;
- background: #fff;
- cursor: pointer;
- transition: all 0.3s;
-}
-
-.expand-button:hover {
- border-color: #1890ff;
- color: #1890ff;
-}
-
-.expand-icon {
- transition: transform 0.3s;
-}
-
-.expand-icon.expanded {
- transform: rotate(180deg);
-}
-
-/* 日期选择区域样式 */
-.date-section {
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-
-.date-picker-wrapper {
- display: flex;
- align-items: center;
- gap: 16px;
-}
-
-.date-picker {
- width: 200px;
-}
-
-.sub-ranking-list {
- display: flex;
- gap: 8px;
-}
-
-.sub-ranking-button {
- padding: 6px 12px;
- border: 1px solid #e8e8e8;
- border-radius: 4px;
- background: #fff;
- cursor: pointer;
- transition: all 0.3s;
-}
-
-.sub-ranking-button:hover {
- border-color: #1890ff;
- color: #1890ff;
-}
-
-.sub-ranking-button.active {
- background: #1890ff;
- border-color: #1890ff;
- color: #fff;
-}
-
-.data-info-trigger {
- display: flex;
- align-items: center;
- gap: 4px;
- color: #1890ff;
- cursor: pointer;
-}
-
-/* 内容列表样式 */
-.content-list {
- background: #fff;
- border-radius: 8px;
-}
-
-.list-header {
- display: flex;
- justify-content: space-between;
- padding: 16px;
- background: #fafafa;
- border-bottom: 1px solid #f0f0f0;
-}
-
-.header-left {
- display: flex;
- gap: 16px;
- flex: 1;
-}
-
-.header-right {
- display: flex;
- gap: 16px;
- min-width: 500px;
- align-items: center;
-}
-
-.rank-column {
- width: 60px;
- text-align: center;
-}
-
-.info-column {
- flex: 1;
-}
-
-.category-column {
- width: 120px;
- color: #666;
- font-size: 14px;
- padding-left: 16px;
-}
-
-.stats-columns {
- display: flex;
- gap: 16px;
- min-width: 400px;
-}
-
-.stat-column {
- width: 80px;
- text-align: center;
- color: #666;
- font-size: 14px;
-}
-
-.content-item {
- display: flex;
- padding: 16px;
- border-bottom: 1px solid #f0f0f0;
- cursor: pointer;
- transition: background-color 0.3s;
-}
-
-.content-item:hover {
- background-color: #fafafa;
-}
-
-.rank {
- width: 60px;
- text-align: center;
- font-weight: bold;
- color: #1890ff;
-}
-
-.content-info {
- display: flex;
- gap: 16px;
- flex: 1;
- margin-left: 16px;
-}
-
-.thumbnail {
- width: 120px;
- height: 120px;
- border-radius: 4px;
- overflow: hidden;
- flex-shrink: 0;
-}
-
-.cover-image {
- width: 100%;
- height: 100%;
- object-fit: cover;
-}
-
-.no-image {
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- background: #f5f5f5;
- color: #999;
-}
-
-.info {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-}
-
-.title {
- margin: 0 0 8px 0;
- font-size: 16px;
- font-weight: 500;
- color: #333;
- text-align: left;
-}
-
-.title:hover {
- color: #1890ff;
-}
-
-.author-info {
- display: flex;
- align-items: center;
- gap: 8px;
- color: #666;
-}
-
-.avatar {
- 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;
- align-items: center;
- min-width: 500px;
-}
-
-.category {
- width: 128px;
- color: #666;
- font-size: 14px;
- text-align: left;
-}
-
-.stats {
- display: flex;
- gap: 48px;
- flex: 1;
- justify-content: flex-end;
-}
-
-.stat {
- width: 96px;
- text-align: center;
-}
-
-.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;
-}
-
-/* 加载状态样式 */
-.loading {
- padding: 40px;
- text-align: center;
- color: #999;
-}
-
-/* 无数据状态样式 */
-.no-data {
- padding: 40px;
- text-align: center;
- color: #999;
-}
-
-/* 分页样式 */
-.pagination-wrapper {
- margin-top: 24px;
- display: flex;
- justify-content: center;
-}
-
-/* 数据说明弹窗样式 */
-.data-info {
- padding: 8px;
-}
-
-.info-item {
- margin-bottom: 8px;
-}
-
-.info-label {
- color: #666;
- margin-right: 8px;
-}
-
-.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
deleted file mode 100644
index 5ca4b938..00000000
--- a/src/components/hot-content/HotContent.tsx
+++ /dev/null
@@ -1,493 +0,0 @@
-import React from 'react';
-import { Pagination, DatePicker, Popover } from 'antd';
-import { InfoCircleOutlined } from '@ant-design/icons';
-import dayjs from 'dayjs';
-import locale from 'antd/es/date-picker/locale/zh_CN';
-import { PlatformRanking, RankingContent } from '@/api/hot';
-import './HotContent.css';
-
-interface HotContentProps {
- rankingList: PlatformRanking[];
- selectedRanking: PlatformRanking | null;
- rankingContents: RankingContent[];
- rankingLoading: boolean;
- pagination: any;
- categories: string[];
- selectedCategory: string;
- isExpanded: boolean;
- selectedDate: string;
- rankingMinDate: string;
- rankingMaxDate: string;
- onRankingSelect: (ranking: PlatformRanking) => void;
- onCategorySelect: (category: string) => void;
- onDateChange: (date: dayjs.Dayjs | null) => void;
- onPageChange: (page: number) => void;
- onContentClick: (url: string, title: string) => void;
- onExpandToggle: () => void;
- getImageUrl: (path: string) => 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 }) => (
- <div className="data-info">
- <div className="info-item">
- <span className="info-label">更新时间:</span>
- {ranking.updateFrequency}
- </div>
- <div className="info-item">
- <span className="info-label">统计数据截止:</span>
- {new Date(ranking.updateTime).toLocaleString('zh-CN', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit',
- })}
- </div>
- <div className="info-item">
- <span className="info-label">时间查看:</span>
- 按日
- </div>
- <div className="info-item">
- <span className="info-label">排序规则:</span>
- 统计当日点赞量前500名的作品推荐
- </div>
- </div>
-);
-
-const HotContent: React.FC<HotContentProps> = ({
- rankingList,
- selectedRanking,
- rankingContents,
- rankingLoading,
- pagination,
- categories,
- selectedCategory,
- isExpanded,
- selectedDate,
- rankingMinDate,
- rankingMaxDate,
- onRankingSelect,
- onCategorySelect,
- onDateChange,
- onPageChange,
- onContentClick,
- onExpandToggle,
- getImageUrl,
- formatNumber,
-}) => {
- return (
- <div className="hot-content">
-
- {/* 榜单选择 */}
- {rankingList.length > 1 && (
- <div className="ranking-selector">
- <div className="ranking-list">
- {rankingList
- .filter((ranking) => !ranking.parentId)
- .map((ranking) => (
- <button
- key={ranking.id}
- className={`ranking-button ${
- selectedRanking?.id === ranking.id ? 'active' : ''
- }`}
- onClick={() => onRankingSelect(ranking)}
- >
- {ranking.name}
- </button>
- ))}
- </div>
- </div>
- )}
-
- {/* 筛选区域 */}
- <div className="filter-section">
- {/* 分类筛选 */}
- <div className="category-filter">
- <div className="category-grid">
- <div className="category-list">
- {categories.map((category) => (
- <button
- key={category}
- className={`category-button ${
- selectedCategory === category ? 'active' : ''
- }`}
- onClick={() => onCategorySelect(category)}
- >
- {category}
- </button>
- ))}
- </div>
- {categories.length > 8 && (
- <button
- className="expand-button"
- onClick={onExpandToggle}
- >
- <span>{isExpanded ? '收起' : '展开'}</span>
- <InfoCircleOutlined
- className={`expand-icon ${isExpanded ? 'expanded' : ''}`}
- />
- </button>
- )}
- </div>
- </div>
-
- {/* 日期选择和子榜单选择 */}
- <div className="date-section">
- <div className="date-picker-wrapper">
- <DatePicker
- value={dayjs(selectedDate)}
- onChange={onDateChange}
- locale={locale}
- allowClear={false}
- className="date-picker"
- placeholder="选择日期"
- disabledDate={(current) => {
- return (
- current < dayjs(rankingMinDate) ||
- current > dayjs(rankingMaxDate)
- );
- }}
- />
-
- {/* 子榜单选择 */}
- {selectedRanking &&
- rankingList.filter(
- (ranking) =>
- ranking.parentId ===
- (selectedRanking.parentId || selectedRanking.id),
- ).length > 0 && (
- <div className="sub-ranking-list">
- {rankingList
- .filter(
- (ranking) =>
- ranking.parentId ===
- (selectedRanking.parentId || selectedRanking.id),
- )
- .map((ranking) => (
- <button
- key={ranking.id}
- className={`sub-ranking-button ${
- selectedRanking?.id === ranking.id ? 'active' : ''
- }`}
- onClick={() => onRankingSelect(ranking)}
- >
- {ranking.name}
- </button>
- ))}
- </div>
- )}
- </div>
-
- {selectedRanking && (
- <Popover
- content={<DataInfoContent ranking={selectedRanking} />}
- title="数据说明"
- trigger="hover"
- placement="bottomRight"
- overlayClassName="data-info-popover"
- >
- <div className="data-info-trigger">
- <InfoCircleOutlined />
- <span>数据说明</span>
- </div>
- </Popover>
- )}
- </div>
- </div>
-
- {/* 内容列表 */}
- <div className="content-list">
- {rankingLoading ? (
- <div className="loading">加载榜单数据中...</div>
- ) : rankingContents.length > 0 ? (
- <>
- {/* 表头 */}
- <div className="list-header">
- <div className="header-left">
- <div className="rank-column">排名</div>
- <div className="info-column">笔记信息</div>
- </div>
- <div className="header-right">
- <div className="category-column">作品分类</div>
- <div className="stats-columns">
- {/* 快手增量榜单 */}
- {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>
-
- {/* 内容项 */}
- {rankingContents.map((item) => (
- <div
- key={item.id}
- className="content-item"
- onClick={() => onContentClick(item.url, item.title)}
- >
- <div className="rank">{item.rankingPosition}</div>
- <div className="content-info">
- <div className="thumbnail">
- {item.cover ? (
- <img
- src={getImageUrl(item.cover)}
- alt={item.title}
- className="cover-image"
- />
- ) : (
- <div className="no-image">暂无图片</div>
- )}
- </div>
- <div className="info">
- <h3 className="title">{item.title}</h3>
- <div className="author-info">
- {item.author && (
- <>
- <img
- src={getImageUrl(item.author.avatar)}
- alt={item.author.name}
- className="avatar"
- />
- <span className="author-name">
- {item.author.name}
- </span>
- {item.author.fansCount && (
- <span className="fans-count">
- 粉丝数 {item.author.fansCount.toLocaleString()}
- </span>
- )}
- <span className="publish-time">
- 发布于{' '}
- {dayjs(item.publishTime).format('YYYY-MM-DD HH:mm')}
- </span>
- </>
- )}
- </div>
- </div>
- </div>
- <div className="content-stats">
- <div className="category">{item.category}</div>
- <div className="stats">
- {/* 快手增量榜单 */}
- {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>
- ))}
-
- {/* 分页 */}
- {pagination && pagination.totalPages > 1 && (
- <div className="pagination-wrapper">
- <Pagination
- current={pagination.currentPage}
- total={pagination.totalItems}
- pageSize={pagination.itemsPerPage}
- showSizeChanger={false}
- showQuickJumper
- showTotal={(total) => `共 ${total} 条`}
- onChange={onPageChange}
- />
- </div>
- )}
- </>
- ) : (
- <div className="no-data">暂无榜单数据</div>
- )}
- </div>
- </div>
- );
-};
-
-export default HotContent;
\ No newline at end of file
diff --git a/src/components/hot-content/SideMenu.css b/src/components/hot-content/SideMenu.css
deleted file mode 100644
index 781373a1..00000000
--- a/src/components/hot-content/SideMenu.css
+++ /dev/null
@@ -1,70 +0,0 @@
-.side-menu {
- width: 192px;
- padding: 16px;
- background-color: #fff;
- border-right: 1px solid #f0f0f0;
- flex-shrink: 0;
-}
-
-.menu-section {
- margin-bottom: 24px;
-}
-
-.menu-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-weight: 500;
- color: #333;
- margin-bottom: 12px;
- cursor: pointer;
- padding: 4px 0;
-}
-
-.menu-header:hover {
- color: #a66ae4;
-}
-
-.menu-title {
- font-size: 16px;
- font-weight: bold;
-}
-
-.menu-list {
- list-style: none;
- padding: 0;
- margin: 0;
-}
-
-.menu-item {
- display: flex;
- align-items: center;
- padding: 8px;
- border-radius: 4px;
- cursor: pointer;
- transition: all 0.2s;
- margin-bottom: 4px;
-}
-
-.menu-item:hover {
- background-color: #f5f5f5;
-}
-
-.menu-item.active {
- background-color: #f4ebff;
- color: #a66ae4;
-}
-
-.platform-icon {
- width: 20px;
- height: 20px;
- margin-right: 8px;
-}
-
-.loading {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 16px 0;
- color: #999;
-}
\ No newline at end of file
diff --git a/src/components/hot-content/SideMenu.tsx b/src/components/hot-content/SideMenu.tsx
deleted file mode 100644
index c8899cc9..00000000
--- a/src/components/hot-content/SideMenu.tsx
+++ /dev/null
@@ -1,191 +0,0 @@
-import React from 'react';
-import { DownOutlined, RightOutlined } from '@ant-design/icons';
-import { Platform } from '@/api/hot';
-import './SideMenu.css';
-import { useTransClient } from '@/app/i18n/client';
-
-const config = {
- imageCDN: 'https://yika-bj.oss-cn-beijing.aliyuncs.com/',
- apiBaseURL: 'https://ttgufwxxqyow.sealosbja.site/api',
-};
-
-// 处理图片地址
-const getImageUrl = (path: string) => {
- if (!path) return '';
- if (path.startsWith('http')) return path;
- return `${config.imageCDN}${path}`;
-};
-
-
-interface SideMenuProps {
- platforms: Platform[];
- selectedPlatform: Platform | null;
- loading: boolean;
- contentExpanded: boolean;
- topicExpanded: boolean;
- hotEventExpanded: boolean;
- viralTitleExpanded: boolean;
- talkExpanded: boolean;
- hotPlatformExpanded: boolean;
- viralTitleLoading: boolean;
- viralTitlePlatforms: Platform[];
- selectedViralPlatform: Platform | null;
- msgTypeList: string[];
- selectedMsgType: string;
- onPlatformSelect: (platform: Platform) => void;
- onContentExpand: () => void;
- onTopicExpand: () => void;
- onHotEventExpand: () => void;
- onViralTitleExpand: () => void;
- onTalkExpand: () => void;
- onHotPlatformExpand: () => void;
- onViralPlatformSelect: (platform: Platform, timeType: string) => void;
- onMsgTypeClick: (type: string) => void;
- // getImageUrl: (path: string) => string;
- onHotContentClick: () => void;
- onViralTitleCategorySelect: (category: string) => void;
-}
-
-const SideMenu: React.FC<SideMenuProps> = ({
- platforms,
- selectedPlatform,
- loading,
- contentExpanded,
- topicExpanded,
- hotEventExpanded,
- viralTitleExpanded,
- talkExpanded,
- hotPlatformExpanded,
- viralTitleLoading,
- viralTitlePlatforms,
- selectedViralPlatform,
- msgTypeList,
- selectedMsgType,
- onPlatformSelect,
- onContentExpand,
- onTopicExpand,
- onHotEventExpand,
- onViralTitleExpand,
- onTalkExpand,
- onHotPlatformExpand,
- onViralPlatformSelect,
- onMsgTypeClick,
- // getImageUrl,
- onHotContentClick,
- onViralTitleCategorySelect,
-}) => {
- const { t } = useTransClient('hot-content');
-
- return (
- <div className="side-menu">
- {/* 热门内容 */}
- <div className="menu-section">
- <div className="menu-header" onClick={() => { onContentExpand(); onHotContentClick(); }}>
- <span className="menu-title">{t('hotContent')}</span>
- {contentExpanded ? <DownOutlined /> : <RightOutlined />}
- </div>
- {contentExpanded && (
- <ul className="menu-list">
- {loading ? (
- <div className="loading">{t('loading')}</div>
- ) : (
- platforms.map((platform) => (
- <li
- key={platform.id}
- className={`menu-item ${
- selectedPlatform?.id === platform.id ? 'active' : ''
- }`}
- onClick={() => onPlatformSelect(platform)}
- >
- <img
- src={getImageUrl(platform.icon)}
- alt={platform.name}
- className="platform-icon"
- />
- <span>{platform.name}</span>
- </li>
- ))
- )}
- </ul>
- )}
- </div>
-
- {/* 热点事件 */}
- <div className="menu-section">
- <div className="menu-header" onClick={onHotEventExpand}>
- <span className="menu-title">{t('hotEvents')}</span>
- {hotEventExpanded ? <DownOutlined /> : <RightOutlined />}
- </div>
- {hotEventExpanded && (
- <ul className="menu-list">
- <li
- className={`menu-item ${hotPlatformExpanded ? 'active' : ''}`}
- onClick={onHotPlatformExpand}
- >
- <span>{t('hotTopics')}</span>
- </li>
- </ul>
- )}
- </div>
-
- {/* 热门专题 */}
- <div className="menu-section">
- <div className="menu-header" onClick={onTopicExpand}>
- <span className="menu-title">{t('topics')}</span>
- {topicExpanded ? <DownOutlined /> : <RightOutlined />}
- </div>
- {topicExpanded && (
- <ul className="menu-list">
- {loading ? (
- <div className="loading">{t('loading')}</div>
- ) : (
- msgTypeList.map((type) => (
- <li
- key={type}
- className={`menu-item ${selectedMsgType === type ? 'active' : ''}`}
- onClick={() => onMsgTypeClick(type)}
- >
- <span>{type}</span>
- </li>
- ))
- )}
- </ul>
- )}
- </div>
-
- {/* 爆款标题 */}
- <div className="menu-section">
- <div className="menu-header" onClick={onViralTitleExpand}>
- <span className="menu-title">{t('viralTitles')}</span>
- {viralTitleExpanded ? <DownOutlined /> : <RightOutlined />}
- </div>
- {viralTitleExpanded && (
- <ul className="menu-list">
- {viralTitleLoading ? (
- <div className="loading">{t('loading')}</div>
- ) : (
- viralTitlePlatforms.map((platform) => (
- <li
- key={platform.id}
- className={`menu-item ${
- selectedViralPlatform?.id === platform.id ? 'active' : ''
- }`}
- onClick={() => onViralPlatformSelect(platform, '')}
- >
- <img
- src={getImageUrl(platform.icon)}
- alt={platform.name}
- className="platform-icon"
- />
- <span>{platform.name}</span>
- </li>
- ))
- )}
- </ul>
- )}
- </div>
- </div>
- );
-};
-
-export default SideMenu;
\ No newline at end of file