Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
buzhichi downs app
bulaienaofutuojiesenzhang85fea01997e0
diff --git a/src/app/i18n/locales/en/publish.json b/src/app/i18n/locales/en/publish.jsonindex eec87cc6..914c423e 100644--- a/src/app/i18n/locales/en/publish.json+++ b/src/app/i18n/locales/en/publish.json@@ -13,7 +13,9 @@"delete": "Delete"},"tips": {- "workSaved": "Please select the account to publish"+ "workSaved": "Please select the account to publish",+ "pcNotSupported": "Web does not support this platform, please download the App to publish",+ "accountOffline": "This account is offline and cannot be published"},"status": {"publishFailed": "Failed",diff --git a/src/app/i18n/locales/zh-CN/publish.json b/src/app/i18n/locales/zh-CN/publish.jsonindex 64b81d84..047d5b54 100644--- a/src/app/i18n/locales/zh-CN/publish.json+++ b/src/app/i18n/locales/zh-CN/publish.json@@ -13,7 +13,9 @@"delete": "删除"},"tips": {- "workSaved": "请选择要发布的账户"+ "workSaved": "请选择要发布的账户",+ "pcNotSupported": "Web不支持该平台,请下载App进行发布",+ "accountOffline": "该账号已离线,无法发布"},"status": {"publishFailed": "发布失败",diff --git a/src/components/ChooseAccountModule/chooseAccountModule.module.scss b/src/components/ChooseAccountModule/chooseAccountModule.module.scssindex 5ad10f8f..c0d536f7 100644--- a/src/components/ChooseAccountModule/chooseAccountModule.module.scss+++ b/src/components/ChooseAccountModule/chooseAccountModule.module.scss@@ -297,10 +297,39 @@cursor: not-allowed;opacity: 0.5;background: #f5f5f5;+ }++ &--pc-not-supported {+ position: relative;+ cursor: pointer;&:hover {- border-color: #e9ecef;- box-shadow: none;+ .simpleAccountChoose-accounts-item-overlay {+ opacity: 1;+ }+ }+ }++ &-overlay {+ position: absolute;+ top: 0;+ left: 0;+ right: 0;+ bottom: 0;+ background: rgba(0, 0, 0, 0.7);+ border-radius: 8px;+ display: flex;+ align-items: center;+ justify-content: center;+ opacity: 0.8;+ transition: all 0.2s ease;+ z-index: 10;++ &-text {+ color: #fff;+ font-weight: bold;+ font-size: 14px;+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);}}}diff --git a/src/components/ChooseAccountModule/components/SimpleAccountChoose.tsx b/src/components/ChooseAccountModule/components/SimpleAccountChoose.tsxindex e600c956..2d02ba57 100644--- a/src/components/ChooseAccountModule/components/SimpleAccountChoose.tsx+++ b/src/components/ChooseAccountModule/components/SimpleAccountChoose.tsx@@ -16,6 +16,7 @@ import {Tooltip,Collapse,} from "antd";+import DownloadAppModal from "@/components/common/DownloadAppModal";import { CheckOutlined } from "@ant-design/icons";import { useShallow } from "zustand/react/shallow";import { AccountPlatInfoMap } from "@/app/config/platConfig";@@ -76,6 +77,9 @@ const SimpleAccountChoose = memo(const [accountGroupList, setAccountGroupList] = useState<AccountGroup[]>([]);// 每次change操作的数据const recentData = useRef<SocialAccount>();+ // 下载App弹窗状态+ const [downloadModalVisible, setDownloadModalVisible] = useState(false);+ const [currentPlatform, setCurrentPlatform] = useState<string>('');const { accountList } = useAccountStore(useShallow((state) => ({accountList: state.accountList,@@ -191,6 +195,17 @@ const SimpleAccountChoose = memo(const platInfo = AccountPlatInfoMap.get(account.type);const isSelected = choosedAccountsList.some(item => item.id === account.id);const isDisable = choosedAccounts?.find((k) => k.id === account.id) && isCancelChooseAccount;+ const isPcNotSupported = platInfo && platInfo.pcNoThis === true;++ const handleAccountClick = () => {+ if (isDisable) return;+ if (isPcNotSupported) {+ setCurrentPlatform(platInfo?.name || '');+ setDownloadModalVisible(true);+ return;+ }+ handleSelectAccount(account);+ };return (<div@@ -199,18 +214,24 @@ const SimpleAccountChoose = memo("simpleAccountChoose-accounts-item",isSelected && "simpleAccountChoose-accounts-item--active",isDisable && "simpleAccountChoose-accounts-item--disable",+ isPcNotSupported && "simpleAccountChoose-accounts-item--pc-not-supported",].join(" ")}- onClick={() => {- if (isDisable) return;- handleSelectAccount(account);- }}+ onClick={handleAccountClick}><Tooltiptitle={- <>- <p>昵称:{account.nickname}</p>- <p>平台:{platInfo?.name}</p>- </>+ isPcNotSupported ? (+ <>+ <p>昵称:{account.nickname}</p>+ <p>平台:{platInfo?.name}</p>+ <p style={{ color: '#ff4d4f' }}>Web不支持该平台,请下载App</p>+ </>+ ) : (+ <>+ <p>昵称:{account.nickname}</p>+ <p>平台:{platInfo?.name}</p>+ </>+ )}><div className="simpleAccountChoose-accounts-item-avatar">@@ -226,9 +247,15 @@ const SimpleAccountChoose = memo(</span></Tooltip>- <div className="simpleAccountChoose-accounts-item-choose">- <CheckOutlined />- </div>+ {isPcNotSupported ? (+ <div className="simpleAccountChoose-accounts-item-overlay">+ <span className="simpleAccountChoose-accounts-item-overlay-text">APP</span>+ </div>+ ) : (+ <div className="simpleAccountChoose-accounts-item-choose">+ <CheckOutlined />+ </div>+ )}</div>);};@@ -318,6 +345,14 @@ const SimpleAccountChoose = memo({renderGroupContent()}</>)}++ {/* 下载App弹窗 */}+ <DownloadAppModal+ visible={downloadModalVisible}+ onClose={() => setDownloadModalVisible(false)}+ platform={currentPlatform}+ appName="Aitoearn App"+ /></div>);},diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsxindex a945a3c9..7e8c237a 100644--- a/src/components/PublishDialog/index.tsx+++ b/src/components/PublishDialog/index.tsx@@ -10,6 +10,7 @@ import {} from "react";import styles from "./publishDialog.module.scss";import { Button, message, Modal, List, Spin, Tooltip } from "antd";+import DownloadAppModal from "@/components/common/DownloadAppModal";import {ArrowRightOutlined,ExclamationCircleFilled,@@ -116,6 +117,9 @@ const PublishDialog = memo(const [moderationResult, setModerationResult] = useState<boolean | null>(null);const [moderationDesc, setModerationDesc] = useState<string>("");const [moderationLevel, setModerationLevel] = useState<any>(null);+ // 下载App弹窗状态+ const [downloadModalVisible, setDownloadModalVisible] = useState(false);+ const [currentPlatform, setCurrentPlatform] = useState<string>('');const { t } = useTransClient("publish");// 内容安全检测函数@@ -350,16 +354,7 @@ const PublishDialog = memo(}}, [pubListChoosed, setPubListChoosed]);- // 过滤PC端不支持的平台账户:如被默认选中则自动移除- useEffect(() => {- const filtered = pubListChoosed.filter((item) => {- const plat = AccountPlatInfoMap.get(item.account.type);- return !(plat && plat.pcNoThis === true);- });- if (filtered.length !== pubListChoosed.length) {- setPubListChoosed(filtered);- }- }, [pubListChoosed, setPubListChoosed]);+ // 移除PC端不支持的平台账户过滤逻辑,改为在UI中显示遮罩// 关闭弹框并确认关闭const closeDialog = useCallback(() => {@@ -584,10 +579,6 @@ const PublishDialog = memo(</div><div className="publishDialog-con-acconts">{pubList- .filter((pubItem) => {- const plat = AccountPlatInfoMap.get(pubItem.account.type);- return !(plat && plat.pcNoThis === true);- }).map((pubItem) => {const platConfig = AccountPlatInfoMap.get(pubItem.account.type,@@ -596,25 +587,40 @@ const PublishDialog = memo((v) => v.account.id === pubItem.account.id,);const isOffline = pubItem.account.status === 0;+ const isPcNotSupported = platConfig && platConfig.pcNoThis === true;return (- <div- className={[- "publishDialog-con-acconts-item",- isChoosed- ? "publishDialog-con-acconts-item--active"- : "",- ].join(" ")}- style={{- borderColor: isChoosed- ? platConfig.themeColor- : "transparent",- }}+ <Tooltip+ title={+ isPcNotSupported+ ? t('tips.pcNotSupported' as any)+ : isOffline+ ? t('tips.accountOffline' as any)+ : undefined+ }key={pubItem.account.id}- onClick={(e) => {+ >+ <div+ className={[+ "publishDialog-con-acconts-item",+ isChoosed+ ? "publishDialog-con-acconts-item--active"+ : "",+ ].join(" ")}+ style={{+ borderColor: isChoosed+ ? platConfig.themeColor+ : "transparent",+ }}+ onClick={(e) => {e.stopPropagation();if (isOffline) {- message.warning("该账号已离线,无法发布");+ message.warning(t('tips.accountOffline' as any));+ return;+ }+ if (isPcNotSupported) {+ setCurrentPlatform(platConfig?.name || '');+ setDownloadModalVisible(true);return;}const newPubListChoosed = [...pubListChoosed];@@ -657,13 +663,13 @@ const PublishDialog = memo(setPubListChoosed(newPubListChoosed);}}>- {/* 账号头像:离线显示遮罩并禁用 */}+ {/* 账号头像:离线或PC不支持显示遮罩并禁用 */}<div style={{ position: "relative" }}><AvatarPlat- className={`publishDialog-con-acconts-item-avatar ${!isChoosed || isOffline ? 'disabled' : ''}`}+ className={`publishDialog-con-acconts-item-avatar ${!isChoosed || isOffline || isPcNotSupported ? 'disabled' : ''}`}account={pubItem.account}size="large"- disabled={isOffline || !isChoosed}+ disabled={isOffline || !isChoosed || isPcNotSupported}/>{isOffline && (<div@@ -684,8 +690,30 @@ const PublishDialog = memo(已离线</div>)}+ {isPcNotSupported && !isOffline && (+ <div+ style={{+ position: "absolute",+ inset: 0,+ background: "rgba(0,0,0,0.6)",+ borderRadius: "50%",+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ color: "#fff",+ fontSize: 10,+ fontWeight: 600,+ pointerEvents: "none",+ textAlign: "center",+ lineHeight: 1.2,+ }}+ >+ APP+ </div>+ )}</div>- </div>+ </div>+ </Tooltip>);})}</div>@@ -1155,6 +1183,14 @@ const PublishDialog = memo(</div>)}</Modal>++ {/* 下载App弹窗 */}+ <DownloadAppModal+ visible={downloadModalVisible}+ onClose={() => setDownloadModalVisible(false)}+ platform={currentPlatform}+ appName="Aitoearn App"+ /></>);},diff --git a/src/components/PublishDialog/publishDialog.module.scss b/src/components/PublishDialog/publishDialog.module.scssindex b300aff1..2742caef 100644--- a/src/components/PublishDialog/publishDialog.module.scss+++ b/src/components/PublishDialog/publishDialog.module.scss@@ -34,8 +34,8 @@ $assistantWidth: 330px;}&-acconts {display: flex;- flex-wrap: nowrap;- gap: 12px;+ flex-wrap: wrap;+ gap: 11px;&-item {border: 2px solid transparent;border-radius: 50%;