Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(数据统计): 国际化处理完成
gaoSir1efaba0e6fd5
diff --git a/.idea/workspace.xml b/.idea/workspace.xmlindex 1d45a6e9..9dcbe4b1 100644--- a/.idea/workspace.xml+++ b/.idea/workspace.xml@@ -4,14 +4,14 @@<option name="autoReloadType" value="NONE" /></component><component name="ChangeListManager">- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(数据统计): echarts图接入API">- <change afterPath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/components/DataStatisticsTable/dataStatisticsTable.module.scss" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/components/DataStatisticsTable/index.tsx" 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$/src/api/types/dataStatistics.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/types/dataStatistics.ts" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/DataStatisticsCore.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/DataStatisticsCore.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/echart/drawDataStatisticsEchartLine.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/dataStatistics/echart/drawDataStatisticsEchartLine.ts" 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" /></list><option name="SHOW_DIALOG" value="false" /><option name="HIGHLIGHT_CONFLICTS" value="true" />@@ -212,31 +212,8 @@<workItem from="1757646484870" duration="466000" /><workItem from="1757647784882" duration="2426000" /><workItem from="1757656251307" duration="25699000" />- <workItem from="1757687709611" duration="2157000" />- </task>- <task id="LOCAL-00005" summary="feat(发布弹框): 上传图片和上传视频完成">- <option name="closed" value="true" />- <created>1752057751552</created>- <option name="number" value="00005" />- <option name="presentableId" value="LOCAL-00005" />- <option name="project" value="LOCAL" />- <updated>1752057751552</updated>- </task>- <task id="LOCAL-00006" summary="feat(发布弹框): 发布API接入完成">- <option name="closed" value="true" />- <created>1752066983987</created>- <option name="number" value="00006" />- <option name="presentableId" value="LOCAL-00006" />- <option name="project" value="LOCAL" />- <updated>1752066983987</updated>- </task>- <task id="LOCAL-00007" summary="fix: 修复ts报错问题">- <option name="closed" value="true" />- <created>1752067126597</created>- <option name="number" value="00007" />- <option name="presentableId" value="LOCAL-00007" />- <option name="project" value="LOCAL" />- <updated>1752067126597</updated>+ <workItem from="1757687709611" duration="2478000" />+ <workItem from="1757902659875" duration="5176000" /></task><task id="LOCAL-00008" summary="fix(日历): 解决一个诡异的bug,日历,拖动发布记录时,拖到比当前时间小的日历正常显示,拖到比当前时间大的日历时间会盖住发布记录。"><option name="closed" value="true" />@@ -606,7 +583,31 @@<option name="project" value="LOCAL" /><updated>1757688007999</updated></task>- <option name="localTasksCounter" value="54" />+ <task id="LOCAL-00054" summary="feat(数据统计): 数据大体完成">+ <option name="closed" value="true" />+ <created>1757689928273</created>+ <option name="number" value="00054" />+ <option name="presentableId" value="LOCAL-00054" />+ <option name="project" value="LOCAL" />+ <updated>1757689928273</updated>+ </task>+ <task id="LOCAL-00055" summary="feat(数据统计): 1. 添加账号搜索功能。 2. 添加账号离线状态和重新登录。">+ <option name="closed" value="true" />+ <created>1757925090335</created>+ <option name="number" value="00055" />+ <option name="presentableId" value="LOCAL-00055" />+ <option name="project" value="LOCAL" />+ <updated>1757925090335</updated>+ </task>+ <task id="LOCAL-00056" summary="feat(数据统计): 优化">+ <option name="closed" value="true" />+ <created>1757925767099</created>+ <option name="number" value="00056" />+ <option name="presentableId" value="LOCAL-00056" />+ <option name="project" value="LOCAL" />+ <updated>1757925767099</updated>+ </task>+ <option name="localTasksCounter" value="57" /><servers /></component><component name="TypeScriptGeneratedFilesManager">@@ -669,9 +670,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: 尝试多语言SEO优化,添加静态站点配置" />- <MESSAGE value="fix: 解决404问题" />- <MESSAGE value="chore: b站校验优化" /><MESSAGE value="fix(发布): usePubParamsVerify参数校验优化" /><MESSAGE value="fix(seo): 站点地图修复" /><MESSAGE value="fix(日历):发布时间格式修复" />@@ -694,6 +692,9 @@<MESSAGE value="feat(数据统计): 接入数据API,并且分拣数据" /><MESSAGE value="feat(数据统计): 引入echarts" /><MESSAGE value="feat(数据统计): echarts图接入API" />- <option name="LAST_COMMIT_MESSAGE" value="feat(数据统计): echarts图接入API" />+ <MESSAGE value="feat(数据统计): 数据大体完成" />+ <MESSAGE value="feat(数据统计): 1. 添加账号搜索功能。 2. 添加账号离线状态和重新登录。" />+ <MESSAGE value="feat(数据统计): 优化" />+ <option name="LAST_COMMIT_MESSAGE" value="feat(数据统计): 优化" /></component></project>\ No newline at end of filediff --git a/@types/resources.d.ts b/@types/resources.d.tsindex 18c331c3..57c6ed82 100644--- a/@types/resources.d.ts+++ b/@types/resources.d.ts@@ -358,7 +358,17 @@ interface Resources {},"dataStatistics": {"title": "数据统计",- "description": "在这里查看和分析您的数据统计信息。"+ "description": "在这里查看和分析您的数据统计信息。",+ "accountData": "账号数据",+ "selectSpace": "选择空间",+ "inputAccountName": "请输入账号名称",+ "noAccount": "暂无账号",+ "totalAccount": "累计账号数",+ "online": "在线",+ "offline": "离线",+ "fansCount": "粉丝数",+ "loginFailed": "登陆失败",+ "relogin": "重新登录"},"demo": {"demoText": "测试文字",diff --git a/src/app/[lng]/dataStatistics/components/DataStatisticsDetails/index.tsx b/src/app/[lng]/dataStatistics/components/DataStatisticsDetails/index.tsxindex 7e86043a..2155a4a3 100644--- a/src/app/[lng]/dataStatistics/components/DataStatisticsDetails/index.tsx+++ b/src/app/[lng]/dataStatistics/components/DataStatisticsDetails/index.tsx@@ -5,6 +5,7 @@ import { useShallow } from "zustand/react/shallow";import Icon from "@ant-design/icons";import { DatePicker } from "antd";import { Dayjs } from "dayjs";+import { useTransClient } from "@/app/i18n/client";export interface IDataStatisticsDetailsRef {}@@ -31,13 +32,14 @@ const DataStatisticsDetails = memo(timeRangeValue: state.timeRangeValue,})),);+ const { t } = useTransClient("dataStatistics");return (<div className={styles.dataStatisticsDetails}><div className="dataStatisticsDetails-head">- <h3>数据明细</h3>+ <h3>{t("dataDetails")}</h3><div className="dataStatisticsDetails-head-rangePicker">- <label>时间范围:</label>+ <label>{t("timeRange")}</label><DatePicker.RangePickervalue={timeRangeValue}allowClear={false}@@ -72,7 +74,7 @@ const DataStatisticsDetails = memo({detail.total}</p><p className="dataStatisticsDetails-content-item-yesterday">- 昨日新增+ {t("yesterdayIncrease")}<b>{detail.yesterday}</b></p></div>diff --git a/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx b/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsxindex 88b42f08..01e6d15c 100644--- a/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx+++ b/src/app/[lng]/dataStatistics/components/DataStatisticsHeader/index.tsx@@ -18,6 +18,7 @@ import "swiper/css";import "swiper/css/navigation";import AvatarPlat from "@/components/AvatarPlat";import AddAccountModal from "@/app/[lng]/accounts/components/AddAccountModal";+import { useTransClient } from "@/app/i18n/client";export interface IDataStatisticsHeaderRef {}@@ -48,6 +49,7 @@ const DataStatisticsHeader = memo(})),);const [addAccountModalOpen, setAddAccountModalOpen] = useState(false);+ const { t } = useTransClient("dataStatistics");return (<div className={styles.dataStatisticsHeader}>@@ -62,7 +64,7 @@ const DataStatisticsHeader = memo(/><div className="dataStatisticsHeader-top">- <h2>账号数据</h2>+ <h2>{t("accountData")}</h2><div className="dataStatisticsHeader-top-options"><Selectmode="multiple"@@ -70,7 +72,7 @@ const DataStatisticsHeader = memo(style={{ width: "220px" }}options={accountGroupList}fieldNames={{ value: "id", label: "name" }}- placeholder="选择空间"+ placeholder={t("selectSpace")}maxTagCount={1}onChange={(value) => {setChoosedGroupIds(value);@@ -78,7 +80,7 @@ const DataStatisticsHeader = memo(/><Input.Searchstyle={{ width: "300px" }}- placeholder="请输入账号名称"+ placeholder={t("inputAccountName")}allowClearonSearch={(value) => {setAccountSearchValue(value);@@ -90,27 +92,27 @@ const DataStatisticsHeader = memo(<div className="dataStatisticsHeader-accounts">{filteredAccountList.length === 0 ? (<>- <Empty style={{ width: "100%", height: "100%" }} />+ <Empty style={{ width: "100%", height: "100%" }} description={t("noAccount")} /></>) : (<><div className="dataStatisticsHeader-accountCount"><div className="dataStatisticsHeader-accountCount-title"><AccountCount />- 累计账号数+ {t("totalAccount")}</div><div className="dataStatisticsHeader-accountCount-number">{filteredAccountList.length}</div><Tag bordered={false} icon={<CheckCircleOutlined />}>- 在线{" "}+ {t("online")}{" "}<b>{filteredAccountList.filter((v) => v.status === 1).length}</b></Tag><br /><Tag bordered={false} icon={<WarningOutlined />}>- 离线{" "}+ {t("offline")}{" "}<b>{filteredAccountList.filter((v) => v.status === 0).length}</b>@@ -147,13 +149,13 @@ const DataStatisticsHeader = memo({account.status === 1 ? (<div className="accounts-swiper-item-fans">- 粉丝数 <span>{account.fansCount}</span>+ {t("fansCount")} <span>{account.fansCount}</span></div>) : (<div className="accounts-swiper-item-offline"><span><ExclamationCircleOutlined />- 登陆失败+ {t("loginFailed")}</span><aonClick={(e) => {@@ -161,7 +163,7 @@ const DataStatisticsHeader = memo(setAddAccountModalOpen(true);}}>- 重新登录+ {t("relogin")}</a></div>)}diff --git a/src/app/[lng]/dataStatistics/useDataStatistics.tsx b/src/app/[lng]/dataStatistics/useDataStatistics.tsxindex 293947ad..27b75ca8 100644--- a/src/app/[lng]/dataStatistics/useDataStatistics.tsx+++ b/src/app/[lng]/dataStatistics/useDataStatistics.tsx@@ -14,6 +14,7 @@ import { getStatisticsPeriodApi } from "@/api/dataStatistics";import { StatisticsPeriodModel } from "@/api/types/dataStatistics";import { message } from "antd";import drawDataStatisticsEchartLine from "@/app/[lng]/dataStatistics/echart/drawDataStatisticsEchartLine";+import { directTrans } from "@/app/i18n/client";export interface IDataStatisticsStore {// 当前选择的账户组IDs@@ -57,50 +58,7 @@ const state: IDataStatisticsStore = {accountSearchValue: "",choosedGroupIds: [],filteredAccountList: [],- dataDetails: [- {- title: "涨粉数",- value: "fansCount",- icon: FansCount,- total: 0,- yesterday: 0,- },- {- title: "播放数",- value: "readCount",- icon: VideoCameraFilled,- total: 0,- yesterday: 0,- },- {- title: "评论数",- value: "commentCount",- icon: MessageFilled,- total: 0,- yesterday: 0,- },- {- title: "点赞数",- value: "likeCount",- icon: HeartFilled,- total: 0,- yesterday: 0,- },- {- title: "收藏数",- value: "collectCount",- icon: CollectCount,- total: 0,- yesterday: 0,- },- {- title: "分享数",- value: "forwardCount",- icon: ForwardCount,- total: 0,- yesterday: 0,- },- ],+ dataDetails: [],currentDetailType: "",timeRangeValue: [dayjs().subtract(7, "day"), dayjs()],loading: false,@@ -120,8 +78,54 @@ export const useDataStatisticsStore = create((set, get) => {const methods = {async init() {+ const dataDetails = [+ {+ title: directTrans("dataStatistics", "growthFansCount"),+ value: "fansCount",+ icon: FansCount,+ total: 0,+ yesterday: 0,+ },+ {+ title: directTrans("dataStatistics", "readCount"),+ value: "readCount",+ icon: VideoCameraFilled,+ total: 0,+ yesterday: 0,+ },+ {+ title: directTrans("dataStatistics", "commentCount"),+ value: "commentCount",+ icon: MessageFilled,+ total: 0,+ yesterday: 0,+ },+ {+ title: directTrans("dataStatistics", "likeCount"),+ value: "likeCount",+ icon: HeartFilled,+ total: 0,+ yesterday: 0,+ },+ {+ title: directTrans("dataStatistics", "collectCount"),+ value: "collectCount",+ icon: CollectCount,+ total: 0,+ yesterday: 0,+ },+ {+ title: directTrans("dataStatistics", "forwardCount"),+ value: "forwardCount",+ icon: ForwardCount,+ total: 0,+ yesterday: 0,+ },+ ];+set({- currentDetailType: get().dataDetails[0].value,+ dataDetails,+ currentDetailType: dataDetails[0].value,});},diff --git a/src/app/i18n/locales/en/dataStatistics.json b/src/app/i18n/locales/en/dataStatistics.jsonindex 62456320..a1c1eda5 100644--- a/src/app/i18n/locales/en/dataStatistics.json+++ b/src/app/i18n/locales/en/dataStatistics.json@@ -1,4 +1,23 @@{"title": "Data Statistics",- "description": "View and analyze your data statistics here."+ "description": "View and analyze your data statistics here.",+ "accountData": "Account Data",+ "selectSpace": "Select Space",+ "inputAccountName": "Enter account name",+ "noAccount": "No accounts",+ "totalAccount": "Total Accounts",+ "online": "Online",+ "offline": "Offline",+ "fansCount": "Fans",+ "growthFansCount": "Growth Fans",+ "loginFailed": "Login Failed",+ "relogin": "Relogin",+ "dataDetails": "Data Details",+ "timeRange": "Time Range:",+ "yesterdayIncrease": "Yesterday Increase",+ "readCount": "Reads",+ "commentCount": "Comments",+ "likeCount": "Likes",+ "collectCount": "Collections",+ "forwardCount": "Shares"}\ No newline at end of filediff --git a/src/app/i18n/locales/zh-CN/dataStatistics.json b/src/app/i18n/locales/zh-CN/dataStatistics.jsonindex 477976db..1b190e48 100644--- a/src/app/i18n/locales/zh-CN/dataStatistics.json+++ b/src/app/i18n/locales/zh-CN/dataStatistics.json@@ -1,4 +1,23 @@{"title": "数据统计",- "description": "在这里查看和分析您的数据统计信息。"+ "description": "在这里查看和分析您的数据统计信息。",+ "accountData": "账号数据",+ "selectSpace": "选择空间",+ "inputAccountName": "请输入账号名称",+ "noAccount": "暂无账号",+ "totalAccount": "累计账号数",+ "online": "在线",+ "offline": "离线",+ "fansCount": "粉丝数",+ "growthFansCount": "涨粉数",+ "loginFailed": "登陆失败",+ "relogin": "重新登录",+ "dataDetails": "数据明细",+ "timeRange": "时间范围:",+ "yesterdayIncrease": "昨日新增",+ "readCount": "播放数",+ "commentCount": "评论数",+ "likeCount": "点赞数",+ "collectCount": "收藏数",+ "forwardCount": "分享数"}\ No newline at end of file