Skip to content

Let's use AI to Earn!

facebook login again page

bulaienaofutuojsonzhang4987f1bcf36f
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
index 904e9a94..21b1c2a4 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
@@ -257,10 +257,6 @@ const UserManageModal = memo(
const [cutLoading, setCutLoading] = useState(false);
const [isAddAccountOpen, setIsAddAccountOpen] = useState(false);
const [targetGroupIdForModal, setTargetGroupIdForModal] = useState<string | undefined>(undefined);
- const preAccountIds = useRef<Set<string>>(new Set());
- const pendingGroupIdRef = useRef<string | null>(null);
- const isAssigningRef = useRef(false);
- const snapshotReadyRef = useRef(false);
const columns = useMemo(() => {
const columns: TableProps<SocialAccount>["columns"] = [
@@ -417,46 +413,11 @@ const UserManageModal = memo(
setIsAddAccountOpen(true);
} else {
// 如果选择的是具体空间,直接使用该空间
- pendingGroupIdRef.current = currentGroupId;
setTargetGroupIdForModal(currentGroupId);
- if ((useAccountStore.getState().accountList || []).length === 0) {
- await getAccountList();
- }
- preAccountIds.current = new Set(
- (useAccountStore.getState().accountList || []).map((v) => v.id),
- );
- snapshotReadyRef.current = true;
setIsAddAccountOpen(true);
}
};
- useEffect(() => {
- const maybeAssign = async () => {
- if (!pendingGroupIdRef.current) return;
- if (isAssigningRef.current) return;
- if (!snapshotReadyRef.current) return;
- const currList = accountList || [];
- const newAccounts = currList.filter((a) => !preAccountIds.current.has(a.id));
- if (newAccounts.length === 0) return;
- isAssigningRef.current = true;
- try {
- const targetGroupId = pendingGroupIdRef.current!;
- for (const acc of newAccounts) {
- try {
- await updateAccountApi({ id: acc.id, groupId: targetGroupId });
- } catch {}
- }
- await getAccountList();
- message.success(t("accountAddedToSpace" as any));
- } finally {
- pendingGroupIdRef.current = null;
- preAccountIds.current = new Set();
- isAssigningRef.current = false;
- snapshotReadyRef.current = false;
- }
- };
- maybeAssign();
- }, [accountList]);
return (
<>
@@ -557,15 +518,8 @@ const UserManageModal = memo(
setTargetGroupIdForModal(undefined);
}}
onAddSuccess={async (acc) => {
- try {
- if (pendingGroupIdRef.current) {
- await updateAccountApi({ id: acc.id, groupId: pendingGroupIdRef.current });
- message.success(t("accountAddedToSpace" as any));
- }
- } finally {
- pendingGroupIdRef.current = null;
- await getAccountList();
- }
+ // 账号已经在授权时直接添加到指定空间,无需额外移动
+ await getAccountList();
}}
targetGroupId={targetGroupIdForModal}
showSpaceSelector={activeGroup === allUser.current}
diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsx
index 2dd79900..dc44306d 100644
--- a/src/components/PublishDialog/index.tsx
+++ b/src/components/PublishDialog/index.tsx
@@ -51,7 +51,7 @@ import { bilibiliSkip } from "@/app/[lng]/accounts/plat/BilibiliLogin";
import { youtubeSkip } from "@/app/[lng]/accounts/plat/YoutubeLogin";
import { twitterSkip } from "@/app/[lng]/accounts/plat/TwtterLogin";
import { tiktokSkip } from "@/app/[lng]/accounts/plat/TiktokLogin";
-import { facebookSkip } from "@/app/[lng]/accounts/plat/FacebookLogin";
+import { facebookSkip, FacebookPagesModal } from "@/app/[lng]/accounts/plat/FacebookLogin";
import { instagramSkip } from "@/app/[lng]/accounts/plat/InstagramLogin";
import { threadsSkip } from "@/app/[lng]/accounts/plat/ThreadsLogin";
import { wxGzhSkip } from "@/app/[lng]/accounts/plat/WxGzh";
@@ -135,6 +135,8 @@ const PublishDialog = memo(
// 下载App弹窗状态
const [downloadModalVisible, setDownloadModalVisible] = useState(false);
const [currentPlatform, setCurrentPlatform] = useState<string>('');
+ // Facebook页面选择弹窗状态
+ const [showFacebookPagesModal, setShowFacebookPagesModal] = useState(false);
const { t } = useTransClient("publish");
const router = useRouter();
@@ -176,7 +178,7 @@ const PublishDialog = memo(
try {
await facebookSkip(platform, targetSpaceId);
// Facebook授权成功后显示页面选择弹窗
- // handleFacebookAuthSuccess(); // 这里可能需要处理Facebook页面选择
+ handleFacebookAuthSuccess();
} catch (error) {
console.error('Facebook授权失败:', error);
}
@@ -217,6 +219,17 @@ const PublishDialog = memo(
}
}, [accountGroupList, getAccountList]);
+ // 处理Facebook授权成功后的页面选择
+ const handleFacebookAuthSuccess = () => {
+ setShowFacebookPagesModal(true);
+ };
+
+ // 处理Facebook页面选择成功
+ const handleFacebookPagesSuccess = () => {
+ setShowFacebookPagesModal(false);
+ // 可以在这里添加成功提示或其他逻辑
+ };
+
// 内容安全检测函数
const handleContentModeration = useCallback(async () => {
// 获取当前描述内容
@@ -1327,6 +1340,13 @@ const PublishDialog = memo(
platform={currentPlatform}
appName="Aitoearn App"
/>
+
+ {/* Facebook页面选择弹窗 */}
+ <FacebookPagesModal
+ open={showFacebookPagesModal}
+ onClose={() => setShowFacebookPagesModal(false)}
+ onSuccess={handleFacebookPagesSuccess}
+ />
</>
);
},