Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 恢复选择账户弹框
gaoSir27257b586b20
diff --git a/.idea/workspace.xml b/.idea/workspace.xmlindex 1d3511ea..f98f0061 100644--- a/.idea/workspace.xml+++ b/.idea/workspace.xml@@ -4,12 +4,13 @@<option name="autoReloadType" value="SELECTIVE" /></component><component name="ChangeListManager">- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="fix(日历): 删除最佳时间">- <change afterPath="$PROJECT_DIR$/src/app/demo111/page.tsx" afterDir="false" />+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="chore: 测试静态站点">+ <change afterPath="$PROJECT_DIR$/src/components/ChooseAccountModule/ChooseAccountModule.tsx" afterDir="false" />+ <change afterPath="$PROJECT_DIR$/src/components/ChooseAccountModule/chooseAccountModule.module.scss" afterDir="false" />+ <change afterPath="$PROJECT_DIR$/src/components/ChooseAccountModule/components/PlatChoose.tsx" afterDir="false" /><change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />- <change beforePath="$PROJECT_DIR$/next-sitemap.config.js" beforeDir="false" afterPath="$PROJECT_DIR$/next-sitemap.config.js" afterDir="false" />- <change beforePath="$PROJECT_DIR$/public/robots.txt" beforeDir="false" afterPath="$PROJECT_DIR$/public/robots.txt" afterDir="false" /></list>+ <list id="46060a5d-0c4f-44c0-b456-d80eb5b8a41b" name="选择用户弹框恢复" comment="选择用户弹框恢复" /><option name="SHOW_DIALOG" value="false" /><option name="HIGHLIGHT_CONFLICTS" value="true" /><option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />@@ -42,38 +43,38 @@<option name="hideEmptyMiddlePackages" value="true" /><option name="showLibraryContents" value="true" /></component>- <component name="PropertiesComponent">{- "keyToString": {- "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",- "git-widget-placeholder": "master",- "ignore.virus.scanning.warn.message": "true",- "last_opened_file_path": "E:/project-dev/web/艺咖/aitoearn-web/src/api/plat",- "node.js.detected.package.eslint": "true",- "node.js.detected.package.tslint": "true",- "node.js.selected.package.eslint": "(autodetect)",- "node.js.selected.package.tslint": "(autodetect)",- "nodejs_package_manager_path": "npm",- "settings.editor.selected.configurable": "Code Search",- "ts.external.directory.path": "E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib",- "vue.rearranger.settings.migration": "true"+ <component name="PropertiesComponent"><![CDATA[{+ "keyToString": {+ "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",+ "git-widget-placeholder": "master",+ "ignore.virus.scanning.warn.message": "true",+ "last_opened_file_path": "E:/project-dev/web/艺咖/aitoearn-web/src/components",+ "node.js.detected.package.eslint": "true",+ "node.js.detected.package.tslint": "true",+ "node.js.selected.package.eslint": "(autodetect)",+ "node.js.selected.package.tslint": "(autodetect)",+ "nodejs_package_manager_path": "npm",+ "settings.editor.selected.configurable": "Code Search",+ "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>@@ -88,6 +89,7 @@</component><component name="RecentsManager"><key name="MoveFile.RECENT_KEYS">+ <recent name="E:\project-dev\web\艺咖\aitoearn-web\src\components" /><recent name="E:\project-dev\web\艺咖\aitoearn-web\src\api\plat" /></key></component>@@ -95,6 +97,7 @@<component name="TaskManager"><task active="true" id="Default" summary="默认任务"><changelist id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="" />+ <changelist id="46060a5d-0c4f-44c0-b456-d80eb5b8a41b" name="选择用户弹框恢复" comment="" /><created>1751977665735</created><option name="number" value="Default" /><option name="presentableId" value="Default" />@@ -110,7 +113,7 @@<workItem from="1752498765091" duration="2121000" /><workItem from="1752543943603" duration="2208000" /><workItem from="1752546939831" duration="7230000" />- <workItem from="1752567594292" duration="3714000" />+ <workItem from="1752567594292" duration="4172000" /></task><task id="LOCAL-00001" summary="feat(CalendarTiming): 优化发布记录列表展示 - 调整日历记录项的样式和布局 - 优化 RecordCore组件,添加平台图标和时间显示 - 修改 CalendarTimingItem 组件,移除不必要的 Fragment -调整 index.tsx 中的日期格式化逻辑"><option name="closed" value="true" />@@ -320,7 +323,15 @@<option name="project" value="LOCAL" /><updated>1752567697244</updated></task>- <option name="localTasksCounter" value="27" />+ <task id="LOCAL-00027" summary="chore: 测试静态站点">+ <option name="closed" value="true" />+ <created>1752571476186</created>+ <option name="number" value="00027" />+ <option name="presentableId" value="LOCAL-00027" />+ <option name="project" value="LOCAL" />+ <updated>1752571476186</updated>+ </task>+ <option name="localTasksCounter" value="28" /><servers /></component><component name="TypeScriptGeneratedFilesManager">@@ -331,11 +342,38 @@<option featureType="com.intellij.fileTypeFactory" implementationName="sitemap.xml" /></component><component name="Vcs.Log.Tabs.Properties">+ <option name="RECENT_FILTERS">+ <map>+ <entry key="User">+ <value>+ <list>+ <RecentGroup>+ <option name="FILTER_VALUES">+ <option value="*" />+ </option>+ </RecentGroup>+ </list>+ </value>+ </entry>+ </map>+ </option><option name="TAB_STATES"><map><entry key="MAIN"><value>- <State />+ <State>+ <option name="FILTERS">+ <map>+ <entry key="user">+ <value>+ <list>+ <option value="*" />+ </list>+ </value>+ </entry>+ </map>+ </option>+ </State></value></entry></map>@@ -344,8 +382,6 @@<component name="VcsManagerConfiguration"><option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" /><option name="CHECK_NEW_TODO" value="false" />- <MESSAGE value="feat(CalendarTiming): 优化发布记录列表展示 - 调整日历记录项的样式和布局 - 优化 RecordCore组件,添加平台图标和时间显示 - 调整 index.tsx 中的日期格式化逻辑" />- <MESSAGE value="fix: platInfo添加一些非空判断" /><MESSAGE value="feat: 发布记录展示添加状态展示" /><MESSAGE value="feat(发布弹框): 上传图片和上传视频完成" /><MESSAGE value="feat(发布弹框): 发布API接入完成" />@@ -369,6 +405,8 @@<MESSAGE value="fix(发布弹框): 修复右侧预览不正常隐藏的问题" /><MESSAGE value="feat(发布弹框): 立即发布接入API" /><MESSAGE value="fix(日历): 删除最佳时间" />- <option name="LAST_COMMIT_MESSAGE" value="fix(日历): 删除最佳时间" />+ <MESSAGE value="chore: 测试静态站点" />+ <MESSAGE value="选择用户弹框恢复" />+ <option name="LAST_COMMIT_MESSAGE" value="选择用户弹框恢复" /></component></project>\ No newline at end of filediff --git a/src/components/ChooseAccountModule/ChooseAccountModule.tsx b/src/components/ChooseAccountModule/ChooseAccountModule.tsxnew file mode 100644index 00000000..b81626c7--- /dev/null+++ b/src/components/ChooseAccountModule/ChooseAccountModule.tsx@@ -0,0 +1,119 @@+import {+ ForwardedRef,+ forwardRef,+ memo,+ useEffect,+ useImperativeHandle,+ useRef,+ useState,+} from "react";+import { Modal, Tabs } from "antd";+import PlatChoose, {+ IPlatChooseProps,+ IPlatChooseRef,+} from "@/components/ChooseAccountModule/components/PlatChoose";+import { SocialAccount } from "@/api/types/account.type";++export interface IChooseAccountModuleRef {+ getPlatChooseRef: () => IPlatChooseRef | null;+}++export interface IChooseAccountModuleProps {+ open: boolean;+ onClose: (open: boolean) => void;+ // 按平台props+ platChooseProps?: IPlatChooseProps;+ // 按平台选择确认+ onPlatConfirm?: (accounts: SocialAccount[]) => void;+ // 按平台选择change+ onPlatChange?: (accounts: SocialAccount[], account: SocialAccount) => void;+}++const ChooseAccountModule = memo(+ forwardRef(+ (+ {+ open,+ onClose,+ onPlatConfirm,+ onPlatChange,+ platChooseProps,+ }: IChooseAccountModuleProps,+ ref: ForwardedRef<IChooseAccountModuleRef>,+ ) => {+ const [newChoosedAccounts, setNewChoosedAccounts] = useState<+ SocialAccount[]+ >([]);+ const platChooseRef = useRef<IPlatChooseRef>(null);++ const handleOk = () => {+ if (onPlatConfirm) onPlatConfirm(newChoosedAccounts);+ close();+ };++ const handleCancel = () => {+ setNewChoosedAccounts(platChooseProps?.choosedAccounts || []);+ close();+ };++ const close = () => {+ onClose(false);+ };++ useEffect(() => {+ setTimeout(() => platChooseRef.current?.recover(), 1);+ }, [platChooseProps?.choosedAccounts]);++ useEffect(() => {+ platChooseRef.current?.init();+ }, [open]);++ const ImperativeHandle: IChooseAccountModuleRef = {+ getPlatChooseRef() {+ return platChooseRef.current;+ },+ };+ useImperativeHandle(ref, () => ImperativeHandle);++ return (+ <Modal+ width={800}+ title="账户选择"+ open={open}+ onOk={handleOk}+ onCancel={handleCancel}+ >+ <Tabs+ defaultActiveKey="1"+ items={[+ {+ key: "1",+ label: "按平台选择",+ children: (+ <>+ {platChooseProps && (+ <PlatChoose+ {...platChooseProps}+ disableAllSelect={+ platChooseProps.disableAllSelect || false+ }+ ref={platChooseRef}+ onChange={(aList, account) => {+ setNewChoosedAccounts(aList);+ if (onPlatChange) onPlatChange(aList, account);+ }}+ />+ )}+ </>+ ),+ },+ ]}+ />+ </Modal>+ );+ },+ ),+);+ChooseAccountModule.displayName = "ChooseAccountModule";++export default ChooseAccountModule;diff --git a/src/components/ChooseAccountModule/chooseAccountModule.module.scss b/src/components/ChooseAccountModule/chooseAccountModule.module.scssnew file mode 100644index 00000000..1b8cafb5--- /dev/null+++ b/src/components/ChooseAccountModule/chooseAccountModule.module.scss@@ -0,0 +1,102 @@+.platChoose {+ display: flex;++ :global {+ .platChoose-empty {+ display: flex;+ justify-content: center;+ width: 100%;+ }++ .platChoose-platSelect {+ padding-right: 20px;+ .ant-checkbox-wrapper {+ margin-bottom: 5px;+ white-space: nowrap;+ }++ .ant-segmented {+ width: 100%;+ box-sizing: border-box;+ .ant-segmented-item {+ margin-bottom: 5px;+ padding: 3px 60px 3px 0;+ }++ .ant-segmented-item-label {+ display: flex;+ align-items: center;+ .ant-segmented-item-icon {+ display: flex;+ align-items: center;+ }+ }+ }+ }++ .platChoose-con {+ width: 100%;+ display: flex;+ flex-direction: column;+ justify-content: space-between;+ &-wrapper {+ width: 100%;+ }+ }++ .platChoose-tips {+ color: var(--errerColor);+ font-size: var(--fs-xs);+ }++ .platChoose-accounts {+ margin-top: 10px;+ width: 100%;+ display: grid;+ grid-template-columns: repeat(2, 1fr);+ gap: 15px;++ &-item {+ background: rgb(247, 250, 250);+ cursor: pointer;+ padding: 10px;+ box-sizing: border-box;+ border-radius: 6px 0 6px 6px;+ align-items: center;+ min-width: 0;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ position: relative;+ &-nickname {+ margin-left: 5px;+ }++ &-choose {+ position: absolute;+ top: 0;+ right: 0;+ padding: 0 4px;+ text-align: center;+ background: rgb(225, 230, 230);+ border-radius: 0 0 0 12px;+ color: #fff;+ font-size: 12px;+ }++ &--active {+ background: var(--colorPrimary2);++ .platChoose-accounts-item-choose {+ background: var(--colorPrimary5);+ }+ }++ &--disable {+ cursor: no-drop;+ opacity: 0.5;+ }+ }+ }+ }+}\ No newline at end of filediff --git a/src/components/ChooseAccountModule/components/PlatChoose.tsx b/src/components/ChooseAccountModule/components/PlatChoose.tsxnew file mode 100644index 00000000..22b3f27a--- /dev/null+++ b/src/components/ChooseAccountModule/components/PlatChoose.tsx@@ -0,0 +1,402 @@+import {+ ForwardedRef,+ forwardRef,+ memo,+ useEffect,+ useImperativeHandle,+ useMemo,+ useRef,+ useState,+} from "react";+import styles from "../chooseAccountModule.module.scss";+import {+ Avatar,+ Badge,+ Checkbox,+ ConfigProvider,+ Empty,+ Segmented,+ Tooltip,+} from "antd";+import { CheckOutlined } from "@ant-design/icons";+import { useShallow } from "zustand/react/shallow";+import useCssVariables from "@/app/hooks/useCssVariables";+import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";+import { PubType } from "@/app/config/publishConfig";+import { useAccountStore } from "@/store/account";+import Link from "next/link";+import { SocialAccount } from "@/api/types/account.type";++export interface IPlatChooseRef {+ /**+ * 恢复选中状态+ * @param choosedAccounts+ */+ recover: () => void;+ // 每次关闭弹框的时候需要初始化一些状态+ init: () => void;+ // 设置选中平台+ setActivePlat: (activePlat: PlatType) => void;+}++export interface IPlatChooseProps {+ pubType: PubType;+ // 默认选择的平台+ defaultPlat?: PlatType;+ onChange?: (+ choosedAcounts: SocialAccount[],+ choosedAcount: SocialAccount,+ ) => void;+ // 外部传入的已经选中的数据,这个值只有在确认更改才会更新+ choosedAccounts?: SocialAccount[];+ // 按平台 是否禁用多选,true=禁用,false=不禁用+ disableAllSelect?: boolean;+ // 可选择的平台,默认为全部+ allowPlatSet?: Set<PlatType>;+ // 是否可以取消已经选择的账户,默认为 false+ isCancelChooseAccount?: boolean;+}++const PlatChoose = memo(+ forwardRef(+ (+ {+ pubType,+ onChange,+ choosedAccounts,+ disableAllSelect = false,+ isCancelChooseAccount = false,+ allowPlatSet,+ defaultPlat,+ }: IPlatChooseProps,+ ref: ForwardedRef<IPlatChooseRef>,+ ) => {+ const cssVars = useCssVariables();+ // 所有账户数据+ const [accountMap, setAccountMap] = useState<+ Map<PlatType, SocialAccount[]>+ >(new Map());+ // 当前选择的平台+ const [activePlat, setActivePlat] = useState<PlatType | undefined>();+ // 当前选择的账户数据+ const [choosedAcountMap, setChoosedAcountMap] = useState<+ Map<PlatType, SocialAccount[]>+ >(new Map());+ // 每次change操作的数据+ const recentData = useRef<SocialAccount>();+ const { accountList } = useAccountStore(+ useShallow((state) => ({+ accountList: state.accountList,+ })),+ );++ // 经过 allowPlatSet 过滤后的账户数据+ const accountMapLast = useMemo(() => {+ const newVal = new Map<PlatType, SocialAccount[]>();+ for (const [accountType, accountList] of accountMap) {+ if (!allowPlatSet ? true : allowPlatSet.has(accountType)) {+ newVal.set(accountType, accountList);+ }+ }+ return newVal;+ }, [accountMap, allowPlatSet]);++ // 默认平台设置+ useEffect(() => {+ const defaultPlatData = Array.from(accountMapLast).find(+ ([plat, data]) => data.length !== 0,+ );+ setActivePlat(+ defaultPlat ||+ (defaultPlatData+ ? defaultPlatData[0]+ : Array.from(accountMapLast.keys())[0]),+ );+ }, [accountMapLast]);++ // 所有平台的账户数据+ const getAllAccountList = useMemo(() => {+ const allAccountList = [];+ for (const [_, accountList] of accountMapLast) {+ allAccountList.push(...accountList);+ }+ return allAccountList;+ }, [accountMapLast]);++ // 当前选择的所有平台的账户数据+ const getChoosedAllAccountList = useMemo(() => {+ const allAccountList = [];+ for (const [_, accountList] of choosedAcountMap) {+ allAccountList.push(...accountList);+ }+ return allAccountList;+ }, [choosedAcountMap]);++ // 当前平台的所有用户数据+ const currAccountList = useMemo(+ () => (activePlat && accountMapLast.get(activePlat)) || [],+ [activePlat, accountMapLast],+ );++ // 当前平台的选择账户的数据+ const currChoosedAcount = useMemo(+ () => (activePlat && choosedAcountMap.get(activePlat)) || [],+ [activePlat, choosedAcountMap],+ );++ useEffect(() => {+ setAccountMap((prevMap) => {+ const newMap = new Map(prevMap);+ Array.from(AccountPlatInfoMap).map(([key, value]) => {+ if (value.pubTypes.has(pubType)) {+ newMap.set(key, []);+ }+ });+ // 添加渲染账户数据值+ accountList.map((v) => {+ newMap.get(v.type)?.push(v);+ });+ return newMap;+ });+ }, [accountList]);++ useEffect(() => {+ return () => {+ setAccountMap(new Map());+ setChoosedAcountMap(new Map());+ init();+ };+ }, []);++ // change事件+ useEffect(() => {+ if (!recentData.current) return;+ let accounts: SocialAccount[] = [];+ Array.from(choosedAcountMap).map(([key, value]) => {+ accounts = [...accounts, ...value];+ });+ if (onChange) onChange(accounts, recentData.current!);+ }, [choosedAcountMap]);++ const init = () => {+ recentData.current = undefined;+ };++ useImperativeHandle(ref, () => ({+ // 恢复到本次操作之前的状态+ recover() {+ if (!choosedAccounts || choosedAccounts.length === 0)+ return setChoosedAcountMap(new Map());++ setChoosedAcountMap(() => {+ const newV = new Map();+ choosedAccounts.map((v) => {+ if (!newV.has(v.type)) newV.set(v.type, []);+ newV.get(v.type)!.push(v);+ });+ return newV;+ });+ },+ setActivePlat,+ init,+ }));++ return (+ <div className={styles.platChoose}>+ {getAllAccountList.length === 0 ? (+ <div className="platChoose-empty">+ <Empty+ description={+ <>+ 无账户数据,请前往 <Link href="/accounts">账户</Link>+ 添加数据+ </>+ }+ />+ </div>+ ) : (+ <>+ <div className="platChoose-platSelect">+ {!disableAllSelect && (+ <Checkbox+ indeterminate={+ getChoosedAllAccountList.length > 0 &&+ getChoosedAllAccountList.length < getAllAccountList.length+ }+ onChange={(e) => {+ const { checked } = e.target;+ setChoosedAcountMap((v) => {+ const newMap = new Map(v);+ recentData.current = currAccountList[0];++ for (const [+ accountType,+ accountList,+ ] of accountMapLast) {+ if (checked) {+ newMap.set(accountType, accountList);+ } else {+ newMap.set(accountType, []);+ }+ }+ return newMap;+ });+ }}+ checked={+ getAllAccountList.length ===+ getChoosedAllAccountList.length+ }+ >+ 选择所有平台账户+ </Checkbox>+ )}+ <ConfigProvider+ theme={{+ components: {+ Segmented: {+ trackBg: "#fff",+ itemSelectedBg: cssVars["--colorPrimary1"],+ itemHoverBg: cssVars["--colorPrimary2"],+ itemActiveBg: cssVars["--colorPrimary3"],+ itemSelectedColor: cssVars["--colorPrimary9"],+ },+ },+ }}+ >+ <Segmented+ vertical+ size="large"+ value={activePlat}+ options={Array.from(accountMapLast)+ .map(([key, value]) => {+ if (value.length === 0) return undefined;+ const platInfo = AccountPlatInfoMap.get(key)!;+ return {+ value: key,+ label: platInfo.name,+ icon: (+ <Badge+ count={choosedAcountMap.get(key)?.length}+ size="small"+ >+ <img+ style={{ width: "25px" }}+ src={platInfo.icon}+ />+ </Badge>+ ),+ };+ })+ .filter((v) => v !== undefined)+ .filter((v) =>+ allowPlatSet ? allowPlatSet.has(v.value) : true,+ )}+ onChange={setActivePlat}+ />+ </ConfigProvider>+ </div>++ <div className="platChoose-con">+ {currAccountList && (+ <div className="platChoose-con-wrapper">+ {!disableAllSelect ? (+ <Checkbox+ indeterminate={+ currChoosedAcount.length > 0 &&+ currChoosedAcount.length < currAccountList.length+ }+ onChange={(e) => {+ setChoosedAcountMap((v) => {+ recentData.current = currAccountList[0];+ return new Map(v).set(+ activePlat!,+ e.target.checked ? currAccountList : [],+ );+ });+ }}+ checked={+ currChoosedAcount.length === currAccountList.length+ }+ >+ 全选 已选择 {currChoosedAcount.length} 个+ </Checkbox>+ ) : (+ <span>已选择 {currChoosedAcount.length} 个</span>+ )}+ <div className="platChoose-accounts">+ {currAccountList.map((v) => {+ // true=禁用+ const isDisable =+ choosedAccounts?.find((k) => k.id === v.id) &&+ isCancelChooseAccount;+ return (+ <div+ key={v.id}+ className={[+ "platChoose-accounts-item",+ currChoosedAcount.find((k) => k.id === v.id) &&+ "platChoose-accounts-item--active",+ isDisable && "platChoose-accounts-item--disable",+ ].join(" ")}+ onClick={() => {+ if (isDisable) return;+ recentData.current = v;+ setChoosedAcountMap((prevV) => {+ const newV = new Map(prevV);+ let list = newV.get(activePlat!);+ if (!list) {+ list = [];+ newV.set(activePlat!, list);+ }+ // 是否存在+ if (list.some((k) => k.id === v.id)) {+ // 有、去掉+ list = list.filter((k) => k.id !== v.id);+ } else {+ // 无、添加+ list.push(v);+ }+ newV.set(activePlat!, list);+ return newV;+ });+ }}+ >+ <Tooltip+ title={+ <>+ <p>昵称:{v.nickname}</p>+ </>+ }+ >+ <Avatar src={v.avatar} />+ <span className="platChoose-accounts-item-nickname">+ {v.nickname}+ </span>+ </Tooltip>++ <div className="platChoose-accounts-item-choose">+ <CheckOutlined />+ </div>+ </div>+ );+ })}+ </div>+ </div>+ )}++ {AccountPlatInfoMap.get(activePlat!)?.tips && (+ <div className="platChoose-tips">+ {AccountPlatInfoMap.get(activePlat!)?.tips?.publish}+ </div>+ )}+ </div>+ </>+ )}+ </div>+ );+ },+ ),+);+PlatChoose.displayName = "PlatChoose";++export default PlatChoose;