Skip to content

Let's use AI to Earn!

feat: Add DraftSelectionModal component for selecting drafts

gaoSir1f1b1c497ae1
diff --git a/@types/resources.d.ts b/@types/resources.d.ts
index b14ebea2..d3d4aa78 100644
--- a/@types/resources.d.ts
+++ b/@types/resources.d.ts
@@ -138,6 +138,7 @@ interface Resources {
"confirm": "确认"
},
"mobileOnlySupport": "移动端支持",
+ "xhsOfflineTip": "小红书账号已离线,请下载App进行操作",
"reauthConfirm": {
"title": "会话已过期",
"content": "您的 {{platformName}} 账号 \"{{nickname}}\"(位于 {{spaceName}})会话已过期。是否重新登录?",
@@ -1988,7 +1989,8 @@ interface Resources {
"workSaved": "请选择要发布的账户",
"pcNotSupported": "Web不支持该平台,请下载App进行发布",
"accountOffline": "该账号已离线,无法发布",
- "tiktokForbidden": "该平台暂不支持发布"
+ "tiktokForbidden": "该平台暂不支持发布",
+ "xhsOffline": "小红书账号已离线,请下载App进行操作"
},
"status": {
"publishFailed": "发布失败",
@@ -2033,7 +2035,9 @@ interface Resources {
"uploadImageOrVideo": "上传图片或视频",
"uploadImage": "请上传图片",
"uploadVideo": "请上传视频",
- "dragAndSelect": "拖放 & 选择图片或视频"
+ "dragAndSelect": "拖放 & 选择图片或视频",
+ "selectFile": "选择文件",
+ "uploadLocal": "上传本地图片或视频"
},
"validation": {
"facebookStoryNoDes": "Facebook Story不支持填写描述",
@@ -2119,6 +2123,18 @@ interface Resources {
"contentUnsafe": "内容不安全",
"preview": "点击查看"
},
+ "messages": {
+ "authFailedRetry": "授权失败,请重试",
+ "pleaseInputContent": "请先输入内容",
+ "contentModerationFailed": "内容安全检测失败,请稍后重试",
+ "contentModerationError": "内容安全检测失败",
+ "unsupportedPlatformType": "未支持的平台类型",
+ "platformNotSupportedDirect": "暂不支持 {{platform}} 平台的直接授权",
+ "facebookAuthFailed": "Facebook授权失败",
+ "accountListRefreshed": "账号列表已刷新",
+ "refreshAccountListFailed": "刷新账号列表失败",
+ "authFailed": "授权失败"
+ },
"badges": {
"offline": "已离线",
"forbidden": "禁"
diff --git a/src/app/i18n/locales/en/publish.json b/src/app/i18n/locales/en/publish.json
index 306521e8..e3435f3d 100644
--- a/src/app/i18n/locales/en/publish.json
+++ b/src/app/i18n/locales/en/publish.json
@@ -61,7 +61,9 @@
"uploadImageOrVideo": "Upload image or video",
"uploadImage": "Please upload image",
"uploadVideo": "Please upload video",
- "dragAndSelect": "Drag & select image or video"
+ "dragAndSelect": "Drag & select image or video",
+ "selectFile": "Select File",
+ "uploadLocal": "Upload local image or video"
},
"validation": {
"facebookStoryNoDes": "Facebook Story does not support description",
diff --git a/src/app/i18n/locales/zh-CN/publish.json b/src/app/i18n/locales/zh-CN/publish.json
index f4eb3596..1c178471 100644
--- a/src/app/i18n/locales/zh-CN/publish.json
+++ b/src/app/i18n/locales/zh-CN/publish.json
@@ -62,7 +62,9 @@
"uploadImageOrVideo": "上传图片或视频",
"uploadImage": "请上传图片",
"uploadVideo": "请上传视频",
- "dragAndSelect": "拖放 & 选择图片或视频"
+ "dragAndSelect": "拖放 & 选择图片或视频",
+ "selectFile": "选择文件",
+ "uploadLocal": "上传本地图片或视频"
},
"validation": {
"facebookStoryNoDes": "Facebook Story不支持填写描述",
diff --git a/src/components/PublishDialog/compoents/DraftSelectionModal/index.tsx b/src/components/PublishDialog/compoents/DraftSelectionModal/index.tsx
new file mode 100644
index 00000000..e885258e
--- /dev/null
+++ b/src/components/PublishDialog/compoents/DraftSelectionModal/index.tsx
@@ -0,0 +1,354 @@
+import {
+ ForwardedRef,
+ forwardRef,
+ memo,
+ useCallback,
+ useEffect,
+ useMemo,
+ useState,
+} from "react";
+import { Button, List, message, Modal, Spin } from "antd";
+import { FolderOpenOutlined } from "@ant-design/icons";
+import { PubType } from "@/app/config/publishConfig";
+import { getOssUrl } from "@/utils/oss";
+import { apiGetMaterialGroupList, apiGetMaterialList } from "@/api/material";
+import { AccountPlatInfoMap } from "@/app/config/platConfig";
+import { useTransClient } from "@/app/i18n/client";
+import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";
+import { useShallow } from "zustand/react/shallow";
+
+export interface IDraftSelectionModalRef {}
+
+export interface IDraftSelectionModalProps {
+ draftModalOpen: boolean;
+ onCancel: () => void;
+}
+
+const DraftSelectionModal = memo(
+ forwardRef(
+ (
+ { draftModalOpen, onCancel }: IDraftSelectionModalProps,
+ ref: ForwardedRef<IDraftSelectionModalRef>,
+ ) => {
+ const {
+ pubListChoosed,
+ step,
+ setAccountAllParams,
+ expandedPubItem,
+ setOnePubParams,
+ } = usePublishDialog(
+ useShallow((state) => ({
+ pubListChoosed: state.pubListChoosed,
+ step: state.step,
+ setAccountAllParams: state.setAccountAllParams,
+ expandedPubItem: state.expandedPubItem,
+ setOnePubParams: state.setOnePubParams,
+ })),
+ );
+ const { t } = useTransClient("publish");
+ const [groupLoading, setGroupLoading] = useState(false);
+ const [groups, setGroups] = useState<any[]>([]);
+ const [selectedGroup, setSelectedGroup] = useState<any | null>(null);
+ const [draftLoading, setDraftLoading] = useState(false);
+ const [drafts, setDrafts] = useState<any[]>([]);
+
+ // 过滤可用类型(根据当前步骤和账户选择)
+ const allowImage = useMemo(() => {
+ if (step === 1 && expandedPubItem) {
+ const platConfig = AccountPlatInfoMap.get(
+ expandedPubItem.account.type,
+ )!;
+ return platConfig.pubTypes.has(PubType.ImageText);
+ }
+ if (pubListChoosed.length === 1) {
+ const platConfig = AccountPlatInfoMap.get(
+ pubListChoosed[0].account.type,
+ )!;
+ return platConfig.pubTypes.has(PubType.ImageText);
+ }
+ return true;
+ }, [step, expandedPubItem, pubListChoosed]);
+
+ const allowVideo = useMemo(() => {
+ if (step === 1 && expandedPubItem) {
+ const platConfig = AccountPlatInfoMap.get(
+ expandedPubItem.account.type,
+ )!;
+ return platConfig.pubTypes.has(PubType.VIDEO);
+ }
+ if (pubListChoosed.length === 1) {
+ const platConfig = AccountPlatInfoMap.get(
+ pubListChoosed[0].account.type,
+ )!;
+ return platConfig.pubTypes.has(PubType.VIDEO);
+ }
+ return true;
+ }, [step, expandedPubItem, pubListChoosed]);
+
+ const fetchGroups = useCallback(async () => {
+ try {
+ setGroupLoading(true);
+ const res: any = await apiGetMaterialGroupList(1, 100);
+ const list = res?.data?.list || [];
+ const filtered = list.filter((g: any) => {
+ if (g.type === PubType.ImageText) return allowImage;
+ if (g.type === PubType.VIDEO) return allowVideo;
+ return true;
+ });
+ setGroups(filtered);
+ } catch (e) {
+ } finally {
+ setGroupLoading(false);
+ }
+ }, [allowImage, allowVideo]);
+
+ const fetchDrafts = useCallback(async (groupId: string) => {
+ try {
+ setDraftLoading(true);
+ const res: any = await apiGetMaterialList(groupId, 1, 100);
+ setDrafts(res?.data?.list || []);
+ } catch (e) {
+ } finally {
+ setDraftLoading(false);
+ }
+ }, []);
+
+ // 选择草稿后填充参数
+ const applyDraft = useCallback(
+ (draft: any) => {
+ const nextParams: any = {};
+ if (draft.title) nextParams.title = draft.title;
+ if (draft.desc) nextParams.des = draft.desc;
+
+ // 处理媒体内容
+ if (Array.isArray(draft.mediaList) && draft.mediaList.length > 0) {
+ const videos = draft.mediaList.filter(
+ (m: any) => m.type === PubType.VIDEO,
+ );
+ const images = draft.mediaList.filter(
+ (m: any) => m.type !== PubType.VIDEO,
+ );
+
+ // 如果有视频,设置视频参数
+ if (videos.length > 0) {
+ const firstVideo = videos[0];
+ const ossUrl = getOssUrl(firstVideo.url);
+ const coverOss = getOssUrl(draft.coverUrl);
+ nextParams.video = {
+ ossUrl: ossUrl,
+ videoUrl: ossUrl,
+ cover: {
+ ossUrl: coverOss,
+ imgUrl: coverOss,
+ },
+ };
+ }
+
+ // 如果有图片,设置图片参数
+ if (images.length > 0) {
+ nextParams.images = images.map((v: any) => {
+ const ossUrl = getOssUrl(v.url);
+ return {
+ ossUrl,
+ imgUrl: ossUrl,
+ };
+ });
+ }
+ }
+
+ if (step === 1 && expandedPubItem) {
+ setOnePubParams(nextParams, expandedPubItem.account.id);
+ } else {
+ setAccountAllParams(nextParams);
+ }
+ onCancel();
+ message.success(t("draft.selectDraftSuccess"));
+ },
+ [setAccountAllParams, setOnePubParams, step, expandedPubItem],
+ );
+
+ useEffect(() => {
+ if (draftModalOpen) {
+ setSelectedGroup(null);
+ setDrafts([]);
+ fetchGroups();
+ }
+ }, [draftModalOpen, fetchGroups]);
+
+ useEffect(() => {
+ if (selectedGroup?._id) {
+ fetchDrafts(selectedGroup._id);
+ }
+ }, [selectedGroup, fetchDrafts]);
+
+ return (
+ <Modal
+ open={draftModalOpen}
+ onCancel={() => onCancel()}
+ footer={null}
+ title={
+ selectedGroup
+ ? t("draft.selectDraftItem")
+ : t("draft.selectDraftGroup")
+ }
+ width={720}
+ >
+ {!selectedGroup ? (
+ <div>
+ {groupLoading ? (
+ <div style={{ textAlign: "center", padding: 24 }}>
+ <Spin />
+ </div>
+ ) : (
+ <List
+ grid={{ gutter: 16, column: 2 }}
+ dataSource={groups}
+ locale={{ emptyText: t("draft.noDraftGroups") }}
+ renderItem={(item: any) => (
+ <List.Item>
+ <div
+ style={{
+ background: "#FAEFFC",
+ border: "2px solid transparent",
+ padding: "16px",
+ borderRadius: "12px",
+ cursor: "pointer",
+ transition: "all 0.3s ease",
+ minHeight: "80px",
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "center",
+ alignItems: "center",
+ textAlign: "center",
+ position: "relative",
+ }}
+ onClick={() => setSelectedGroup(item)}
+ >
+ <div
+ style={{
+ fontSize: 24,
+ marginBottom: 8,
+ color: "#667eea",
+ }}
+ >
+ <FolderOpenOutlined />
+ </div>
+ <div
+ style={{
+ fontWeight: 600,
+ fontSize: 16,
+ color: "#2c3e50",
+ marginBottom: 4,
+ }}
+ >
+ {item.name || item.title}
+ </div>
+ {item.desc && (
+ <div
+ style={{
+ fontSize: 12,
+ color: "#7f8c8d",
+ lineHeight: 1.4,
+ }}
+ >
+ {item.desc}
+ </div>
+ )}
+ <div
+ style={{
+ position: "absolute",
+ top: 8,
+ left: 8,
+ padding: "2px 8px",
+ borderRadius: "12px",
+ fontSize: 10,
+ color: "#fff",
+ background:
+ item.type === PubType.ImageText
+ ? "#52c41a"
+ : "#1890ff",
+ }}
+ >
+ {item.type === PubType.ImageText
+ ? t("draft.imageGroup")
+ : t("draft.videoGroup")}
+ </div>
+ </div>
+ </List.Item>
+ )}
+ />
+ )}
+ </div>
+ ) : (
+ <div>
+ <div style={{ marginBottom: 12 }}>
+ <Button type="link" onClick={() => setSelectedGroup(null)}>
+ {t("draft.backToGroups")}
+ </Button>
+ </div>
+ {draftLoading ? (
+ <div style={{ textAlign: "center", padding: 24 }}>
+ <Spin />
+ </div>
+ ) : (
+ <List
+ grid={{ gutter: 16, column: 2 }}
+ dataSource={drafts}
+ locale={{ emptyText: t("draft.noDrafts") }}
+ renderItem={(item: any) => (
+ <List.Item>
+ <div
+ style={{
+ border: "1px solid #eee",
+ borderRadius: 8,
+ overflow: "hidden",
+ cursor: "pointer",
+ }}
+ onClick={() => applyDraft(item)}
+ >
+ <div
+ style={{
+ width: "100%",
+ paddingTop: "56%",
+ position: "relative",
+ background: "#f7f7f7",
+ }}
+ >
+ {Array.isArray(item.mediaList) &&
+ item.mediaList[0] && (
+ <img
+ src={getOssUrl(item.coverUrl)}
+ alt=""
+ style={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ width: "100%",
+ height: "100%",
+ objectFit: "cover",
+ }}
+ />
+ )}
+ </div>
+ <div style={{ padding: 8 }}>
+ <div style={{ fontWeight: 600 }}>
+ {item.title || "-"}
+ </div>
+ <div style={{ fontSize: 12, color: "#999" }}>
+ {item.desc || ""}
+ </div>
+ </div>
+ </div>
+ </List.Item>
+ )}
+ />
+ )}
+ </div>
+ )}
+ </Modal>
+ );
+ },
+ ),
+);
+
+export default DraftSelectionModal;
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx
index 5b157894..c89667bd 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx
@@ -141,7 +141,7 @@ const PubParmasTextareaUpload = memo(
.click();
}}
>
- 上传本地图片或视频
+ {t("upload.uploadLocal")}
</a>
),
},
@@ -153,12 +153,8 @@ const PubParmasTextareaUpload = memo(
</a>
),
},
- {
- key: "3",
- label: "选择草稿",
- },
];
- }, []);
+ }, [t]);
return (
<div
@@ -265,7 +261,7 @@ const PubParmasTextareaUpload = memo(
<Dropdown menu={{ items: dropdownItems }} placement="top">
<div className="pubParmasTextarea-uploads-upload-blocker">
<PlusOutlined style={{ fontSize: "20px" }} />
- 选择文件
+ {t("upload.selectFile")}
</div>
</Dropdown>
)}
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
index 5d84aba9..dad7fcc9 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
@@ -35,6 +35,7 @@ import dynamic from "next/dynamic";
import Aibrush from "@/components/PublishDialog/svgs/aibrush.svg";
import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";
import { useShallow } from "zustand/react/shallow";
+import DraftSelectionModal from "@/components/PublishDialog/compoents/DraftSelectionModal";
const { TextArea } = Input;
const { Dragger } = Upload;
@@ -89,6 +90,7 @@ const PubParmasTextarea = memo(
}: IPubParmasTextareaProps,
ref: ForwardedRef<IPubParmasTextareaRef>,
) => {
+ const [draftModalOpen, setDraftModalOpen] = useState(false);
const { setOpenLeft } = usePublishDialog(
useShallow((state) => ({
setOpenLeft: state.setOpenLeft,
@@ -484,7 +486,7 @@ const PubParmasTextarea = memo(
type="text"
onClick={(e) => {
e.stopPropagation();
- setOpenLeft(true);
+ setDraftModalOpen(true);
}}
>
{t("actions.selectDraft")}
@@ -514,6 +516,11 @@ const PubParmasTextarea = memo(
<div className="pubParmasTextarea-footer-extend">{extend}</div>
)}
</div>
+
+ <DraftSelectionModal
+ draftModalOpen={draftModalOpen}
+ onCancel={() => setDraftModalOpen(false)}
+ />
</div>
</>
);
diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsx
index e74637af..10676204 100644
--- a/src/components/PublishDialog/index.tsx
+++ b/src/components/PublishDialog/index.tsx
@@ -9,13 +9,11 @@ import {
useState,
} from "react";
import styles from "./publishDialog.module.scss";
-import { Button, message, Modal, List, Spin, Tooltip } from "antd";
+import { Button, message, Modal, Tooltip } from "antd";
import DownloadAppModal from "@/components/common/DownloadAppModal";
import {
ArrowRightOutlined,
ExclamationCircleFilled,
- FileTextOutlined,
- FolderOpenOutlined,
InfoCircleOutlined,
} from "@ant-design/icons";
import PublishDialogAi from "@/components/PublishDialog/compoents/PublishDialogAi";
@@ -37,10 +35,7 @@ import {
} from "@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils";
import { generateUUID } from "@/utils";
import { useTransClient } from "@/app/i18n/client";
-import { apiGetMaterialGroupList, apiGetMaterialList } from "@/api/material";
-import { getOssUrl } from "@/utils/oss";
import { toolsApi } from "@/api/tools";
-import { useRouter } from "next/navigation";
import { PlatType } from "@/app/config/platConfig";
// 导入各平台授权函数
import { kwaiSkip } from "@/app/[lng]/accounts/plat/kwaiLogin";
@@ -150,7 +145,6 @@ const PublishDialog = memo(
const [showFacebookPagesModal, setShowFacebookPagesModal] =
useState(false);
const { t } = useTransClient("publish");
- const router = useRouter();
// 获取账户store
const { accountGroupList, getAccountList } = useAccountStore(
@@ -345,89 +339,6 @@ const PublishDialog = memo(
}
}, [hasDescription]);
- // 草稿选择弹窗/数据
- const [draftModalOpen, setDraftModalOpen] = useState(false);
- const [groupLoading, setGroupLoading] = useState(false);
- const [groups, setGroups] = useState<any[]>([]);
- const [selectedGroup, setSelectedGroup] = useState<any | null>(null);
- const [draftLoading, setDraftLoading] = useState(false);
- const [drafts, setDrafts] = useState<any[]>([]);
-
- // 过滤可用类型(根据当前步骤和账户选择)
- const allowImage = useMemo(() => {
- if (step === 1 && expandedPubItem) {
- const platConfig = AccountPlatInfoMap.get(
- expandedPubItem.account.type,
- )!;
- return platConfig.pubTypes.has(PubType.ImageText);
- }
- if (pubListChoosed.length === 1) {
- const platConfig = AccountPlatInfoMap.get(
- pubListChoosed[0].account.type,
- )!;
- return platConfig.pubTypes.has(PubType.ImageText);
- }
- return true;
- }, [step, expandedPubItem, pubListChoosed]);
-
- const allowVideo = useMemo(() => {
- if (step === 1 && expandedPubItem) {
- const platConfig = AccountPlatInfoMap.get(
- expandedPubItem.account.type,
- )!;
- return platConfig.pubTypes.has(PubType.VIDEO);
- }
- if (pubListChoosed.length === 1) {
- const platConfig = AccountPlatInfoMap.get(
- pubListChoosed[0].account.type,
- )!;
- return platConfig.pubTypes.has(PubType.VIDEO);
- }
- return true;
- }, [step, expandedPubItem, pubListChoosed]);
-
- const fetchGroups = useCallback(async () => {
- try {
- setGroupLoading(true);
- const res: any = await apiGetMaterialGroupList(1, 100);
- const list = res?.data?.list || [];
- const filtered = list.filter((g: any) => {
- if (g.type === PubType.ImageText) return allowImage;
- if (g.type === PubType.VIDEO) return allowVideo;
- return true;
- });
- setGroups(filtered);
- } catch (e) {
- } finally {
- setGroupLoading(false);
- }
- }, [allowImage, allowVideo]);
-
- const fetchDrafts = useCallback(async (groupId: string) => {
- try {
- setDraftLoading(true);
- const res: any = await apiGetMaterialList(groupId, 1, 100);
- setDrafts(res?.data?.list || []);
- } catch (e) {
- } finally {
- setDraftLoading(false);
- }
- }, []);
-
- useEffect(() => {
- if (draftModalOpen) {
- setSelectedGroup(null);
- setDrafts([]);
- fetchGroups();
- }
- }, [draftModalOpen, fetchGroups]);
-
- useEffect(() => {
- if (selectedGroup?._id) {
- fetchDrafts(selectedGroup._id);
- }
- }, [selectedGroup, fetchDrafts]);
-
useEffect(() => {
if (open) {
init(accounts, defaultAccountId);
@@ -469,60 +380,6 @@ const PublishDialog = memo(
});
}, [onClose, t]);
- // 选择草稿后填充参数
- const applyDraft = useCallback(
- (draft: any) => {
- const nextParams: any = {};
- if (draft.title) nextParams.title = draft.title;
- if (draft.desc) nextParams.des = draft.desc;
-
- // 处理媒体内容
- if (Array.isArray(draft.mediaList) && draft.mediaList.length > 0) {
- const videos = draft.mediaList.filter(
- (m: any) => m.type === PubType.VIDEO,
- );
- const images = draft.mediaList.filter(
- (m: any) => m.type !== PubType.VIDEO,
- );
-
- // 如果有视频,设置视频参数
- if (videos.length > 0) {
- const firstVideo = videos[0];
- const ossUrl = getOssUrl(firstVideo.url);
- const coverOss = getOssUrl(draft.coverUrl);
- nextParams.video = {
- ossUrl: ossUrl,
- videoUrl: ossUrl,
- cover: {
- ossUrl: coverOss,
- imgUrl: coverOss,
- },
- };
- }
-
- // 如果有图片,设置图片参数
- if (images.length > 0) {
- nextParams.images = images.map((v: any) => {
- const ossUrl = getOssUrl(v.url);
- return {
- ossUrl,
- imgUrl: ossUrl,
- };
- });
- }
- }
-
- if (step === 1 && expandedPubItem) {
- setOnePubParams(nextParams, expandedPubItem.account.id);
- } else {
- setAccountAllParams(nextParams);
- }
- setDraftModalOpen(false);
- message.success(t("draft.selectDraftSuccess"));
- },
- [setAccountAllParams, setOnePubParams, step, expandedPubItem],
- );
-
// 是否打开右侧预览
const openRight = useMemo(() => {
if (step === 0) {
@@ -625,29 +482,10 @@ const PublishDialog = memo(
}}
>
<div className="publishDialog-con">
- <div
- className="publishDialog-con-head"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
+ <div className="publishDialog-con-head">
<span className="publishDialog-con-head-title">
{t("title")}
</span>
- <div style={{ display: "flex", gap: 8 }}>
- <Button
- size="small"
- icon={<FileTextOutlined />}
- onClick={(e) => {
- e.stopPropagation();
- setDraftModalOpen(true);
- }}
- >
- {t("actions.selectDraft")}
- </Button>
- </div>
</div>
<div className="publishDialog-con-acconts">
{pubList.map((pubItem) => {
@@ -1051,172 +889,6 @@ const PublishDialog = memo(
</div>
</Modal>
- {/* Draft Selection Modal */}
- <Modal
- open={draftModalOpen}
- onCancel={() => setDraftModalOpen(false)}
- footer={null}
- title={
- selectedGroup
- ? t("draft.selectDraftItem")
- : t("draft.selectDraftGroup")
- }
- width={720}
- >
- {!selectedGroup ? (
- <div>
- {groupLoading ? (
- <div style={{ textAlign: "center", padding: 24 }}>
- <Spin />
- </div>
- ) : (
- <List
- grid={{ gutter: 16, column: 2 }}
- dataSource={groups}
- locale={{ emptyText: t("draft.noDraftGroups") }}
- renderItem={(item: any) => (
- <List.Item>
- <div
- style={{
- background: "#FAEFFC",
- border: "2px solid transparent",
- padding: "16px",
- borderRadius: "12px",
- cursor: "pointer",
- transition: "all 0.3s ease",
- minHeight: "80px",
- display: "flex",
- flexDirection: "column",
- justifyContent: "center",
- alignItems: "center",
- textAlign: "center",
- position: "relative",
- }}
- onClick={() => setSelectedGroup(item)}
- >
- <div
- style={{
- fontSize: 24,
- marginBottom: 8,
- color: "#667eea",
- }}
- >
- <FolderOpenOutlined />
- </div>
- <div
- style={{
- fontWeight: 600,
- fontSize: 16,
- color: "#2c3e50",
- marginBottom: 4,
- }}
- >
- {item.name || item.title}
- </div>
- {item.desc && (
- <div
- style={{
- fontSize: 12,
- color: "#7f8c8d",
- lineHeight: 1.4,
- }}
- >
- {item.desc}
- </div>
- )}
- <div
- style={{
- position: "absolute",
- top: 8,
- left: 8,
- padding: "2px 8px",
- borderRadius: "12px",
- fontSize: 10,
- color: "#fff",
- background:
- item.type === PubType.ImageText
- ? "#52c41a"
- : "#1890ff",
- }}
- >
- {item.type === PubType.ImageText
- ? t("draft.imageGroup")
- : t("draft.videoGroup")}
- </div>
- </div>
- </List.Item>
- )}
- />
- )}
- </div>
- ) : (
- <div>
- <div style={{ marginBottom: 12 }}>
- <Button type="link" onClick={() => setSelectedGroup(null)}>
- {t("draft.backToGroups")}
- </Button>
- </div>
- {draftLoading ? (
- <div style={{ textAlign: "center", padding: 24 }}>
- <Spin />
- </div>
- ) : (
- <List
- grid={{ gutter: 16, column: 2 }}
- dataSource={drafts}
- locale={{ emptyText: t("draft.noDrafts") }}
- renderItem={(item: any) => (
- <List.Item>
- <div
- style={{
- border: "1px solid #eee",
- borderRadius: 8,
- overflow: "hidden",
- cursor: "pointer",
- }}
- onClick={() => applyDraft(item)}
- >
- <div
- style={{
- width: "100%",
- paddingTop: "56%",
- position: "relative",
- background: "#f7f7f7",
- }}
- >
- {Array.isArray(item.mediaList) &&
- item.mediaList[0] && (
- <img
- src={getOssUrl(item.coverUrl)}
- alt=""
- style={{
- position: "absolute",
- left: 0,
- top: 0,
- width: "100%",
- height: "100%",
- objectFit: "cover",
- }}
- />
- )}
- </div>
- <div style={{ padding: 8 }}>
- <div style={{ fontWeight: 600 }}>
- {item.title || "-"}
- </div>
- <div style={{ fontSize: 12, color: "#999" }}>
- {item.desc || ""}
- </div>
- </div>
- </div>
- </List.Item>
- )}
- />
- )}
- </div>
- )}
- </Modal>
-
{/* 下载App弹窗 */}
<DownloadAppModal
visible={downloadModalVisible}
diff --git a/src/components/PublishDialog/publishDialog.module.scss b/src/components/PublishDialog/publishDialog.module.scss
index 97c096e0..d594bc5c 100644
--- a/src/components/PublishDialog/publishDialog.module.scss
+++ b/src/components/PublishDialog/publishDialog.module.scss
@@ -218,7 +218,7 @@ $assistantWidth: 380px;
position: absolute;
width: 50%;
height: 20px;
- z-index: 10;
+ z-index: 8;
border-radius: 0 0 15px 15px;
top: 0;
left: 50%;