Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(热门内容): 热门内容添加表格
gaoSir22265d4c9d1d
diff --git a/.idea/workspace.xml b/.idea/workspace.xmlindex 46167dba..ffc9f0df 100644--- a/.idea/workspace.xml+++ b/.idea/workspace.xml@@ -4,21 +4,15 @@<option name="autoReloadType" value="NONE" /></component><component name="ChangeListManager">- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(热门内容): 恢复新热门内容">- <change afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContent/index.tsx" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContentLabel/hotContentLabel.module.scss" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContentLabel/index.tsx" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotEvent/index.tsx" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotFeatures/index.tsx" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotTitle/index.tsx" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/hotContent.enum.ts" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.env" beforeDir="false" afterPath="$PROJECT_DIR$/.env" afterDir="false" />+ <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$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/pnpm-lock.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pnpm-lock.yaml" 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]/hotContent/HotContentCore.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/HotContentCore.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContentSidebar/hotContentSidebar.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContentSidebar/hotContentSidebar.module.scss" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContentSidebar/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContentSidebar/index.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContent/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/components/HotContent/index.tsx" afterDir="false" /><change beforePath="$PROJECT_DIR$/src/app/[lng]/hotContent/hotContent.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/hotContent.module.scss" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/hotContent/useHotContent.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/hotContent/useHotContent.ts" afterDir="false" /></list><option name="SHOW_DIALOG" value="false" /><option name="HIGHLIGHT_CONFLICTS" value="true" />@@ -221,22 +215,8 @@<workItem from="1757656251307" duration="25699000" /><workItem from="1757687709611" duration="2478000" /><workItem from="1757902659875" duration="8213000" />- </task>- <task id="LOCAL-00012" summary="fix(发布): 默认返回快手参数">- <option name="closed" value="true" />- <created>1752219562256</created>- <option name="number" value="00012" />- <option name="presentableId" value="LOCAL-00012" />- <option name="project" value="LOCAL" />- <updated>1752219562256</updated>- </task>- <task id="LOCAL-00013" summary="feat(日历):细节调整,1. 发布记录查看,添加图片、视频分别处理。 2. 发布API添加图片处理">- <option name="closed" value="true" />- <created>1752229429479</created>- <option name="number" value="00013" />- <option name="presentableId" value="LOCAL-00013" />- <option name="project" value="LOCAL" />- <updated>1752229429479</updated>+ <workItem from="1757990250575" duration="77000" />+ <workItem from="1758007785895" duration="5213000" /></task><task id="LOCAL-00014" summary="feat(日历):日历在同一个单元格发布记录太多会自动隐藏,并且显示按钮让用户点击查看更多"><option name="closed" value="true" />@@ -614,7 +594,23 @@<option name="project" value="LOCAL" /><updated>1757930268660</updated></task>- <option name="localTasksCounter" value="61" />+ <task id="LOCAL-00061" summary="feat(热门内容): 添加侧边栏、标签数据、构建获取数据的基本逻辑及缓存逻辑">+ <option name="closed" value="true" />+ <created>1757947500152</created>+ <option name="number" value="00061" />+ <option name="presentableId" value="LOCAL-00061" />+ <option name="project" value="LOCAL" />+ <updated>1757947500152</updated>+ </task>+ <task id="LOCAL-00062" summary="feat(热门内容): 热门内容添加日期选择">+ <option name="closed" value="true" />+ <created>1757949881878</created>+ <option name="number" value="00062" />+ <option name="presentableId" value="LOCAL-00062" />+ <option name="project" value="LOCAL" />+ <updated>1757949881878</updated>+ </task>+ <option name="localTasksCounter" value="63" /><servers /></component><component name="TypeScriptGeneratedFilesManager">@@ -677,8 +673,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="feat: password 密码登录、重置密码,添加md5加密" />- <MESSAGE value="fix: 将之前转发的逻辑改为直连" /><MESSAGE value="fix: 删除代理地址" /><MESSAGE value="fix: 修复发布记录Dropdown报错" /><MESSAGE value="fix: 默认空间国际化" />@@ -702,6 +696,8 @@<MESSAGE value="feat(数据统计): 1. echarts图优化。 2. 平台名称进行国际化。" /><MESSAGE value="feat(数据统计): 添加昨日新增" /><MESSAGE value="feat(热门内容): 恢复新热门内容" />- <option name="LAST_COMMIT_MESSAGE" value="feat(热门内容): 恢复新热门内容" />+ <MESSAGE value="feat(热门内容): 添加侧边栏、标签数据、构建获取数据的基本逻辑及缓存逻辑" />+ <MESSAGE value="feat(热门内容): 热门内容添加日期选择" />+ <option name="LAST_COMMIT_MESSAGE" value="feat(热门内容): 热门内容添加日期选择" /></component></project>\ No newline at end of filediff --git a/package.json b/package.jsonindex 1aebbe36..3e34e53f 100644--- a/package.json+++ b/package.json@@ -52,6 +52,7 @@"react-dom": "^18","react-i18next": "15.4.1","react-icons": "^5.5.0",+ "react-infinite-scroll-component": "^6.1.0","react-qrcode-logo": "^4.0.0","react-sortablejs": "^6.1.4","react-transition-group": "^4.4.5",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 1bb942fb..4cc70351 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -113,6 +113,9 @@ importers:react-icons:specifier: ^5.5.0version: 5.5.0([email protected])+ react-infinite-scroll-component:+ specifier: ^6.1.0+ version: 6.1.0([email protected])react-qrcode-logo:specifier: ^4.0.0@@ -3302,6 +3305,11 @@ packages:peerDependencies:react: '*'+ resolution: {integrity: sha512-SQu5nCqy8DxQWpnUVLx7V7b7LcA37aM7tvoWjTLZp1dk6EJibM5/4EJKzOnl07/BsM1Y40sKLuqjCwwH/xV0TQ==}+ peerDependencies:+ react: '>=16.0.0'+resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}@@ -3652,6 +3660,10 @@ packages:engines: {node: '>=10'}hasBin: true+ resolution: {integrity: sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ==}+ engines: {node: '>=8'}+resolution: {integrity: sha512-B71/4oyj61iNH0KeCamLuE2rmKuTO5byTOSVwECM5FA7TiAiAW+UqTKZ9ERueC4qvgSttUhdmq1mXC3kJqGX7A==}engines: {node: '>=12.22'}@@ -7474,6 +7486,11 @@ snapshots:dependencies:react: 18.3.1+ dependencies:+ react: 18.3.1+ throttle-debounce: 2.3.0+@@ -7869,6 +7886,8 @@ snapshots:commander: 2.20.3source-map-support: 0.5.21+ [email protected]: {}+diff --git a/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx b/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsxindex 01e6d15c..286ca06f 100644--- a/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx+++ b/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx@@ -92,7 +92,10 @@ const DataStatisticsHeader = memo(<div className="dataStatisticsHeader-accounts">{filteredAccountList.length === 0 ? (<>- <Empty style={{ width: "100%", height: "100%" }} description={t("noAccount")} />+ <Empty+ style={{ width: "100%", height: "100%" }}+ description={t("noAccount")}+ /></>) : (<>@@ -149,7 +152,8 @@ const DataStatisticsHeader = memo({account.status === 1 ? (<div className="accounts-swiper-item-fans">- {t("fansCount")} <span>{account.fansCount}</span>+ {t("fansCount")}{" "}+ <span>{account.fansCount}</span></div>) : (<div className="accounts-swiper-item-offline">diff --git a/src/app/[lng]/hotContent/HotContentCore.tsx b/src/app/[lng]/hotContent/HotContentCore.tsxindex fd261257..0ae01228 100644--- a/src/app/[lng]/hotContent/HotContentCore.tsx+++ b/src/app/[lng]/hotContent/HotContentCore.tsx@@ -24,18 +24,20 @@ export const HotContentCore = () => {size="large"wrapperClassName={styles.hotContent}>- <HotContentSidebar />+ <div className="hotContent-wrapper">+ <HotContentSidebar />- <div className="hotContent-content">- {hotType === HotType.hotContent ? (- <HotContent />- ) : hotType === HotType.hotEvent ? (- <HotEvent />- ) : hotType === HotType.hotFeatures ? (- <HotFeatures />- ) : (- <HotTitle />- )}+ <div className="hotContent-content">+ {hotType === HotType.hotContent ? (+ <HotContent />+ ) : hotType === HotType.hotEvent ? (+ <HotEvent />+ ) : hotType === HotType.hotFeatures ? (+ <HotFeatures />+ ) : (+ <HotTitle />+ )}+ </div></div></Spin>);diff --git a/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss b/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scssindex e36a3cba..91e21295 100644--- a/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss+++ b/src/app/[lng]/hotContent/components/HotContent/hotContent.module.scss@@ -1,7 +1,14 @@.hotContent {+ height: 100%;+ display: flex;+ flex-direction: column;:global {.hotContent-options {margin-top: 15px;+ display: flex;+ justify-content: space-between;+ align-items: center;+ color: var(--grayColor6);&-select {display: flex;align-items: center;@@ -21,6 +28,43 @@border-top-left-radius: 0;}}++ &-explain {+ .anticon {+ margin-left: 5px;+ }+ }+ }++ .hotContent-table {+ height: 100%;+ box-sizing: border-box;+ overflow: auto;+ margin-top: 15px;+ position: relative;+ @include table-flex-container-with-selectors;++ scrollbar-width: none;+ &::-webkit-scrollbar {+ display: none;+ }++ thead {+ position: sticky;+ top: 0;+ z-index: 10;+ .ant-table-cell {+ background: rgba(237, 242, 242);+ padding: 10px 16px;++ &:last-of-type {+ border-bottom-right-radius: 8px;+ }+ &:first-of-type {+ border-bottom-left-radius: 8px;+ }+ }+ }}}}\ No newline at end of filediff --git a/src/app/[lng]/hotContent/components/HotContent/index.tsx b/src/app/[lng]/hotContent/components/HotContent/index.tsxindex 9e4ca1a1..311d5032 100644--- a/src/app/[lng]/hotContent/components/HotContent/index.tsx+++ b/src/app/[lng]/hotContent/components/HotContent/index.tsx@@ -2,6 +2,7 @@ import {ForwardedRef,forwardRef,memo,+ useCallback,useEffect,useMemo,useState,@@ -10,12 +11,24 @@ import { useHotContent } from "@/app/[lng]/hotContent/useHotContent";import { useShallow } from "zustand/react/shallow";import HotContentLabel from "@/app/[lng]/hotContent/components/HotContentLabel";import styles from "./hotContent.module.scss";-import { Select } from "antd";+import { Popover, Select, Table } from "antd";+import { QuestionCircleOutlined } from "@ant-design/icons";+import type { TableProps } from "antd";+import { platformApi, RankingContent } from "@/api/hot";export interface IHotContentRef {}export interface IHotContentProps {}+const columns: TableProps<RankingContent>["columns"] = [+ {+ title: "排名",+ dataIndex: "rankingPosition",+ key: "rankingPosition",+ render: (text, data, index) => <span>{index + 1}</span>,+ },+];+const HotContent = memo(forwardRef(({}: IHotContentProps, ref: ForwardedRef<IHotContentRef>) => {const { labelData, rankingData, datesData, twoMenuKey } = useHotContent(@@ -30,6 +43,10 @@ const HotContent = memo(const [labelValue, setLabelValue] = useState("全部");// 当前选中的日期const [dateValue, setDateValue] = useState("");+ // 数据loading+ const [loading, setLoading] = useState(false);+ // 表格数据+ const [dataSource, setDataSource] = useState<RankingContent[]>([]);// 获取当前选中的标签、日期、榜单const selectedLabelInfo = useMemo(() => {@@ -55,9 +72,20 @@ const HotContent = memo(// 请求列表数据useEffect(() => {if (dateValue === "") return;- console.log("请求列表数据", { labelValue, dateValue });+ getTableData();}, [labelValue, dateValue]);+ const getTableData = useCallback(async () => {+ const res = await platformApi.getRankingContents(+ selectedLabelInfo.ranking.id,+ 1,+ 20,+ labelValue,+ dateValue,+ );+ setDataSource(res?.data.items || []);+ }, [selectedLabelInfo, labelValue, dateValue]);+return (<div className={styles.hotContent}><HotContentLabel@@ -78,6 +106,27 @@ const HotContent = memo(onChange={(e) => setDateValue(e)}></Select></div>++ <Popover+ content={+ <>+ <p>更新时间:{selectedLabelInfo.ranking.updateFrequency}</p>+ <p>统计数据截止:{selectedLabelInfo.ranking.updateTime}</p>+ <p>更新时间:按日</p>+ <p>排序规则:统计当日点赞量前500名的作品推荐</p>+ </>+ }+ placement="bottomLeft"+ >+ <div className="hotContent-options-explain">+ 数据说明+ <QuestionCircleOutlined />+ </div>+ </Popover>+ </div>++ <div className="hotContent-table">+ <Table dataSource={dataSource} columns={columns} pagination={false} /></div></div>);diff --git a/src/app/[lng]/hotContent/hotContent.module.scss b/src/app/[lng]/hotContent/hotContent.module.scssindex f36c9db4..dff439fc 100644--- a/src/app/[lng]/hotContent/hotContent.module.scss+++ b/src/app/[lng]/hotContent/hotContent.module.scss@@ -1,11 +1,13 @@.hotContent {display: flex;height: 100%;+ width: 100%;+ min-height: 0;border-top: 1px solid var(--grayColor1);:global {- .ant-spin-container {+ .hotContent-wrapper {display: flex;- flex: 1;+ height: 100%;.hotContent-content {padding: 15px 20px;box-sizing: border-box;@@ -15,5 +17,11 @@overflow: auto;}}++ .ant-spin-container {+ height: 100%;+ width: 100%;+ min-height: 0;+ }}}\ No newline at end of file