Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 账户国际化及添加源信息、删除不需要的代码、账户组接入新增接口
gaoSir8937eb3cf8bd
diff --git a/@types/resources.d.ts b/@types/resources.d.tsindex e8a3ed8a..e1bec60f 100644--- a/@types/resources.d.ts+++ b/@types/resources.d.ts@@ -1,83 +1,87 @@interface Resources {- common: {- profile: "个人中心";- logout: "退出登录";- unknownUser: "未知用户";- login: "登录";- };- demo: {- demoText: "测试文字";- title: "测试页面标题";- };+ "account": {+ "title": "账户",+ "describe": "账户页面"+ },+ "common": {+ "profile": "个人中心",+ "logout": "退出登录",+ "unknownUser": "未知用户",+ "login": "登录"+ },+ "demo": {+ "demoText": "测试文字",+ "title": "测试页面标题"+ },"hot-content": {- all: "全部";- loading: "加载中...";- noData: "暂无数据";- rank: "排名";- cover: "封面";- title: "标题";- author: "作者";- category: "分类";- likes: "点赞";- shares: "分享";- comments: "评论数";- collections: "收藏数";- publishTime: "发布于";- fans: "粉丝";- viewMore: "查看更多";- timeRange: "时间范围";- filter: "筛选";- hotTopics: "热门专题";- viralTitles: "爆款标题";- topics: "专题";- engagement: "互动量";- rising: "热";- noHotTopics: "暂无热点数据";- noViralTitles: "暂无爆款标题数据";- noTopicData: "暂无专题数据";- total: "共";- items: "条";- video: "视频";- noImage: "暂无图片";- platform: "平台";- hotEvents: "热点事件";- hotContent: "热点内容";- };- login: {- welcomeBack: "哎呦赚";- emailPlaceholder: "邮箱";- passwordPlaceholder: "密码";- login: "登录";- or: "或";- forgotPassword: "忘记密码?";- completeRegistration: "完成注册";- setPassword: "设置密码";- passwordRequired: "请输入密码";- passwordMinLength: "密码长度不能小于6位";- enterPassword: "请输入密码";- inviteCode: "邀请码(选填)";- enterInviteCode: "请输入邀请码";- waitingForActivation: "等待激活中...";- loginSuccess: "登录成功";- loginFailed: "登录失败";- loginError: "登录失败,请稍后重试";- activationEmailSent: "激活链接已发送至邮箱,请查收并点击激活";- registerSuccess: "注册成功,已自动登录";- checkStatusError: "检查注册状态失败";- registerError: "注册失败,请稍后重试";- googleLoginFailed: "Google 登录失败";- };- route: {- home: "首页";- accounts: "账户";- publish: "发布";- hotContent: "热门内容";- hotContentNew: "热门内容新";- };- translation: {- title: "AIToEarn官方网站";- content: "最好用的开源矩阵工具";- };+ "all": "全部",+ "loading": "加载中...",+ "noData": "暂无数据",+ "rank": "排名",+ "cover": "封面",+ "title": "标题",+ "author": "作者",+ "category": "分类",+ "likes": "点赞",+ "shares": "分享",+ "comments": "评论数",+ "collections": "收藏数",+ "publishTime": "发布于",+ "fans": "粉丝",+ "viewMore": "查看更多",+ "timeRange": "时间范围",+ "filter": "筛选",+ "hotTopics": "热门专题",+ "viralTitles": "爆款标题",+ "topics": "专题",+ "engagement": "互动量",+ "rising": "热",+ "noHotTopics": "暂无热点数据",+ "noViralTitles": "暂无爆款标题数据",+ "noTopicData": "暂无专题数据",+ "total": "共",+ "items": "条",+ "video": "视频",+ "noImage": "暂无图片",+ "platform": "平台",+ "hotEvents": "热点事件",+ "hotContent": "热点内容"+ },+ "login": {+ "welcomeBack": "哎呦赚",+ "emailPlaceholder": "邮箱",+ "passwordPlaceholder": "密码",+ "login": "登录",+ "or": "或",+ "forgotPassword": "忘记密码?",+ "completeRegistration": "完成注册",+ "setPassword": "设置密码",+ "passwordRequired": "请输入密码",+ "passwordMinLength": "密码长度不能小于6位",+ "enterPassword": "请输入密码",+ "inviteCode": "邀请码(选填)",+ "enterInviteCode": "请输入邀请码",+ "waitingForActivation": "等待激活中...",+ "loginSuccess": "登录成功",+ "loginFailed": "登录失败",+ "loginError": "登录失败,请稍后重试",+ "activationEmailSent": "激活链接已发送至邮箱,请查收并点击激活",+ "registerSuccess": "注册成功,已自动登录",+ "checkStatusError": "检查注册状态失败",+ "registerError": "注册失败,请稍后重试",+ "googleLoginFailed": "Google 登录失败"+ },+ "route": {+ "home": "首页",+ "accounts": "账户",+ "publish": "发布",+ "hotContent": "热门内容",+ "hotContentNew": "热门内容新"+ },+ "translation": {+ "title": "AIToEarn官方网站",+ "content": "最好用的开源矩阵工具"+ }}export default Resources;diff --git a/src/api/account.ts b/src/api/account.tsindex 66e212b0..7634cac1 100644--- a/src/api/account.ts+++ b/src/api/account.ts@@ -39,13 +39,20 @@ export const deleteAccountApi = (id: number) => {return sxRequest.post<SocialAccount>(`account/delete/${id}`);};+// 删除多个账户+export const deleteAccountsApi = (ids: number[]) => {+ return sxRequest.post<SocialAccount>("account/deletes", {+ ids,+ });+};+// 创建账户组export const createAccountGroupApi = (data: Partial<AccountGroupItem>) => {return sxRequest.post("accountGroup/create", data);};// 更新账户组-export const updateAccountGroupApi = (data: AccountGroupItem) => {+export const updateAccountGroupApi = (data: Partial<AccountGroupItem>) => {return sxRequest.post("accountGroup/update", data);};diff --git a/src/api/types/account.type.ts b/src/api/types/account.type.tsindex 06d31030..6f79d5f7 100644--- a/src/api/types/account.type.ts+++ b/src/api/types/account.type.ts@@ -41,6 +41,6 @@ export interface UpdateAccountStatisticsParams {// 账户组 item 数据export interface AccountGroupItem {id: number;- name: number;+ name: string;rank: number;}diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scssindex 0c64d2c6..0c56147b 100644--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss@@ -119,7 +119,7 @@border: none;background: transparent;.ant-collapse-content-box {- padding: 0;+ padding: 0 !important;}.ant-collapse-header {background: transparent;diff --git a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsxindex 3aa15046..49ca5dfb 100644--- a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx+++ b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx@@ -9,6 +9,7 @@ import {} from "react";import {Avatar,+ Button,Drawer,message,Modal,@@ -30,6 +31,7 @@ import { SocialAccount } from "@/api/types/account.type";import { AccountPlatInfoMap } from "@/app/config/platConfig";import { AccountStatus } from "@/app/config/accountConfig";import AvatarPlat from "@/components/AvatarPlat";+import { deleteAccountsApi } from "@/api/account";export interface IUserManageModalRef {setActiveGroup: (groupId: number) => void;@@ -90,6 +92,7 @@ const UserManageModal = memo(const [activeGroup, setActiveGroup] = useState(allUser.current);// 是否改变了顺序const isUpdateRank = useRef(false);+ const [deleteLoading, setDeleteLoading] = useState(false);const columns = useMemo(() => {const columns: TableProps<SocialAccount>["columns"] = [@@ -233,21 +236,34 @@ const UserManageModal = memo(return (<><Modal- centeredopen={deleteHitOpen}title="删除提示"width={500}zIndex={1002}- onCancel={() => setDeleteHitOpen(false)}rootClassName={styles.userManageDeleteHitModal}- onOk={async () => {- // TODO 删除- // await icpDeleteAccounts(selectedRows.map((v) => v.id));- // await getAccountList();- // setDeleteHitOpen(false);- // setSelectedRows([]);- // message.success("删除成功");- }}+ footer={+ <>+ <Button onClick={() => setDeleteHitOpen(false)}>取消</Button>+ <Button+ type="primary"+ loading={deleteLoading}+ onClick={async () => {+ setDeleteLoading(true);+ const res = await deleteAccountsApi(+ selectedRows.map((v) => v.id),+ );+ if (!res) return setDeleteLoading(false);+ await getAccountList();+ setDeleteHitOpen(false);+ setSelectedRows([]);+ message.success("删除成功");+ setDeleteLoading(false);+ }}+ >+ 确认+ </Button>+ </>+ }><p>是否删除以下diff --git a/src/app/[lng]/accounts/components/AccountSidebar/UserManageSidebar.tsx b/src/app/[lng]/accounts/components/AccountSidebar/UserManageSidebar.tsxindex 52a26fdf..a4e0f6c8 100644--- a/src/app/[lng]/accounts/components/AccountSidebar/UserManageSidebar.tsx+++ b/src/app/[lng]/accounts/components/AccountSidebar/UserManageSidebar.tsx@@ -1,14 +1,11 @@import { ForwardedRef, forwardRef, memo, useRef, useState } from "react";-import { Button, Input, message, Modal } from "antd";-import {- ExclamationCircleFilled,- PlusOutlined,- UnorderedListOutlined,-} from "@ant-design/icons";+import { Button, Input, Modal } from "antd";+import { PlusOutlined, UnorderedListOutlined } from "@ant-design/icons";import { useAccountStore } from "@/store/account";import { useShallow } from "zustand/react/shallow";import styles from "./AccountSidebar.module.scss";import { ReactSortable } from "react-sortablejs";+import { createAccountGroupApi, updateAccountGroupApi } from "@/api/account";export interface IUserManageSidebarRef {}@@ -68,17 +65,16 @@ const UserManageSidebar = memo(disabled={groupName.length === 0}onClick={async () => {setCreateGroupLoading(true);- // TODO 用户组新增和编辑- // if (createGroupId === -1) {- // await icpAddAccountGroup({- // name: groupName,- // });- // } else {- // await icpEditDeleteAccountGroup({- // name: groupName,- // id: createGroupId,- // });- // }+ if (createGroupId === -1) {+ await createAccountGroupApi({+ name: groupName,+ });+ } else {+ await updateAccountGroupApi({+ name: groupName,+ id: createGroupId,+ });+ }await getAccountGroup();setCreateGroupLoading(false);diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/AccountLoginLyaout/accountLoginLyaout.module.scss b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/AccountLoginLyaout/accountLoginLyaout.module.scssdeleted file mode 100644index e7c8e039..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/AccountLoginLyaout/accountLoginLyaout.module.scss+++ /dev/null@@ -1,68 +0,0 @@-.accountLoginLyaout {- :global {- .ant-spin-container {- display: flex;- }- .accountLoginLyaout-right, .accountLoginLyaout-left {- height: 400px;- display: flex;- flex-direction: column;- width: 50%;- }- .accountLoginLyaout-left {- align-items: center;- justify-content: center;- &-qRCode {- width: 156px;- height: 156px;- padding: 10px;- background: var(--grayColor0);- position: relative;- img {- border-radius: 7px;- width: 100%;- height: 100%;- }- &-expire {- position: absolute;- width: 100%;- height: 100%;- top: 0;- left: 0;- background: rgba(255, 255, 255, 0.9);- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- span {- font-weight: 900;- color: var(--error-color);- }- a {- margin-top: 5px;- }- }- }- &-tips {- margin-top: 20px;- color: var(--grayColor8);- font-size: var(--fs-md);- }- }- .accountLoginLyaout-right {- padding: 40px 40px 0;- border-left: 1px solid var(--grayColor2);- h2 {- font-size: var(--fs-lg);- text-align: center;- margin-bottom: 40px;- }- input {- height: 40px;- }- .ant-form {- width: 100%;- }- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/AccountLoginLyaout/index.tsx b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/AccountLoginLyaout/index.tsxdeleted file mode 100644index 0e047b41..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/AccountLoginLyaout/index.tsx+++ /dev/null@@ -1,140 +0,0 @@-"use client";--import { ForwardedRef, forwardRef, memo } from "react";-import styles from "./accountLoginLyaout.module.scss";-import { Button, Form, Input, Spin } from "antd";-import { phoneReg } from "@/utils/regulars";-import GetCode from "@/components/GetCode/GetCode";--export interface IAccountLoginInfo {- phone: string;- code: string;-}--export interface IAccountLoginLyaoutRef {}--export interface IAccountLoginLyaoutProps {- // 整体loading- loading?: boolean;- // 获取二维码loading- qRCodeLoading: boolean;- // 二维码是否过期- isQRCodeExpire?: boolean;- // 二维码过期后刷新二维码- onFlushQRCode?: () => void;- // 二维码URL- qRCodeUrl: string;- // 二维码提示信息- qRCodeTips?: string;- // 手机号登录配置- phoneConfig?: {- // 下次发送验证码时间- codeSendTime: number;- // 点击验证码发送事件- onCodeSend: (phone: string) => void;- // 点击登录事件- onLogin: (p: IAccountLoginInfo) => void;- // 登录loding- loading: boolean;- };-}--const AccountLoginLyaout = memo(- forwardRef(- (- {- qRCodeTips,- qRCodeUrl,- phoneConfig,- isQRCodeExpire = false,- qRCodeLoading,- onFlushQRCode,- loading = false,- }: IAccountLoginLyaoutProps,- ref: ForwardedRef<IAccountLoginLyaoutRef>,- ) => {- const [form] = Form.useForm();-- return (- <Spin wrapperClassName={styles.accountLoginLyaout} spinning={loading}>- <div className="accountLoginLyaout-left">- <Spin- spinning={qRCodeLoading}- wrapperClassName="accountLoginLyaout-left-qRCode"- >- {qRCodeUrl && <img src={qRCodeUrl} />}- {isQRCodeExpire && (- <div className="accountLoginLyaout-left-qRCode-expire">- <span>二维码已过期</span>- <a onClick={onFlushQRCode}>点击刷新</a>- </div>- )}- </Spin>- {qRCodeTips && (- <p className="accountLoginLyaout-left-tips">{qRCodeTips}</p>- )}- </div>- {phoneConfig && (- <div className="accountLoginLyaout-right">- <h2>手机号登录</h2>- <Form- form={form}- onFinish={(params) => {- phoneConfig!.onLogin(params);- }}- >- <Form.Item<IAccountLoginInfo>- name="phone"- rules={[- { required: true, message: "请输入手机号" },- {- pattern: phoneReg,- message: "手机号格式错误,请重新输入",- },- ]}- >- <Input placeholder="请输入您的手机号码" />- </Form.Item>-- <div style={{ position: "relative", height: "40px" }}>- <Form.Item<IAccountLoginInfo>- name="code"- rules={[{ required: true, message: "验证码不能为空" }]}- >- <Input placeholder="请输入您的验证码" />- </Form.Item>- <GetCode- codeSendTime={phoneConfig!.codeSendTime}- onGetCode={async (unlock) => {- const validateRes = await form- .validateFields(["phone"])- .catch(() => unlock());- if (!validateRes) return;- phoneConfig!.onCodeSend(form.getFieldValue("phone"));- }}- />- </div>-- <Form.Item- wrapperCol={{ offset: 0 }}- style={{ marginTop: "50px" }}- >- <Button- htmlType="submit"- type="primary"- style={{ width: "100%", padding: "18px 0" }}- loading={phoneConfig.loading}- >- 登录- </Button>- </Form.Item>- </Form>- </div>- )}- </Spin>- );- },- ),-);--export default AccountLoginLyaout;diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.type.ts b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.type.tsdeleted file mode 100644index 507da46e..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.type.ts+++ /dev/null@@ -1,8 +0,0 @@-import { SocialAccount } from "@/api/types/account.type";--export interface IAccountLoginPlatProps {- // 登录成功- onLoginSuccess: (accountInfo: null | Partial<SocialAccount>) => void;- // 代理地址- proxy?: string;-}diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.utils.ts b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.utils.tsdeleted file mode 100644index 55557565..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.utils.ts+++ /dev/null@@ -1,22 +0,0 @@-import { Cookie } from "undici-types";--export function parseCookieString(cookieString: string): Cookie[] {- return cookieString- .split(";")- .map((pair) => pair.trim())- .filter(Boolean)- .map((pair) => {- const eqIndex = pair.indexOf("=");- let name = "",- value = "";- if (eqIndex !== -1) {- name = pair.slice(0, eqIndex).trim();- value = pair.slice(eqIndex + 1).trim();- } else {- name = pair.trim();- value = "";- }- return { name, value } as Cookie;- })- .filter((cookie) => cookie.value !== ""); // 过滤掉 value 为空字符串的-}diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/index.tsx b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/index.tsxdeleted file mode 100644index 549cdc80..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/index.tsx+++ /dev/null@@ -1,161 +0,0 @@-"use client";--import {- ForwardedRef,- forwardRef,- memo,- useEffect,- useMemo,- useState,-} from "react";-import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";-import DouyinLogin from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/DouyinLogin";-import WxSphLogin from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/WxSphLogin";-import XhsLogin from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/XhsLogin";-import { Button, message, Modal, Steps, Switch, Tooltip } from "antd";-import KwaiLogin from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/KwaiLogin";-import styles from "./styles/accountLogin.module.scss";-import { useShallow } from "zustand/react/shallow";-import { useUserStore } from "@/store/user";-import { QuestionCircleOutlined } from "@ant-design/icons";-import ProxyInput, {- verifyProxy,-} from "@/app/[lng]/accounts/components/ProxyInput";--export interface IAccountLoginRef {}--export interface IAccountLoginProps {- plat: PlatType;- open: boolean;- onLoginSuccess: (cookie: string) => void;- onCancel: () => void;-}--const AccountLogin = memo(- forwardRef(- (- { plat, open, onLoginSuccess, onCancel }: IAccountLoginProps,- ref: ForwardedRef<IAccountLoginRef>,- ) => {- const { setIsAddAccountPorxy, isAddAccountPorxy } = useUserStore(- useShallow((state) => ({- setIsAddAccountPorxy: state.setIsAddAccountPorxy,- isAddAccountPorxy: state.isAddAccountPorxy,- })),- );- const platInfo = useMemo(() => {- return (- AccountPlatInfoMap.get(plat) ||- AccountPlatInfoMap.get(PlatType.Douyin)!- );- }, [plat]);- // 代理地址- const [proxy, setProxy] = useState("");- // 步骤- const [currStep, setCurrStep] = useState(0);- const [verifyProxyLoading, setVerifyProxyLoading] = useState(false);-- useEffect(() => {- if (isAddAccountPorxy) {- setCurrStep(0);- } else {- setCurrStep(1);- }- }, [isAddAccountPorxy]);-- const Plat = useMemo(() => {- switch (plat) {- case PlatType.Douyin:- return DouyinLogin;- case PlatType.WxSph:- return WxSphLogin;- case PlatType.Xhs:- return XhsLogin;- case PlatType.KWAI:- return KwaiLogin;- }- }, [plat]);-- return (- <>- <Modal- title={- <div className={styles.ALModaltitle}>- <span className="ALModaltitle-title">{platInfo.name}登录</span>- <div className="ALModaltitle-switch">- <span>- 是否开启代理- <Tooltip title="开启后下次进入页面默认会为开启状态">- <QuestionCircleOutlined />- </Tooltip>- </span>- <Switch- value={isAddAccountPorxy}- onChange={(e) => setIsAddAccountPorxy(e)}- />- </div>- </div>- }- open={open}- onCancel={onCancel}- footer={null}- width={800}- >- {isAddAccountPorxy && (- <Steps- style={{ marginTop: "20px" }}- current={currStep}- items={[- {- title: "设置代理地址",- },- {- title: "登录",- },- ]}- />- )}-- {currStep === 0 ? (- <>- <ProxyInput onChange={(e) => setProxy(e)} />- <div style={{ display: "flex", justifyContent: "right" }}>- <Button- type="primary"- style={{ width: "200px", padding: "16px 0" }}- loading={verifyProxyLoading}- onClick={async () => {- setVerifyProxyLoading(true);- const verifyRes = await verifyProxy(proxy);- setVerifyProxyLoading(false);- if (verifyRes) {- setCurrStep(1);- } else {- return message.error("代理地址不可用,无法添加账户!");- }- }}- >- 下一步- </Button>- </div>- </>- ) : (- <>- <Plat- proxy={isAddAccountPorxy ? proxy : ""}- onLoginSuccess={(accountInfo) => {- if (accountInfo) {- console.log("登录", accountInfo);- }- }}- />- </>- )}- </Modal>- </>- );- },- ),-);--export default AccountLogin;diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/DouyinLogin.tsx b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/DouyinLogin.tsxdeleted file mode 100644index e77acc32..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/DouyinLogin.tsx+++ /dev/null@@ -1,16 +0,0 @@-"use client";--import { ForwardedRef, forwardRef, memo } from "react";-import { IAccountLoginPlatProps } from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.type";--export interface IDouyinLoginRef {}--const DouyinLogin = memo(- forwardRef(- ({}: IAccountLoginPlatProps, ref: ForwardedRef<IDouyinLoginRef>) => {- return <div></div>;- },- ),-);--export default DouyinLogin;diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/KwaiLogin.tsx b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/KwaiLogin.tsxdeleted file mode 100644index 22cac04f..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/KwaiLogin.tsx+++ /dev/null@@ -1,14 +0,0 @@-"use client";--import { ForwardedRef, forwardRef, memo } from "react";-import { IAccountLoginPlatProps } from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.type";--export interface IKwaiLoginRef {}--const KwaiLogin = memo(- forwardRef(({}: IAccountLoginPlatProps, ref: ForwardedRef<IKwaiLoginRef>) => {- return <div></div>;- }),-);--export default KwaiLogin;diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/WxSphLogin.tsx b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/WxSphLogin.tsxdeleted file mode 100644index c1df8b69..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/WxSphLogin.tsx+++ /dev/null@@ -1,16 +0,0 @@-"use client";--import { ForwardedRef, forwardRef, memo } from "react";-import { IAccountLoginPlatProps } from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.type";--export interface IWxSphLoginRef {}--const WxSphLogin = memo(- forwardRef(- ({}: IAccountLoginPlatProps, ref: ForwardedRef<IWxSphLoginRef>) => {- return <div></div>;- },- ),-);--export default WxSphLogin;diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/XhsLogin.tsx b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/XhsLogin.tsxdeleted file mode 100644index 8c8da8b4..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/plats/XhsLogin.tsx+++ /dev/null@@ -1,181 +0,0 @@-"use client";--import {- ForwardedRef,- forwardRef,- memo,- useEffect,- useRef,- useState,-} from "react";-import { IAccountLoginPlatProps } from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.type";-import styles from "../styles/xhsLogin.module.scss";-import { requestPlatApi } from "@/utils/otherRequest";-import AccountLoginLyaout from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/AccountLoginLyaout";-import { message } from "antd";-import { sleep } from "@/utils/general";-import { parseCookieString } from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin/accountLogin.utils";-import { PlatXhs } from "@/app/plat/platChildren/xhs/PlatXhs";--export interface IXhsLoginRef {}--const XhsLogin = memo(- forwardRef(- (- { proxy, onLoginSuccess }: IAccountLoginPlatProps,- ref: ForwardedRef<IXhsLoginRef>,- ) => {- const [qsImg, setQsImg] = useState("");- const [qRCodeLoading, setQRCodeLoading] = useState(false);- const [isQRCodeExpire, setIsQRCodeExpire] = useState(false);- const [loginLoading, setLoginLoading] = useState(false);- const sendCodeResRef = useRef<any>(null);- // 停止轮询的方法- const stopPolling = useRef<() => void>(() => {});- const [getUserInfoLoding, setGetUserInfoLoding] = useState(false);-- useEffect(() => {- getLoginQRCode();-- return () => {- stopPolling.current();- };- }, []);-- // 获取登录二维码- const getLoginQRCode = async () => {- setIsQRCodeExpire(false);- stopPolling.current();-- setQRCodeLoading(true);- const loginQrCodeRes = await requestPlatApi({- url: "xhs/login_qr_code",- method: "POST",- data: {- proxy: proxy,- },- }).catch((err) => {- setQRCodeLoading(false);- message.error(`${err}`);- });-- if (qRCodeLoading) return;- setQRCodeLoading(false);- setQsImg(- "data:image/png;base64," +- loginQrCodeRes.data.response_body.data.base64_qr_code,- );-- let isStopPolling = false;- stopPolling.current = () => {- isStopPolling = true;- };- while (true) {- if (isStopPolling) break;- const res = await requestPlatApi({- url: "xhs/check_login",- method: "POST",- data: {- proxy: proxy,- qr_id: loginQrCodeRes.data.response_body.data.qr_id,- code: loginQrCodeRes.data.response_body.data.code,- cookie: loginQrCodeRes.data.response_body.data.cookie,- },- });- const status = res.data.response_body.data.code_status;- // 验证码过期- if (status === 3) {- setIsQRCodeExpire(true);- break;- }- // 验证码登录成功- if (status === 2) {- loginSuccess(res.data.response_body.cookie);- break;- }- await sleep(2000);- }- };-- const loginSuccess = async (cookie: string) => {- setGetUserInfoLoding(true);- const platXhs = new PlatXhs({- cookieList: parseCookieString(cookie),- proxy: proxy,- });- const accountInfo = await platXhs.getAccountInfo();- setGetUserInfoLoding(false);- onLoginSuccess(accountInfo);- };-- return (- <div className={styles.xhsLogin}>- <AccountLoginLyaout- qRCodeLoading={qRCodeLoading}- qRCodeUrl={qsImg}- phoneConfig={{- codeSendTime: 180,- onCodeSend: async (phone: string) => {- sendCodeResRef.current = await requestPlatApi({- url: "xhs/send_code",- method: "POST",- data: {- proxy: proxy,- mobile: phone,- },- });- if (sendCodeResRef.current.data.response_body.code === -1) {- message.error(sendCodeResRef.current.data.response_body.msg);- }- },- onLogin: async (params) => {- setLoginLoading(true);-- const checkCodeRes = await requestPlatApi({- url: "xhs/check_code",- method: "POST",- data: {- proxy: proxy,- code: params.code,- mobile: params.phone,- cookie: sendCodeResRef.current?.data?.cookie || "",- },- });-- if (checkCodeRes?.data?.response_body?.code !== 0) {- setLoginLoading(false);- return message.error("验证码错误,请稍后重试!");- }-- const loginCodeRes = await requestPlatApi({- url: "xhs/login_code",- method: "POST",- data: {- proxy: proxy,- mobile_token:- checkCodeRes.data.response_body.data.mobile_token,- mobile: params.phone,- cookie: sendCodeResRef.current?.data?.cookie || "",- },- });- if (loginCodeRes.data.response_body.code !== 0) {- setLoginLoading(false);- return message.error(loginCodeRes.msg);- }- setLoginLoading(false);- loginSuccess(loginCodeRes.data.response_body.cookie);- },- loading: loginLoading,- }}- qRCodeTips="可用小红书或微信扫码"- isQRCodeExpire={isQRCodeExpire}- onFlushQRCode={getLoginQRCode}- loading={getUserInfoLoding}- />- </div>- );- },- ),-);--export default XhsLogin;diff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/styles/accountLogin.module.scss b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/styles/accountLogin.module.scssdeleted file mode 100644index 7f660e56..00000000--- a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/styles/accountLogin.module.scss+++ /dev/null@@ -1,20 +0,0 @@-.ALModaltitle {- display: flex;- align-items: center;- :global {- .ALModaltitle-title {- display: block;- margin-right: 10px;- }- .ALModaltitle-switch {- display: flex;- align-items: center;- & > span {- font-weight: 400;- font-size: var(--fs-xs);- display: block;- margin-right: 5px;- }- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/styles/xhsLogin.module.scss b/src/app/[lng]/accounts/components/AddAccountModal/AccountLogin/styles/xhsLogin.module.scssdeleted file mode 100644index e69de29b..00000000diff --git a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/src/app/[lng]/accounts/components/AddAccountModal/index.tsxindex 821862f6..3441aa7a 100644--- a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx+++ b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx@@ -3,7 +3,6 @@ import styles from "./AddAccountModal.module.scss";import { Button, Modal, Tooltip } from "antd";import { AccountPlatInfoArr, PlatType } from "@/app/config/platConfig";import { SocialAccount } from "@/api/types/account.type";-import AccountLogin from "@/app/[lng]/accounts/components/AddAccountModal/AccountLogin";export interface IAddAccountModalRef {}@@ -32,17 +31,6 @@ const AddAccountModal = memo(return (<>- {addPlat && (- <AccountLogin- open={accountLoginOpen}- plat={addPlat!}- onLoginSuccess={(cookie) => {- console.log("登录完成:", cookie);- }}- onCancel={() => setAccountLoginOpen(false)}- />- )}-<Modaltitle="账号添加"open={open}diff --git a/src/app/[lng]/accounts/page.tsx b/src/app/[lng]/accounts/page.tsxindex 4c34cb8a..00716d8a 100644--- a/src/app/[lng]/accounts/page.tsx+++ b/src/app/[lng]/accounts/page.tsx@@ -1,4 +1,19 @@import AccountPageCore from "@/app/[lng]/accounts/accountCore";+import { PageParams } from "@/app/globals";+import { useTranslation } from "@/app/i18n";+import { getMetadata } from "@/utils/general";++export async function generateMetadata({ params }: PageParams) {+ const { lng } = await params;+ const { t } = await useTranslation(lng, "account");+ return await getMetadata(+ {+ title: t("title"),+ description: t("describe"),+ },+ lng,+ );+}export default function Page() {return <AccountPageCore />;diff --git a/src/app/[lng]/layout.tsx b/src/app/[lng]/layout.tsxindex cd78687b..51167ff6 100644--- a/src/app/[lng]/layout.tsx+++ b/src/app/[lng]/layout.tsx@@ -18,8 +18,7 @@ export async function generateMetadata({const { t } = await useTranslation(lng);return {title: t("title"),- // @ts-ignore- content: t("content"),+ description: t("content"),};}diff --git a/src/app/i18n/locales/en/account.json b/src/app/i18n/locales/en/account.jsonnew file mode 100644index 00000000..8ee1f4d6--- /dev/null+++ b/src/app/i18n/locales/en/account.json@@ -0,0 +1,4 @@+{+ "title": "account",+ "describe": "account Page"+}\ No newline at end of filediff --git a/src/app/i18n/locales/zh-CN/account.json b/src/app/i18n/locales/zh-CN/account.jsonnew file mode 100644index 00000000..3b10e78e--- /dev/null+++ b/src/app/i18n/locales/zh-CN/account.json@@ -0,0 +1,4 @@+{+ "title": "账户",+ "describe": "账户页面"+}\ No newline at end of filediff --git a/src/app/var.css b/src/app/var.cssindex 7c444be7..85ad3141 100644--- a/src/app/var.css+++ b/src/app/var.css@@ -77,4 +77,8 @@--error-color: #ef4444;/* 成功色 */--success-color: #10b981;+ /* 错误颜色 */+ --errorColor: var(--error-color);+ /* 成功色 */+ --successColor: var(--success-color);}