Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
fix: Some bugs have been fixed (#463)
Gao18bdddd8f50c
diff --git a/project/web/src/app/i18n/locales/en/account.json b/project/web/src/app/i18n/locales/en/account.jsonindex 6e8011c0..f78b469a 100644--- a/project/web/src/app/i18n/locales/en/account.json+++ b/project/web/src/app/i18n/locales/en/account.json@@ -194,6 +194,7 @@"douyin": "Douyin","xiaohongshu": "Xiaohongshu"},+ "channel": "Channel","sidebar": {"noAccounts": "No accounts","noOnlineAccounts": "No online accounts",@@ -296,9 +297,24 @@"createSpaceNamePlaceholder": "Enter space name","createSpaceSuccess": "Space created successfully","createSpaceFailed": "Failed to create space",+ "editSpaceSuccess": "Space edited successfully",+ "editSpaceFailed": "Failed to edit space",+ "deleteChannelSuccess": "Channel deleted successfully",+ "deleteChannelFailed": "Failed to delete channel",+ "sortSuccess": "Sort successful",+ "sortFailed": "Sort failed",+ "moveUp": "Move up",+ "moveDown": "Move down",+ "noChannels": "No channels",+ "deleteConfirm": "Confirm delete","deleteSpaceConfirm": "Confirm Delete Space","deleteSpaceSuccess": "Space deleted successfully","deleteSpaceFailed": "Failed to delete space",+ "channelCount": "{{count}} channels",+ "sorting": "Sorting...",+ "deleting": "Deleting...",+ "fans": "Fans: {{count}}",+ "deleteDialogContent": "Are you sure you want to delete {{type}} '{{name}}'? This action cannot be undone.","noData": "No data available"}}diff --git a/project/web/src/app/i18n/locales/zh-CN/account.json b/project/web/src/app/i18n/locales/zh-CN/account.jsonindex 5bc8c68d..1f2d9e04 100644--- a/project/web/src/app/i18n/locales/zh-CN/account.json+++ b/project/web/src/app/i18n/locales/zh-CN/account.json@@ -1,6 +1,6 @@{- "title": "账户",- "describe": "账户页面",+ "title": "发布",+ "describe": "发布页面","today": "今天","defaultSpace": "默认空间","addPost": "添加帖子",@@ -297,9 +297,26 @@"createSpaceNamePlaceholder": "输入空间名称","createSpaceSuccess": "创建空间成功","createSpaceFailed": "创建空间失败",+ "editSpaceSuccess": "空间编辑成功",+ "editSpaceFailed": "空间编辑失败",+ "deleteChannelSuccess": "删除频道成功",+ "deleteChannelFailed": "删除频道失败",+ "sortSuccess": "排序成功",+ "sortFailed": "排序失败",+ "moveUp": "上移",+ "moveDown": "下移",+ "noChannels": "暂无频道",+ "deleteConfirm": "确认删除",+ "channelCount": "{{count}} 个频道",+ "sorting": "排序中...",+ "deleting": "删除中...",+ "fans": "粉丝: {{count}}",+ "deleteDialogContent": "确定要删除 {{type}} \"{{name}}\" 吗?此操作无法撤销。","deleteSpaceConfirm": "确认删除空间","deleteSpaceSuccess": "删除空间成功","deleteSpaceFailed": "删除空间失败","noData": "暂无数据"}+ ,+ "channel": "频道"}diff --git a/project/web/src/app/i18n/locales/zh-CN/route.json b/project/web/src/app/i18n/locales/zh-CN/route.jsonindex 22aee1c8..0923455d 100644--- a/project/web/src/app/i18n/locales/zh-CN/route.json+++ b/project/web/src/app/i18n/locales/zh-CN/route.json@@ -1,7 +1,7 @@{"home": "首页","tasksHistory": "任务记录",- "accounts": "账户",+ "accounts": "发布","publish": "发布","hotContent": "热门内容","hotContentNew": "热门内容新",diff --git a/project/web/src/app/layout/Providers.tsx b/project/web/src/app/layout/Providers.tsxindex 7efbec87..2be92293 100644--- a/project/web/src/app/layout/Providers.tsx+++ b/project/web/src/app/layout/Providers.tsx@@ -55,9 +55,7 @@ export function Providers({if (queryToken) {useUserStore.getState().setToken(queryToken);}- useDataStatisticsStore.getState().init();- useUserStore.getState().getUserInfo();- useAccountStore.getState().accountInit();+ useUserStore.getState().appInit();}}, [_hasHydrated]);diff --git a/project/web/src/components/ChannelManager/components/ChannelItem.tsx b/project/web/src/components/ChannelManager/components/ChannelItem.tsxindex 98ff4fe1..61b2167b 100644--- a/project/web/src/components/ChannelManager/components/ChannelItem.tsx+++ b/project/web/src/components/ChannelManager/components/ChannelItem.tsx@@ -8,32 +8,27 @@'use client'+import type { SocialAccount } from '@/api/types/account.type'import Image from 'next/image'-import { DeleteOutlined, LoadingOutlined } from '@ant-design/icons'+import { Loader2 } from 'lucide-react'import { Trash2 } from 'lucide-react'import { AccountPlatInfoMap } from '@/app/config/platConfig'import { getOssUrl } from '@/utils/oss'import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'import { Button } from '@/components/ui/button'--interface Channel {- id: string- name: string- platform: string- accountId: string- avatar?: string- fansCount?: number-}+import AccountStatusView from '@/app/[lng]/accounts/components/AccountsTopNav/components/AccountStatusView'+import { useTransClient } from '@/app/i18n/client'interface ChannelItemProps {- channel: Channel- onDelete: (channel: Channel) => void+ channel: SocialAccount+ onDelete: (channel: SocialAccount) => voiddeleteLoading?: string | null}export function ChannelItem({ channel, onDelete, deleteLoading }: ChannelItemProps) {- const platInfo = AccountPlatInfoMap.get(channel.platform as any)+ const platInfo = AccountPlatInfoMap.get(channel.type)const isDeleting = deleteLoading === channel.id+ const { t } = useTransClient("account");return (<div@@ -42,12 +37,14 @@ export function ChannelItem({ channel, onDelete, deleteLoading }: ChannelItemPro}`}><Avatar className="h-10 w-10 shrink-0">- <AvatarImage src={getOssUrl(channel.avatar)} alt={channel.name} />- <AvatarFallback>{channel.name[0]}</AvatarFallback>+ <AvatarImage src={getOssUrl(channel.avatar)} alt={channel.nickname} />+ <AvatarFallback>{channel.nickname?.[0] || channel.account?.[0]}</AvatarFallback></Avatar><div className="flex-1 min-w-0">- <div className="font-medium text-sm truncate">{channel.name}</div>+ <div className="font-medium text-sm truncate">+ {channel.nickname || channel.account}+ </div><div className="flex items-center gap-2 mt-1 flex-wrap">{platInfo?.icon && (<Image@@ -61,14 +58,10 @@ export function ChannelItem({ channel, onDelete, deleteLoading }: ChannelItemPro<span className="text-xs text-muted-foreground shrink-0">{platInfo?.name}</span>- {/* 状态显示 */}- <span className="flex items-center gap-1 text-xs text-green-600 shrink-0">- <div className="w-2 h-2 bg-green-600 rounded-full"></div>- 在线- </span>- {channel.fansCount !== undefined && (+ <AccountStatusView account={channel} />+ {channel.fansCount !== undefined && channel.fansCount !== null && (<span className="text-xs text-muted-foreground shrink-0">- 粉丝: {channel.fansCount}+ {t('channelManager.fans', { count: channel.fansCount })}</span>)}</div>@@ -76,7 +69,7 @@ export function ChannelItem({ channel, onDelete, deleteLoading }: ChannelItemPro{isDeleting ? (<div className="p-1">- <LoadingOutlined className="h-4 w-4 text-muted-foreground animate-spin" />+ <Loader2 className="h-4 w-4 text-muted-foreground animate-spin" /></div>) : (<Buttondiff --git a/project/web/src/components/ChannelManager/components/DeleteConfirmDialog.tsx b/project/web/src/components/ChannelManager/components/DeleteConfirmDialog.tsxindex 80947863..ead227f4 100644--- a/project/web/src/components/ChannelManager/components/DeleteConfirmDialog.tsx+++ b/project/web/src/components/ChannelManager/components/DeleteConfirmDialog.tsx@@ -20,6 +20,7 @@ import {AlertDialogHeader,AlertDialogTitle,} from '@/components/ui/alert-dialog'+import { Loader2 } from 'lucide-react'interface DeleteConfirmDialogProps {open: boolean@@ -48,12 +49,10 @@ export function DeleteConfirmDialog({{t('channelManager.deleteConfirm', '确认删除')}</AlertDialogTitle><AlertDialogDescription>- 确定要删除- {type === 'space' ? '空间' : '频道'}- {' '}- "- {name}- " 吗?此操作无法撤销。+ {t('channelManager.deleteDialogContent', {+ type: type === 'space' ? t('space') : t('channel'),+ name,+ })}</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>@@ -67,8 +66,8 @@ export function DeleteConfirmDialog({>{loading ? (<>- <LoadingOutlined className="h-4 w-4 mr-2 animate-spin" />- 删除中...+ <Loader2 className="h-4 w-4 mr-2 animate-spin" />+ {t('channelManager.deleting', '删除中...')}</>) : (t('common.confirm', '确认')diff --git a/project/web/src/components/ChannelManager/components/SpaceItem.tsx b/project/web/src/components/ChannelManager/components/SpaceItem.tsxindex 2de5413d..2bc1ffd0 100644--- a/project/web/src/components/ChannelManager/components/SpaceItem.tsx+++ b/project/web/src/components/ChannelManager/components/SpaceItem.tsx@@ -34,17 +34,9 @@ import {} from '@/components/ui/dropdown-menu'import { Input } from '@/components/ui/input'import { toast } from '@/lib/toast'+import type { SocialAccount } from '@/api/types/account.type'import { ChannelItem } from './ChannelItem'-interface Channel {- id: string- name: string- platform: string- accountId: string- avatar?: string- fansCount?: number-}-interface AccountGroup {id: stringname: string@@ -53,7 +45,7 @@ interface AccountGroup {interface SpaceItemProps {space: AccountGroup- channels: Channel[]+ channels: SocialAccount[]index: numbertotalSpaces: numberisCollapsed: boolean@@ -70,7 +62,7 @@ interface SpaceItemProps {onMoveUp?: () => voidonMoveDown?: () => voidonDelete: () => void- onChannelDelete: (channel: Channel) => void+ onChannelDelete: (channel: SocialAccount) => voidonRefresh: () => void}@@ -146,21 +138,16 @@ export function SpaceItem({<><div className="flex-1 min-w-0"><div className="font-medium text-sm">{space.name}</div>- {space.isDefault && (- <div className="text-xs text-muted-foreground">- {t('account.defaultSpace', '默认空间')}- </div>- )}</div><div className="text-xs text-muted-foreground shrink-0">- {channels.length} 个频道+ {t('channelManager.channelCount', { count: channels.length })}</div>{isSorting && (<div className="flex items-center gap-1 text-xs text-muted-foreground shrink-0">- <LoadingOutlined className="h-3 w-3 animate-spin" />- 排序中...+ <Loader2 className="h-3 w-3 animate-spin" />+ {t('channelManager.sorting', '排序中...')}</div>)}diff --git a/project/web/src/components/ChannelManager/components/UnifiedChannelSpaceList.tsx b/project/web/src/components/ChannelManager/components/UnifiedChannelSpaceList.tsxindex e8705860..83373920 100644--- a/project/web/src/components/ChannelManager/components/UnifiedChannelSpaceList.tsx+++ b/project/web/src/components/ChannelManager/components/UnifiedChannelSpaceList.tsx@@ -9,6 +9,7 @@'use client'+import type { SocialAccount } from '@/api/types/account.type'import { useCallback, useState } from 'react'import { useShallow } from 'zustand/react/shallow'import { deleteAccountApi, deleteAccountGroupApi, updateAccountGroupApi } from '@/api/account'@@ -22,16 +23,6 @@ import { SpaceItem } from './SpaceItem'import { DeleteConfirmDialog } from './DeleteConfirmDialog'import { SpaceListSkeleton } from './SpaceListSkeleton'-// 频道数据类型-interface Channel {- id: string- name: string- platform: string- accountId: string- avatar?: string- fansCount?: number-}-export function UnifiedChannelSpaceList() {const { t } = useTransClient('account')const {@@ -182,19 +173,10 @@ export function UnifiedChannelSpaceList() {}, [accountGroupList, getAccountGroup, t, sortingSpaceLoading])// 获取空间下的频道- const getChannelsInSpace = useCallback((spaceId: string): Channel[] => {+ const getChannelsInSpace = useCallback((spaceId: string): SocialAccount[] => {// TODO: 从API获取真实频道数据// 暂时返回模拟数据- return accountList- .filter(account => account.groupId === spaceId)- .map(account => ({- id: account.id,- name: account.nickname || account.account,- platform: account.type || 'unknown',- accountId: account.account,- avatar: account.avatar,- fansCount: account.fansCount,- }))+ return accountList.filter(account => account.groupId === spaceId)}, [accountList])if (accountLoading) {@@ -240,11 +222,11 @@ export function UnifiedChannelSpaceList() {id: space.id,name: space.name,})}- onChannelDelete={(channel: Channel) => setDeleteDialog({+ onChannelDelete={(channel: SocialAccount) => setDeleteDialog({open: true,type: 'channel',id: channel.id,- name: channel.name,+ name: channel.nickname,})}onRefresh={getAccountGroup}/>diff --git a/project/web/src/components/common/LoginModal/index.tsx b/project/web/src/components/common/LoginModal/index.tsxindex 87830261..a6d2f23d 100644--- a/project/web/src/components/common/LoginModal/index.tsx+++ b/project/web/src/components/common/LoginModal/index.tsx@@ -70,7 +70,7 @@ export function LoginModal({onSuccess: propOnSuccess,useGlobalStore = false,}: ILoginModalProps) {- const { setToken, setUserInfo } = useUserStore()+ const { setToken, setUserInfo, appInit } = useUserStore()const { t } = useTransClient('login')// 全局 store 状态@@ -140,6 +140,7 @@ export function LoginModal({toast.success(t('loginSuccess'))handleClose()handleSuccess()+ appInit();}// 处理邮箱登录diff --git a/project/web/src/store/user.ts b/project/web/src/store/user.tsindex a1986a3b..6610d978 100644--- a/project/web/src/store/user.ts+++ b/project/web/src/store/user.ts@@ -5,6 +5,7 @@ import { PublishDatePickerType } from '@/components/PublishDialog/compoents/Publimport { createPersistStore } from '@/utils/createPersistStore'import lodash from "lodash";import { useAccountStore } from '.'+import { useDataStatisticsStore } from '@/app/[lng]/dataStatistics/useDataStatistics'export interface UserInfo {createTime: string@@ -102,6 +103,12 @@ export const useUserStore = createPersistStore(set({ userInfo })},+ appInit() {+ useDataStatisticsStore.getState().init();+ methods.getUserInfo();+ useAccountStore.getState().accountInit();+ },+// 获取用户信息async getUserInfo() {const res = await getUserInfoApi()