Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
refactor(发布): 旧发布和发布记录全部删除
gaoSir97da647f09e0
diff --git a/.idea/workspace.xml b/.idea/workspace.xmlindex d415a7e4..33bd0c32 100644--- a/.idea/workspace.xml+++ b/.idea/workspace.xml@@ -4,30 +4,113 @@<option name="autoReloadType" value="SELECTIVE" /></component><component name="ChangeListManager">- <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="feat: 拖动调整完成(目前等待接接口)">- <change afterPath="$PROJECT_DIR$/src/api/plat/kwai.ts" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/api/plat/types/kwai.type.ts" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.env" beforeDir="false" afterPath="$PROJECT_DIR$/.env" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.env.development" beforeDir="false" afterPath="$PROJECT_DIR$/.env.development" afterDir="false" />+ <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="feat: 授权改到后端">+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/PublishDialog.util.ts" afterDir="false" />+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/VideoCoverSeting.tsx" afterDir="false" />+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/videoCoverSeting.module.scss" afterDir="false" /><change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />- <change beforePath="$PROJECT_DIR$/next.config.mjs" beforeDir="false" afterPath="$PROJECT_DIR$/next.config.mjs" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/plat/kwaiLogin.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/plat/kwaiLogin.ts" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/constant.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/constant.ts" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/comment.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/AICreateTitle/AICreateTitle.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/AICreateTitle/aICreateTitle.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/AICreateTitle/useAICreateTitle.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/Choose/ImgChoose.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/Choose/ImgChoose.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/Choose/ImgChoose.util.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/Choose/VideoChoose.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/Choose/videoChoose.util.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/ChooseAccountModule/ChooseAccountModule.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/ChooseAccountModule/chooseAccountModule.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/ChooseAccountModule/components/PlatChoose.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/CommonComponents/CommonComponents.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/CommonComponents/CommonLocationSelect.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/CommonComponents/CommonScheduledTimeSelect.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/CommonComponents/CommonTopicSelect.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/CommonComponents/CommonUserSelect.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/CommonComponents/commonComponents.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/PubAccountDetModule/pubAccountDetModule.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/PubProgressModule/pubProgressModule.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/PublishSidebar.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/SupportPlat/SupportPlat.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/components/SupportPlat/supportPlat.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/hooks/usePubParamsVerify.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImgTextImagesView.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/imgTextImagesView.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageRightSetting/ImageRightSetting.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.type.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/children/hooks/useImagePlatParams.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/imageParamsSet.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/image.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/imagePage.type.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/page.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/imagePage/useImagePageStore.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/layout.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/page.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/pubRecord/page.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/pubRecord/pubRecord.common.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/pubRecord/pubRecord.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/publish.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/comment.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/CommonPubSetting.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/NoChoosePage.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoChooseItem.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoCoverSeting.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/LocationSelect.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/TopicSelect.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/UserSelect.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/useDebounceFetcher.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.type.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/components/videoCoverSeting.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/images/importRecord.png" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/images/localUpload.png" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/page.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/useVideoPageStore.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/video.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/publish/videoPage/videoPage.type.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/layout/BellMessage/bellMessage.module.scss" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/layout/BellMessage/index.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/layout/LyaoutHeader.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/layout/LyaoutHeader.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/layout/routerData.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/layout/routerData.ts" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/PlatBase.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/PlatManage.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/plat.type.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/plat.util.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/platChildren/bilibili/BilibiliPlat.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/platChildren/bilibili/BilibiliPubCore.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/platChildren/kwai/KwaiPlat.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/platChildren/kwai/KwaiPubCore.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/platChildren/youtube/YoutubePlat.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/plat/platChildren/youtube/YoutubePubCore.ts" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/plats/plats.type.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/plats/plats.type.ts" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.type.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.type.ts" afterDir="false" /></list><option name="SHOW_DIALOG" value="false" /><option name="HIGHLIGHT_CONFLICTS" value="true" /><option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /><option name="LAST_RESOLUTION" value="IGNORE" /></component>+ <component name="ChangesViewManager">+ <option name="groupingKeys">+ <option value="directory" />+ </option>+ </component><component name="FileTemplateManagerImpl"><option name="RECENT_TEMPLATES"><list>- <option value="TypeScript JSX File" /><option value="tsx组件模板" /><option value="TypeScript File" />+ <option value="TypeScript JSX File" /></list></option></component>@@ -36,7 +119,7 @@<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /></component><component name="ProblemsViewState">- <option name="selectedTabId" value="ProjectErrors" />+ <option name="selectedTabId" value="CurrentFile" /></component><component name="ProjectColorInfo">{"customColor": "",@@ -90,6 +173,7 @@<recent name="E:\project-dev\web\艺咖\aitoearn-web\src\components\PublishDialog\plats" /></key><key name="MoveFile.RECENT_KEYS">+ <recent name="E:\project-dev\web\艺咖\aitoearn-web\src\components\PublishDialog\compoents" /><recent name="E:\project-dev\web\艺咖\aitoearn-web\src\components\PublishDialog\compoents\PlatParamsSetting" /><recent name="E:\project-dev\web\艺咖\aitoearn-web\src\components\PublishDialog\compoents\PubParmasTextarea" /><recent name="E:\project-dev\web\艺咖\aitoearn-web\src\assets\svgs\plat" />@@ -123,7 +207,7 @@<workItem from="1751273285905" duration="3882000" /><workItem from="1751278214456" duration="955000" /><workItem from="1751334170049" duration="2844000" />- <workItem from="1751351785412" duration="12693000" />+ <workItem from="1751351785412" duration="16797000" /></task><task id="LOCAL-00001" summary="feat: 日历完善"><option name="closed" value="true" />@@ -285,7 +369,15 @@<option name="project" value="LOCAL" /><updated>1751256097944</updated></task>- <option name="localTasksCounter" value="21" />+ <task id="LOCAL-00021" summary="feat: 授权改到后端">+ <option name="closed" value="true" />+ <created>1751376590963</created>+ <option name="number" value="00021" />+ <option name="presentableId" value="LOCAL-00021" />+ <option name="project" value="LOCAL" />+ <updated>1751376590963</updated>+ </task>+ <option name="localTasksCounter" value="22" /><servers /></component><component name="TypeScriptGeneratedFilesManager">@@ -325,6 +417,7 @@<MESSAGE value="feat: 【发布弹框】预览样式调整" /><MESSAGE value="feat: 日历拖拽初步开发" /><MESSAGE value="feat: 拖动调整完成(目前等待接接口)" />- <option name="LAST_COMMIT_MESSAGE" value="feat: 拖动调整完成(目前等待接接口)" />+ <MESSAGE value="feat: 授权改到后端" />+ <option name="LAST_COMMIT_MESSAGE" value="feat: 授权改到后端" /></component></project>\ No newline at end of filediff --git a/src/app/[lng]/publish/comment.ts b/src/app/[lng]/publish/comment.tsdeleted file mode 100644index 8a18e894..00000000--- a/src/app/[lng]/publish/comment.ts+++ /dev/null@@ -1,27 +0,0 @@-import { SocialAccount } from "@/api/types/account.type";-import { AccountStatus } from "@/app/config/accountConfig";--// export type PubRecordModel = PubRecordModelLast;--// 接口失效处理-export async function accountFailureDispose<T>(- {- status,- data,- }: {- status: number;- data?: T;- },- account: SocialAccount,- callback: (account: SocialAccount) => void,-) {- if (status !== 200 && status !== 201) {- if (status === 401) {- account.status = AccountStatus.DISABLE;- callback(account);- // await ipcUpdateAccountStatus(account.id, AccountStatus.DISABLE);- }- return [];- }- return data || [];-}diff --git a/src/app/[lng]/publish/components/AICreateTitle/AICreateTitle.tsx b/src/app/[lng]/publish/components/AICreateTitle/AICreateTitle.tsxdeleted file mode 100644index 458aefe6..00000000--- a/src/app/[lng]/publish/components/AICreateTitle/AICreateTitle.tsx+++ /dev/null@@ -1,92 +0,0 @@-import React, { ForwardedRef, forwardRef, memo, useState } from "react";-import styles from "./aICreateTitle.module.scss";-import { Button, message, Tooltip } from "antd";-import { ExclamationCircleOutlined } from "@ant-design/icons";-import { useShallow } from "zustand/react/shallow";-import { useAICreateTitleStore } from "./useAICreateTitle";-import { toolsApi } from "@/api/tools";-import { AiCreateType } from "@/api/types/tools";-import { APP_HOT_URL } from "@/constant";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";--const VITE_APP_FILE_HOST = APP_HOT_URL;--export interface IAICreateTitleRef {}--export interface IAICreateTitleProps {- type: AiCreateType;- // 提示信息- tips?: string;- // 用于生成文字的视频- videoFile?: IVideoFile;- onAiCreateFinish: (text: string) => void;- // 字数限制- max: number;-}--/**- * AI生成标题和描述- */-const AICreateTitle = memo(- forwardRef(- (- { type, tips, videoFile, onAiCreateFinish, max }: IAICreateTitleProps,- ref: ForwardedRef<IAICreateTitleRef>,- ) => {- const [loading, setLoading] = useState(false);- const { getVideo, setVideo } = useAICreateTitleStore(- useShallow((state) => ({- getVideo: state.getVideo,- setVideo: state.setVideo,- })),- );-- return (- <div className={styles.aICreateTitle}>- <Button- loading={loading}- type="link"- onClick={async () => {- if (!videoFile) return message.warning("您必须上传一个视频!");- if (videoFile.duration > 40)- return message.warning("视频超过40秒,不支持生成!");- if (loading) return;- setLoading(true);- const videoId = videoFile.size + videoFile.filename;- let videoOssUrl = "";- videoOssUrl = getVideo(videoId);- // 上传- if (!videoOssUrl) {- const { name } = await toolsApi.uploadFileTemp(videoFile.file);- if (name) {- videoOssUrl = VITE_APP_FILE_HOST + name;- setVideo(videoId, videoOssUrl);- } else {- setLoading(false);- return message.error("网络繁忙,请稍后重试!");- }- }- const res = await toolsApi.apiVideoAiTitle(- videoOssUrl,- type,- max,- );- onAiCreateFinish(res);- setLoading(false);- }}- >- {type === AiCreateType.TITLE ? "AI生成标题" : "AI生成描述"}- {tips && (- <Tooltip title={tips}>- <ExclamationCircleOutlined />- </Tooltip>- )}- </Button>- </div>- );- },- ),-);-AICreateTitle.displayName = "AICreateTitle";--export default AICreateTitle;diff --git a/src/app/[lng]/publish/components/AICreateTitle/aICreateTitle.module.scss b/src/app/[lng]/publish/components/AICreateTitle/aICreateTitle.module.scssdeleted file mode 100644index 9c5d7fe7..00000000--- a/src/app/[lng]/publish/components/AICreateTitle/aICreateTitle.module.scss+++ /dev/null@@ -1,8 +0,0 @@-.aICreateTitle {- :global {- button {- margin: 0;- padding: 0;- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/publish/components/AICreateTitle/useAICreateTitle.ts b/src/app/[lng]/publish/components/AICreateTitle/useAICreateTitle.tsdeleted file mode 100644index 205a09fd..00000000--- a/src/app/[lng]/publish/components/AICreateTitle/useAICreateTitle.ts+++ /dev/null@@ -1,55 +0,0 @@-import { create } from "zustand";-import { combine } from "zustand/middleware";-import lodash from "lodash";--interface IAICreateTitleStore {- /**- * 视频列表- * key=视频名称+视频size,value=oss地址- */- aiCreateVideoMap: Map<string, string>;-}--const store: IAICreateTitleStore = {- aiCreateVideoMap: new Map([]),-};--const getStore = () => {- return lodash.cloneDeep(store);-};--/**- * 这个store是为了记录 [AICreateTitle.tsx] 组件上传的视频- * 防止同一个视频被上传多次- * 注意要在引用该组件的页面销毁后调用这个store的clear方法- */-export const useAICreateTitleStore = create(- combine(- {- ...store,- },- (set, get, storeApi) => {- const methods = {- clear() {- set({- ...getStore(),- });- },-- getVideo(key: string) {- return get().aiCreateVideoMap.get(key) || "";- },-- setVideo(key: string, value: string) {- const aiCreateVideoMap = new Map(get().aiCreateVideoMap);- aiCreateVideoMap.set(key, value);-- set({- aiCreateVideoMap,- });- },- };- return methods;- },- ),-);diff --git a/src/app/[lng]/publish/components/Choose/ImgChoose.util.ts b/src/app/[lng]/publish/components/Choose/ImgChoose.util.tsdeleted file mode 100644index ce596dd4..00000000--- a/src/app/[lng]/publish/components/Choose/ImgChoose.util.ts+++ /dev/null@@ -1,37 +0,0 @@-import { generateUUID, getFilePathName } from "@/utils";-import { IImgFile } from "@/app/[lng]/publish/components/Choose/ImgChoose";--export const formatImg = async ({- path,- file,- blob,-}: {- path: string;- file?: Uint8Array;- blob?: Blob;-}): Promise<IImgFile> => {- return new Promise((resolve) => {- const { filename, suffix } = getFilePathName(path);- if (!blob) {- blob = new Blob([file!], {- type: `image/${suffix}`,- });- }- const imgUrl = URL.createObjectURL(blob);-- const img = new Image();- img.onload = () => {- resolve({- id: generateUUID(),- width: img.width,- height: img.height,- imgPath: path,- size: blob!.size,- filename,- file: blob!,- imgUrl,- });- };- img.src = imgUrl;- });-};diff --git a/src/app/[lng]/publish/components/Choose/VideoChoose.tsx b/src/app/[lng]/publish/components/Choose/VideoChoose.tsxdeleted file mode 100644index 4932f204..00000000--- a/src/app/[lng]/publish/components/Choose/VideoChoose.tsx+++ /dev/null@@ -1,137 +0,0 @@-/*- * @Author: nevin- * @Date: 2025-01-22 21:59:36- * @LastEditTime: 2025-01-23 15:40:37- * @LastEditors: nevin- * @Description: 选择视频- */-import { Button, message, Upload } from "antd";-import { FC, useRef } from "react";-import { IImgFile } from "@/app/[lng]/publish/components/Choose/ImgChoose";-import { RcFile } from "antd/es/upload";-import {- formatVideo,- VideoGrabFrame,-} from "@/app/[lng]/publish/components/Choose/videoChoose.util";--interface VideoChooseProps {- // 单选就使用单选方法,多选就使用单选方法-- // 单选返回- onChoose?: (videoFile: IVideoFile) => void;- // 多选返回方法- onMultipleChoose?: (videoFiles: IVideoFile[]) => void;- children?: React.ReactNode;- // 开始选择- onStartShoose?: () => void;- onChooseFail?: () => void;-}--export interface IVideoFile {- size: number;- file: Blob;- // 前端临时路径,注意不要存到数据库- videoUrl: string;- filename: string;- // 视频宽度- width: number;- // 视频高度- height: number;- // 视频下取整的时长,单位秒- duration: number;- // 视频首帧图片- cover: IImgFile;-}--async function getVideoInfo(videoUrl: string): Promise<{- width: number;- height: number;- // 下取整的时长- duration: number;- // 视频首帧- cover: IImgFile;-}> {- return await VideoGrabFrame(videoUrl, 0);-}--// 根据视频的Uint8Array和路径获取文件-// export const formatVideo = async (-// path: string,-// file: Uint8Array,-// ): Promise<IVideoFile> => {-// const { filename, suffix } = getFilePathName(path);-// const blob = new Blob([file], { type: `video/${suffix}` });-// const videoUrl = URL.createObjectURL(blob);-//-// const videoInfo = await getVideoInfo(videoUrl, filename);-// return {-// videoPath: path,-// size: file.length,-// filename,-// file: blob,-// videoUrl,-// ...videoInfo,-// };-// };--const VideoChoose: FC<VideoChooseProps> = ({- onChoose,- onMultipleChoose,- children,- onStartShoose,- onChooseFail,-}) => {- const chooseCount = useRef<number>(0);- const fileListRef = useRef<RcFile[]>([]);-- /**- * 发送上传的事件- */- const handleUploadVideo = async () => {- try {- const tasks: Promise<IVideoFile>[] = [];- for (const file of fileListRef.current) {- tasks.push(formatVideo(file));- }- const videoFiles = await Promise.all(tasks);-- if (onMultipleChoose) {- onMultipleChoose(videoFiles);- } else if (onChoose) {- onChoose(videoFiles[0]);- }- } catch (e) {- message.error("选择视频失败");- console.error(e);- }- };-- return (- <Upload- accept=".mp4"- multiple={!!onMultipleChoose}- beforeUpload={async (file, uploadFileList) => {- chooseCount.current++;- fileListRef.current = [...fileListRef.current, file];-- if (chooseCount.current === uploadFileList.length) {- handleUploadVideo();- fileListRef.current = [];- chooseCount.current = 0;- }-- return Upload.LIST_IGNORE;- }}- >- {children ? (- <div className="videoChoose" style={{ cursor: "pointer" }}>- {children}- </div>- ) : (- <Button type="primary">选择视频</Button>- )}- </Upload>- );-};--export default VideoChoose;diff --git a/src/app/[lng]/publish/components/ChooseAccountModule/ChooseAccountModule.tsx b/src/app/[lng]/publish/components/ChooseAccountModule/ChooseAccountModule.tsxdeleted file mode 100644index 76ee7161..00000000--- a/src/app/[lng]/publish/components/ChooseAccountModule/ChooseAccountModule.tsx+++ /dev/null@@ -1,119 +0,0 @@-import {- ForwardedRef,- forwardRef,- memo,- useEffect,- useImperativeHandle,- useRef,- useState,-} from "react";-import { Modal, Tabs } from "antd";-import { AccountInfo } from "@/app/[lng]/publish/videoPage/videoPage.type";-import PlatChoose, {- IPlatChooseProps,- IPlatChooseRef,-} from "@/app/[lng]/publish/components/ChooseAccountModule/components/PlatChoose";--export interface IChooseAccountModuleRef {- getPlatChooseRef: () => IPlatChooseRef | null;-}--export interface IChooseAccountModuleProps {- open: boolean;- onClose: (open: boolean) => void;- // 按平台props- platChooseProps?: IPlatChooseProps;- // 按平台选择确认- onPlatConfirm?: (accounts: AccountInfo[]) => void;- // 按平台选择change- onPlatChange?: (accounts: AccountInfo[], account: AccountInfo) => void;-}--const ChooseAccountModule = memo(- forwardRef(- (- {- open,- onClose,- onPlatConfirm,- onPlatChange,- platChooseProps,- }: IChooseAccountModuleProps,- ref: ForwardedRef<IChooseAccountModuleRef>,- ) => {- const [newChoosedAccounts, setNewChoosedAccounts] = useState<- AccountInfo[]- >([]);- 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/app/[lng]/publish/components/ChooseAccountModule/chooseAccountModule.module.scss b/src/app/[lng]/publish/components/ChooseAccountModule/chooseAccountModule.module.scssdeleted file mode 100644index 1b8cafb5..00000000--- a/src/app/[lng]/publish/components/ChooseAccountModule/chooseAccountModule.module.scss+++ /dev/null@@ -1,102 +0,0 @@-.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/app/[lng]/publish/components/ChooseAccountModule/components/PlatChoose.tsx b/src/app/[lng]/publish/components/ChooseAccountModule/components/PlatChoose.tsxdeleted file mode 100644index 4fbbd8d2..00000000--- a/src/app/[lng]/publish/components/ChooseAccountModule/components/PlatChoose.tsx+++ /dev/null@@ -1,399 +0,0 @@-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 { AccountInfo } from "@/app/[lng]/publish/videoPage/videoPage.type";-import Link from "next/link";--export interface IPlatChooseRef {- /**- * 恢复选中状态- * @param choosedAccounts- */- recover: () => void;- // 每次关闭弹框的时候需要初始化一些状态- init: () => void;- // 设置选中平台- setActivePlat: (activePlat: PlatType) => void;-}--export interface IPlatChooseProps {- pubType: PubType;- // 默认选择的平台- defaultPlat?: PlatType;- onChange?: (- choosedAcounts: AccountInfo[],- choosedAcount: AccountInfo,- ) => void;- // 外部传入的已经选中的数据,这个值只有在确认更改才会更新- choosedAccounts?: AccountInfo[];- // 按平台 是否禁用多选,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, AccountInfo[]>- >(new Map());- // 当前选择的平台- const [activePlat, setActivePlat] = useState<PlatType | undefined>();- // 当前选择的账户数据- const [choosedAcountMap, setChoosedAcountMap] = useState<- Map<PlatType, AccountInfo[]>- >(new Map());- // 每次change操作的数据- const recentData = useRef<AccountInfo>();- const { accountList } = useAccountStore(- useShallow((state) => ({- accountList: state.accountList,- })),- );-- // 经过 allowPlatSet 过滤后的账户数据- const accountMapLast = useMemo(() => {- const newVal = new Map<PlatType, AccountInfo[]>();- 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: AccountInfo[] = [];- 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;diff --git a/src/app/[lng]/publish/components/CommonComponents/CommonComponents.tsx b/src/app/[lng]/publish/components/CommonComponents/CommonComponents.tsxdeleted file mode 100644index 1d139727..00000000--- a/src/app/[lng]/publish/components/CommonComponents/CommonComponents.tsx+++ /dev/null@@ -1,202 +0,0 @@-import { Button, Radio, Select, SelectProps } from "antd";-import styles from "./commonComponents.module.scss";-import React, { ReactNode, useEffect, useState } from "react";-import { PlusOutlined, UserAddOutlined } from "@ant-design/icons";-import { AccountStatus } from "@/app/config/accountConfig";-import { AccountInfo } from "@/app/[lng]/publish/videoPage/videoPage.type";-import { VisibleTypeEnum } from "@/app/config/publishConfig";-import { IMixItem } from "@/app/plat/plat.type";--// 本地上传、素材上传展示的块-export const ChooseChunk = ({- onClick,- imgUrl,- color,- text,- hoverColor,- style,-}: {- onClick?: () => void;- imgUrl: string;- hoverColor?: string;- color: string;- text: string;- style?: React.CSSProperties;-}) => {- const [isHovered, setIsHovered] = useState(false);-- return (- <>- <div- className={styles.chooseChunk}- onClick={() => {- if (onClick) onClick();- }}- style={- isHovered- ? {- borderColor: hoverColor || color,- ...(style || {}),- }- : style || {}- }- onMouseEnter={() => setIsHovered(true)}- onMouseLeave={() => setIsHovered(false)}- >- <img src={imgUrl} />- <Button type="primary" size="large" style={{ background: color }}>- {text}- </Button>- </div>- </>- );-};--// 选择账户展示的块-export const ChooseAccountChunk = ({- onClick,- children,-}: {- onClick: () => void;- children?: ReactNode;-}) => {- return (- <div className={styles.chooseAccountChunk} onClick={onClick}>- <UserAddOutlined className="chooseAccountChunk-user" />- <Button icon={<PlusOutlined />} type="primary">- 选择发布账号- </Button>- {children}- </div>- );-};--export interface PubPermissionProps {- onChange?: (visibleType: VisibleTypeEnum) => void;- value?: VisibleTypeEnum;- title?: string;- style?: React.CSSProperties;-}--// 权限设置-export const PubPermission = ({- onChange,- value,- style,- title = "权限设置",-}: PubPermissionProps) => {- return (- <>- <h1>{title}</h1>- <Radio.Group- style={style}- options={[- {- label: "公开(所有人可见)",- value: VisibleTypeEnum.Public,- },- { label: "好友可见", value: VisibleTypeEnum.Friend },- {- label: "私密(仅自己可见)",- value: VisibleTypeEnum.Private,- },- ]}- onChange={(e) => {- if (onChange) onChange(e.target.value);- }}- value={value}- />- </>- );-};--// 账户重新登录-export const AccountRestartLogin = ({- account,- onAccountRestart,-}: {- account?: AccountInfo;- onAccountRestart: () => void;-}) => {- return (- <>- {account?.status === AccountStatus.DISABLE && (- <div className={styles.accountRestartLogin}>- 账户已失效,- <Button- type="link"- onClick={() => {- onAccountRestart();- }}- >- 重新登录- </Button>- 后可获取- </div>- )}- </>- );-};--// 合集-export const CommonMixSelect = ({- account,- onAccountChange,- children,- ...props-}: {- account?: AccountInfo;- children?: React.ReactNode;- onAccountChange?: (account: AccountInfo) => void;-} & SelectProps) => {- if (!account || !onAccountChange) return "";-- const [options, setOptions] = useState<IMixItem[]>([]);-- const getList = async () => {- // TODO 获取合集- // const res = await icpGetMixList(account!);- // const data = await accountFailureDispose(res, account!, onAccountChange);- // setOptions(data);- };-- useEffect(() => {- getList();- // TODO onAccountLoginFinish- // return onAccountLoginFinish((newAccount) => {- // account = newAccount;- // getList();- // });- }, []);-- return (- <>- <h1>合集</h1>- <Select- options={options}- allowClear- style={{ width: "100%" }}- placeholder="选择合集"- fieldNames={{- label: "name",- value: "id",- }}- optionRender={({ data }) => {- return (- <div className={styles.mixSelectItem}>- <div className="mixSelectItem-left">- {data.coverImg && <img src={data.coverImg} />}- {data.name}- </div>- <div className="mixSelectItem-right">- 共{data.feedCount}个作品- </div>- </div>- );- }}- {...props}- />- {children}- </>- );-};diff --git a/src/app/[lng]/publish/components/CommonComponents/CommonLocationSelect.tsx b/src/app/[lng]/publish/components/CommonComponents/CommonLocationSelect.tsxdeleted file mode 100644index d40d44b9..00000000--- a/src/app/[lng]/publish/components/CommonComponents/CommonLocationSelect.tsx+++ /dev/null@@ -1,96 +0,0 @@-import React, { useEffect, useRef } from "react";-import { Select, SelectProps, Spin } from "antd";-import styles from "./commonComponents.module.scss";-import useDebounceFetcher from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/useDebounceFetcher";-import {- AccountInfo,- ILocationDataItem,-} from "@/app/[lng]/publish/videoPage/videoPage.type";--interface CommonLocationSelectProps<ValueType = any>- extends Omit<SelectProps<ValueType | ValueType[]>, "options" | "children"> {- account?: AccountInfo;- onAccountChange?: (account: AccountInfo) => void;- children?: React.ReactNode;-}--// 通用位置选择器-export default function CommonLocationSelect({- children,- account,- onAccountChange,- ...props-}: CommonLocationSelectProps<ILocationDataItem>) {- if (!account || !onAccountChange) return "";-- const { fetching, options, debounceFetcher } =- useDebounceFetcher<ILocationDataItem>(async (keywords) => {- // TODO 位置获取- // if (location.current.loca.length === 0) await getLocation();- // const locationData = await icpGetLocationData({- // account: account!,- // keywords,- // latitude: location.current.loca[1],- // longitude: location.current.loca[0],- // cityName: location.current.city,- // });- // return await accountFailureDispose(- // locationData,- // account,- // onAccountChange,- // );- return undefined;- });- // 位置 0=经度 1=纬度- const location = useRef<{- loca: number[];- city: string;- }>({- loca: [],- city: "",- });-- useEffect(() => {- getLocation();- }, []);-- const getLocation = async () => {- // 当前经纬度获取- // const res = await icpGetLocation();- // location.current.loca = res.gcj02;- // location.current.city = res.city;- };-- return (- <>- <h1>位置</h1>- <Select- showSearch- allowClear- style={{ width: "100%" }}- placeholder="请选择关联位置"- labelInValue- filterOption={false}- onSearch={debounceFetcher}- notFoundContent={fetching ? <Spin size="small" /> : null}- {...props}- options={options?.map((v) => {- return {- value: v.id,- label: v.name,- ...v,- };- })}- optionRender={({ data }) => {- return (- <div className={styles.locationSelect}>- <p className="location-name">{data.name}</p>- <p className="location-simpleAddress">{data.simpleAddress}</p>- </div>- );- }}- />- {children}- </>- );-}diff --git a/src/app/[lng]/publish/components/CommonComponents/CommonScheduledTimeSelect.tsx b/src/app/[lng]/publish/components/CommonComponents/CommonScheduledTimeSelect.tsxdeleted file mode 100644index 2275e002..00000000--- a/src/app/[lng]/publish/components/CommonComponents/CommonScheduledTimeSelect.tsx+++ /dev/null@@ -1,103 +0,0 @@-import React, { ForwardedRef, forwardRef, memo, useMemo } from "react";-import dayjs from "dayjs";-import { DatePicker } from "antd";-import styles from "./commonComponents.module.scss";-import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";--export interface ICommonScheduledTimeSelectRef {}--export interface ICommonScheduledTimeSelectProps {- // 分钟、当前时间 + 这个分钟之后的时间才可以选择- timeOffset?: number;- // 天,昨天 ~ maxDate- maxDate?: number;- value?: dayjs.Dayjs | null | undefined;- onChange?:- | ((date: dayjs.Dayjs, dateString: string | string[]) => void)- | undefined;- platType?: PlatType;- isTitle?: boolean;-}--// 通用定时发布-const CommonScheduledTimeSelect = memo(- forwardRef(- (- {- timeOffset,- maxDate,- value,- onChange,- platType,- isTitle = true,- }: ICommonScheduledTimeSelectProps,- ref: ForwardedRef<ICommonScheduledTimeSelectRef>,- ) => {- const getMaxTimes = useMemo(() => {- const accountPlatInfo = AccountPlatInfoMap.get(platType!);- const timingMax = accountPlatInfo?.commonPubParamsConfig.timingMax;-- return {- timeOffset: timeOffset || timingMax!.timeOffset,- maxDate: maxDate || timingMax!.maxDate,- };- }, [platType]);-- const range = (start: number, end: number) => {- const result = [];- for (let i = start; i < end; i++) {- result.push(i);- }- return result;- };-- const disabledDate = (current: dayjs.Dayjs) => {- const yesterday = dayjs().subtract(0, "day").startOf("day");- const futureDate = dayjs().add(getMaxTimes.maxDate, "day").endOf("day");- return (- current &&- (current.isBefore(yesterday, "day") ||- current.isAfter(futureDate, "day"))- );- };-- const disabledTime = (current: dayjs.Dayjs | null) => {- const now = dayjs();- const minutesOffset = now.add(getMaxTimes.timeOffset, "minute");- if (current && current.isBefore(minutesOffset)) {- const hours = minutesOffset.hour();- const minutes = minutesOffset.minute();- return {- disabledHours: () => range(0, hours),- disabledMinutes: () => range(0, minutes),- };- }- return {- disabledHours: () => [],- disabledMinutes: () => [],- };- };-- return (- <>- {isTitle && <h1>定时发布</h1>}- <DatePicker- format="YYYY-MM-DD HH:mm"- disabledDate={disabledDate}- disabledTime={disabledTime}- showTime={{ defaultValue: dayjs("00:00:00", "HH:mm:ss") }}- value={value}- onChange={onChange}- />- <p className={styles.tips}>- 支持{getMaxTimes.timeOffset}分钟后及{getMaxTimes.maxDate}- 天内的定时发布- </p>- </>- );- },- ),-);-CommonScheduledTimeSelect.displayName = "CommonScheduledTimeSelect";--export default CommonScheduledTimeSelect;diff --git a/src/app/[lng]/publish/components/CommonComponents/CommonTopicSelect.tsx b/src/app/[lng]/publish/components/CommonComponents/CommonTopicSelect.tsxdeleted file mode 100644index 0708d8fc..00000000--- a/src/app/[lng]/publish/components/CommonComponents/CommonTopicSelect.tsx+++ /dev/null@@ -1,71 +0,0 @@-import React from "react";-import { SelectProps } from "antd";-import { Select, Spin } from "antd";-import styles from "./commonComponents.module.scss";-import useDebounceFetcher from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/useDebounceFetcher";-import { AccountInfo } from "@/app/[lng]/publish/videoPage/videoPage.type";--export interface CommonTopicSelectProps<ValueType = any>- extends Omit<SelectProps<ValueType | ValueType[]>, "options" | "children"> {- tips?: string;- account?: AccountInfo;- onAccountChange?: (account: AccountInfo) => void;- children?: React.ReactNode;-}--export type CommonTopicSelectValueType = {- label: string;- value: string | number;-};--// 通用话题选择器-export default function CommonTopicSelect({- tips,- children,- account,- onAccountChange,- ...props-}: CommonTopicSelectProps<CommonTopicSelectValueType>) {- if (!account || !onAccountChange) return "";-- const { fetching, options, debounceFetcher } =- useDebounceFetcher<CommonTopicSelectValueType>(- async (keyword: string): Promise<CommonTopicSelectValueType[]> => {- // TODO 话题获取- // const topics = await icpGetTopic(account!, keyword);- //- // const res = await accountFailureDispose(- // topics,- // account,- // onAccountChange,- // );- // return res!.map((v) => {- // return {- // label: v.name,- // value: v.name,- // };- // }) as CommonTopicSelectValueType[];- return [];- },- );-- return (- <>- <h1>话题</h1>- <Select- allowClear- mode="multiple"- style={{ width: "100%" }}- placeholder="输入关键字搜索"- labelInValue- filterOption={false}- onSearch={debounceFetcher}- notFoundContent={fetching ? <Spin size="small" /> : null}- {...props}- options={options}- />- {children}- <p className={styles.tips}>{tips}</p>- </>- );-}diff --git a/src/app/[lng]/publish/components/CommonComponents/CommonUserSelect.tsx b/src/app/[lng]/publish/components/CommonComponents/CommonUserSelect.tsxdeleted file mode 100644index 29a058e1..00000000--- a/src/app/[lng]/publish/components/CommonComponents/CommonUserSelect.tsx+++ /dev/null@@ -1,109 +0,0 @@-import React, { useEffect } from "react";-import { Avatar, Select, SelectProps, Spin } from "antd";-import styles from "./commonComponents.module.scss";-import { describeNumber } from "@/utils";-import { IUsersItem } from "@/app/plat/plat.type";-import useDebounceFetcher from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/useDebounceFetcher";-import { AccountInfo } from "@/app/[lng]/publish/videoPage/videoPage.type";--export interface CommonUserSelectProps<ValueType = any>- extends Omit<SelectProps<ValueType | ValueType[]>, "options" | "children"> {- account?: AccountInfo;- tips?: string;- title?: string;- children?: React.ReactNode;- onAccountChange?: (account: AccountInfo) => void;-}--// 通用用户选择器-export default function CommonUserSelect({- account,- children,- onAccountChange,- ...props-}: CommonUserSelectProps<IUsersItem>) {- if (!account || !onAccountChange) return "";-- const { fetching, options, debounceFetcher, setOptions } =- useDebounceFetcher<IUsersItem>(async (keywords) => {- return await getList(keywords);- });-- const getList = async (keywords?: string) => {- // TODO 获取用户列表- // const res = await icpGetUsers({- // page: 1,- // keyword: keywords || "",- // account: account!,- // });- // const data = await accountFailureDispose(res, account!, onAccountChange);- // setOptions(data);- // return data;- return [];- };-- useEffect(() => {- if (props.showSearch === false) {- getList();-- // TODO 登录完成- // return onAccountLoginFinish((newAccount) => {- // account = newAccount;- // getList();- // });- }- }, []);-- return (- <>- <h1>{props.title || "@用户选择"}</h1>- <Select- {...props}- showSearch={- props.hasOwnProperty("showSearch") ? props.showSearch : true- }- allowClear- style={{ width: "100%" }}- mode="multiple"- placeholder="输入关键词搜索"- labelInValue- filterOption={false}- onSearch={- (props.hasOwnProperty("showSearch") ? props.showSearch : true)- ? debounceFetcher- : undefined- }- notFoundContent={fetching ? <Spin size="small" /> : null}- fieldNames={{- label: "name",- value: "id",- }}- options={options}- optionRender={({ data }) => {- return (- <div className={styles.usersSelect}>- <Avatar src={data.image} />- <div className="usersSelect-con">- <div className="usersSelect-con-name">{data.name}</div>- {(data.unique_id || data.follower_count) && (- <div className="usersSelect-con-footer">- <div className="usersSelect-con-footer-follower">- 粉丝数:{describeNumber(data.follower_count || 0)}- </div>- {data.unique_id && (- <div className="usersSelect-con-footer-unique">- 抖音号:{data.unique_id}- </div>- )}- </div>- )}- </div>- </div>- );- }}- />- {children}- {props.tips && <p className={styles.tips}>{props.tips}</p>}- </>- );-}diff --git a/src/app/[lng]/publish/components/CommonComponents/commonComponents.module.scss b/src/app/[lng]/publish/components/CommonComponents/commonComponents.module.scssdeleted file mode 100644index d4c1b938..00000000--- a/src/app/[lng]/publish/components/CommonComponents/commonComponents.module.scss+++ /dev/null@@ -1,270 +0,0 @@-.chooseChunk {- display: flex;- cursor: pointer;- flex-direction: column;- background: rgb(247, 250, 250);- width: 160px;- height: 160px;- box-sizing: border-box;- padding: 20px;- justify-content: center;- align-items: center;- border-radius: 10px;- border: 1px solid transparent;- transition: 0.3s;- img {- width: 50px;- height: 45px;- object-fit: contain;- }- button {- margin-top: 20px;- width: 110px;- &:hover {- opacity: 0.8;- }- }-}--.chooseAccountChunk {- height: 180px;- background: var(--colorPrimary1);- border: 1px dashed transparent;- border-radius: 8px;- cursor: pointer;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- &:hover {- border-color: var(--colorPrimary6);- }- :global {- .chooseAccountChunk-user {- font-size: 60px;- color: var(--colorPrimary4);- margin-bottom: 10px;- }- }-}--.usersSelect {- display: flex;- padding: 3px 0;- align-items: center;- :global {- .usersSelect-con {- margin-left: 10px;- &-name {- font-size: var(--fs-md);- }- &-footer {- margin-top: 5px;- font-size: var(--fs-xs);- display: flex;- &-follower {- color: var(--grayColor7);- }- &-unique {- margin-left: 20px;- }- }- }- }-}--.locationSelect {- :global {- .location-name {- margin-bottom: 2px;- }- .location-simpleAddress {- font-size: var(--fs-xs);- color: var(--grayColor7);- }- }-}--.hotspotSelect {- display: flex;- justify-content: space-between;- align-items: center;- padding: 3px 10px;- :global {- .hotspotSelect-left {- display: flex;- align-items: center;- img {- width: 35px;- height: 35px;- border-radius: 4px;- object-fit: cover;- margin-right: 10px;- }- }-- .hotspotSelect-right {- }- }-}--.activitySelect {- border-bottom: 1px solid var(--grayColor3);- height: 50px;- cursor: pointer;- padding: 10px 0;- &:last-of-type {- border-bottom: none;- }- :global {- display: flex;- align-items: center;- justify-content: space-between;- .activitySelect-left {- display: flex;- align-items: center;- height: 100%;- &-img {- overflow: hidden;- border-radius: 6px;- margin-left: 10px;- }- ul {- display: flex;- flex-direction: column;- height: 100%;- justify-content: space-between;- li {- &:nth-child(1) {- font-weight: 900;- }- }- }- img {- display: block;- width: 36px;- height: 42px;- border-radius: 8px;- margin-right: 8px;- }- }- .activitySelect-right {- display: flex;- flex-direction: column;- align-items: flex-end;- justify-content: space-between;- height: 100%;- &-top {- padding: 1px 4px;- border-radius: 6px;- font-size: var(--fs-xs);- background: rgb(250, 250, 250);- border: 1px solid #bbbbbb;- }- &-bottom {- button {- margin: 0 0 0 10px;- padding: 0;- height: auto;- }- }- }- }-}--.activityDetails {- :global {- .activityDetails-top {- display: flex;- justify-content: space-between;- align-items: center;- border-bottom: 1px solid #f1f1f1;- padding: 30px 0;- margin-bottom: 20px;- &-left {- display: flex;- align-items: center;- &-img {- overflow: hidden;- img {- width: 50px;- object-fit: contain;- margin-right: 10px;- border-radius: 6px;- }- }- ul {- display: flex;- flex-direction: column;- }- &-title {- font-weight: 900;- font-size: var(--fs-md);- margin-bottom: 3px;- }- &-hot {- font-size: var(--fs-xs);- color: var(--grayColor7);- }- }-- &-tag {- padding: 1px 4px;- border-radius: 6px;- font-size: var(--fs-xs);- margin-bottom: 6px;- background: rgb(225, 225, 225);- }- }-- .activityDetails-bottom {- h2 {- font-size: var(--fs-sm);- }- &-text {- color: var(--grayColor7);- margin-bottom: 10px;- }- ul {- li {- margin-right: 5px;- }- }- }- }-}--.tips {- color: rgb(178, 185, 185);- text-align: left;- font-size: var(--fs-sm);-}--.accountRestartLogin {- display: flex;- align-items: center;- font-size: var(--fs-sm);- button {- margin: 0;- padding: 0;- height: auto;- }-}--.mixSelectItem {- justify-content: space-between;- align-items: center;- display: flex;- :global {- .mixSelectItem-left {- display: flex;- align-items: center;- img {- height: 100%;- width: 30px;- object-fit: contain;- margin-right: 8px;- }- }- }-}diff --git a/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsx b/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsxdeleted file mode 100644index 89bd033b..00000000--- a/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsx+++ /dev/null@@ -1,362 +0,0 @@-import {- ForwardedRef,- forwardRef,- memo,- useEffect,- useImperativeHandle,- useState,-} from "react";-import styles from "./pubAccountDetModule.module.scss";-import { Alert, Button, Checkbox, Modal, Tooltip } from "antd";-import { CheckCircleOutlined, CloseCircleOutlined } from "@ant-design/icons";-import { LoadingOutlined } from "@ant-design/icons";-import { AvatarPlat } from "../PubProgressModule/PubProgressModule";-import { useAccountStore } from "@/store/account";-import { useShallow } from "zustand/react/shallow";-import { AccountInfo } from "@/app/[lng]/publish/videoPage/videoPage.type";-import { AccountGroupItem } from "@/api/types/account.type";--export interface IPubAccountDetModuleRef {- // 打开弹框并且开始检测- startDet: () => void;-}--export interface IPubAccountDetModuleProps {- // 待检测的账户- accounts: AccountInfo[];- // 弹框关闭- onClose?: () => void;- // 发布- onPubClick?: () => void;- /**- * 检测完成- * @param accounts 检测过后的账户数据- */- onDetFinish?: (accounts: AccountInfo[]) => void;- // 重新登录完成事件- onRestartLoginFinish?: (accounts: AccountInfo) => void;- title?: string;- tips?: string;- // 是否需要footer操作栏- isFooter?: boolean;- // 是否需要校验代理地址- isCheckProxy?: boolean;-}--// 发布用户检测-const PubAccountDetModule = memo(- forwardRef(- (- {- onRestartLoginFinish,- accounts,- onClose,- onPubClick,- onDetFinish,- title = "发布检测",- tips = "以下账号将发布至平台",- isFooter = true,- isCheckProxy = false,- }: IPubAccountDetModuleProps,- ref: ForwardedRef<IPubAccountDetModuleRef>,- ) => {- const [open, setOpen] = useState(false);- const [detLoading, setDetLoading] = useState(false);- // 失效 ids- const [disabledIdSet, setDisabledIdSet] = useState<Set<string>>(- new Set([]),- );- const [progress, setProgress] = useState(0);- const [isFilterAccountOl, setIsFilterAccountOl] = useState(false);- // 代理失效的账户组Map- const [proxyInvalidAccountMap, setProxyInvalidAccountMap] = useState<- Map<string, AccountGroupItem>- >(new Map());- const { accountGroupMap, getAccountList } = useAccountStore(- useShallow((state) => ({- accountGroupMap: state.accountGroupMap,- getAccountList: state.getAccountList,- })),- );-- useEffect(() => {- if (open) {- setDisabledIdSet(new Set([]));- setIsFilterAccountOl(false);- }- }, [open]);-- useEffect(() => {- if (disabledIdSet.size === 0) {- setIsFilterAccountOl(false);- }- }, [disabledIdSet]);-- const close = () => {- if (detLoading) return;- setOpen(false);- if (onClose) onClose();- };-- // 检测账户状态- const retLoginStatusCore = async (account: AccountInfo) => {- // TODO 检测账户状态- // const res = await acpAccountLoginCheck(- // account.type,- // account.uid,- // false,- // );- // setProgress((prevProgress) => prevProgress + 1);- // return res;- };-- // TODO 检测代理地址有效性- const retProxyCheckCore = async (group: AccountGroupItem) => {- // let status = true;- // if (group.proxyIp) {- // status = await icpProxyCheck(group.proxyIp);- // }- // return {- // status,- // group,- // };- };-- const getIp = (account: AccountInfo) => {- // TODO 获取ip name- // if (!isCheckProxy) return "";- // const group = accountGroupMap.get(account.groupId!)!;- // if (!group.proxyOpen || !group.proxyIp) return "";- // return "代理" + ` ${group.proxyIp}`;- return "";- };-- const imperative: IPubAccountDetModuleRef = {- async startDet() {- setOpen(true);- if (onDetFinish) {- onDetFinish(accounts);- }- // TODO 账户检测- // setProxyInvalidAccountMap(new Map());- // setDisabledIdSet(new Set([]));- // setOpen(true);- // setDetLoading(true);- //- // // 账户状态- // const tasksAccountStatus: Promise<AccountInfo>[] = [];- // // 代理地址有效性检测- // const tasksProxyCheck: Promise<{- // status: boolean;- // group: AccountGroupItem;- // }>[] = [];- // // 代理地址需要检测的账户组- // const proxyGroupSet = new Set<number>([]);- // for (let i = 0; i < accounts.length; i++) {- // const account = accounts[i];- // tasksAccountStatus.push(retLoginStatusCore(account));- //- // if (isCheckProxy) {- // // 代理有效性检测- // if (!proxyGroupSet.has(account.groupId!)) {- // const group = accountGroupMap.get(account.groupId!)!;- // if (group.proxyOpen) {- // tasksProxyCheck.push(- // retProxyCheckCore(accountGroupMap.get(account.groupId!)!),- // );- // }- // proxyGroupSet.add(account.groupId!);- // }- // }- // }- //- // // 等待代理和账号有效性检测...- // const resGroupProxyStatus = await Promise.all(tasksProxyCheck);- // const resAccountStatus = await Promise.all(tasksAccountStatus);- //- // await getAccountList();- //- // setTimeout(() => {- // if (onDetFinish) onDetFinish(resAccountStatus);- // setDetLoading(false);- //- // const disabledIdSet = new Set<number>([]);- // resAccountStatus.map((v) =>- // v.status === AccountStatus.DISABLE ? disabledIdSet.add(v.id) : "",- // );- // setDisabledIdSet(disabledIdSet);- // setProgress(0);- //- // resGroupProxyStatus.map((v) => {- // if (!v.status) {- // setProxyInvalidAccountMap((prevState) => {- // const newState = new Map<number, AccountGroupItem>(prevState);- // newState.set(v.group.id, v.group);- // return newState;- // });- // }- // });- // }, 50);- },- };- useImperativeHandle(ref, () => imperative);-- return (- <Modal- width={530}- title={title}- maskClosable={false}- open={open}- onCancel={close}- footer={null}- >- <div className={styles.pubAccountDetModule}>- <div className="pubAccountDetModule-tips">- {!detLoading ? (- <>- {disabledIdSet.size === 0 ? (- proxyInvalidAccountMap.size === 0 && `${tips}`- ) : (- <Alert- style={{ marginBottom: "10px" }}- message={- <div className={styles.loginStatusDisable}>- <span>账号登录状态失效,点击账户重新登录</span>- <Checkbox- checked={isFilterAccountOl}- onChange={(e) =>- setIsFilterAccountOl(e.target.checked)- }- >- 过滤在线账户- </Checkbox>- </div>- }- type="error"- showIcon- />- )}-- {proxyInvalidAccountMap.size !== 0 && (- <Alert- message={- <div>- <span>以下代理不可用,请调整后重试:</span>- <ul>- {Array.from(proxyInvalidAccountMap).map(- ([_, v]) => {- return (- <li key={v.id}>- {/* TODO 代理不可用展示 */}- {/*用户组:{v.name},代理地址:{v.proxyIp}{" "}*/}- 不可用- </li>- );- },- )}- </ul>- </div>- }- type="error"- showIcon- />- )}- </>- ) : (- <>- 正在检测账号状态 {progress} / {accounts.length}- <LoadingOutlined />- </>- )}- </div>- <div className="pubAccountDetModule-accounts">- {accounts- .filter((v) =>- isFilterAccountOl- ? disabledIdSet.has(v.id) && !detLoading- : true,- )- .map((v) => {- return (- <div- className={[- "pubAccountDetModule-accounts-account",- disabledIdSet.has(v.id) ||- proxyInvalidAccountMap.get(v.groupId)- ? "pubAccountDetModule-accounts-disable"- : !disabledIdSet.has(v.id) &&- !detLoading &&- "pubAccountDetModule-accounts-ol",- ].join(" ")}- style={{- cursor: disabledIdSet.has(v.id) ? "pointer" : "auto",- }}- key={v.id}- onClick={async () => {- // TODO 重新登录- // if (disabledIdSet.has(v.id)) {- // const res = await accountLogin(v.type);- // if (!res) return;- // message.success("登录成功!");- // if (onRestartLoginFinish) onRestartLoginFinish(res);- // setDisabledIdSet((prevState) => {- // const newState = new Set<number>(prevState);- // newState.delete(res.id);- // return newState;- // });- // }- }}- >- <AvatarPlat account={v} size="default" />- <Tooltip title={v.nickname}>- <div- className={["pubAccountDetModule-accounts-name"].join(- " ",- )}- >- <div className="pubAccountDetModule-accounts-name-wrapper">- <CloseCircleOutlined className="pubAccountDetModule-accounts-disable-icon" />- <CheckCircleOutlined className="pubAccountDetModule-accounts-ol-icon" />- <span>{v.nickname}</span>- </div>- </div>- </Tooltip>- <div className="pubAccountDetModule-accounts-proxy">- <Tooltip title={getIp(v)}>- <span>{getIp(v)}</span>- </Tooltip>- </div>- </div>- );- })}- </div>- </div>-- {isFooter && (- <div style={{ display: "flex", justifyContent: "right" }}>- <Button style={{ marginRight: "10px" }} onClick={close}>- 取消- </Button>- <Button- type="primary"- loading={detLoading}- disabled={- disabledIdSet.size !== 0 || proxyInvalidAccountMap.size !== 0- }- onClick={() => {- setOpen(false);- if (onPubClick) onPubClick();- }}- >- 发布至平台- </Button>- </div>- )}- </Modal>- );- },- ),-);-PubAccountDetModule.displayName = "PubAccountDetModule";--export default PubAccountDetModule;diff --git a/src/app/[lng]/publish/components/PubAccountDetModule/pubAccountDetModule.module.scss b/src/app/[lng]/publish/components/PubAccountDetModule/pubAccountDetModule.module.scssdeleted file mode 100644index 3be9b5b1..00000000--- a/src/app/[lng]/publish/components/PubAccountDetModule/pubAccountDetModule.module.scss+++ /dev/null@@ -1,75 +0,0 @@-.pubAccountDetModule {- min-height: 300px;- :global {- .pubAccountDetModule-tips {- margin-bottom: 20px;- & > .anticon {- margin-left: 10px;- color: var(--colorPrimary6);- }- }-- .pubAccountDetModule-accounts {- display: grid;- grid-template-columns: repeat(4, 1fr);- max-height: 60vh;- overflow: auto;- gap: 10px;- &-account {- display: flex;- flex-direction: column;- justify-content: center;- align-items: center;- overflow: hidden;- }- &-name {- white-space: nowrap;- margin-top: 5px;- text-overflow: ellipsis;- width: 100%;- display: flex;- align-items: center;- justify-content: center;- &-wrapper {- overflow: hidden;- text-overflow: ellipsis;- }- .anticon {- margin-right: 3px;- display: none;- }- }- &-proxy {- color: var(--grayColor7);- font-size: var(--fs-xs);- white-space: nowrap;- width: 100%;- text-overflow: ellipsis;- overflow: hidden;- }- &-disable {- color: var(--errerColor);- .pubAccountDetModule-accounts-disable-icon {- display: inline-block;- }- .pubAccountDetModule-accounts-proxy {- color: var(--errerColor);- }- }- &-ol {- color: var(--successColor);- .pubAccountDetModule-accounts-ol-icon {- display: inline-block;- }- .pubAccountDetModule-accounts-proxy {- color: var(--successColor);- }- }- }- }-}--.loginStatusDisable {- display: flex;- justify-content: space-between;-}diff --git a/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsx b/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsxdeleted file mode 100644index 37cca0f4..00000000--- a/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsx+++ /dev/null@@ -1,114 +0,0 @@-import { ForwardedRef, forwardRef, memo } from "react";-import { Alert, Avatar, Modal, Progress, Tooltip } from "antd";-import styles from "./pubProgressModule.module.scss";-import { MinusOutlined } from "@ant-design/icons";-import type { AvatarSize } from "antd/es/avatar/AvatarContext";-import { SocialAccount } from "@/api/types/account.type";-import { PublishProgressRes } from "@/app/plat/plat.type";-import { AccountPlatInfoMap } from "@/app/config/platConfig";--export interface IPubProgressModuleRef {}--export interface IPubProgressModuleProps {- pubProgressData: PublishProgressRes[];- open: boolean;- onClose: () => void;-}--function getMsg(progressData: PublishProgressRes) {- if (progressData.progress === 100) {- return "发布成功";- } else if (progressData.progress === -1) {- return "发布错误";- } else {- return progressData.msg || "正在加载...";- }-}--export const AvatarPlat = ({- account,- size = "default",-}: {- account: SocialAccount;- size?: AvatarSize;-}) => {- const plat = AccountPlatInfoMap.get(account.type)!;- return (- <>- <div className={styles.avatarPlat}>- <Avatar src={account.avatar} size={size} />- <img- src={plat.icon}- style={{- width: size === "large" ? 15 : size === "default" ? 12.5 : 10,- }}- />- </div>- </>- );-};--// 发布进度展示-const PubProgressModule = memo(- forwardRef(- (- { pubProgressData, open, onClose }: IPubProgressModuleProps,- ref: ForwardedRef<IPubProgressModuleRef>,- ) => {- return (- <Modal- width={700}- title="内容分发"- maskClosable={false}- open={open}- onCancel={onClose}- footer={null}- closeIcon={<MinusOutlined />}- >- <Alert- message={- <>- 关闭此弹框和页面不会影响发布流程,- <b>关闭后可在右上角小铃铛查看发布进度</b>,但请不要关闭哎哟赚哦~- </>- }- type="success"- />- <div className={styles.pubProgressModule}>- {pubProgressData.map((v) => {- const { account } = v;- const plat = AccountPlatInfoMap.get(account.type);- if (!plat) return;-- return (- <div className="pubProgressModule-item" key={account.id}>- <div className="pubProgressModule-item-left">- <AvatarPlat account={account} size="large" />- <Tooltip title={account.nickname}>- <span className="pubProgressModule-item-left-name">- {account.nickname}- </span>- </Tooltip>- </div>-- <div className="pubProgressModule-item-right">- <Progress- percent={v.progress}- status={v.progress === -1 ? "exception" : undefined}- />- <p className="pubProgressModule-item-right-msg">- {getMsg(v)}- </p>- </div>- </div>- );- })}- </div>- </Modal>- );- },- ),-);-PubProgressModule.displayName = "PubProgressModule";--export default PubProgressModule;diff --git a/src/app/[lng]/publish/components/PubProgressModule/pubProgressModule.module.scss b/src/app/[lng]/publish/components/PubProgressModule/pubProgressModule.module.scssdeleted file mode 100644index f4461b6a..00000000--- a/src/app/[lng]/publish/components/PubProgressModule/pubProgressModule.module.scss+++ /dev/null@@ -1,44 +0,0 @@-.pubProgressModule {- padding-top: 20px;- :global {- .pubProgressModule-item {- display: flex;- justify-content: space-between;- margin-bottom: 30px;- &-left {- width: 50%;- display: flex;- align-items: center;- white-space: nowrap;- &-name {- text-overflow: ellipsis;- overflow: hidden;- margin-left: 6px;- padding-right: 20px;- }- }-- &-right {- width: 50%;- flex-shrink: 0;- &-msg {- color: var(--grayColor7);- font-size: var(--fs-xs);- }- }- }- }-}--.avatarPlat {- position: relative;- display: flex;- justify-content: center;- & > img {- position: absolute;- bottom: 0;- right: 0;- transform: translate(-10%, 20%);- border-radius: 50%;- }-}\ No newline at end of filediff --git a/src/app/[lng]/publish/components/PublishSidebar.tsx b/src/app/[lng]/publish/components/PublishSidebar.tsxdeleted file mode 100644index 18618afd..00000000--- a/src/app/[lng]/publish/components/PublishSidebar.tsx+++ /dev/null@@ -1,58 +0,0 @@-"use client";--import { ForwardedRef, forwardRef, memo, useMemo } from "react";-import { Segmented } from "antd";-import {- VideoCameraOutlined,- FileImageOutlined,- ContainerOutlined,-} from "@ant-design/icons";-import { usePathname, useRouter } from "next/navigation";--export interface IPublishSidebarRef {}--export interface IPublishSidebarProps {}--const PublishSidebar = memo(- forwardRef(- ({}: IPublishSidebarProps, ref: ForwardedRef<IPublishSidebarRef>) => {- const pathname = usePathname();- const router = useRouter();-- const currChooseRoute = useMemo(() => {- return pathname.split("/publish/")[1];- }, [pathname]);-- return (- <Segmented- value={currChooseRoute}- vertical- size="large"- options={[- {- label: "视频发布",- value: "videoPage",- icon: <VideoCameraOutlined />,- },- // { label: '文章发布', value: '/publish/text', icon: <FileOutlined /> },- {- label: "图片发布",- value: "imagePage",- icon: <FileImageOutlined />,- },- {- label: "发布记录",- value: "pubRecord",- icon: <ContainerOutlined />,- },- ]}- onChange={(value) => {- router.push(value);- }}- />- );- },- ),-);--export default PublishSidebar;diff --git a/src/app/[lng]/publish/components/SupportPlat/SupportPlat.tsx b/src/app/[lng]/publish/components/SupportPlat/SupportPlat.tsxdeleted file mode 100644index 7cf47b44..00000000--- a/src/app/[lng]/publish/components/SupportPlat/SupportPlat.tsx+++ /dev/null@@ -1,47 +0,0 @@-import { ForwardedRef, forwardRef, memo } from "react";-import styles from "./supportPlat.module.scss";-import { PubType } from "@/app/config/publishConfig";-import { AccountPlatInfoMap } from "@/app/config/platConfig";--export interface ISupportPlatRef {}--export interface ISupportPlatProps {- pubType: PubType;- style?: React.CSSProperties;-}--const SupportPlat = memo(- forwardRef(- (- { pubType, style }: ISupportPlatProps,- ref: ForwardedRef<ISupportPlatRef>,- ) => {- return (- <div- className={`${styles.supportPlat} ${pubType !== PubType.VIDEO && styles.supportPlatBg}`}- style={style}- >- <div className="supportPlatBg-title">支持平台</div>- <div className="supportPlat-tip">- <p className="supportPlat-tip--line" />- <p className="supportPlat-tip-text">支持以下平台</p>- <p className="supportPlat-tip--line" />- </div>- <ul className="supportPlat-con">- {Array.from(AccountPlatInfoMap).map(([k, v]) => {- if (!v.pubTypes.has(pubType)) return null;- return (- <li key={v.name}>- <img src={v.icon} />- </li>- );- })}- </ul>- </div>- );- },- ),-);-SupportPlat.displayName = "SupportPlat";--export default SupportPlat;diff --git a/src/app/[lng]/publish/components/SupportPlat/supportPlat.module.scss b/src/app/[lng]/publish/components/SupportPlat/supportPlat.module.scssdeleted file mode 100644index 3faf2f3a..00000000--- a/src/app/[lng]/publish/components/SupportPlat/supportPlat.module.scss+++ /dev/null@@ -1,60 +0,0 @@-.supportPlat {- :global {- .supportPlat-tip {- margin-bottom: 10px;- font-size: var(--fs-xs);- display: flex;- align-items: center;- &--line {- width: 100%;- height: 1px;- background: rgb(243, 243, 243);- }- &-text {- white-space: nowrap;- padding: 0 15px;- color: rgb(136, 145, 145);- }- }- .supportPlat-con {- //display: grid;- //grid-template-columns: repeat(8, 1fr);- gap: 20px;- display: flex;- justify-content: center;- align-items: center;- min-width: 340px;- img {- width: 25px;- }- }- .supportPlatBg-title {- display: none;- }- }-}--.supportPlatBg {- padding: 15px;- display: flex;- border-radius: 10px;- background: rgb(247, 250, 250);- :global {- .supportPlat-tip {- display: none;- }- .supportPlat-con {- display: grid;- gap: 10px;- grid-template-columns: repeat(7, 1fr);- }- .supportPlatBg-title {- display: block;- font-weight: 900;- font-size: var(--fs-xs);- color: rgb(157, 164, 164);- margin: 3px 10px 0 0;- white-space: nowrap;- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/publish/hooks/usePubParamsVerify.tsx b/src/app/[lng]/publish/hooks/usePubParamsVerify.tsxdeleted file mode 100644index 8ae59c48..00000000--- a/src/app/[lng]/publish/hooks/usePubParamsVerify.tsx+++ /dev/null@@ -1,250 +0,0 @@-import { memo, useMemo } from "react";-import { parseTopicString } from "@/utils";-import { Alert, Tooltip } from "antd";-import { InfoCircleOutlined } from "@ant-design/icons";-import {- AccountInfo,- IPubParams,-} from "@/app/[lng]/publish/videoPage/videoPage.type";-import {- AccountPlatInfoMap,- IAccountPlatInfo,- PlatType,-} from "@/app/config/platConfig";-import { AccountStatus } from "@/app/config/accountConfig";--// 错误状态-export enum PubParamsErrStatusEnum {- // 登录错误- LOGIN = 1,- // 参数错误- PARAMS = 2,-}-export interface ErrPubParamsItem {- // 这个错误提示会在账户tab显示- message: string;- // 错误类型,用户区分是否需要显示重新登录的错误提示- errType: PubParamsErrStatusEnum;- // 参数错误提示消息- parErrMsg?: string;- // 发生错误的平台- plat?: PlatType;-}--export type ErrPubParamsMapType = Map<string | number, ErrPubParamsItem>;--interface IPubParamsVerifyItem<T = undefined> {- id: string | number;- account?: AccountInfo;- pubParams: IPubParams;- other: T;-}--/**- * 发布参数校验是否复合平台规范- * @param data- * @param moreVerify- */-export default function <T>(- data: IPubParamsVerifyItem<T>[],- moreVerify?: {- // 错误参数扩展- moreErrorVerifyCallback?: (- item: IPubParamsVerifyItem<T>,- errParamsMapTemp: ErrPubParamsMapType,- platInfo: IAccountPlatInfo,- ) => void;- // 警告参数扩展- moreWranVerifyCallback?: (- item: IPubParamsVerifyItem<T>,- wranParamsMapTemp: ErrPubParamsMapType,- platInfo: IAccountPlatInfo,- ) => void;- },-) {- // 用于判断描述中的话题是否符合规范- const descTopicRegex = /#\S+#\S+/;-- // 错误参数,发布之前会检测错误参数,防止平台无法发布- const errParamsMap = useMemo(() => {- const errParamsMapTemp: ErrPubParamsMapType = new Map();- for (const v of data) {- if (!v.account) continue;- const platInfo = AccountPlatInfoMap.get(v.account!.type)!;- const { topics } = parseTopicString(v.pubParams.describe || "");- const topicsAll = [...new Set(v.pubParams.topics?.concat(topics))];- const { topicMax } = platInfo.commonPubParamsConfig;-- (() => {- // 错误信息---------------------- // 登录状态校验- if (v.account && v.account.status === AccountStatus.DISABLE) {- return errParamsMapTemp.set(v.id, {- message: "登录失效",- errType: PubParamsErrStatusEnum.LOGIN,- parErrMsg: "登录失效,请重新登录",- });- }- // 快手要求封面必须大于 400x400- if (- v.account?.type === PlatType.KWAI &&- v.pubParams.cover &&- (v.pubParams.cover.width < 400 || v.pubParams.cover.height < 400)- ) {- return errParamsMapTemp.set(v.id, {- message: "参数错误",- errType: PubParamsErrStatusEnum.PARAMS,- parErrMsg: "封面最小尺寸400*400",- });- }- // 话题校验- if (topicsAll.length > topicMax) {- return errParamsMapTemp.set(v.id, {- message: "参数错误",- errType: PubParamsErrStatusEnum.PARAMS,- parErrMsg: `${platInfo.name}话题最多不能超过${topicMax}个`,- });- }- /**- * 抖音的话题和活动奖励校验- * 抖音规定活动奖励 + 话题不能超过5个- */- if (- v.account?.type === PlatType.Douyin &&- topicsAll.length +- v.pubParams.diffParams![PlatType.Douyin]!.activitys!.length >- topicMax- ) {- return errParamsMapTemp.set(v.id, {- message: "参数错误",- errType: PubParamsErrStatusEnum.PARAMS,- parErrMsg: `话题 + 活动奖励不能超过${topicMax}个`,- });- }- // 判断描述中的话题中间是否用空格分割,如:#话题1#话题2#话题3 这种格式错误- if (descTopicRegex.test(v.pubParams.describe || "")) {- return errParamsMapTemp.set(v.id, {- message: "参数错误",- errType: PubParamsErrStatusEnum.PARAMS,- parErrMsg: `描述中的话题必须使用空格分割,如:“#话题1 #话题2”`,- });- }-- if (moreVerify?.moreErrorVerifyCallback)- moreVerify?.moreErrorVerifyCallback(v, errParamsMapTemp, platInfo);- })();-- // 通用参数- if (errParamsMapTemp.has(v.id)) {- errParamsMapTemp.set(v.id, {- ...errParamsMapTemp.get(v.id)!,- plat: v.account.type,- });- }- }- return errParamsMapTemp;- }, [data]);-- // 警告参数,警告参数只会展示,不会阻止平台发布- const warnParamsMap = useMemo(() => {- const warnParamsMapTemp: ErrPubParamsMapType = new Map();- for (const v of data) {- if (!v.account) continue;- const platInfo = AccountPlatInfoMap.get(v.account!.type)!;-- if (moreVerify?.moreWranVerifyCallback)- moreVerify?.moreWranVerifyCallback(v, warnParamsMapTemp, platInfo);- }- return warnParamsMapTemp;- }, [data]);-- return {- errParamsMap,- warnParamsMap,- };-}--// 用于展示校验的结果-export const PubParamsVerifyInfo = memo(- ({- id,- warnParamsMap,- errParamsMap,- onAccountRestart,- style,- }: {- id?: string | number;- errParamsMap?: ErrPubParamsMapType;- warnParamsMap?: ErrPubParamsMapType;- onAccountRestart: (plat?: PlatType) => void;- style?: React.CSSProperties;- }) => {- const errPubParams = useMemo(() => {- let errPubParams: ErrPubParamsItem | undefined = undefined;- if (!errParamsMap) return errPubParams;- for (const [itemId, errPubParamsItem] of errParamsMap) {- if (itemId === id) {- errPubParams = errPubParamsItem;- break;- }- }- return errPubParams;- }, [id, errParamsMap]);-- const paramsWarningList = useMemo(() => {- if (!warnParamsMap) return [];- return Array.from(warnParamsMap)- .map(([itemId, item]) => (itemId === id ? item : undefined))- .filter((v) => v !== undefined);- }, [warnParamsMap, id]);-- return (- <>- {errPubParams && (- <Alert- type="error"- showIcon- message={- errPubParams.errType === PubParamsErrStatusEnum.LOGIN ? (- <>- 登录失效,请- <a- style={{ fontSize: "13px" }}- onClick={() => {- onAccountRestart(errPubParams.plat);- }}- >- 重新登录- </a>- </>- ) : (- errPubParams.parErrMsg- )- }- style={style}- />- )}-- {paramsWarningList.length !== 0 && (- <Alert- type="warning"- showIcon- icon={- <Tooltip title="这是参数警告,参数警告不会阻止您的发布!">- <InfoCircleOutlined />- </Tooltip>- }- message={- <>- {paramsWarningList.map((v, i) => {- return <p key={i}>{v.parErrMsg}</p>;- })}- </>- }- style={style}- />- )}- </>- );- },-);diff --git a/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx b/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsxdeleted file mode 100644index c6770f8d..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx+++ /dev/null@@ -1,105 +0,0 @@-import React, { ForwardedRef, forwardRef, memo } from "react";-import styles from "../../image.module.scss";-import localUpload from "../../../videoPage/images/localUpload.png";-import { Input } from "antd";-import { useShallow } from "zustand/react/shallow";-import { useImagePageStore } from "../../useImagePageStore";-import ImgTextImagesView from "./ImgTextImagesView";-import { ChooseChunk } from "@/app/[lng]/publish/components/CommonComponents/CommonComponents";-import ImgChoose from "@/app/[lng]/publish/components/Choose/ImgChoose";--const { TextArea } = Input;--export interface IImageLeftSettingRef {}--export interface IImageLeftSettingProps {}--const ImageLeftSetting = memo(- forwardRef(- ({}: IImageLeftSettingProps, ref: ForwardedRef<IImageLeftSettingRef>) => {- const { commonPubParams, setCommonPubParams, addImages, images } =- useImagePageStore(- useShallow((state) => ({- setAllPubParams: state.setAllPubParams,- commonPubParams: state.commonPubParams,- setCommonPubParams: state.setCommonPubParams,- addImages: state.addImages,- images: state.images,- })),- );-- return (- <div className={styles.imageLeftSetting}>- <div className="imageLeftSetting-upload">- {images.length === 0 ? (- <ImgChoose- onMultipleChoose={(imgFiles) => {- if (imgFiles.length !== 0) {- addImages(imgFiles);- }- }}- >- <ChooseChunk- text="本地上传"- imgUrl={localUpload.src}- color="linear-gradient(to right, rgb(255, 142, 28), rgb(255, 124, 24))"- hoverColor="rgb(255, 142, 28)"- style={{- marginRight: "15px",- width: "260px",- height: "180px",- }}- />- </ImgChoose>- ) : (- <ImgTextImagesView />- )}- </div>-- <div className="imageLeftSetting-commonPar">- <div className="imageLeftSetting-commonPar-titles">- <label>通用发布设置</label>- </div>-- <div className="imageLeftSetting-commonPar-item">- <label>一键设置标题:</label>- <Input- value={commonPubParams.title}- placeholder="请输入标题"- showCount- variant="filled"- onChange={(e) => {- setCommonPubParams({- title: e.target.value,- });- }}- />- </div>-- <div- className="imageLeftSetting-commonPar-item"- style={{ alignItems: "baseline" }}- >- <label>一键设置简介:</label>- <TextArea- value={commonPubParams.describe}- maxLength={1000}- placeholder="请输入简介"- showCount- variant="filled"- onChange={(e) => {- setCommonPubParams({- describe: e.target.value,- });- }}- />- </div>- </div>- </div>- );- },- ),-);-ImageLeftSetting.displayName = "ImageLeftSetting";--export default ImageLeftSetting;diff --git a/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImgTextImagesView.tsx b/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImgTextImagesView.tsxdeleted file mode 100644index 6e52ab22..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/ImgTextImagesView.tsx+++ /dev/null@@ -1,95 +0,0 @@-import { ForwardedRef, forwardRef, memo, useEffect, useState } from "react";-import styles from "./imgTextImagesView.module.scss";-import { Button } from "antd";-import { CloseOutlined, PlusOutlined } from "@ant-design/icons";-import { useImagePageStore } from "../../useImagePageStore";-import { useShallow } from "zustand/react/shallow";-import { ReactSortable } from "react-sortablejs";-import ImgChoose from "@/app/[lng]/publish/components/Choose/ImgChoose";--export interface IImgTextImagesViewRef {}--export interface IImgTextImagesViewProps {}--const ImgTextImagesView = memo(- forwardRef(- ({}: IImgTextImagesViewProps, ref: ForwardedRef<IImgTextImagesViewRef>) => {- const { images, setImages, addImages, imgUploadLimit } =- useImagePageStore(- useShallow((state) => ({- images: state.images,- setImages: state.setImages,- addImages: state.addImages,- imgUploadLimit: state.imgUploadLimit,- })),- );- const [srcollEl, setSrcollEl] = useState<HTMLElement>();-- useEffect(() => {- const el = document.getElementById("imgTextImagesView-wrapper");- setSrcollEl(el!);- }, []);-- return (- <div className={styles.imgTextImagesView}>- <div className="imgTextImagesView_head">- <div className="imgTextImagesView_head-left">- 图片编辑({images.length}/{imgUploadLimit})- </div>- <div className="imgTextImagesView_head-right">- <div className="imgTextImagesView_head-right-tips">- 长按拖动排序- </div>- <ImgChoose- onMultipleChoose={(imgFiles) => {- if (imgFiles.length !== 0) {- addImages(imgFiles);- }- }}- >- <Button type="link" icon={<PlusOutlined />}>- 本地上传- </Button>- </ImgChoose>- </div>- </div>-- <div id="imgTextImagesView-wrapper">- {srcollEl && (- <ReactSortable- className="imgTextImagesView_content"- list={images}- animation={250}- setList={setImages}- scrollSensitivity={100}- scroll={srcollEl}- scrollSpeed={15}- >- {images.map((v, i) => {- return (- <div className="imgTextImagesView_content-item" key={v.id}>- <img src={v.imgUrl} alt={v.filename} />- <div- className="imgTextImagesView_content-item-close"- onClick={() => {- const newImages = [...images];- newImages.splice(i, 1);- setImages(newImages);- }}- >- <CloseOutlined />- </div>- </div>- );- })}- </ReactSortable>- )}- </div>- </div>- );- },- ),-);-ImgTextImagesView.displayName = "ImgTextImagesView";--export default ImgTextImagesView;diff --git a/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/imgTextImagesView.module.scss b/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/imgTextImagesView.module.scssdeleted file mode 100644index a99008d4..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageLeftSetting/imgTextImagesView.module.scss+++ /dev/null@@ -1,83 +0,0 @@-.imgTextImagesView {- width: 100%;- border-radius: 6px;- padding: 10px;- box-sizing: border-box;- font-size: 15px;- border: 10px solid rgb(247, 250, 250);- :global {- .imgTextImagesView_head {- display: flex;- justify-content: space-between;- align-items: center;- margin-bottom: 10px;- &-left {- }- &-right {- display: flex;- align-items: center;- &-tips {- color: var(--grayColor7);- margin-right: 8px;- }- button {- margin: 0;- padding: 0;- gap: 3px;- display: flex;- align-items: center;- font-size: 15px;- }- }- }--- .imgTextImagesView_content {- display: grid;- grid-template-columns: repeat(5, 1fr);- gap: 10px;- height: 100%;- box-sizing: border-box;- &-item {- min-width: 100px;- height: 102px;- border: 1px solid var(--grayColor3);- cursor: move;- position: relative;- &:hover {- .imgTextImagesView_content-item-close {- display: block !important;- }- }- img {- width: 100%;- height: 100%;- object-fit: contain;- user-select: none;- display: block;- }- &-close {- display: none;- cursor: pointer;- background: rgba(0, 0, 0, 0.7);- width: 16px;- height: 16px;- line-height: 15px;- font-size: 10px;- text-align: center;- position: absolute;- right: 0;- top: 0;- color: #fff;- }- }- }-- #imgTextImagesView-wrapper {- overflow-y: auto;- overflow-x: hidden;- max-height: 500px;- box-sizing: border-box;- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/ImageRightSetting.tsx b/src/app/[lng]/publish/imagePage/components/ImageRightSetting/ImageRightSetting.tsxdeleted file mode 100644index 19a9c183..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/ImageRightSetting.tsx+++ /dev/null@@ -1,95 +0,0 @@-import { ForwardedRef, forwardRef, memo, useRef, useState } from "react";-import styles from "../../image.module.scss";-import { Steps } from "antd";-import { useShallow } from "zustand/react/shallow";-import { useImagePageStore } from "../../useImagePageStore";-import ImageParamsSet from "./components/ImageParamsSet";-import ChooseAccountModule, {- IChooseAccountModuleRef,-} from "@/app/[lng]/publish/components/ChooseAccountModule/ChooseAccountModule";-import { ChooseAccountChunk } from "@/app/[lng]/publish/components/CommonComponents/CommonComponents";-import SupportPlat from "@/app/[lng]/publish/components/SupportPlat/SupportPlat";-import { PubType } from "@/app/config/publishConfig";--export interface IImageRightSettingRef {}--export interface IImageRightSettingProps {}--const ImageRightSetting = memo(- forwardRef(- ({}: IImageRightSettingProps, ref: ForwardedRef<IImageRightSettingRef>) => {- const [chooseAccountOpen, setChooseAccountOpen] = useState(false);- const { imageAccounts, addAccount, activePlat } = useImagePageStore(- useShallow((state) => ({- imageAccounts: state.imageAccounts,- addAccount: state.addAccount,- activePlat: state.activePlat,- })),- );- const chooseAccountModuleRef = useRef<IChooseAccountModuleRef>(null);-- return (- <>- <ChooseAccountModule- ref={chooseAccountModuleRef}- open={chooseAccountOpen}- onClose={setChooseAccountOpen}- platChooseProps={{- choosedAccounts: imageAccounts- .map((v) => v.account)- .filter((v) => v !== undefined),- pubType: PubType.ImageText,- defaultPlat: activePlat,- }}- onPlatConfirm={(aList) => {- addAccount(aList);- }}- />- {imageAccounts.length === 0 ? (- <div className={styles.imageRightSetting}>- <SupportPlat- pubType={PubType.ImageText}- style={{ marginTop: "15px" }}- />-- <h2 className="imageRightSetting-title">发布账户</h2>- <ChooseAccountChunk- onClick={() => {- setChooseAccountOpen(true);- }}- />-- <Steps- direction="vertical"- size="small"- items={[- {- title: "选择发布账号",- description: "选择将要推文的账号",- },- {- title: "调整发文规则",- description:- "完成账号选择后,撰写推文,按需调整各个平台发文规则",- },- ]}- />- </div>- ) : (- <ImageParamsSet- openChooseAccount={() => {- setChooseAccountOpen(true);- chooseAccountModuleRef- .current!.getPlatChooseRef()- ?.setActivePlat(activePlat!);- }}- />- )}- </>- );- },- ),-);-ImageRightSetting.displayName = "ImageRightSetting";--export default ImageRightSetting;diff --git a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsx b/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsxdeleted file mode 100644index 6da39cf4..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsx+++ /dev/null@@ -1,169 +0,0 @@-import { ForwardedRef, forwardRef, memo, useEffect, useMemo } from "react";-import { useImagePageStore } from "../../../useImagePageStore";-import { useShallow } from "zustand/react/shallow";-import styles from "./imageParamsSet.module.scss";-import { IImageAccountItem } from "../../../imagePage.type";-import { CloseOutlined, InfoOutlined } from "@ant-design/icons";-import ParamsSettingDetails from "./ParamsSettingDetails";-import { Tooltip } from "antd";-import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";-import { ErrPubParamsItem } from "@/app/[lng]/publish/hooks/usePubParamsVerify";--export interface IImageParamsSetRef {}--export interface IImageParamsSetProps {- openChooseAccount: () => void;-}--// 图片发布右侧参数设置-const ImageParamsSet = memo(- forwardRef(- (- { openChooseAccount }: IImageParamsSetProps,- ref: ForwardedRef<IImageParamsSetRef>,- ) => {- const {- imageAccounts,- activePlat,- setActivePlat,- setPlatActiveAccountMap,- platActiveAccountMap,- delAccountByPalt,- errParamsMap,- } = useImagePageStore(- useShallow((state) => ({- imageAccounts: state.imageAccounts,- setActivePlat: state.setActivePlat,- activePlat: state.activePlat,- setPlatActiveAccountMap: state.setPlatActiveAccountMap,- platActiveAccountMap: state.platActiveAccountMap,- delAccountByPalt: state.delAccountByPalt,- errParamsMap: state.errParamsMap,- })),- );-- const platAccountImagesMap = useMemo(() => {- // 平台账户map- const platAccountMap = new Map<PlatType, IImageAccountItem[]>([]);-- for (const imageAccount of imageAccounts) {- if (!platAccountMap.has(imageAccount.account.type)) {- platAccountMap.set(imageAccount.account.type, []);- }- platAccountMap.get(imageAccount.account.type)?.push(imageAccount);- }- return platAccountMap;- }, [imageAccounts]);-- useEffect(() => {- // 当前选择的平台不存在了便重新选择- if (!activePlat || !platAccountImagesMap.has(activePlat)) {- setActivePlat(Array.from(platAccountImagesMap)[0][0]);- }-- // 默认选中的平台map- const newPlatActiveAccountMap = new Map<PlatType, IImageAccountItem>();-- for (const [accountType, imageAccountItems] of platAccountImagesMap) {- if (!newPlatActiveAccountMap.has(accountType)) {- newPlatActiveAccountMap.set(accountType, imageAccountItems[0]);- }- }-- // 将旧的选中的平台账户设置为新的- for (const [accountType, imageAccountItem] of newPlatActiveAccountMap) {- // 旧的选中账户- const activeImageAccountItem = platActiveAccountMap.get(accountType);- if (- !activeImageAccountItem ||- activeImageAccountItem.account.id === imageAccountItem.account.id- )- continue;-- // 旧的选中账户新的账户列表是否存在,如果存在则使用上一次选中的状态- if (- platAccountImagesMap- .get(accountType)!- .some((v) => v.account.id === activeImageAccountItem.account.id)- ) {- newPlatActiveAccountMap.set(- accountType,- platActiveAccountMap.get(accountType)!,- );- break;- }- }-- // 设置store当前选择的平台账户- setPlatActiveAccountMap(newPlatActiveAccountMap);- }, [platAccountImagesMap]);-- // key=平台,val==错误消息- const errParamsPlatMap = useMemo(() => {- if (!errParamsMap) return undefined;- const errParamsMapTemp = new Map<PlatType, ErrPubParamsItem>();- for (const [_, errParamsItem] of errParamsMap) {- if (!errParamsMapTemp.has(errParamsItem.plat!)) {- errParamsMapTemp.set(errParamsItem.plat!, errParamsItem);- }- }- return errParamsMapTemp;- }, [errParamsMap]);-- return (- <div className={styles.imageParamsSet}>- <div className="imageParamsSet_plats">- {Array.from(platAccountImagesMap).map(([accountType]) => {- const platInfo = AccountPlatInfoMap.get(accountType)!;- return (- <div- className={[- "imageParamsSet_plats-item",- accountType === activePlat &&- "imageParamsSet_plats-item--active",- ].join(" ")}- key={accountType}- onClick={() => {- setActivePlat(accountType);- }}- >- <div className="imageParamsSet_plats-item-img">- <img src={platInfo.icon} />- <div- className={`${styles.closeIcon} imageParamsSet_plats-item-close`}- onClick={(e) => {- e.stopPropagation();- delAccountByPalt(accountType);- }}- >- <CloseOutlined />- </div>- {errParamsPlatMap?.get(accountType) && (- <Tooltip- title={errParamsPlatMap?.get(accountType)?.parErrMsg}- >- <div className="imageParamsSet_plats-item-err">- <InfoOutlined />- </div>- </Tooltip>- )}- </div>- <span>{platInfo.name}</span>- </div>- );- })}- </div>- {activePlat && platAccountImagesMap.get(activePlat) && (- <ParamsSettingDetails- openChooseAccount={openChooseAccount}- imageAccountList={platAccountImagesMap.get(activePlat)!}- />- )}- </div>- );- },- ),-);-ImageParamsSet.displayName = "ImageParamsSet";--export default ImageParamsSet;diff --git a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.type.ts b/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.type.tsdeleted file mode 100644index 8c4f0393..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageParamsSet.type.ts+++ /dev/null@@ -1 +0,0 @@-export interface ImageRightSettingChildProps {}diff --git a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx b/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsxdeleted file mode 100644index b5720c67..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx+++ /dev/null@@ -1,387 +0,0 @@-import { useShallow } from "zustand/react/shallow";-import React, { useEffect, useState } from "react";-import { Input, SelectProps, Tooltip } from "antd";-import { useImagePageStore } from "../../../useImagePageStore";-import { useImagePlatParams } from "./children/hooks/useImagePlatParams";-import { QuestionCircleOutlined } from "@ant-design/icons";-import dayjs from "dayjs";-import { VideoPubRestartLogin } from "../../../../videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon";-import { ILocationDataItem } from "@/app/[lng]/publish/videoPage/videoPage.type";-import { IMixItem, IUsersItem } from "@/app/plat/plat.type";-import CommonLocationSelect from "@/app/[lng]/publish/components/CommonComponents/CommonLocationSelect";-import CommonTopicSelect, {- CommonTopicSelectProps,- CommonTopicSelectValueType,-} from "@/app/[lng]/publish/components/CommonComponents/CommonTopicSelect";-import CommonUserSelect, {- CommonUserSelectProps,-} from "@/app/[lng]/publish/components/CommonComponents/CommonUserSelect";-import CommonScheduledTimeSelect, {- ICommonScheduledTimeSelectProps,-} from "@/app/[lng]/publish/components/CommonComponents/CommonScheduledTimeSelect";-import {- AccountRestartLogin,- CommonMixSelect,- PubPermission,- PubPermissionProps,-} from "@/app/[lng]/publish/components/CommonComponents/CommonComponents";-import { AccountPlatInfoMap } from "@/app/config/platConfig";--interface DebounceSelectProps<ValueType = any>- extends Omit<SelectProps<ValueType | ValueType[]>, "options" | "children"> {}--const { TextArea } = Input;--// 重新登录-export const ImgTextPubRestartLogin = () => {- const { imageAccountItem } = useImagePlatParams();- const { accountRestart } = useImagePageStore(- useShallow((state) => ({- accountRestart: state.accountRestart,- })),- );-- return (- <AccountRestartLogin- account={imageAccountItem.account}- onAccountRestart={() => {- accountRestart(imageAccountItem.account!.type);- }}- />- );-};--// 位置选择器-export const ImgTextLocationSelect = ({- ...props-}: DebounceSelectProps<ILocationDataItem>) => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams, updateAccounts } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- updateAccounts: state.updateAccounts,- })),- );-- return (- <CommonLocationSelect- {...props}- account={imageAccountItem.account}- value={imageAccountItem.pubParams!.location}- onAccountChange={(account) => {- updateAccounts([account]);- }}- onChange={(_, value) => {- setOnePubParams(- {- location: (value as ILocationDataItem) || null,- },- imageAccountItem.account.id,- );- }}- >- <ImgTextPubRestartLogin />- </CommonLocationSelect>- );-};--// 话题选择器-export const ImgTextTopicSelect = ({ ...props }: CommonTopicSelectProps) => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams, updateAccounts } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- updateAccounts: state.updateAccounts,- })),- );- const { topicMax } = AccountPlatInfoMap.get(- imageAccountItem.account.type,- )!.commonPubParamsConfig;- props.maxCount = props.maxCount || topicMax;- props.tips = props.tips || `您可以添加${topicMax}个话题`;-- return (- <CommonTopicSelect- {...props}- account={imageAccountItem.account}- value={imageAccountItem.pubParams!.topics!.map((v) => {- return {- value: v,- label: v,- };- })}- onAccountChange={(account) => {- updateAccounts([account]);- }}- onChange={(newValue) => {- setOnePubParams(- {- topics: (newValue as CommonTopicSelectValueType[]).map(- (v) => v.label,- ),- diffParams: {- ...imageAccountItem.pubParams.diffParams,- },- },- imageAccountItem.account.id,- );- }}- >- <ImgTextPubRestartLogin />- </CommonTopicSelect>- );-};--// 用户选择器-export const ImgTextUserSelect = ({- ...props-}: CommonUserSelectProps<IUsersItem>) => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams, updateAccounts } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- updateAccounts: state.updateAccounts,- })),- );-- return (- <CommonUserSelect- {...props}- account={imageAccountItem.account!}- onAccountChange={(account) => {- updateAccounts([account]);- }}- value={- imageAccountItem.pubParams!.mentionedUserInfo?.map((v) => {- return {- ...v,- id: v.value,- name: v.label,- };- }) as any- }- onChange={(_, value) => {- setOnePubParams(- {- mentionedUserInfo: value- ? (value as IUsersItem[]).map((v) => {- return {- value: v.id,- label: v.name,- };- })- : undefined,- },- imageAccountItem.account.id,- );- }}- >- <ImgTextPubRestartLogin />- </CommonUserSelect>- );-};--// 标题-export const ImgTextTitleInput = ({- placeholder,- tips,- title = "标题",- maxLength = 20,-}: {- placeholder: string;- tips?: string;- title?: string;- maxLength?: number;-}) => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- })),- );- const [value, setValue] = useState(imageAccountItem.pubParams.title);-- useEffect(() => {- setOnePubParams(- {- title: value,- },- imageAccountItem.account.id,- );- }, [value]);- useEffect(() => {- setValue(imageAccountItem.pubParams.title);- }, [imageAccountItem.pubParams.title]);-- return (- <>- <h1>- {title}- {tips && (- <Tooltip title={tips}>- <QuestionCircleOutlined style={{ marginLeft: "2px" }} />- </Tooltip>- )}- </h1>- <Input- spellCheck={false}- value={value}- maxLength={maxLength}- placeholder={placeholder}- showCount- variant="filled"- onChange={(e) => {- setValue(e.target.value);- }}- />- </>- );-};--// 描述-export const ImgTextDescTextArea = ({- placeholder,- title = "描述",- maxLength = 1000,-}: {- placeholder: string;- tips?: string;- title?: string;- maxLength?: number;-}) => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- })),- );- const [value, setValue] = useState(imageAccountItem?.pubParams.describe);-- useEffect(() => {- setOnePubParams(- {- describe: value,- },- imageAccountItem.account!.id,- );- }, [value]);- useEffect(() => {- setValue(imageAccountItem?.pubParams.describe || "");- }, [imageAccountItem?.pubParams.describe]);-- return (- <>- <h1>{title}</h1>- <TextArea- spellCheck={false}- value={value}- placeholder={placeholder}- variant="filled"- showCount- maxLength={maxLength}- autoSize={{ minRows: 6, maxRows: 6 }}- onChange={(e) => {- setValue(e.target.value);- }}- />- </>- );-};--// 权限设置-export const ImgTextPubPermission = ({ ...props }: PubPermissionProps) => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- })),- );- return (- <PubPermission- style={{- display: "flex",- gap: 4,- flexDirection: "column",- }}- onChange={(e) => {- setOnePubParams(- {- visibleType: e,- },- imageAccountItem.account!.id,- );- }}- value={imageAccountItem?.pubParams.visibleType}- {...props}- />- );-};--// 定时发布-export const ImgTextScheduledTimeSelect = ({- ...props-}: ICommonScheduledTimeSelectProps) => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- })),- );-- return (- <CommonScheduledTimeSelect- {...props}- platType={imageAccountItem?.account?.type}- value={- imageAccountItem?.pubParams.timingTime- ? dayjs(imageAccountItem?.pubParams.timingTime)- : undefined- }- onChange={(e) => {- if (!imageAccountItem) return;- setOnePubParams(- {- timingTime: e ? e.toDate() : undefined,- },- imageAccountItem.account.id,- );- }}- />- );-};--// 合集-export const ImgTextMixSelect = () => {- const { imageAccountItem } = useImagePlatParams();- const { setOnePubParams, updateAccounts } = useImagePageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- updateAccounts: state.updateAccounts,- })),- );-- return (- <CommonMixSelect- account={imageAccountItem.account}- onAccountChange={(account) => {- updateAccounts([account]);- }}- value={imageAccountItem.pubParams.mixInfo?.value}- onChange={(_, value) => {- setOnePubParams(- {- mixInfo: !value- ? undefined- : {- label: (value as IMixItem).name,- value: (value as IMixItem).id,- },- },- imageAccountItem.account.id,- );- }}- >- <VideoPubRestartLogin />- </CommonMixSelect>- );-};diff --git a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsx b/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsxdeleted file mode 100644index f2dae336..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsx+++ /dev/null@@ -1,152 +0,0 @@-import { ForwardedRef, forwardRef, memo, useMemo } from "react";-import styles from "./imageParamsSet.module.scss";-import { CloseOutlined, PlusOutlined } from "@ant-design/icons";-import { Alert, Avatar, Tooltip } from "antd";-import { IImageAccountItem } from "../../../imagePage.type";-import { useImagePageStore } from "../../../useImagePageStore";-import { useShallow } from "zustand/react/shallow";-import { PubParamsVerifyInfo } from "@/app/[lng]/publish/hooks/usePubParamsVerify";-import { AccountStatus } from "@/app/config/accountConfig";-import { PlatType } from "@/app/config/platConfig";--export interface IParamsSettingDetailsRef {}--export interface IParamsSettingDetailsProps {- imageAccountList: IImageAccountItem[];- openChooseAccount: () => void;-}--// 图文发布右侧参数设置的具体参数设置,为了防止代码冗余拆分-const ParamsSettingDetails = memo(- forwardRef(- (- { imageAccountList, openChooseAccount }: IParamsSettingDetailsProps,- ref: ForwardedRef<IParamsSettingDetailsRef>,- ) => {- const {- activePlat,- platActiveAccountMap,- delAccountById,- setPlatActiveAccountMap,- accountRestart,- errParamsMap,- warnParamsMap,- } = useImagePageStore(- useShallow((state) => ({- activePlat: state.activePlat,- platActiveAccountMap: state.platActiveAccountMap,- setPlatActiveAccountMap: state.setPlatActiveAccountMap,- delAccountById: state.delAccountById,- accountRestart: state.accountRestart,- errParamsMap: state.errParamsMap,- warnParamsMap: state.warnParamsMap,- })),- );-- const currAccountItem = useMemo(() => {- if (!activePlat) return undefined;- return platActiveAccountMap.get(activePlat);- }, [platActiveAccountMap, activePlat]);-- return (- <div className={styles.paramsSettingItem}>- <h1 style={{ marginTop: "10px" }}>- <span>发布账号</span>- <i>*</i>- </h1>- <div className="paramsSettingItem-users">- <div- className="paramsSettingItem-users-item"- onClick={openChooseAccount}- >- <div className="paramsSettingItem-users-item-img">- <Avatar size="large" icon={<PlusOutlined />} />- </div>- <p className="paramsSettingItem-users-item-name">发布账号</p>- </div>-- {imageAccountList.map((v) => {- return (- <div- className={[- "paramsSettingItem-users-item",- currAccountItem?.account?.id === v.account.id &&- "paramsSettingItem-users-item--active",- ].join(" ")}- key={v.account.id}- onClick={() => {- const newPlatActiveAccountMap = new Map(- platActiveAccountMap,- );- newPlatActiveAccountMap.set(activePlat!, v);- setPlatActiveAccountMap(newPlatActiveAccountMap);- }}- >- <div className="paramsSettingItem-users-item-img">- <div- className={`paramsSettingItem-users-item-close ${styles.closeIcon}`}- onClick={(e) => {- e.stopPropagation();- delAccountById(v.account.id);- }}- >- <CloseOutlined />- </div>- <Avatar src={v.account.avatar} size="large" />- </div>- {v.account.status === AccountStatus.DISABLE ? (- <Tooltip- title={- <>- 账号已失效,请- <a- onClick={() => {- accountRestart(v.account.type);- }}- >- 重新登录- </a>- 。- </>- }- >- <Alert message="登录失效" type="error" />- </Tooltip>- ) : (- <Tooltip title={v.account.nickname}>- <p className="paramsSettingItem-users-item-name">- {v.account.nickname}- </p>- </Tooltip>- )}- </div>- );- })}- </div>-- <PubParamsVerifyInfo- style={{ marginTop: "20px" }}- onAccountRestart={() => {- accountRestart(activePlat!);- }}- warnParamsMap={warnParamsMap}- errParamsMap={errParamsMap}- id={currAccountItem?.account.id}- />-- {/*{(() => {*/}- {/* switch (activePlat) {*/}- {/* case PlatType.Douyin:*/}- {/* return <ImageParamsSet_Douyin />;*/}- {/* case PlatType.Xhs:*/}- {/* return <ImageParamsSet_XHS />;*/}- {/* }*/}- {/*})()}*/}- </div>- );- },- ),-);-ParamsSettingDetails.displayName = "ParamsSettingDetails";--export default ParamsSettingDetails;diff --git a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/children/hooks/useImagePlatParams.ts b/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/children/hooks/useImagePlatParams.tsdeleted file mode 100644index 1918b623..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/children/hooks/useImagePlatParams.ts+++ /dev/null@@ -1,20 +0,0 @@-import { useImagePageStore } from "../../../../../useImagePageStore";-import { useShallow } from "zustand/react/shallow";-import { useMemo } from "react";--export function useImagePlatParams() {- const { activePlat, platActiveAccountMap } = useImagePageStore(- useShallow((state) => ({- activePlat: state.activePlat,- platActiveAccountMap: state.platActiveAccountMap,- })),- );-- const imageAccountItem = useMemo(() => {- return platActiveAccountMap.get(activePlat!)!;- }, [activePlat, platActiveAccountMap]);-- return {- imageAccountItem,- };-}diff --git a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/imageParamsSet.module.scss b/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/imageParamsSet.module.scssdeleted file mode 100644index 4b5b6b6e..00000000--- a/src/app/[lng]/publish/imagePage/components/ImageRightSetting/components/imageParamsSet.module.scss+++ /dev/null@@ -1,142 +0,0 @@-.imageParamsSet {- width: 45%;- min-width: 0;- display: flex;- :global {- .imageParamsSet_plats {- padding: 15px 10px;- border-right: 1px solid var(--grayColor3);- margin-right: 15px;- &-item {- display: flex;- flex-direction: column;- align-items: center;- font-size: var(--fs-xs);- color: var(--grayColor10);- cursor: pointer;- padding: 20px 15px 15px;- border-radius: 6px;- white-space: nowrap;- &:hover {- .imageParamsSet_plats-item-close {- display: flex !important;- }- }- &-err {- position: absolute;- bottom: 2px;- right: -5px;- color: #fff;- background: red;- width: 12px;- height: 12px;- line-height: 10px;- text-align: center;- border-radius: 50%;- }- &-img {- position: relative;- img {- width: 35px;- margin-bottom: 4px;- }- }- &-close {- }-- &--active {- background: var(--colorPrimary1);- }- }- }- }-}--.closeIcon {- position: absolute;- background: red;- color: #fff;- border-radius: 50%;- justify-content: center;- align-items: center;- width: 14px;- height: 14px;- font-size: 9px;- top: -7px;- right: -7px;- display: none;-}--.paramsSettingItem {- width: 100%;- overflow: auto;- padding-right: 15px;- text-align: left;- :global {- h1 {- font-size: var(--fs-md);- font-weight: 400;- display: flex;- align-items: center;- color: var(--grayColor10);- margin: 30px 0 10px 0;- span {- margin-right: 5px;- }- i {- color: red;- }- }-- .paramsSettingItem-users {- display: flex;- &-item {- width: 70px;- font-size: var(--fs-sm);- cursor: pointer;- display: flex;- flex-direction: column;- align-items: center;- margin-right: 5px;- .ant-alert {- padding: 2px 4px;- font-size: var(--fs-xs);- font-weight: 900;- margin-top: 4px;- border-radius: 6px;- color: var(--errerColor);- }- &--active {- .paramsSettingItem-users-item-img {- border-color: var(--colorPrimary6);- }- .paramsSettingItem-users-item-name {- color: var(--colorPrimary6);- }- }- &:hover {- .paramsSettingItem-users-item-close {- display: flex !important;- }- }- &-img {- border: 2px solid transparent;- display: inline-block;- position: relative;- transition: 0.3s;- border-radius: 50%;- }- &-close {- }- &-name {- width: 100%;- margin-top: 6px;- overflow: hidden;- white-space: nowrap;- text-overflow: ellipsis;- text-align: center;- }- }- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/publish/imagePage/image.module.scss b/src/app/[lng]/publish/imagePage/image.module.scssdeleted file mode 100644index 61b43328..00000000--- a/src/app/[lng]/publish/imagePage/image.module.scss+++ /dev/null@@ -1,100 +0,0 @@-.image {- display: flex;- flex-direction: column;- width: 100%;- height: 100%;- :global {- .image-wrapper {- width: 1200px;- margin: 0 auto;- height: 100%;- min-height: 0;- box-sizing: border-box;- padding: 15px 0;- display: flex;- @media (max-width: 1450px) {- width: 90%;- }- }- .image-footer {- border-top: 1px solid var(--grayColor3);- padding: 15px 0;- text-align: center;- button {- margin-right: 20px;- &:last-of-type {- margin-right: 0;- }- }- }- }-}--.imageLeftSetting {- width: 65%;- display: flex;- flex-direction: column;- overflow: auto;- height: 100%;- min-height: 0;- box-sizing: border-box;- padding: 25px 20px 0 0;- border-right: 1px solid var(--grayColor3);- :global {- .imageLeftSetting-upload {- width: 100%;- display: flex;- justify-content: center;- border-bottom: 1px solid var(--grayColor3);- padding-bottom: 30px;- margin-bottom: 25px;- }- .imageLeftSetting-commonPar {- height: 100%;- &-titles, &-item {- display: flex;- align-items: center;- justify-content: space-between;- font-size: var(--fs-sm);- margin-bottom: 30px;- & > label {- flex-shrink: 0;- }- }- &-item {- textarea {- height: 150px;- resize: none;- }- }- }- }-}--.imageRightSetting {- width: 45%;- box-sizing: border-box;- margin-left: 20px;- :global {- .imageRightSetting-title {- text-align: left;- font-size: var(--fs-sm);- margin: 25px 0 5px 0;- }-- .ant-steps {- margin-top: 30px;- .ant-steps-item {- height: 70px;- }- .ant-steps-item-title {- color: #222 !important;- font-weight: 900;- }- .ant-steps-item-description {- color: var(--grayColor7) !important;- font-size: var(--fs-xs);- }- }- }-}diff --git a/src/app/[lng]/publish/imagePage/imagePage.type.ts b/src/app/[lng]/publish/imagePage/imagePage.type.tsdeleted file mode 100644index 3cb9b5f0..00000000--- a/src/app/[lng]/publish/imagePage/imagePage.type.ts+++ /dev/null@@ -1,7 +0,0 @@-import { IPubParams } from "../videoPage/videoPage.type";-import { SocialAccount } from "@/api/types/account.type";--export interface IImageAccountItem {- account: SocialAccount;- pubParams: IPubParams;-}diff --git a/src/app/[lng]/publish/imagePage/page.tsx b/src/app/[lng]/publish/imagePage/page.tsxdeleted file mode 100644index b0898f76..00000000--- a/src/app/[lng]/publish/imagePage/page.tsx+++ /dev/null@@ -1,311 +0,0 @@-"use client";--import styles from "./image.module.scss";-import { useShallow } from "zustand/react/shallow";-import { useImagePageStore } from "./useImagePageStore";-import ImageLeftSetting from "./components/ImageLeftSetting/ImageLeftSetting";-import ImageRightSetting from "./components/ImageRightSetting/ImageRightSetting";-import { Button, message, Popconfirm } from "antd";-import React, { useEffect, useMemo, useRef, useState } from "react";-import { signInApi } from "@/api/signIn";-import { toolsApi } from "@/api/tools";-import { sensitivityLoading } from "@/utils";-import usePubParamsVerify, {- PubParamsErrStatusEnum,-} from "@/app/[lng]/publish/hooks/usePubParamsVerify";-import PubAccountDetModule, {- IPubAccountDetModuleRef,-} from "@/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule";-import { PublishProgressRes } from "@/app/plat/plat.type";-import PubProgressModule from "@/app/[lng]/publish/components/PubProgressModule/PubProgressModule";-import { IImageAccountItem } from "@/app/[lng]/publish/imagePage/imagePage.type";--export default function Page() {- const {- clear,- images,- imageAccounts,- setActivePlat,- setPlatActiveAccountMap,- setErrParamsMap,- updateAccounts,- commonPubParams,- } = useImagePageStore(- useShallow((state) => ({- clear: state.clear,- images: state.images,- imageAccounts: state.imageAccounts,- setPlatActiveAccountMap: state.setPlatActiveAccountMap,- setActivePlat: state.setActivePlat,- setErrParamsMap: state.setErrParamsMap,- updateAccounts: state.updateAccounts,- commonPubParams: state.commonPubParams,- })),- );- const { errParamsMap, warnParamsMap } = usePubParamsVerify(- imageAccounts.map((v) => {- return {- id: v.account.id,- account: v.account,- pubParams: v.pubParams,- } as any;- }),- {- moreWranVerifyCallback(item, wranParamsMapTemp, platInfo) {- const { imgTextConfig } = platInfo.commonPubParamsConfig;- if (imgTextConfig) {- const { imagesMax } = imgTextConfig;- if (images.length > imagesMax) {- wranParamsMapTemp.set(item.id, {- message: "参数警告",- errType: PubParamsErrStatusEnum.PARAMS,- parErrMsg: `${platInfo.name}的图片上传数最多不能超过${imagesMax}个,多余的图片会被系统过滤!`,- });- }- }- },- },- );- const pubAccountDetModuleRef = useRef<IPubAccountDetModuleRef>(null);- const [loading, setLoading] = useState(false);- const [pubProgressModuleOpen, setPubProgressModuleOpen] = useState(false);- // 主进程传过来的发布进度数据,key为用户id value为发布进度数据- const [pubProgressMap, setPubProgressMap] = useState<- Map<string, PublishProgressRes>- >(new Map());- // 敏感词检测- const [sensitiveDetLoading, setSensitiveDetLoading] = useState(false);-- useEffect(() => {- setErrParamsMap(errParamsMap, warnParamsMap);- }, [errParamsMap, warnParamsMap]);-- useEffect(() => {- return () => {- clear();- };- }, []);-- // 发布- const pubCore = async () => {- setPubProgressModuleOpen(true);- setLoading(true);- await signInApi.createSignInRecord();-- const err = () => {- setLoading(false);- message.error("网络繁忙,请稍后重试!");- };- // 创建一级记录- // const recordRes = await icpCreatePubRecord({- // title: commonPubParams.title,- // desc: commonPubParams.describe,- // type: PubType.ImageText,- // coverPath: images[0].imgPath,- // });- // if (!recordRes) return err();- //- // for (const vData of imageAccounts) {- // const account = vData.account!;- // // 创建二级记录- // await icpCreateImgTextPubRecord({- // ...vData.pubParams,- // type: account.type,- // accountId: account.id,- // pubRecordId: recordRes.id,- // publishTime: new Date(),- // desc: vData.pubParams.describe,- // coverPath: images[0].imgPath,- // imagesPath: images.map((v) => v.imgPath),- // });- // }- // const okRes = await icpPubImgText(recordRes.id);- // setLoading(false);- // setPubProgressModuleOpen(false);- // usePubStroe.getState().clearImgTextPubSave();- // const successList = okRes.filter((v) => v.code === 1);- // useCommontStore.getState().notification!.open({- // message: "发布结果",- // description: (- // <>- // 一共发布 {okRes.length} 条数据,成功 {successList.length} 条,失败{" "}- // {okRes.length - successList.length} 条- // </>- // ),- // showProgress: true,- // btn: (- // <Space>- // <Button- // type="primary"- // size="small"- // onClick={() => {- // navigate("/publish/pubRecord");- // }}- // >- // 查看发布记录- // </Button>- // </Space>- // ),- // key: Date.now(),- // });- };-- // 进度- const pubProgressData = useMemo(() => {- return imageAccounts.map((v) => {- const progress = pubProgressMap.get(v.account!.id);- return {- account: v.account!,- progress: progress?.progress || 0,- msg: progress?.msg || "",- };- });- }, [pubProgressMap, imageAccounts]);-- // 一键发布点击- const pubClick = () => {- pubAccountDetModuleRef.current!.startDet();- setLoading(true);- };-- const sensitiveDetCore = async (- content: string,- accountItem: IImageAccountItem,- ) => {- const res = await toolsApi.textModeration(content);-- return {- sensitive: res !== "Normal",- accountItem,- };- };-- return (- <div className={styles.image}>- <PubProgressModule- open={pubProgressModuleOpen}- pubProgressData={pubProgressData as any}- onClose={() => setPubProgressModuleOpen(false)}- />- <PubAccountDetModule- isCheckProxy={true}- ref={pubAccountDetModuleRef}- accounts={imageAccounts- .map((v) => v.account)- .filter((v) => v !== undefined)}- onClose={() => {- setLoading(false);- }}- onPubClick={() => {- pubCore();- }}- onRestartLoginFinish={(account) => {- updateAccounts([account]);- }}- onDetFinish={(accounts) => {- updateAccounts(accounts);- }}- />- <div className="image-wrapper">- <ImageLeftSetting />- <ImageRightSetting />- </div>- <div className="image-footer">- <Popconfirm- title="温馨提示"- description="是否确认清空内容和账号?"- onConfirm={() => {- clear();- }}- okText="确认"- cancelText="取消"- >- <Button>一键清空</Button>- </Popconfirm>- <Button- loading={sensitiveDetLoading}- color="danger"- variant="solid"- disabled={imageAccounts.length === 0 || images.length === 0}- onClick={async () => {- setSensitiveDetLoading(true);- const core = async () => {- const tasks: Promise<{- // 作品- accountItem: IImageAccountItem;- // 是否敏感 true=敏感 false=正常- sensitive: boolean;- }>[] = [];- // 如果检测内容重复不会进行检测- const contentSet = new Set<string>();-- imageAccounts.map((v) => {- const content = `- ${v.pubParams.title}- ${v.pubParams.describe}- `;- if (content.trim() !== "" && !contentSet.has(content)) {- contentSet.add(content);- tasks.push(sensitiveDetCore(content, v));- }- });- return await Promise.all(tasks);- };-- const taskRes = await Promise.all([core(), sensitivityLoading()]);- const res = taskRes[0];-- setSensitiveDetLoading(false);-- if (res.length === 0) return message.success("检测正常");-- if (res.every((v) => !v.sensitive)) {- message.success("检测正常");- return;- }- for (const { sensitive, accountItem } of res) {- if (sensitive) {- message.warning("检测到此条作品存在敏感信息!");- setActivePlat(accountItem.account.type);- const platActiveAccountMap = new Map(- useImagePageStore.getState().platActiveAccountMap,- );- platActiveAccountMap.set(accountItem.account.type, accountItem);- setPlatActiveAccountMap(platActiveAccountMap);- break;- }- }- }}- >- 内容安全检测- </Button>- <Button- loading={loading}- type="primary"- disabled={imageAccounts.length === 0 || images.length === 0}- onClick={() => {- for (const [key, errVideoItem] of errParamsMap) {- if (errVideoItem) {- const imageAccount = imageAccounts.find(- (v) => v.account.id === key,- )!;- const platType = imageAccount!.account.type;- const platActiveAccountMap = new Map(- useImagePageStore.getState().platActiveAccountMap,- );- setActivePlat(platType);- platActiveAccountMap.set(platType, imageAccount);- setPlatActiveAccountMap(platActiveAccountMap);- message.warning(errVideoItem.parErrMsg);- return;- }- }- pubClick();- }}- >- 一键发布- </Button>- </div>- </div>- );-}diff --git a/src/app/[lng]/publish/imagePage/useImagePageStore.ts b/src/app/[lng]/publish/imagePage/useImagePageStore.tsdeleted file mode 100644index bc064442..00000000--- a/src/app/[lng]/publish/imagePage/useImagePageStore.ts+++ /dev/null@@ -1,284 +0,0 @@-import { create } from "zustand";-import { combine } from "zustand/middleware";-import { IImgFile } from "../components/Choose/ImgChoose";-import { IImageAccountItem } from "./imagePage.type";-import lodash from "lodash";-import { useVideoPageStore } from "../videoPage/useVideoPageStore";-import { AccountInfo, IPubParams } from "../videoPage/videoPage.type";-import { message } from "antd";-import { PlatType } from "@/app/config/platConfig";-import { ErrPubParamsMapType } from "@/app/[lng]/publish/hooks/usePubParamsVerify";--export interface IImagePageStore {- // 账户数据和对应参数- imageAccounts: IImageAccountItem[];- // 选择的图片数据- images: IImgFile[];- // 每个平台当前选择的账户- platActiveAccountMap: Map<PlatType, IImageAccountItem>;- // 当前选择的平台- activePlat?: PlatType;- // 通用参数- commonPubParams: IPubParams;- // 图片上传上限- imgUploadLimit: number;- /**- * 这个属性在 imagePage/page.tsx 中进行计算,然后实时的放到这里- * 因为别的组件需要这个属性,为了使其只计算一次,特此放到store引用- */- errParamsMap?: ErrPubParamsMapType;- warnParamsMap?: ErrPubParamsMapType;-}--const store: IImagePageStore = {- imgUploadLimit: 35,- images: [],- imageAccounts: [],- platActiveAccountMap: new Map<PlatType, IImageAccountItem>(),- activePlat: undefined,- commonPubParams: useVideoPageStore.getState().pubParamsInit(),- errParamsMap: undefined,- warnParamsMap: undefined,-};--const getStore = () => {- return lodash.cloneDeep(store);-};--// 视频发布所有组件的共享状态和方法-export const useImagePageStore = create(- combine(- {- ...getStore(),- },- (set, get, storeApi) => {- const methods = {- setPlatActiveAccountMap(- platActiveAccountMap: Map<PlatType, IImageAccountItem>,- ) {- set({- platActiveAccountMap,- });- },- setErrParamsMap(- errParamsMap: ErrPubParamsMapType,- warnParamsMap: ErrPubParamsMapType,- ) {- set({- errParamsMap,- warnParamsMap,- });- },- setActivePlat(activePlat: PlatType) {- set({- activePlat,- });- },- // 设置图片- setImages(images: IImgFile[]) {- set({- images,- });- },-- // TODO 恢复临时图文记录- // async setTempSaveParams({- // images,- // commonPubParams,- // imageAccounts,- // }: {- // images?: IImgFile[];- // commonPubParams?: IPubParams;- // imageAccounts?: IImageAccountItem[];- // }) {- // if (images) {- // const tasks: Promise<IImgFile>[] = [];- // for (const image of images) {- // tasks.push(getImgFile(image.imgPath));- // }- // const imgFiles = await Promise.all(tasks);- // set({- // images: imgFiles,- // });- // }- //- // if (imageAccounts) {- // const accountList = useAccountStore.getState().accountList;- // imageAccounts = imageAccounts.map((v) => {- // v.account = accountList.find(- // (account) => v.account?.id === account.id,- // )!;- // return v;- // });- // set({- // imageAccounts,- // });- // }- //- // if (commonPubParams) {- // set({- // commonPubParams,- // });- // }- // },-- /**- * TODO 账户重新登录。登录成功后会自动更新该条账户数据- */- async accountRestart(pType: PlatType) {- // const res = await accountLogin(pType);- // if (!res) return;- // message.success("登录成功!");- // // 更新此条账户数据- // methods.updateAccounts([res]);- },-- // 添加图片- addImages(images: IImgFile[]) {- if (images.length + get().images.length > get().imgUploadLimit) {- return message.warning(`最多上传${get().imgUploadLimit}张图片!`);- }- set({- images: [...get().images, ...images],- });- },-- // 设置所有参数- setAllPubParams(pubParmas: IPubParams) {- const imageAccounts = [...get().imageAccounts];-- imageAccounts.map((v) => {- // 替换- Object.keys(pubParmas).map((key) => {- if (pubParmas.hasOwnProperty(key)) {- v.pubParams[key as "topics"] = pubParmas[key as "topics"];- }- });- });- set({- imageAccounts,- });- },-- // 设置通用发布参数- setCommonPubParams(pubParmas: IPubParams) {- console.log(pubParmas);- const commonPubParams = { ...get().commonPubParams };- const imageAccounts = [...get().imageAccounts];-- for (const key in commonPubParams) {- if (pubParmas.hasOwnProperty(key)) {- const keyType = key as "title";- const val = pubParmas[keyType];- commonPubParams[keyType] = pubParmas[keyType];- imageAccounts.map((v) => {- v.pubParams[keyType] = val;- });- }- }- set({- commonPubParams,- imageAccounts,- });- },-- // 按照账号id删除- delAccountById(accountId: string) {- const imageAccounts = get().imageAccounts.filter(- (v) => v.account.id !== accountId,- );- set({- imageAccounts,- });- },-- // 按平台删除- delAccountByPalt(accountType: PlatType) {- const imageAccounts = get().imageAccounts.filter(- (v) => v.account.type !== accountType,- );- set({- imageAccounts,- });- },-- // 添加账户- addAccount(accounts: AccountInfo[]) {- let imageAccounts = [...get().imageAccounts];- // 新增账户- const accountSet = new Set<string>(accounts.map((v) => v.id));- // 已有账户- const existAccountSet = new Set<string>(- imageAccounts.map((v) => v.account.id),- );- // 要添加到数据的账户- const notAddAccount: AccountInfo[] = [];-- // 过滤掉新增账户中的 已有账户- for (const account of accounts) {- if (!existAccountSet.has(account.id)) notAddAccount.push(account);- }-- /**- * 新增账户没有的账户- * 但是已有账户有,那么过滤- */- imageAccounts = imageAccounts.filter((v) =>- accountSet.has(v.account.id),- );-- // 根据账户添加数据- for (const account of notAddAccount) {- imageAccounts.push({- account,- pubParams: lodash.cloneDeep(get().commonPubParams),- });- }-- set({- imageAccounts,- });- },-- // 设置单条数据的参数- setOnePubParams(pubParmas: IPubParams, id: string) {- const imageAccounts = [...get().imageAccounts];- const findedData = imageAccounts.find((v) => v.account.id === id);- if (!findedData) return;-- for (const key in pubParmas) {- if (pubParmas.hasOwnProperty(key)) {- findedData.pubParams[key as "title"] = pubParmas[key as "title"];- }- }-- set({ imageAccounts });- },-- // 更新用户数据- updateAccounts(accounts: AccountInfo[]) {- const imageAccounts = [...get().imageAccounts];- const imageTextMap = new Map<string, IImageAccountItem>();-- imageAccounts.map((v) => {- imageTextMap.set(v.account.id || "0", v);- });-- accounts.map((v) => {- imageTextMap.get(v.id)!.account = v;- });-- set({ imageAccounts });- },-- // 清除本store所有数据- clear() {- set({- ...getStore(),- });- },- };- return methods;- },- ),-);diff --git a/src/app/[lng]/publish/layout.tsx b/src/app/[lng]/publish/layout.tsxdeleted file mode 100644index 69d39aea..00000000--- a/src/app/[lng]/publish/layout.tsx+++ /dev/null@@ -1,17 +0,0 @@-import styles from "./publish.module.scss";-import PublishSidebar from "@/app/[lng]/publish/components/PublishSidebar";--export default function RootLayout({- children,- params,-}: Readonly<{- children: React.ReactNode;- params: Promise<{ lng: string }>;-}>) {- return (- <div className={styles.publish}>- <PublishSidebar />- {children}- </div>- );-}diff --git a/src/app/[lng]/publish/page.tsx b/src/app/[lng]/publish/page.tsxdeleted file mode 100644index f4f4fde6..00000000--- a/src/app/[lng]/publish/page.tsx+++ /dev/null@@ -1,5 +0,0 @@-import { redirect } from "next/navigation";--export default function Page() {- redirect("/publish/videoPage");-}diff --git a/src/app/[lng]/publish/pubRecord/page.tsx b/src/app/[lng]/publish/pubRecord/page.tsxdeleted file mode 100644index 8d163339..00000000--- a/src/app/[lng]/publish/pubRecord/page.tsx+++ /dev/null@@ -1,379 +0,0 @@-"use client";--import { useEffect, useMemo, useState } from "react";-import styles from "./pubRecord.module.scss";-import { apiGetPublishList, PubStatus, AccountType } from "@/api/publish";-import {- Button,- Image,- Select,- Table,- TableProps,- Tag,- Modal,- Descriptions,- Typography,-} from "antd";-import { formatTime } from "@/utils";-import { PubType } from "@/app/config/publishConfig";-import { PubRecordStatusTag } from "@/app/layout/BellMessage";-import {- ImageView,- PlatformView,-} from "@/app/[lng]/publish/pubRecord/pubRecord.common";--const { Text, Title } = Typography;--// 发布记录数据模型-export interface PubRecordModel {- id: number;- flowId: string;- type: PubType;- title: string;- desc?: string;- accountId: string;- accountType: AccountType;- uid: string;- videoUrl?: string;- coverUrl?: string;- imgList?: string[];- publishTime: string;- status: PubStatus;- option?: any;- // 兼容原有字段- coverPath?: string;- videoPath?: string;- // 其他不确定的字段使用 any- [key: string]: any;-}--// 详情弹窗内容组件-const DetailContent = ({ data }: { data: PubRecordModel }) => {- const renderValue = (key: string, value: any) => {- // 特殊字段处理- if (key === "imgList" || key === "imgUrlList") {- if (Array.isArray(value) && value.length > 0) {- return (- <div style={{ display: "flex", flexWrap: "wrap", gap: "8px" }}>- {value.map((url: string, index: number) => (- <Image- key={index}- src={url}- width={80}- height={80}- style={{ objectFit: "cover", borderRadius: "4px" }}- fallback="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3Ik1RnG4W+FgYxN"- />- ))}- </div>- );- }- return <Text type="secondary">无图片</Text>;- }-- if (key === "videoUrl" || key === "coverUrl") {- if (value && typeof value === "string") {- return (- <div>- <Text copyable>{value}</Text>- {value.match(/\.(jpg|jpeg|png|gif|webp)$/i) && (- <div style={{ marginTop: "8px" }}>- <Image- src={value}- width={120}- height={80}- style={{ objectFit: "cover" }}- />- </div>- )}- </div>- );- }- }-- if (key === "option" && typeof value === "object") {- return (- <div- style={{- backgroundColor: "#f5f5f5",- padding: "8px",- borderRadius: "4px",- }}- >- <pre style={{ margin: 0, fontSize: "12px" }}>- {JSON.stringify(value, null, 2)}- </pre>- </div>- );- }-- if (key === "publishTime") {- return <Text>{formatTime(value)}</Text>;- }-- if (key === "status") {- return <PubRecordStatusTag status={value} />;- }-- if (key === "type") {- const typeMap: Record<string, string> = {- [PubType.ARTICLE]: "文章发布",- [PubType.VIDEO]: "视频发布",- [PubType.ImageText]: "图文发布",- };- return <Tag color="blue">{typeMap[value] || "未知类型"}</Tag>;- }-- if (key === "accountType") {- return <PlatformView accountType={value} />;- }-- // 默认处理- if (typeof value === "object" && value !== null) {- return (- <div- style={{- backgroundColor: "#f5f5f5",- padding: "8px",- borderRadius: "4px",- }}- >- <pre style={{ margin: 0, fontSize: "12px" }}>- {JSON.stringify(value, null, 2)}- </pre>- </div>- );- }-- return <Text>{String(value)}</Text>;- };-- const fieldLabels: Record<string, string> = {- id: "记录ID",- flowId: "流程ID",- type: "发布类型",- title: "标题",- desc: "描述",- accountId: "账户ID",- accountType: "平台类型",- uid: "用户ID",- videoUrl: "视频链接",- coverUrl: "封面链接",- imgList: "图片列表",- imgUrlList: "图片链接列表",- publishTime: "发布时间",- status: "发布状态",- option: "发布选项",- coverPath: "封面路径",- videoPath: "视频路径",- };-- return (- <div style={{ maxHeight: "60vh", overflow: "auto" }}>- <Descriptions- column={1}- bordered- size="small"- labelStyle={{ fontWeight: "bold", width: "120px" }}- contentStyle={{ wordBreak: "break-all" }}- >- {Object.entries(data).map(([key, value]) => (- <Descriptions.Item- label={fieldLabels[key] || key}- key={key}- style={{ padding: "12px" }}- >- {renderValue(key, value)}- </Descriptions.Item>- ))}- </Descriptions>- </div>- );-};--// 主页面组件-export default function Page() {- const [pubRecordList, setPubRecordList] = useState<PubRecordModel[]>([]);- const [loading, setLoading] = useState(false);- const [detailOpen, setDetailOpen] = useState(false);- const [detailData, setDetailData] = useState<any>(null);- const [pubType, setPubType] = useState<PubType | undefined>();- const [currentPage, setCurrentPage] = useState(1);- const [totalCount, setTotalCount] = useState(0);-- const columns = useMemo(() => {- const columns: TableProps<PubRecordModel>["columns"] = [- {- title: "序号",- render: (text, prm, ind) => ind + 1,- width: 70,- key: "序号",- },- {- title: "发布内容",- render: (text, prm) => <ImageView prm={prm} width={30} height={50} />,- width: 200,- key: "发布内容",- },- {- title: "标题",- dataIndex: "title",- key: "title",- width: 200,- render: (text) => (- <div- style={{- maxWidth: 180,- overflow: "hidden",- textOverflow: "ellipsis",- whiteSpace: "nowrap",- }}- >- {text}- </div>- ),- },- {- title: "平台",- dataIndex: "accountType",- key: "accountType",- width: 120,- render: (text, prm) => <PlatformView accountType={prm.accountType} />,- },- {- title: "发布时间",- dataIndex: "publishTime",- key: "publishTime",- render: (text, prm) => formatTime(prm.publishTime),- width: 200,- },- {- title: "发布类型",- dataIndex: "type",- key: "type",- render: (_, prm) => {- switch (prm.type) {- case PubType.ARTICLE:- return <>文章发布</>;- case PubType.VIDEO:- return <>视频发布</>;- case PubType.ImageText:- return <>图文发布</>;- default:- return <>未知类型</>;- }- },- width: 120,- },- {- title: "状态",- dataIndex: "status",- key: "status",- render: (text, prm) => <PubRecordStatusTag status={prm.status} />,- width: 100,- },- {- title: "操作",- width: 100,- key: "操作",- render: (text, prm) => (- <>- <Button- type="link"- onClick={(e) => {- e.stopPropagation();- setDetailData(prm);- setDetailOpen(true);- }}- >- 详情- </Button>- </>- ),- },- ];- return columns;- }, []);-- useEffect(() => {- getPubList(currentPage);- }, [pubType, currentPage]);-- async function getPubList(page = currentPage) {- setLoading(true);- try {- const res: any = await apiGetPublishList(page, 10, {- type: pubType,- });- if (res?.data?.list) {- setPubRecordList(res.data.list);- setTotalCount(res.data.totalCount || 0);- } else {- setPubRecordList([]);- setTotalCount(0);- }- } catch (error) {- console.error("获取发布记录失败:", error);- setPubRecordList([]);- setTotalCount(0);- } finally {- setLoading(false);- }- }-- return (- <div className={[styles.pubRecord].join(" ")}>- {/* 详情弹窗 */}- <Modal- open={detailOpen}- title={- <div style={{ display: "flex", alignItems: "center", gap: "8px" }}>- <Title level={4} style={{ margin: 0 }}>- 发布记录详情- </Title>- {detailData && <Tag color="blue">ID: {detailData.id}</Tag>}- </div>- }- onCancel={() => setDetailOpen(false)}- footer={null}- width={800}- style={{ top: 20 }}- >- {detailData && <DetailContent data={detailData} />}- </Modal>-- <div className="pubRecord-options">- <Select- style={{ width: 120 }}- placeholder="发布类型"- allowClear- value={pubType}- onChange={(e) => {- setPubType(e as PubType);- }}- options={[- { value: PubType.ARTICLE, label: "文章" },- { value: PubType.ImageText, label: "图文" },- { value: PubType.VIDEO, label: "视频" },- ]}- />- </div>-- <Table<PubRecordModel>- columns={columns}- dataSource={pubRecordList}- scroll={{ y: "70vh" }}- rowKey="id"- loading={loading}- pagination={{- total: totalCount,- pageSize: 10,- current: currentPage,- showSizeChanger: false,- showQuickJumper: false,- onChange: (page) => setCurrentPage(page),- }}- />- </div>- );-}diff --git a/src/app/[lng]/publish/pubRecord/pubRecord.common.tsx b/src/app/[lng]/publish/pubRecord/pubRecord.common.tsxdeleted file mode 100644index c3b5eada..00000000--- a/src/app/[lng]/publish/pubRecord/pubRecord.common.tsx+++ /dev/null@@ -1,101 +0,0 @@-// 图片视图组件-import { useEffect, useMemo, useState } from "react";-import styles from "./pubRecord.module.scss";-import { PubStatus, AccountType } from "@/api/publish";-import { Image, Tag, Avatar, Space, Typography } from "antd";-import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";-import { PubRecordModel } from "@/app/[lng]/publish/pubRecord/page";--const { Text, Title } = Typography;--export const ImageView = ({- prm,- width,- height,-}: {- prm: PubRecordModel;- width: number | string;- height: number | string;-}) => {- const [imgUrl, setImgUrl] = useState("");-- useEffect(() => {- // 优先使用 coverUrl,如果没有则使用 coverPath- const coverUrl = prm.coverUrl || prm.coverPath;- if (coverUrl) {- if (coverUrl.includes("https://") || coverUrl.includes("http://")) {- setImgUrl(coverUrl);- } else {- // 如果是本地路径,可以转换为 URL- setImgUrl(coverUrl);- }- }- }, [prm.coverUrl, prm.coverPath]);-- const filename = useMemo(() => {- const videoUrl = prm.videoUrl || prm.videoPath;- if (videoUrl) {- return videoUrl.split("/").pop() || "未知文件";- }- return "未知文件";- }, [prm.videoUrl, prm.videoPath]);-- return (- <div- className={styles["pubRecord-pubCon"]}- style={{ minHeight: height + "px" }}- >- {imgUrl ? (- <Image src={imgUrl} height={height} width={width} />- ) : (- <div- style={{- width,- height,- backgroundColor: "#f5f5f5",- display: "flex",- alignItems: "center",- justifyContent: "center",- }}- >- <span>无封面</span>- </div>- )}- <span title={filename} className="pubRecord-pubCon-name">- {filename}- </span>- </div>- );-};--// 平台展示组件-export const PlatformView = ({ accountType }: { accountType: AccountType }) => {- const platInfo = AccountPlatInfoMap.get(accountType as unknown as PlatType);-- if (!platInfo) {- return <Tag color="default">未知平台</Tag>;- }-- return (- <Space>- <Avatar size="small" src={platInfo.icon} />- <Text>{platInfo.name}</Text>- </Space>- );-};--// 发布状态标签组件-export const PubRecordStatusTag = ({ status }: { status: PubStatus }) => {- switch (status) {- case PubStatus.FAIL:- return <Tag color="error">发布失败</Tag>;- case PubStatus.RELEASED:- return <Tag color="success">发布成功</Tag>;- case PubStatus.PartSuccess:- return <Tag color="warning">部分发布成功</Tag>;- case PubStatus.UNPUBLISH:- return <Tag color="processing">未发布</Tag>;- default:- return <Tag color="default">未知状态</Tag>;- }-};diff --git a/src/app/[lng]/publish/pubRecord/pubRecord.module.scss b/src/app/[lng]/publish/pubRecord/pubRecord.module.scssdeleted file mode 100644index 60234f91..00000000--- a/src/app/[lng]/publish/pubRecord/pubRecord.module.scss+++ /dev/null@@ -1,115 +0,0 @@-.pubRecord {- width: 100%;- min-width: 0;- padding: 20px;- box-sizing: border-box;- :global {- .pubRecord-options {- margin-bottom: 10px;- }- .pubRecord-record {- margin-top: 20px;- display: flex;- flex-wrap: wrap;- &-item {- background: rgb(247, 250, 250);- padding: 15px 15px 5px 15px;- border-radius: 6px;- box-sizing: border-box;- position: relative;- width: calc(50% - 8px);- margin-bottom: 16px;- &:nth-child(even) {- margin-left: 16px;- }- &-btns {- display: flex;- justify-content: right;- min-height: 30px;- button {- margin: 0;- padding: 0;- }- }- &-status {- position: absolute;- top: 0;- right: 0;- font-size: var(--fs-xs);- padding: 2px 5px;- border-radius: 6px 6px 0 6px;- }- &--success {- background: rgb(218, 245, 233);- color: var(--successColor);- }- &--processing {- background: #e6f4ff;- color: #1677ff;- }- &--fail {- background-color: #ffcccc;- color: var(--errerColor);- }- &-con {- display: flex;- &-avatar {- position: relative;- margin-right: 10px;- & > img {- width: 15px;- position: absolute;- border-radius: 50%;- bottom: 0;- right: 0;- }- }- }- &-failMsg {- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;- width: 100%;- font-size: var(--fs-xs);- color: #ff0000;- }- &-userinfo {- overflow: hidden;- text-overflow: ellipsis;- &-time {- font-size: var(--fs-xs);- margin-top: 3px;- color: #b4b4b4;- }- }- }- }- }-}--.pubRecord-component {- :global {- tr {- cursor: pointer;- }- }-}--.pubRecord-pubCon {- display: flex;- align-items: center;- :global {- .ant-image {- flex-shrink: 0;- margin-right: 10px;- img {- object-fit: cover;- }- }- .pubRecord-pubCon-name {- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;- }- }-}diff --git a/src/app/[lng]/publish/publish.module.scss b/src/app/[lng]/publish/publish.module.scssdeleted file mode 100644index 70443bf8..00000000--- a/src/app/[lng]/publish/publish.module.scss+++ /dev/null@@ -1,16 +0,0 @@-.publish {- width: 100%;- display: flex;- @include height_100vh;-- :global {- .ant-segmented {- padding: 30px 10px;-- .ant-segmented-item {- margin-bottom: 5px;- padding: 3px 40px 3px 0;- }- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/publish/videoPage/comment.ts b/src/app/[lng]/publish/videoPage/comment.tsdeleted file mode 100644index 865e3eab..00000000--- a/src/app/[lng]/publish/videoPage/comment.ts+++ /dev/null@@ -1,11 +0,0 @@-/*- * @Author: nevin- * @Date: 2025-01-23 23:15:08- * @LastEditTime: 2025-02-10 13:24:38- * @LastEditors: nevin- * @Description:- */--// import { VideoModel } from '../../../../../electron/db/models/video';--export type VideoPul = any;diff --git a/src/app/[lng]/publish/videoPage/components/CommonPubSetting.tsx b/src/app/[lng]/publish/videoPage/components/CommonPubSetting.tsxdeleted file mode 100644index 37cd14a1..00000000--- a/src/app/[lng]/publish/videoPage/components/CommonPubSetting.tsx+++ /dev/null@@ -1,246 +0,0 @@-import React, { ForwardedRef, forwardRef, memo, useMemo } from "react";-import { Input, Tooltip } from "antd";-import { ExclamationCircleOutlined } from "@ant-design/icons";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import { ScheduledTimeSelect } from "./VideoPubSetModal/components/VideoPubSetModalCommon";-import { AiCreateType } from "@/api/types/tools";-import VideoCoverSeting from "@/app/[lng]/publish/videoPage/components/VideoCoverSeting";-import {- AccountPlatInfoMap,- IAccountPlatInfo,- PlatType,-} from "@/app/config/platConfig";-import AICreateTitle from "@/app/[lng]/publish/components/AICreateTitle/AICreateTitle";--const { TextArea } = Input;--export interface ICommonPubSettingRef {}--export interface ICommonPubSettingProps {}--// 通用参数设置组件-const CommonPubSetting = memo(- forwardRef(- ({}: ICommonPubSettingProps, ref: ForwardedRef<ICommonPubSettingRef>) => {- const {- setPubParams,- videoListChoose,- setVideoCoverFirst,- commonPubParams,- } = useVideoPageStore(- useShallow((state) => ({- setPubParams: state.setPubParams,- videoListChoose: state.videoListChoose,- setVideoCoverFirst: state.setVideoCoverFirst,- commonPubParams: state.commonPubParams,- })),- );-- // 获取选择的账户的所有相关平台- const getChoosedAccountPlatList = useMemo(() => {- const platMap = new Map<PlatType, IAccountPlatInfo>();- videoListChoose.map((v) => {- if (v.account) {- platMap.set(- v.account.type,- AccountPlatInfoMap.get(v.account.type)!,- );- }- });- return Array.from(platMap.values());- }, [videoListChoose]);-- // 所有平台通用发布参数的最大值获取,做为默认值- const getPlatCommonParamsMax = useMemo(() => {- const platList = Array.from(AccountPlatInfoMap.values());-- const maxValue = (getValue: (v: any) => number) =>- Math.max(...platList.map((v) => getValue(v) || -Infinity));-- return {- maxDate: maxValue((v) => v.commonPubParamsConfig.timingMax?.maxDate),- timeOffset: maxValue(- (v) => v.commonPubParamsConfig.timingMax?.timeOffset,- ),- titleMax: maxValue((v) => v.commonPubParamsConfig.titleMax),- };- }, [AccountPlatInfoMap]);-- return (- <div className="commonPubSetting">- <h1>通用发布设置</h1>- <p className="commonPubSetting-tip">- 通用设置中的参数将会应用于所有账号- </p>- <h2>通用封面</h2>- <VideoCoverSeting- videoFile={videoListChoose.find((v) => v.video)?.video}- value={commonPubParams.cover}- saveImgId="common"- onClose={() => {- setPubParams({- cover: undefined,- });- setVideoCoverFirst(true);- }}- onChoosed={(imgFile) => {- setPubParams({- cover: imgFile,- });- }}- />- <p className="commonPubSetting-tip">- 支持常用图片格式上传,暂不支持 GIF,上传后图片将按平台要求自动裁剪- </p>- <p className="commonPubSetting-tip">- 未上传任何图片的情况下,默认选择视频第一帧。- </p>-- <h2>- 标题- <Tooltip- title={- <div>- {Array.from(AccountPlatInfoMap.values()).map((platInfo) => {- const titleMax = platInfo.commonPubParamsConfig.titleMax;- return (- <p key={platInfo.name}>- <b>{platInfo.name}</b>- {!titleMax- ? `没有标题参数`- : `标题字数限制${titleMax}字`}- </p>- );- })}- </div>- }- >- <ExclamationCircleOutlined />- </Tooltip>- </h2>- <Input- showCount- value={commonPubParams.title}- maxLength={Math.min(- getPlatCommonParamsMax.titleMax,- ...getChoosedAccountPlatList.map(- (v) => v.commonPubParamsConfig.titleMax || 30,- ),- )}- placeholder="请输入视频标题"- variant="filled"- onChange={(e) => {- setPubParams({- title: e.target.value,- });- }}- />- <AICreateTitle- type={AiCreateType.TITLE}- tips="在通用发布参数会选择第一个视频作为生成标题的对象"- onAiCreateFinish={(text) => {- setPubParams({- title: text,- });- }}- videoFile={videoListChoose[0]?.video}- max={Math.min(- getPlatCommonParamsMax.titleMax,- ...getChoosedAccountPlatList.map(- (v) => v.commonPubParamsConfig.titleMax || 30,- ),- )}- />-- <h2>描述</h2>- <TextArea- placeholder="请输入视频描述"- variant="filled"- showCount- maxLength={500}- value={commonPubParams.describe}- style={{ height: 200, resize: "none" }}- onChange={(e) => {- setPubParams({- describe: e.target.value,- });- }}- />- <AICreateTitle- type={AiCreateType.DESC}- tips="在通用发布参数会选择第一个视频作为生成描述的对象"- onAiCreateFinish={(text) => {- setPubParams({- describe: text,- });- }}- videoFile={videoListChoose[0]?.video}- max={500}- />- <p className="commonPubSetting-tip">- 描述中可带话题,以‘#’开头、‘空格’结尾,- <Tooltip title="更多详情中单独设置的话题和描述中带的话题都是有效的,发布时将合并去重处理">- <span style={{ color: "rgb(250, 173, 20)" }}>- <ExclamationCircleOutlined style={{ marginRight: "3px" }} />- 发布时- </span>- </Tooltip>- 将根据平台自动处理 如:这是一段文字描述#最美中国 #夏日穿搭- </p>-- <h2>- 定时发布- <Tooltip- styles={{- root: {- maxWidth: "none",- },- }}- title={- <div>- {Array.from(AccountPlatInfoMap.values()).map((platInfo) => {- const timingMax = platInfo.commonPubParamsConfig.timingMax;- return (- <p key={platInfo.name}>- <b>{platInfo.name}</b>- {!timingMax- ? `没有定时发布参数;`- : `支持${timingMax.timeOffset}分钟后及${timingMax.maxDate}天内的定时发布;`}- </p>- );- })}- </div>- }- >- <ExclamationCircleOutlined />- </Tooltip>- </h2>- <ScheduledTimeSelect- maxDate={Math.min(- getPlatCommonParamsMax.maxDate,- ...getChoosedAccountPlatList.map(- (v) => v.commonPubParamsConfig.timingMax?.maxDate || Infinity,- ),- )}- timeOffset={Math.min(- getPlatCommonParamsMax.timeOffset,- ...getChoosedAccountPlatList.map(- (v) =>- v.commonPubParamsConfig.timingMax?.timeOffset || Infinity,- ),- )}- onChange={(e) => {- setPubParams({- timingTime: e ? e.toDate() : undefined,- });- }}- />- </div>- );- },- ),-);-CommonPubSetting.displayName = "CommonPubSetting";--export default CommonPubSetting;diff --git a/src/app/[lng]/publish/videoPage/components/NoChoosePage.tsx b/src/app/[lng]/publish/videoPage/components/NoChoosePage.tsxdeleted file mode 100644index 8e6823c1..00000000--- a/src/app/[lng]/publish/videoPage/components/NoChoosePage.tsx+++ /dev/null@@ -1,63 +0,0 @@-import { ForwardedRef, forwardRef, memo } from "react";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import localUpload from "../images/localUpload.png";-import VideoChoose from "@/app/[lng]/publish/components/Choose/VideoChoose";-import { ChooseChunk } from "@/app/[lng]/publish/components/CommonComponents/CommonComponents";-import { PubType } from "@/app/config/publishConfig";-import SupportPlat from "@/app/[lng]/publish/components/SupportPlat/SupportPlat";--export interface INoChoosePageRef {}--export interface INoChoosePageProps {}--// 未选择视频时暂时的组件-const NoChoosePage = memo(- forwardRef(({}: INoChoosePageProps, ref: ForwardedRef<INoChoosePageRef>) => {- const { addVideos, setLoadingPageLoading, setOperateId } =- useVideoPageStore(- useShallow((state) => ({- addVideos: state.addVideos,- setLoadingPageLoading: state.setLoadingPageLoading,- setOperateId: state.setOperateId,- })),- );-- return (- <div className="video-pubBefore">- <h1>视频发布</h1>- <p className="video-pubBefore-tip">- 支持多视频、多平台、多账号同时发布- </p>-- <div className="video-pubBefore-con">- <VideoChoose- onMultipleChoose={(videoFiles) => {- setOperateId();- addVideos(videoFiles);- }}- onStartShoose={() => {- setLoadingPageLoading(true);- }}- onChooseFail={() => {- setLoadingPageLoading(false);- }}- >- <ChooseChunk- text="本地上传"- imgUrl={localUpload.src}- color="linear-gradient(to right, rgb(255, 142, 28), rgb(255, 124, 24))"- hoverColor="rgb(255, 142, 28)"- style={{ marginRight: "15px" }}- />- </VideoChoose>- </div>-- <SupportPlat pubType={PubType.VIDEO} style={{ marginTop: "15px" }} />- </div>- );- }),-);-NoChoosePage.displayName = "NoChoosePage";--export default NoChoosePage;diff --git a/src/app/[lng]/publish/videoPage/components/VideoChooseItem.tsx b/src/app/[lng]/publish/videoPage/components/VideoChooseItem.tsxdeleted file mode 100644index d220b25d..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoChooseItem.tsx+++ /dev/null@@ -1,251 +0,0 @@-import React, { ForwardedRef, forwardRef, memo, useMemo } from "react";-import { Alert, Avatar, Button, Tooltip } from "antd";-import {- CaretRightOutlined,- DeleteOutlined,- EditOutlined,- PlusOutlined,- VideoCameraFilled,- SwapOutlined,- ExclamationCircleOutlined,-} from "@ant-design/icons";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import { formatSeconds } from "@/utils";-import {AccountChooseType, IVideoChooseItem} from "@/app/[lng]/publish/videoPage/videoPage.type";-import { AccountStatus } from "@/app/config/accountConfig";-import VideoChoose from "@/app/[lng]/publish/components/Choose/VideoChoose";-import { AccountPlatInfoMap } from "@/app/config/platConfig";--export interface IVideoChooseItemRef {}--export interface IVideoChooseItemProps {- videoChooseItem: IVideoChooseItem;- // 用户单选触发- onAccountOneChoose: (id: string, type: AccountChooseType) => void;-}--// 选择视频完成后渲染的列表 item-const VideoChooseItem = memo(- forwardRef(- (- { videoChooseItem, onAccountOneChoose }: IVideoChooseItemProps,- ref: ForwardedRef<IVideoChooseItemRef>,- ) => {- // 数据是否准备完毕- const prepareEnd = !!(videoChooseItem.video && videoChooseItem.account);- const {- deleteAloneVideo,- aloneAdd,- deleteData,- setCurrChooseAccountId,- setVideoPubSetModalOpen,- setLoadingPageLoading,- accountRestart,- } = useVideoPageStore(- useShallow((state) => ({- deleteAloneVideo: state.deleteAloneVideo,- aloneAdd: state.aloneAdd,- deleteData: state.deleteData,- setCurrChooseAccountId: state.setCurrChooseAccountId,- setVideoPubSetModalOpen: state.setVideoPubSetModalOpen,- setLoadingPageLoading: state.setLoadingPageLoading,- accountRestart: state.accountRestart,- })),- );-- // 分辨率是否合规- const isDpiCompliance = useMemo(() => {- if (!videoChooseItem.video) return true;- return (- videoChooseItem.video.height < 640 ||- videoChooseItem.video.width < 480- );- }, []);-- return (- <div className="videoChooseItem">- <div className="videoChooseItem-core">- <div- className="videoChooseItem-left"- key={videoChooseItem.video?.videoUrl}- >- {videoChooseItem.video ? (- <>- <div className="videoChooseItem-video">- <div- className="videoChooseItem-video-close"- onClick={() => deleteAloneVideo(videoChooseItem.id)}- >- x- </div>- <div className="videoChooseItem-video-play">- <img src={videoChooseItem.video.cover.imgUrl} />- {prepareEnd && (- <div- className="videoChooseItem-video-play-click"- onClick={() => {- setVideoPubSetModalOpen(true);- setCurrChooseAccountId(videoChooseItem.id);- }}- >- <CaretRightOutlined />- </div>- )}- </div>- </div>- <div className="videoChooseItem-left-info">- <p- className="videoChooseItem-left-title"- title={videoChooseItem.video?.filename}- >- {videoChooseItem.video?.filename}- </p>- <div className="videoChooseItem-left-bottom">- <div className="videoChooseItem-left-bottom-item">- <label>时长</label>- <span>- {formatSeconds(videoChooseItem.video.duration)}- </span>- </div>- <div- className={[- "videoChooseItem-left-bottom-item",- isDpiCompliance &&- "videoChooseItem-left-bottom-item--warning",- ].join(" ")}- >- <label>分辨率</label>- <span>- {videoChooseItem.video.width}*- {videoChooseItem.video.height}- </span>- {isDpiCompliance && (- <Tooltip title="视频清晰度过低,有概率被平台限流或不能发布,推荐您上传 460*640 分辨率以上的视频">- <ExclamationCircleOutlined />- </Tooltip>- )}- </div>- </div>- </div>- </>- ) : (- <div className="videoChooseItem-left-chooseVideo">- <VideoChoose- onChoose={(videoFile) => {- setLoadingPageLoading(false);- aloneAdd({- video: videoFile,- id: videoChooseItem.id,- });- }}- onStartShoose={() => {- setLoadingPageLoading(true);- }}- >- <VideoCameraFilled />- <span className="videoChooseItem-left-chooseVideo-name">- 添加视频- </span>- </VideoChoose>- </div>- )}- </div>-- <div className="videoChooseItem-right">- {videoChooseItem.account ? (- <div className="videoChooseItem-account">- <div className="videoChooseItem-account-avatar">- <Avatar src={videoChooseItem.account.avatar} size="large" />- <div- className="videoChooseItem-account-avatar-replace"- onClick={() => {- onAccountOneChoose(- videoChooseItem.id,- AccountChooseType.Replace,- );- }}- >- <SwapOutlined />- </div>- </div>- <div className="videoChooseItem-account-con">- <div className="videoChooseItem-account-top">- <Tooltip title={videoChooseItem.account.nickname}>- <span className="videoChooseItem-account-top-name">- {videoChooseItem.account.nickname}- </span>- </Tooltip>- <img- src={- AccountPlatInfoMap.get(videoChooseItem.account.type)- ?.icon- }- />- </div>- {videoChooseItem.account.status ===- AccountStatus.DISABLE && (- <Alert- message="登录失效"- type="error"- showIcon- onClick={() => {- accountRestart(videoChooseItem.account!.type);- }}- />- )}- </div>- </div>- ) : (- <div- className="videoChooseItem-noAccount"- onClick={() => {- onAccountOneChoose(- videoChooseItem.id,- AccountChooseType.Radio,- );- }}- >- <div className="videoChooseItem-noAccount-icon">- <PlusOutlined />- </div>- <span>添加账号</span>- </div>- )}- </div>- </div>-- <div className="videoChooseItem-options">- <Button- color="primary"- type="text"- size="small"- icon={<EditOutlined />}- disabled={!prepareEnd}- onClick={() => {- setVideoPubSetModalOpen(true);- setCurrChooseAccountId(videoChooseItem.id);- }}- >- 发布设置- </Button>- <Button- onClick={() => {- deleteData(videoChooseItem.id);- }}- type="text"- size="small"- danger- icon={<DeleteOutlined />}- >- 删除- </Button>- </div>- </div>- );- },- ),-);-VideoChooseItem.displayName = "VideoChooseItem";--export default VideoChooseItem;diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsxdeleted file mode 100644index f996da5f..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx+++ /dev/null@@ -1,446 +0,0 @@-import React, {- ForwardedRef,- forwardRef,- memo,- useEffect,- useMemo,- useRef,- useState,-} from "react";-import {- Alert,- Avatar,- Button,- message,- Modal,- Space,- Switch,- Tabs,- Tooltip,-} from "antd";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import styles from "./videoPubSetModal.module.scss";-import {- NoticeItem,- NoticeType,- useBellMessageStroe,-} from "@/store/bellMessageStroe";-import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";-import VideoCoverSeting from "@/app/[lng]/publish/videoPage/components/VideoCoverSeting";-import PubAccountDetModule, {- IPubAccountDetModuleRef,-} from "@/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule";-import VideoPubSetModal_KWAI from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI";-import PubProgressModule from "@/app/[lng]/publish/components/PubProgressModule/PubProgressModule";-import VideoPubSetModalVideo, {- IVideoPubSetModalVideoRef,-} from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo";-import usePubParamsVerify, {- PubParamsErrStatusEnum,- PubParamsVerifyInfo,-} from "@/app/[lng]/publish/hooks/usePubParamsVerify";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";-import { useRouter } from "next/navigation";-import { useSystemStore } from "@/store/system";-import { generateUUID } from "@/utils";-import { PubStatus } from "@/app/config/publishConfig";-import { platManage } from "@/app/plat/PlatManage";-import { useCommontStore } from "@/store/commont";-import { PublishVideoParams } from "@/app/plat/plat.type";--export interface IVideoPubSetModalRef {}--export interface IVideoPubSetModalProps {- onClose: (open: boolean) => void;-}--const PubSetModalChild = ({}: {}) => {- const { currChooseAccount } = useVideoPageStore(- useShallow((state) => ({- currChooseAccount: state.currChooseAccount,- })),- );-- const renderedComponent = useMemo(() => {- switch (currChooseAccount?.account?.type) {- case PlatType.KWAI:- return <VideoPubSetModal_KWAI />;- }- return <></>;- }, [currChooseAccount?.account?.type]);-- return renderedComponent || <></>;-};--// 设置发布参数弹框-const VideoPubSetModal = memo(- forwardRef(- (- { onClose }: IVideoPubSetModalProps,- ref: ForwardedRef<IVideoPubSetModalRef>,- ) => {- const router = useRouter();- const { addNotice, noticeMap } = useBellMessageStroe(- useShallow((state) => ({- noticeMap: state.noticeMap,- addNotice: state.addNotice,- })),- );- const {- videoListChoose,- setOnePubParams,- currChooseAccountId,- setCurrChooseAccountId,- videoPubSetModalOpen,- setVideoPubSetModalOpen,- updateAccounts,- accountRestart,- commonPubParams,- clear,- setCurrChooseAccount,- } = useVideoPageStore(- useShallow((state) => ({- videoListChoose: state.videoListChoose,- setOnePubParams: state.setOnePubParams,- setCurrChooseAccountId: state.setCurrChooseAccountId,- currChooseAccountId: state.currChooseAccountId,- videoPubSetModalOpen: state.videoPubSetModalOpen,- setVideoPubSetModalOpen: state.setVideoPubSetModalOpen,- updateAccounts: state.updateAccounts,- accountRestart: state.accountRestart,- clear: state.clear,- commonPubParams: state.commonPubParams,- setCurrChooseAccount: state.setCurrChooseAccount,- })),- );- const [loading, setLoading] = useState(false);- const pubAccountDetModuleRef = useRef<IPubAccountDetModuleRef>(null);- const [pubProgressModuleOpen, setPubProgressModuleOpen] = useState(false);- const videoPubSetModalVideoRef = useRef<IVideoPubSetModalVideoRef>(null);- const { moreParamsOpen, setMoreParamsOpen } = useSystemStore(- useShallow((state) => ({- moreParamsOpen: state.moreParamsOpen,- setMoreParamsOpen: state.setMoreParamsOpen,- })),- );- const { errParamsMap, warnParamsMap } = usePubParamsVerify<IVideoFile>(- videoListChoose.map((v) => {- return {- id: v.id,- account: v.account,- pubParams: v.pubParams,- other: v.video!,- };- }),- {- moreErrorVerifyCallback(item, errParamsMapTemp) {- if (- item?.account?.type === PlatType.Douyin &&- item.other?.duration > 3600- ) {- errParamsMapTemp.set(item.id, {- message: "视频错误",- errType: PubParamsErrStatusEnum.PARAMS,- parErrMsg: `抖音平台规定视频时长最多不能超过60分钟!`,- });- }- },- },- );- const recordId = useRef("");-- useEffect(() => {- if (!currChooseAccountId)- setCurrChooseAccountId(videoListChoose[0]?.id);- }, [videoListChoose]);-- // 发布进度获取- const pubProgressData = useMemo(() => {- return (- (noticeMap.get(NoticeType.PubNotice) || []).find(- (v) => v.id === recordId.current,- )?.pub?.progressList || []- );- }, [noticeMap]);-- // 当前选择的账户数据- const currChooseAccount = useMemo(() => {- if (!currChooseAccountId) return videoListChoose[0];- return videoListChoose.find((v) => v.id === currChooseAccountId);- }, [currChooseAccountId, videoListChoose]);-- useEffect(() => {- if (currChooseAccount) setCurrChooseAccount({ ...currChooseAccount });- }, [currChooseAccount, videoListChoose]);-- const pubCore = async () => {- setLoading(true);- setPubProgressModuleOpen(true);-- // await signInApi.createSignInRecord();- const err = () => {- setLoading(false);- message.error("网络繁忙,请稍后重试!");- };-- const operateId = generateUUID();- recordId.current = operateId;- // 发布记录通知消息初始化- const initialNotice: NoticeItem = {- title:- [- ...new Set(- videoListChoose.map(- (v) => AccountPlatInfoMap.get(v.account!.type)!.name,- ),- ),- ].join("、") + "发布任务",- time: new Date(),- id: operateId,- pub: {- status: PubStatus.UNPUBLISH,- progressList: [],- },- };-- const publishVideoParamsArr: PublishVideoParams[] = [];- for (const vData of videoListChoose) {- initialNotice.pub!.progressList.push({- account: vData.account!,- progress: 0,- msg: "加载中...",- id: vData.account!.id!,- });-- publishVideoParamsArr.push({- videoPubParams: {- ...vData.pubParams,- video: vData.video!,- },- account: vData.account!,- access_token: vData.account!.access_token!,- refresh_token: vData.account!.refresh_token!,- });- }- const noticeList = noticeMap.get(NoticeType.PubNotice) || [];- noticeList.unshift(initialNotice);- addNotice(NoticeType.PubNotice, noticeList);-- // 发布- const okRes = await platManage.publishVideo(- publishVideoParamsArr,- operateId,- );- setLoading(false);- close();- setPubProgressModuleOpen(false);-- // 成功数据- const successList = okRes.filter((v) => v.success);-- initialNotice.pub!.status =- successList.length === okRes.length- ? PubStatus.RELEASED- : PubStatus.PartSuccess;- addNotice(NoticeType.PubNotice, noticeList);-- setTimeout(() => {- useCommontStore.getState().notification!.open({- message: "发布结果",- description: (- <>- 一共发布 {okRes.length} 条数据,成功 {successList.length}{" "}- 条,失败 {okRes.length - successList.length} 条- </>- ),- showProgress: true,- btn: (- <Space>- <Button- type="primary"- size="small"- onClick={() => {- router.push("/publish/pubRecord");- }}- >- 查看发布记录- </Button>- </Space>- ),- key: Date.now(),- });- }, 10);- };-- const handleOk = async () => {- // 数据校验- for (const [key, errVideoItem] of errParamsMap) {- if (errVideoItem) {- setCurrChooseAccountId(`${key}`);- message.warning(errVideoItem.parErrMsg);- setMoreParamsOpen(true);- return;- }- }- setLoading(true);- pubAccountDetModuleRef.current!.startDet();- };-- const close = () => {- setVideoPubSetModalOpen(false);- videoPubSetModalVideoRef.current?.pause();- };-- return (- <>- <PubProgressModule- pubProgressData={pubProgressData}- open={pubProgressModuleOpen}- onClose={() => {- setPubProgressModuleOpen(false);- if (loading) {- close();- }- }}- />- <PubAccountDetModule- ref={pubAccountDetModuleRef}- isCheckProxy={true}- accounts={videoListChoose- .map((v) => v.account)- .filter((v) => v !== undefined)}- onClose={() => {- setLoading(false);- }}- onPubClick={() => {- pubCore();- }}- onRestartLoginFinish={(account) => {- updateAccounts({- accounts: [account],- });- }}- onDetFinish={(accounts) => {- updateAccounts({- accounts,- });- }}- />- <Modal- width={moreParamsOpen ? 900 : 500}- maskClosable={false}- title={- <div className={styles.videoPubSetModal_titleWrap}>- <div className="videoPubSetModal-title">预览及发布</div>- <div className="videoPubSetModal-more">- <div className="videoPubSetModal-more-core">- <label>填写更多参数</label>- <Switch- size="small"- value={moreParamsOpen}- onClick={(e) => setMoreParamsOpen(e)}- />- </div>- <div className="videoPubSetModal-more-tips">- 开启后,将显示更多发布参数供您填写- </div>- </div>- </div>- }- open={videoPubSetModalOpen}- onOk={handleOk}- onCancel={close}- confirmLoading={loading}- okText="发布检测"- >- <div className={styles.videoPubSetModal}>- <Tabs- activeKey={currChooseAccountId}- onChange={setCurrChooseAccountId}- items={videoListChoose- .map((v) => {- const account = v.account!;- const errItem = errParamsMap.get(v.id);- if (!account || !v.video) return undefined;-- return {- key: v.id,- label: (- <div className="videoPubSetModal-tabLabel">- {errItem && (- <Tooltip title={errItem.parErrMsg}>- <Alert- message={errItem.message}- type="error"- showIcon- />- </Tooltip>- )}- <Tooltip title={account.nickname}>- <Avatar src={account?.avatar} size="small" />- <span className="videoPubSetModal-tabLabel-name">- {account?.nickname}- </span>- <img- src={AccountPlatInfoMap.get(account?.type)?.icon}- />- </Tooltip>- </div>- ),- };- })- .filter((v) => v !== undefined)}- />-- <div- className={[- "videoPubSetModal_con",- !moreParamsOpen && "videoPubSetModal_con--noMore",- ].join(" ")}- >- <div className="videoPubSetModal_con-left">- <PubParamsVerifyInfo- style={{ marginBottom: "5px" }}- id={currChooseAccount?.id}- warnParamsMap={warnParamsMap}- errParamsMap={errParamsMap}- onAccountRestart={() => {- accountRestart(currChooseAccount!.account!.type);- }}- />- <div className="videoPubSetModal_con-tips">- <span>*下方参数只应用于当前账号</span>- </div>- <h1>- <span className="videoPubSetModal_con-red">*</span>封面- </h1>- <VideoCoverSeting- saveImgId={currChooseAccount?.id || ""}- videoFile={currChooseAccount?.video}- value={currChooseAccount?.pubParams.cover}- onChoosed={(imgFile) => {- setOnePubParams({- cover: imgFile,- });- }}- />-- {currChooseAccount && <PubSetModalChild />}- </div>- <div className="videoPubSetModal_con-right">- {currChooseAccount && (- <VideoPubSetModalVideo ref={videoPubSetModalVideoRef} />- )}- </div>- </div>- </div>- </Modal>- </>- );- },- ),-);-VideoPubSetModal.displayName = "VideoPubSetModal";--export default VideoPubSetModal;diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsxdeleted file mode 100644index 19d6c1b6..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsx+++ /dev/null@@ -1,43 +0,0 @@-import React, { ForwardedRef, forwardRef, memo } from "react";-import { DescTextArea } from "../components/VideoPubSetModalCommon";-import TopicSelect from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/TopicSelect";-import {- IVideoPubSetModalChildProps,- IVideoPubSetModalChildRef,-} from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.type";--const VideoPubSetModal_KWAI = memo(- forwardRef(- (- {}: IVideoPubSetModalChildProps,- ref: ForwardedRef<IVideoPubSetModalChildRef>,- ) => {- return (- <>- <DescTextArea- placeholder="填写合适的话题和描述,作品能获得更多推荐~"- maxLength={500}- />-- {/*<TopicSelect />*/}-- {/*<UserSelect*/}- {/* maxCount={3}*/}- {/* title="@好友"*/}- {/* tips="您可以添加3个好友"*/}- {/* showSearch={false}*/}- {/*/>*/}-- {/*<LocationSelect />*/}-- {/*<VideoPubPermission />*/}-- {/*<ScheduledTimeSelect />*/}- </>- );- },- ),-);-VideoPubSetModal_KWAI.displayName = "VideoPubSetModal_KWAI";--export default VideoPubSetModal_KWAI;diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsxdeleted file mode 100644index 6ea1ef0e..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsx+++ /dev/null@@ -1,20 +0,0 @@-import { useVideoPageStore } from "../../../../useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";--export default function useVideoPubSetModal() {- const { setOnePubParams, currChooseAccount } = useVideoPageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- currChooseAccount: state.currChooseAccount,- })),- );-- return {- setOnePubParams,- platInfo: currChooseAccount?.account- ? AccountPlatInfoMap.get(currChooseAccount!.account!.type)!- : AccountPlatInfoMap.get(PlatType.Douyin)!,- currChooseAccount: currChooseAccount!,- };-}diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/LocationSelect.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/LocationSelect.tsxdeleted file mode 100644index ab718fe5..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/LocationSelect.tsx+++ /dev/null@@ -1,42 +0,0 @@-import React from "react";-import { SelectProps } from "antd";-import { useVideoPageStore } from "../../../useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import { VideoPubRestartLogin } from "./VideoPubSetModalCommon";-import useVideoPubSetModal from "../children/hooks/useVideoPubSetModal";-import { ILocationDataItem } from "@/app/[lng]/publish/videoPage/videoPage.type";-import CommonLocationSelect from "@/app/[lng]/publish/components/CommonComponents/CommonLocationSelect";--interface DebounceSelectProps<ValueType = any>- extends Omit<SelectProps<ValueType | ValueType[]>, "options" | "children"> {}--// 位置选择器-export default function LocationSelect({- ...props-}: DebounceSelectProps<ILocationDataItem>) {- const { setOnePubParams, updateAccounts } = useVideoPageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- updateAccounts: state.updateAccounts,- })),- );- const { currChooseAccount } = useVideoPubSetModal();-- return (- <CommonLocationSelect- {...props}- account={currChooseAccount.account}- value={currChooseAccount.pubParams!.location}- onAccountChange={(account) => {- updateAccounts({ accounts: [account] });- }}- onChange={(_, value) => {- setOnePubParams({- location: value as ILocationDataItem,- });- }}- >- <VideoPubRestartLogin />- </CommonLocationSelect>- );-}diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/TopicSelect.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/TopicSelect.tsxdeleted file mode 100644index aa7b4217..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/TopicSelect.tsx+++ /dev/null@@ -1,54 +0,0 @@-import React from "react";-import { useVideoPageStore } from "../../../useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import { VideoPubRestartLogin } from "./VideoPubSetModalCommon";-import useVideoPubSetModal from "../children/hooks/useVideoPubSetModal";-import CommonTopicSelect, {- CommonTopicSelectProps,- CommonTopicSelectValueType,-} from "@/app/[lng]/publish/components/CommonComponents/CommonTopicSelect";--interface DebounceSelectProps- extends CommonTopicSelectProps<CommonTopicSelectValueType> {}--// 话题选择器-export default function TopicSelect({ ...props }: DebounceSelectProps) {- const { updateAccounts } = useVideoPageStore(- useShallow((state) => ({- updateAccounts: state.updateAccounts,- })),- );- const { setOnePubParams, platInfo, currChooseAccount } =- useVideoPubSetModal();- const { topicMax } = platInfo.commonPubParamsConfig;- props.maxCount = props.maxCount || topicMax;- props.tips = props.tips || `您可以添加${topicMax}个话题`;-- return (- <CommonTopicSelect- {...props}- account={currChooseAccount.account}- value={currChooseAccount.pubParams!.topics!.map((v) => {- return {- value: v,- label: v,- };- })}- onAccountChange={(account) => {- updateAccounts({ accounts: [account] });- }}- onChange={(newValue) => {- setOnePubParams({- topics: (newValue as CommonTopicSelectValueType[]).map(- (v) => v.label,- ),- diffParams: {- ...currChooseAccount.pubParams.diffParams,- },- });- }}- >- <VideoPubRestartLogin />- </CommonTopicSelect>- );-}diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/UserSelect.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/UserSelect.tsxdeleted file mode 100644index 179175aa..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/UserSelect.tsx+++ /dev/null@@ -1,56 +0,0 @@-import { useVideoPageStore } from "../../../useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import { VideoPubRestartLogin } from "./VideoPubSetModalCommon";-import React from "react";-import useVideoPubSetModal from "../children/hooks/useVideoPubSetModal";-import { IUsersItem } from "@/app/plat/plat.type";-import CommonUserSelect, {- CommonUserSelectProps,-} from "@/app/[lng]/publish/components/CommonComponents/CommonUserSelect";--interface DebounceSelectProps extends CommonUserSelectProps<IUsersItem> {}--// 视频发布用户选择器-export default function UserSelect({ ...props }: DebounceSelectProps) {- const { updateAccounts } = useVideoPageStore(- useShallow((state) => ({- updateAccounts: state.updateAccounts,- })),- );- const { setOnePubParams, currChooseAccount } = useVideoPubSetModal();-- return (- <CommonUserSelect- {...props}- account={currChooseAccount.account!}- onAccountChange={(account) => {- updateAccounts({- accounts: [account],- });- }}- value={- currChooseAccount.pubParams!.mentionedUserInfo?.map((v) => {- return {- ...v,- id: v.value,- name: v.label,- };- }) as any- }- onChange={(_, value) => {- setOnePubParams({- mentionedUserInfo: value- ? (value as IUsersItem[]).map((v) => {- return {- value: v.id,- label: v.name,- };- })- : undefined,- });- }}- >- <VideoPubRestartLogin />- </CommonUserSelect>- );-}diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsxdeleted file mode 100644index 689736a3..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx+++ /dev/null@@ -1,263 +0,0 @@-import { Input, Tooltip } from "antd";-import React, { useEffect, useMemo, useState } from "react";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import dayjs from "dayjs";-import { QuestionCircleOutlined } from "@ant-design/icons";-import { AiCreateType } from "@/api/types/tools";-import useVideoPubSetModal from "../children/hooks/useVideoPubSetModal";-import { AccountPlatInfoMap } from "@/app/config/platConfig";-import AICreateTitle from "@/app/[lng]/publish/components/AICreateTitle/AICreateTitle";-import CommonScheduledTimeSelect, {- ICommonScheduledTimeSelectProps,-} from "@/app/[lng]/publish/components/CommonComponents/CommonScheduledTimeSelect";-import {- AccountRestartLogin,- CommonMixSelect,- PubPermission,- PubPermissionProps,-} from "@/app/[lng]/publish/components/CommonComponents/CommonComponents";-import { IMixItem } from "@/app/plat/plat.type";--const { TextArea } = Input;--export const VideoPubRestartLogin = () => {- const { accountRestart, currChooseAccount } = useVideoPageStore(- useShallow((state) => ({- accountRestart: state.accountRestart,- currChooseAccount: state.currChooseAccount!,- })),- );-- return (- currChooseAccount && (- <AccountRestartLogin- account={currChooseAccount.account}- onAccountRestart={() => {- accountRestart(currChooseAccount.account!.type);- }}- />- )- );-};--// 定时发布-export const ScheduledTimeSelect = ({- ...props-}: ICommonScheduledTimeSelectProps) => {- const { value, onChange } = props;- const { setOnePubParams, currChooseAccount } = useVideoPageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- currChooseAccount: state.currChooseAccount,- })),- );-- return (- <CommonScheduledTimeSelect- {...props}- platType={currChooseAccount?.account?.type}- value={- value- ? value- : currChooseAccount?.pubParams.timingTime- ? dayjs(currChooseAccount?.pubParams.timingTime)- : undefined- }- isTitle={!onChange}- onChange={- onChange- ? onChange- : (e) => {- if (!currChooseAccount) return;- setOnePubParams({- timingTime: e ? e.toDate() : undefined,- });- }- }- />- );-};--// 标题-export const TitleInput = ({- placeholder,- tips,- title = "标题",-}: {- placeholder: string;- tips?: string;- title?: string;-}) => {- const { setOnePubParams, currChooseAccount } = useVideoPageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- currChooseAccount: state.currChooseAccount,- })),- );- const [value, setValue] = useState(currChooseAccount?.pubParams.title || "");- if (!currChooseAccount) return "";- const max = AccountPlatInfoMap.get(currChooseAccount.account!.type)- ?.commonPubParamsConfig.titleMax;-- const titleValue = useMemo(() => {- return currChooseAccount.pubParams.title || "";- }, [currChooseAccount.pubParams.title]);-- useEffect(() => {- setValue(titleValue);- }, [titleValue]);- useEffect(() => {- setOnePubParams({- title: value,- });- }, [value]);-- return (- <>- <h1>- {title}- {tips && (- <Tooltip title={tips}>- <QuestionCircleOutlined style={{ marginLeft: "2px" }} />- </Tooltip>- )}- </h1>- <Input- spellCheck={false}- defaultValue={titleValue}- value={value}- maxLength={max}- placeholder={placeholder}- showCount- variant="filled"- onChange={(e) => {- setValue(e.target.value);- }}- />- <AICreateTitle- type={AiCreateType.TITLE}- onAiCreateFinish={(text) => {- setOnePubParams({- title: text,- });- }}- videoFile={currChooseAccount.video}- max={max || 20}- />- </>- );-};--// 描述-export const DescTextArea = ({- placeholder,- title = "描述",- maxLength,-}: {- placeholder: string;- tips?: string;- title?: string;- maxLength: number;-}) => {- const { setOnePubParams, currChooseAccount } = useVideoPageStore(- useShallow((state) => ({- setOnePubParams: state.setOnePubParams,- currChooseAccount: state.currChooseAccount,- })),- );- const [value, setValue] = useState(- currChooseAccount?.pubParams.describe || "",- );- if (!currChooseAccount) return "";-- const describe = useMemo(() => {- return currChooseAccount.pubParams.describe || "";- }, [currChooseAccount]);- useEffect(() => {- setValue(describe);- }, [describe]);- useEffect(() => {- setOnePubParams({- describe: value,- });- }, [value]);-- return (- <>- <h1>{title}</h1>- <TextArea- spellCheck={false}- defaultValue={currChooseAccount.pubParams.describe}- value={value}- placeholder={placeholder}- variant="filled"- showCount- maxLength={maxLength}- onChange={(e) => {- setValue(e.target.value);- }}- />- <AICreateTitle- type={AiCreateType.DESC}- onAiCreateFinish={(text) => {- setOnePubParams({- describe: text,- });- }}- videoFile={currChooseAccount.video}- max={maxLength}- />- </>- );-};--// 可见性-export const VideoPubPermission = ({ ...props }: PubPermissionProps) => {- const { setOnePubParams, currChooseAccount } = useVideoPubSetModal();- return (- <PubPermission- onChange={(e) => {- setOnePubParams({- visibleType: e,- });- }}- value={currChooseAccount?.pubParams.visibleType}- {...props}- />- );-};--// 合集-export const VideoPubMixSelect = ({}: {}) => {- const { setOnePubParams, currChooseAccount } = useVideoPubSetModal();- const { updateAccounts } = useVideoPageStore(- useShallow((state) => ({- updateAccounts: state.updateAccounts,- })),- );-- return (- <CommonMixSelect- account={currChooseAccount.account}- value={currChooseAccount.pubParams.mixInfo?.value}- onAccountChange={(account) => {- updateAccounts({- accounts: [account],- });- }}- onChange={(_, value) => {- setOnePubParams({- mixInfo: !value- ? undefined- : {- label: (value as IMixItem).name,- value: (value as IMixItem).id,- },- });- }}- >- <VideoPubRestartLogin />- </CommonMixSelect>- );-};diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo.tsxdeleted file mode 100644index b3403f4e..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/VideoPubSetModalVideo.tsx+++ /dev/null@@ -1,142 +0,0 @@-import {- ForwardedRef,- forwardRef,- memo,- useImperativeHandle,- useRef,- useState,-} from "react";-import { Avatar, Segmented } from "antd";-import { HeartFilled } from "@ant-design/icons";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { useShallow } from "zustand/react/shallow";--export interface IVideoPubSetModalVideoRef {- play: () => void;- pause: () => void;-}--export interface IVideoPubSetModalVideoProps {}--const CoverPreview = ({- avatar,- nickname,- height,- coverUrl,-}: {- avatar?: string;- nickname?: string;- height?: number;- coverUrl?: string;-}) => {- return (- <div className="videoPubSetModalVideo-coverPreview-box">- <div- className="videoPubSetModalVideo-coverPreview-box-img"- style={{ height: `${height || 100}px` }}- >- {coverUrl && <img src={coverUrl} />}- </div>- <div className="videoPubSetModalVideo-coverPreview-box-bottom">- <p>***********</p>- <ul className="videoPubSetModalVideo-coverPreview-box-info">- <li>- <Avatar size="small" src={avatar} />- <span>{nickname}</span>- </li>- <li>- <HeartFilled />- <span>1</span>- </li>- </ul>- </div>- </div>- );-};--const VideoPubSetModalVideo = memo(- forwardRef(- (- {}: IVideoPubSetModalVideoProps,- ref: ForwardedRef<IVideoPubSetModalVideoRef>,- ) => {- const videoRef = useRef<HTMLVideoElement>(null);- const [active, setActive] = useState(1);- const { chooseAccountItem } = useVideoPageStore(- useShallow((state) => ({- chooseAccountItem: state.currChooseAccount!,- })),- );- const imperativeMethods: IVideoPubSetModalVideoRef = {- play: () => {- videoRef.current?.play();- },- pause: () => {- videoRef.current?.pause();- },- };- useImperativeHandle(ref, () => imperativeMethods, []);-- return (- <div className="videoPubSetModalVideo">- <Segmented- value={active}- options={[- { label: "预览视频", value: 1 },- { label: "预览封面/标题", value: 2 },- ]}- defaultValue={1}- onChange={setActive}- />-- <div className="videoPubSetModalVideo-video">- <div- className="videoPubSetModalVideo-video-wrapper"- style={- active !== 1- ? {- justifyContent: "left",- }- : {}- }- >- {active === 1 ? (- <>- <div className="videoPubSetModalVideo-video-top" />- <video- ref={videoRef}- src={chooseAccountItem?.video?.videoUrl}- controls- />- </>- ) : (- chooseAccountItem.account && (- <div className="videoPubSetModalVideo-coverPreview">- <div className="videoPubSetModalVideo-coverPreview-con">- <CoverPreview height={150} />- <CoverPreview- height={150}- avatar={chooseAccountItem.account.avatar}- nickname={chooseAccountItem.account.nickname}- coverUrl={chooseAccountItem.pubParams.cover?.imgUrl}- />- <CoverPreview />- </div>- <div className="videoPubSetModalVideo-coverPreview-con">- <CoverPreview height={120} />- <CoverPreview height={110} />- <CoverPreview height={120} />- </div>- </div>- )- )}- </div>- </div>- </div>- );- },- ),-);-VideoPubSetModalVideo.displayName = "VideoPubSetModalVideo";--export default VideoPubSetModalVideo;diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/useDebounceFetcher.ts b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/useDebounceFetcher.tsdeleted file mode 100644index 2868df73..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/components/useDebounceFetcher.ts+++ /dev/null@@ -1,39 +0,0 @@-import { useMemo, useRef, useState } from "react";-import lodash from "lodash";--export default function useDebounceFetcher<T>(- fetchOptions: (_: string) => Promise<any>,- debounceTimeout = 300,-) {- const fetchRef = useRef(0);- const [options, setOptions] = useState<T[]>([]);- const [fetching, setFetching] = useState(false);-- const debounceFetcher = useMemo(() => {- const loadOptions = (value: string) => {- fetchRef.current += 1;- const fetchId = fetchRef.current;- setOptions([]);- setFetching(true);-- fetchOptions(value).then((newOptions) => {- if (fetchId !== fetchRef.current) {- return;- }-- console.log(newOptions);- setOptions(newOptions);- setFetching(false);- });- };-- return lodash.debounce(loadOptions, debounceTimeout);- }, [fetchOptions, debounceTimeout]);-- return {- options,- fetching,- debounceFetcher,- setOptions,- };-}diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scssdeleted file mode 100644index 20dd5949..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss+++ /dev/null@@ -1,253 +0,0 @@-.videoPubSetModal {- :global {- textarea {- resize: none;- height: 150px !important;- }-- .ant-tabs-tab {- padding: 0;- margin: 0 10px 0 0 !important;- background: #fff;- transition: 0.3s;- }- .ant-tabs-ink-bar {- height: 3px !important;- }- .ant-tabs-tab-active {- background: var(--colorPrimary2);- }- .videoPubSetModal_con {- display: flex;- justify-content: space-between;- &--noMore {- justify-content: center;- .videoPubSetModal_con-left {- display: none !important;- }- .videoPubSetModal_con-right {- width: 250px;- }- }- &-red {- color: var(--errerColor);- margin-right: 5px;- }- &-tips {- color: rgb(178, 185, 185);- }- &_top {- margin-bottom: 10px;- button {- width: 100%;- }- }- &-left {- width: calc(70% - 50px);- height: 55vh;- overflow: auto;- padding: 0 20px 20px 0;-- h1 {- font-weight: 400;- font-size: var(--fs-sm);- display: flex;- align-items: center;- margin: 20px 0 8px 0;- }- }- &-right {- width: 30%;- video {- width: 100%;- border-radius: 20px;- }- }- }- .ant-tabs-nav-wrap {- border: 1px solid #e3e3e3;- border-right: none;- border-left: none;- }- .videoPubSetModal-tabLabel {- height: 70px;- width: 100px;- padding: 0 10px;- display: flex;- align-items: center;- justify-content: center;- .ant-alert {- position: absolute;- z-index: 10;- top: 0;- width: 100%;- height: 20px;- padding: 0;- border-radius: 0 0 10px 10px;- display: flex;- border-top: none;- justify-content: center;- .ant-alert-content {- flex: none;- }- .anticon {- font-size: var(--fs-xs);- margin-right: 4px;- }- .ant-alert-message {- font-size: var(--fs-xs);- }- }- & > span {- display: flex;- overflow: hidden;- & > img {- width: 15px;- }- }- .ant-avatar {- flex-shrink: 0 !important;- }- &-name {- display: block;- margin: 0 3px;- max-width: 100%;- overflow: hidden;- text-overflow: ellipsis;- }- }-- .videoPubSetModalVideo {- display: flex;- flex-direction: column;- align-items: center;- min-height: 500px;- .ant-segmented {- margin-bottom: 15px;- }-- &-video {- background: black;- border-radius: 30px;- overflow: hidden;- box-sizing: border-box;- position: relative;- width: 100%;- height: 510px;- &-wrapper {- margin: 5px;- box-sizing: border-box;- height: 100%;- border-radius: 30px;- overflow: hidden;- display: flex;- flex-direction: column;- justify-content: center;- }- &-top {- position: absolute;- width: 50%;- height: 20px;- z-index: 10;- border-radius: 0 0 15px 15px;- top: 0;- left: 50%;- transform: translateX(-50%);- background: black;- }- video {- width: 100%;- max-height: 100%;- object-fit: cover;- border-radius: 0;- }- }-- &-coverPreview {- display: flex;- justify-content: space-between;- &-con {- width: calc(50% - 5px);- }- &-box {- width: 100%;- margin-bottom: 5px;- border-radius: 10px;- overflow: hidden;- &-img {- background: rgb(196, 196, 196);- width: 100%;- img {- width: 100%;- height: 100%;- object-fit: cover;- }- }- &-bottom {- background: rgb(188, 188, 188);- color: #fff;- padding: 8px;- box-sizing: border-box;- p {- font-size: 10px;- }- ul {- display: flex;- justify-content: space-between;- li {- white-space: nowrap;- font-size: 7px;- display: flex;- align-items: center;- box-sizing: border-box;- &:nth-child(1) {- max-width: 80%;- }- span {- text-overflow: ellipsis;- overflow: hidden;- }- .anticon {- margin-right: 2px;- }- .ant-avatar {- width: 16px;- height: 16px;- margin-right: 3px;- flex-shrink: 0;- }- }- }- }- }- }- }- }-}--.videoPubSetModal_titleWrap {- padding-bottom: 10px;- display: flex;- align-items: center;-- :global {- .videoPubSetModal-title {- }- .videoPubSetModal-more {- margin-left: 30px;- font-size: var(--fs-sm);- &-core {- display: flex;- align-items: center;- label {- margin-right: 5px;- }- }- &-tips {- font-weight: 400;- font-size: var(--fs-xs);- color: var(--grayColor7);- }- }- }-}\ No newline at end of filediff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.type.ts b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.type.tsdeleted file mode 100644index 8377be22..00000000--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/videoPubSetModal.type.ts+++ /dev/null@@ -1,3 +0,0 @@-export interface IVideoPubSetModalChildRef {}--export interface IVideoPubSetModalChildProps {}diff --git a/src/app/[lng]/publish/videoPage/images/importRecord.png b/src/app/[lng]/publish/videoPage/images/importRecord.pngdeleted file mode 100644index 956e8421..00000000Binary files a/src/app/[lng]/publish/videoPage/images/importRecord.png and /dev/null differdiff --git a/src/app/[lng]/publish/videoPage/images/localUpload.png b/src/app/[lng]/publish/videoPage/images/localUpload.pngdeleted file mode 100644index 456106bd..00000000Binary files a/src/app/[lng]/publish/videoPage/images/localUpload.png and /dev/null differdiff --git a/src/app/[lng]/publish/videoPage/page.tsx b/src/app/[lng]/publish/videoPage/page.tsxdeleted file mode 100644index 26625e65..00000000--- a/src/app/[lng]/publish/videoPage/page.tsx+++ /dev/null@@ -1,278 +0,0 @@-"use client";--import styles from "./video.module.scss";-import { Button, message, Popconfirm, Spin, Tooltip } from "antd";-import { DeleteOutlined, PlusOutlined } from "@ant-design/icons";-import { useShallow } from "zustand/react/shallow";-import { toolsApi } from "@/api/tools";-import { sensitivityLoading } from "@/utils";-import VideoChoose from "@/app/[lng]/publish/components/Choose/VideoChoose";-import ChooseAccountModule from "@/app/[lng]/publish/components/ChooseAccountModule/ChooseAccountModule";-import NoChoosePage from "@/app/[lng]/publish/videoPage/components/NoChoosePage";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { PubType } from "@/app/config/publishConfig";-import VideoChooseItem from "@/app/[lng]/publish/videoPage/components/VideoChooseItem";-import CommonPubSetting from "@/app/[lng]/publish/videoPage/components/CommonPubSetting";-import VideoPubSetModal from "@/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal";-import {- AccountChooseType,- IVideoChooseItem,-} from "@/app/[lng]/publish/videoPage/videoPage.type";-import { useEffect, useRef, useState } from "react";--export default function Page() {- const {- videoListChoose,- addVideos,- clearVideoList,- clear,- addAccount,- aloneAdd,- setVideoPubSetModalOpen,- loadingPageLoading,- setLoadingPageLoading,- setCurrChooseAccountId,- } = useVideoPageStore(- useShallow((state) => ({- videoListChoose: state.videoListChoose,- addVideos: state.addVideos,- addAccount: state.addAccount,- clearVideoList: state.clearVideoList,- clear: state.clear,- aloneAdd: state.aloneAdd,- setVideoPubSetModalOpen: state.setVideoPubSetModalOpen,- loadingPageLoading: state.loadingPageLoading,- setLoadingPageLoading: state.setLoadingPageLoading,- setCurrChooseAccountId: state.setCurrChooseAccountId,- })),- );- // 账户选择弹框显示隐藏状态- const [chooseAccountOpen, setChooseAccountOpen] = useState(false);- // 账户选择类型- const accountChooseType = useRef(AccountChooseType.MultiSelect);- // 用户单选ID- const accountOneChooseId = useRef<string>();- const [sensitiveDetLoading, setSensitiveDetLoading] = useState(false);-- useEffect(() => {- return () => {- clear();- };- }, []);-- const sensitiveDetCore = async (- content: string,- videoItem: IVideoChooseItem,- ) => {- const res = await toolsApi.textModeration(content);-- return {- sensitive: res !== "Normal",- videoItem,- };- };-- return (- <div className={styles.video}>- <Spin spinning={loadingPageLoading}>- <VideoPubSetModal onClose={setVideoPubSetModalOpen} />- <ChooseAccountModule- platChooseProps={{- disableAllSelect:- accountChooseType.current === AccountChooseType.Radio ||- accountChooseType.current === AccountChooseType.Replace,- choosedAccounts: videoListChoose- .map((v) => v.account)- .filter((v) => v !== undefined),- pubType: PubType.VIDEO,- isCancelChooseAccount: true,- }}- open={chooseAccountOpen}- onClose={setChooseAccountOpen}- onPlatConfirm={(aList) => {- addAccount(aList);- }}- onPlatChange={(_, account) => {- if (- accountChooseType.current === AccountChooseType.Radio ||- accountChooseType.current === AccountChooseType.Replace- ) {- setChooseAccountOpen(false);- aloneAdd({- account,- id: accountOneChooseId.current!,- });- }- }}- />-- {videoListChoose.length !== 0 ? (- // 视频已选择- <div className="video-pubAfter">- <div className="video-pubAfter-con">- <div className="video-pubAfter-left">- <div className="video-pubAfter-left-options">- <div className="video-pubAfter-left-options-video">- <h1>视频</h1>- <VideoChoose- onMultipleChoose={addVideos}- onStartShoose={() => {- setLoadingPageLoading(true);- }}- onChooseFail={() => {- setLoadingPageLoading(false);- }}- >- <Tooltip title="批量添加视频">- <Button type="dashed" icon={<PlusOutlined />}>- 批量添加- </Button>- </Tooltip>- </VideoChoose>- <Tooltip title="删除所有视频">- <Button- type="dashed"- icon={<DeleteOutlined />}- onClick={() => clearVideoList(0)}- >- 清空视频- </Button>- </Tooltip>- </div>- <div className="video-pubAfter-left-options-account">- <h1>账号</h1>- <Tooltip title="批量添加账号">- <Button- type="dashed"- icon={<PlusOutlined />}- onClick={() => {- accountChooseType.current =- AccountChooseType.MultiSelect;- setChooseAccountOpen(true);- }}- >- 批量添加- </Button>- </Tooltip>- <Tooltip title="删除所有账号">- <Button- type="dashed"- icon={<DeleteOutlined />}- onClick={() => {- clearVideoList(1);- }}- >- 清空账号- </Button>- </Tooltip>- </div>- </div>-- <div className="video-pubAfter-left-list">- {videoListChoose.map((v) => {- return (- <VideoChooseItem- key={v.id + v.video + v.account}- videoChooseItem={v}- onAccountOneChoose={(id, type) => {- accountChooseType.current = type;- accountOneChooseId.current = id;- setChooseAccountOpen(true);- }}- />- );- })}- </div>- </div>- <div className="video-pubAfter-right">- <CommonPubSetting />- </div>- </div>- <div className="video-pubAfter-footer">- <Popconfirm- title="温馨提示"- description="是否确认清空内容和账号?"- onConfirm={() => {- clear();- }}- okText="确认"- cancelText="取消"- >- <Button>一键清空</Button>- </Popconfirm>-- <Button- loading={sensitiveDetLoading}- color="danger"- variant="solid"- disabled={!videoListChoose.every((v) => v.account && v.video)}- onClick={async () => {- setSensitiveDetLoading(true);- const core = async () => {- const tasks: Promise<{- // 作品- videoItem: IVideoChooseItem;- // 是否敏感 true=敏感 false=正常- sensitive: boolean;- }>[] = [];- // 如果检测内容重复不会进行检测- const contentSet = new Set<string>();- videoListChoose.map((v) => {- const content = `- ${v.pubParams.title}- ${v.pubParams.describe}- `;- if (content.trim() !== "" && !contentSet.has(content)) {- contentSet.add(content);- tasks.push(sensitiveDetCore(content, v));- }- });- return await Promise.all(tasks);- };-- const taskRes = await Promise.all([- core(),- sensitivityLoading(),- ]);- const res = taskRes[0];-- setSensitiveDetLoading(false);-- if (res.length === 0) return message.success("检测正常");- if (res.every((v) => !v.sensitive)) {- message.success("检测正常");- return;- }- for (const { sensitive, videoItem } of res) {- if (sensitive) {- message.warning("检测到此条作品存在敏感信息!");- setVideoPubSetModalOpen(true);- setCurrChooseAccountId(videoItem.id);- break;- }- }- }}- >- 内容安全检测- </Button>-- <Button- type="primary"- disabled={!videoListChoose.every((v) => v.account && v.video)}- onClick={() => {- setVideoPubSetModalOpen(true);- setCurrChooseAccountId(videoListChoose[0].id);- }}- >- 预览及发布- </Button>- </div>- </div>- ) : (- // 视频未选择- <NoChoosePage />- )}- </Spin>- </div>- );-}diff --git a/src/app/[lng]/publish/videoPage/useVideoPageStore.ts b/src/app/[lng]/publish/videoPage/useVideoPageStore.tsdeleted file mode 100644index f60091f5..00000000--- a/src/app/[lng]/publish/videoPage/useVideoPageStore.ts+++ /dev/null@@ -1,376 +0,0 @@-import { create } from "zustand";-import { combine } from "zustand/middleware";-import { generateUUID } from "@/utils";-import lodash from "lodash";-import { useAICreateTitleStore } from "../components/AICreateTitle/useAICreateTitle";-import {- IPubParams,- IVideoChooseItem,-} from "@/app/[lng]/publish/videoPage/videoPage.type";-import { SocialAccount } from "@/api/types/account.type";-import { PlatType } from "@/app/config/platConfig";-import { VisibleTypeEnum } from "@/app/config/publishConfig";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";--export interface IVideoPageStore {- // 选择的视频数据- videoListChoose: IVideoChooseItem[];- // 视频发布设置弹框的 tab选择- currChooseAccountId: string;- // 视频发布设置弹框显示隐藏状态- videoPubSetModalOpen: boolean;- // 通用发布参数- commonPubParams: IPubParams;- // 在视频页的loading状态- loadingPageLoading: boolean;- /**- * 当前操作的ID- * 每次操作都会分配一个操作ID- */- operateId: string;- // 当前选择的账户数据- currChooseAccount?: IVideoChooseItem;-}--const store: IVideoPageStore = {- videoListChoose: [],- currChooseAccountId: "",- videoPubSetModalOpen: false,- commonPubParams: {- title: "",- describe: "",- cover: undefined,- visibleType: VisibleTypeEnum.Public,- topics: [],- timingTime: undefined,- mixInfo: undefined,- diffParams: {- [PlatType.Xhs]: {},- [PlatType.Douyin]: {- hotPoint: undefined,- selfDeclare: undefined,- activitys: [],- },- [PlatType.WxSph]: {- isOriginal: false,- extLink: undefined,- activity: undefined,- },- },- },- loadingPageLoading: false,- operateId: "",- currChooseAccount: undefined,-};--const getStore = () => {- return lodash.cloneDeep(store);-};--// 视频发布所有组件的共享状态和方法-export const useVideoPageStore = create(- combine(- {- ...getStore(),- },- (set, get, storeApi) => {- const methods = {- // 设置当前的账户数据- setCurrChooseAccount(currChooseAccount: IVideoChooseItem) {- set({- currChooseAccount,- });- },-- // 设置操作ID- setOperateId(operateId?: string) {- // if (get().operateId) return;- set({- operateId: operateId || generateUUID(),- });- },-- // 设置在视频页的loading状态- setLoadingPageLoading(loadingPageLoading: boolean) {- set({- loadingPageLoading,- });- },-- // 设置视频发布设置弹框显示隐藏状态- setVideoPubSetModalOpen(videoPubSetModalOpen: boolean) {- set({- videoPubSetModalOpen,- });- },-- // 设置发布弹框设置tab选择- setCurrChooseAccountId(currChooseAccountId: string) {- set({- currChooseAccountId,- });- },-- // 初始化发布参数- pubParamsInit(): IPubParams {- return lodash.cloneDeep(get().commonPubParams);- },-- // 添加视频数据- addVideos(videoFiles: IVideoFile[]) {- const { videoListChoose } = get();- const newValue = [...get().videoListChoose];- // 是否所有数据的视频全部为空- const isAllVideoNull =- newValue.every((v) => !v.video) && videoFiles.length === 1;- // 记录视频- let videoPointer = 0;-- videoListChoose.map((v) => {- // 有数据缺少视频就填视频- if (!v.video) {- if (isAllVideoNull) {- v.video = videoFiles[0];- } else {- const videoFile = videoFiles[videoPointer];- if (!videoFile) return;- v.video = videoFile;- }- videoPointer++;- }- });-- // 填完剩下的视频添加数据- for (let i = videoPointer; i < videoFiles.length; i++) {- const videoFile = videoFiles[i];- const temp = {- video: videoFile,- pubParams: methods.pubParamsInit(),- id: generateUUID(),- };- newValue.push(temp);- }- set({- videoListChoose: newValue,- loadingPageLoading: false,- });- setTimeout(() => methods.setVideoCoverFirst(), 10);- },-- /**- * 将所有视频设置为首帧封面- * @param force 不管该条数据的参数是否存在 cover 字段强制覆盖- */- setVideoCoverFirst(force?: boolean) {- const videoListChoose = [...get().videoListChoose];-- videoListChoose.map((v) => {- if (force) {- v.pubParams.cover = v.video?.cover;- } else {- if (!get().commonPubParams.cover) {- v.pubParams.cover = v.video?.cover;- }- }- });-- set({- videoListChoose,- });- },-- // 添加账户数据- addAccount(accounts: SocialAccount[]) {- const newV = [...get().videoListChoose];- // 判断是否只有一个视频数据- const isAloneVideo = !!(newV.length === 1 && newV[0].video);- /**- * 已经存在的账户ID做个去重- * 因为accounts会将所有选择的账户数据传入- */- const existAccountsSet = new Set<string>();- newV.map((v) => v.account && existAccountsSet.add(v.account.id));- accounts = accounts.filter((v) => !existAccountsSet.has(v.id));-- // 记录账户- let accountPointer = 0;- newV.map((v) => {- // 有数据缺少账户就填账户- if (!v.account) {- v.account = accounts[accountPointer];- accountPointer++;- }- });-- // 填完剩下的账户添加数据- for (let i = accountPointer; i < accounts.length; i++) {- const video = newV[0].video;- newV.push({- account: accounts[i],- video: isAloneVideo ? video : undefined,- pubParams: methods.pubParamsInit(),- id: generateUUID(),- });- }-- set({- videoListChoose: newV,- });- setTimeout(() => methods.setVideoCoverFirst(), 10);- },-- /**- * 清空视频或账号- * @param type 0=清空视频,1=清空账号- */- clearVideoList(type: 0 | 1) {- let newValue = [...get().videoListChoose];- newValue = newValue- .map((v) => {- if (type === 0) {- v.video = undefined;- return !v.account ? undefined : v;- } else {- v.account = undefined;- return !v.video ? undefined : v;- }- })- .filter(Boolean) as IVideoChooseItem[];- set({- videoListChoose: newValue,- });- },-- // 清空所有数据- clear() {- set({- ...getStore(),- });- useAICreateTitleStore.getState().clear();- },-- // 删除某个视频- deleteAloneVideo(id: string) {- const newValue = [...get().videoListChoose];- for (const videoChooseItem of newValue) {- if (id === videoChooseItem.id) {- videoChooseItem.video = undefined;- break;- }- }- set({- videoListChoose: newValue.filter((v) => v.video || v.account),- });- },-- // 删除某一条数据- deleteData(id: string) {- set({- videoListChoose: [...get().videoListChoose].filter(- (v) => v.id !== id,- ),- });- },-- // 单个视频或者账户添加- aloneAdd({- video,- account,- id,- }: {- video?: IVideoFile;- account?: SocialAccount;- id: string;- }) {- const newValue = [...get().videoListChoose];-- const vci = newValue.find((v) => v.id === id);- if (!vci) return console.error(`找不到id为 ${id} 个数据`);- if (video) vci.video = video;- if (account) vci.account = account;-- set({- videoListChoose: newValue,- });- setTimeout(() => methods.setVideoCoverFirst(), 10);- },-- // 账户数据批量更新- updateAccounts({ accounts }: { accounts: SocialAccount[] }) {- if (!accounts) return;-- const newValue = [...get().videoListChoose];- if (newValue.length === 0) return;- // key=账户ID val= videoListChoose item- const videoListMap = new Map<string, IVideoChooseItem>();-- newValue.map((v) => {- videoListMap.set(v.account?.id || "0", v);- });-- accounts.map((v) => {- const videoItem = videoListMap.get(v.id);- if (videoItem) videoItem.account = v;- });-- set({- videoListChoose: newValue,- });- },-- // 设置所有视频数据的发布参数- setPubParams(pubParmas: IPubParams) {- const videoListChoose = [...get().videoListChoose];- const commonPubParams = { ...get().commonPubParams };-- videoListChoose.map((v) => {- Object.keys(pubParmas).map((key) => {- if (pubParmas.hasOwnProperty(key)) {- v.pubParams[key as "title"] = pubParmas[key as "title"];- commonPubParams[key as "title"] = pubParmas[key as "title"];- }- });- });- set({- videoListChoose,- commonPubParams,- });- },-- // 设置单条数据的发布参数- setOnePubParams(pubParmas: IPubParams, id?: string) {- const newValue = [...get().videoListChoose];-- const findedData = newValue.find(- (v) => v.id === (id || get().currChooseAccount!.id),- );- if (findedData) {- for (const key in pubParmas) {- if (pubParmas.hasOwnProperty(key)) {- findedData.pubParams[key as "title"] =- pubParmas[key as "title"];- }- }- }- set({- videoListChoose: newValue,- });- },-- /**- * 账户重新登录。登录成功后会自动更新该条账户数据- */- async accountRestart(pType: PlatType) {- // TODO 重新登录- // const res = await accountLogin(pType);- // if (!res) return;- // console.log(res);- // message.success("登录成功!");- // // 更新此条账户数据- // methods.updateAccounts({ accounts: [res] });- },- };- return methods;- },- ),-);diff --git a/src/app/[lng]/publish/videoPage/video.module.scss b/src/app/[lng]/publish/videoPage/video.module.scssdeleted file mode 100644index 6f77db03..00000000--- a/src/app/[lng]/publish/videoPage/video.module.scss+++ /dev/null@@ -1,419 +0,0 @@-.video {- width: 100%;- height: 100%;- min-width: 0;- display: flex;- :global {- .ant-spin-nested-loading {- width: 100%;- .ant-spin-container {- height: 100%;- }- }- .video-pubBefore {- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- width: 100%;- height: 100%;- &-con {- display: flex;- }- h1 {- font-size: 24px;- }- &-tip {- font-size: var(--fs-sm);- color: var(--grayColor10);- margin: 20px 0;- }- }-- .video-pubAfter {- display: flex;- flex-direction: column;- flex: 1;- height: 100%;- min-height: 0;- box-sizing: border-box;- &-con {- height: 100%;- min-height: 0;- padding: 15px 15px 0 15px;- display: flex;- box-sizing: border-box;- }- &-left {- width: 70%;- display: flex;- flex-direction: column;- flex: 1;- &-list {- flex: 1;- overflow-y: auto;- padding-right: 10px;- }- &-options {- display: flex;- justify-content: space-between;- align-items: center;- margin-bottom: 15px;- h1 {- font-weight: 400;- font-size: var(--fs-lg);- margin-right: 10px;- }- &-account, &-video {- align-items: center;- display: flex;-- button {- margin-right: 10px;- }- }- }- }- &-right {- width: 30%;- margin-left: 20px;- padding: 20px 10px 10px 10px;- border-left: 1px solid rgb(232, 232, 232);- overflow: auto;- }- &-footer {- text-align: center;- border-top: 1px solid var(--grayColor3);- padding: 15px;- button {- margin-right: 20px;- &:last-of-type {- margin-right: 0;- }- }- }- }-- .videoChooseItem {- text-align: left;- margin-bottom: 20px;- height: 90px;- display: flex;- &-noAccount {- width: 100%;- min-width: 0;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- cursor: pointer;- font-size: var(--fs-sm);- &-icon {- background: rgba(172, 182, 182);- display: flex;- width: 40px;- height: 40px;- align-items: center;- justify-content: center;- border-radius: 50%;- font-size: 20px;- color: #fff;- margin-bottom: 4px;- transition: 0.3s;- }- & > span {- color: #444;- }-- &:hover {- & > span {- color: var(--colorPrimary5) !important;- }- .videoChooseItem-noAccount-icon {- background: var(--colorPrimary5);- }- }- }- &-options {- flex-shrink: 0;- margin-left: 5px;- border: 1px solid rgb(232, 232, 232);- height: calc(100% - 2px);- border-radius: 6px;- padding: 0 15px 0 20px;- box-sizing: border-box;- position: relative;- display: flex;- align-items: baseline;- justify-content: center;- flex-direction: column;- button {- width: 100% !important;- justify-content: left !important;- &:nth-of-type(1) {- margin-bottom: 5px;- }- }- &:after, &:before {- content: "";- display: block;- position: absolute;- border: 1px solid rgb(196, 196, 196);- width: 20px;- height: 6px;- border-radius: 20px;- left: 0;- transform: translateX(-70%);- }- &:after {- top: 25%;- }- &:before {- top: 65%;- }- }- &-core {- display: flex;- background: rgb(247, 250, 250);- padding: 10px;- box-sizing: border-box;- border: 1px solid transparent;- transition: 0.3s;- border-radius: 8px;- height: 100%;- width: 100%;- min-width: 0;- &:hover {- border-color: var(--colorPrimary5);- .videoChooseItem-video-close {- display: flex !important;- z-index: 10;- }- }- }- &-left {- display: flex;- width: 100%;- min-width: 0;- &-chooseVideo {- width: 100%;- cursor: pointer;- display: flex;- justify-content: center;- align-items: center;- .videoChoose {- width: 100%;- height: 100%;- display: flex;- flex-direction: column;- justify-content: center;- align-items: center;- }- .anticon {- color: rgb(172, 182, 182);- font-size: 30px;- }- &-name {- font-size: var(--fs-sm);- color: rgb(121, 121, 121);- }- &:hover {- .anticon, .videoChooseItem-left-chooseVideo-name {- color: var(--colorPrimary5);- }- }- }- &-info {- display: flex;- flex-direction: column;- margin-left: 15px;- justify-content: center;- overflow: hidden;- }- &-bottom {- display: flex;- font-size: var(--fs-sm);- margin-top: 14px;- &-item {- margin-right: 30px;- label {- margin-right: 10px;- color: var(--grayColor7);- }- &--warning {- color: var(--errerColor);- label {- color: var(--errerColor);- }- & > span {- margin-right: 5px;- }- }- }- }- &-title {- font-size: var(--fs-sm);- font-weight: 900;- white-space: nowrap;- text-overflow: ellipsis;- overflow: hidden;- }- }- &-right {- width: 200px;- flex-shrink: 0;- display: flex;- align-items: center;- border-left: 1px solid #e5e5e5;- padding-left: 20px;- box-sizing: border-box;- }- &-account {- width: 100%;- display: flex;- align-items: center;- &:hover {- .videoChooseItem-account-avatar-replace {- display: flex !important;- }- }- &-avatar {- position: relative;- .ant-avatar {- flex-shrink: 0;- }- &-replace {- display: none;- position: absolute;- cursor: pointer;- color: #fff;- background: var(--colorPrimary5);- width: 16px;- height: 16px;- bottom: -2px;- right: -2px;- align-items: center;- justify-content: center;- font-size: 10px;- border-radius: 50%;- }- }- &-con {- width: 100%;- display: flex;- flex-direction: column;- justify-content: center;- margin-left: 5px;- font-size: var(--fs-sm);-- .ant-alert {- padding: 0 3px;- width: 80px;- font-size: var(--fs-xs);- margin-top: 5px;- color: #ff4d4f;- cursor: pointer;- .anticon {- margin-right: 4px;- }- }- }- &-top {- width: 100%;- display: flex;- align-items: center;- &-name {- display: block;- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;- max-width: 80%;- }- img {- width: 15px;- margin-left: 5px;- }- }- }- &-video {- width: 50px;- height: 100%;- position: relative;- flex-shrink: 0;- &-close {- border-radius: 50%;- position: absolute;- right: -4px;- top: -4px;- background: red;- display: none;- justify-content: center;- align-items: center;- width: 15px;- height: 15px;- cursor: pointer;- }- &-play {- width: 100%;- height: 100%;- position: relative;- img {- width: 100%;- height: 100%;- object-fit: cover;- border-radius: 4px;- }- &-click {- position: absolute;- display: none;- align-items: center;- justify-content: center;- border-radius: 50%;- top: 50%;- left: 50%;- transform: translate(-50%, -50%);- color: #fff;- font-size: 24px;- width: 30px;- height: 30px;- background: var(--colorPrimary5);- }- &:hover {- .videoChooseItem-video-play-click {- display: flex !important;- cursor: pointer;- }- }- }- }- }-- .commonPubSetting {- text-align: left;- .ant-input-data-count {- bottom: 0;- }-- h1 {- font-weight: 400;- font-size: var(--fs-lg);- margin-bottom: 5px;- }- h2 {- font-weight: 400;- font-size: var(--fs-md);- margin-bottom: 5px;- margin-top: 20px;- .anticon {- margin-left: 3px;- }- }- &-tip {- font-size: var(--fs-sm);- color: var(--grayColor7);- margin-top: 5px;- }- }- }-}-diff --git a/src/app/[lng]/publish/videoPage/videoPage.type.ts b/src/app/[lng]/publish/videoPage/videoPage.type.tsdeleted file mode 100644index 6c9bd109..00000000--- a/src/app/[lng]/publish/videoPage/videoPage.type.ts+++ /dev/null@@ -1,121 +0,0 @@-import { SocialAccount } from "@/api/types/account.type";-import { PlatType } from "@/app/config/platConfig";-import { VisibleTypeEnum } from "@/app/config/publishConfig";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";-import { IImgFile } from "@/app/[lng]/publish/components/Choose/ImgChoose";--// 微信视频号活动-export interface WxSphEvent {- eventCreatorNickname: string;- eventTopicId: string;- eventName: string;-}--/**- * 不同平台的差异化参数- * 每个平台有相同点,有不同点,这不同点都在这个参数下集合- */-export type DiffParmasType = {- [PlatType.Xhs]?: {};- [PlatType.Douyin]?: {- // 申请关联的热点- hotPoint?: ILableValue;- // 申请关联的活动- activitys?: ILableValue[];- // 自主声明- selfDeclare?: DeclarationDouyin;- };- [PlatType.WxSph]?: {- // 是否为原创- isOriginal?: boolean;- // 扩展链接- extLink?: string;- // 活动- activity?: WxSphEvent;- };- [PlatType.KWAI]?: {};-};--// 自主声明-export enum DeclarationDouyin {- // 内容由AI生成- AIGC = "aigc",- // 可能会引人不适- MaybeUnsuitable = "maybe_unsuitable",- // 虚拟作品。仅供娱乐- OnlyFunNew = "only_fun_new",- // 危险行为,请勿模仿- DangerousBehavior = "dangerous_behavior",- // 内容自行拍摄- SelfShoot = "self_shoot",- // 内容取材网络- FromNetV3 = "from_net_v3",-}--// 包含一个name和一个value的对象-export interface ILableValue {- label: string;- value: string | number;-}--// 地点数据-export interface ILocationDataItem {- // 地点名称- name: string;- // 简单地址简介- simpleAddress: string;- // 地址ID- id: string;- // 小红书特有- poi_type?: number;- latitude: number;- longitude: number;- // 市- city: string;-}--export interface IPubParams {- // 视频标题- title?: string;- // 视频描述- describe?: string;- // 视频封面- cover?: IImgFile;- // 查看权限- visibleType?: VisibleTypeEnum;- // 视频话题- topics?: string[];- // 每个平台的差异性参数- diffParams?: DiffParmasType;- // 位置- location?: ILocationDataItem;- // 定时发布日期- timingTime?: Date;- // @用户- mentionedUserInfo?: ILableValue[];- // 合集- mixInfo?: ILableValue;-}--// 选择视频的每项数据-export interface IVideoChooseItem {- // 选择的视频- video?: IVideoFile;- // 选择的账户- account?: SocialAccount;- // 发布参数- pubParams: IPubParams;- // 唯一id- id: string;-}--export type AccountInfo = SocialAccount;--export enum AccountChooseType {- // 多选- MultiSelect = 0,- // 单选- Radio = 1,- // 替换- Replace = 2,-}diff --git a/src/app/layout/BellMessage/bellMessage.module.scss b/src/app/layout/BellMessage/bellMessage.module.scssdeleted file mode 100644index 96137de9..00000000--- a/src/app/layout/BellMessage/bellMessage.module.scss+++ /dev/null@@ -1,84 +0,0 @@-.bellMessage {- display: flex;- width: 600px;- height: 500px;- :global {- .bellMessage-menu {- width: 200px;- border-right: 1px solid var(--grayColor2);- height: 100%;- box-sizing: border-box;- display: flex;- flex-direction: column;- .ant-menu {- height: 100%;- border-right: none;- }- &-title {- font-weight: 900;- font-size: var(--fs-sm);- color: var(--grayColor10);- padding: 0 0 0 18px;- margin: 18px 0 10px 0;- position: relative;- &:after {- content: "";- display: flex;- position: absolute;- top: 50%;- left: 0;- transform: translateY(-50%);- width: 2px;- height: 70%;- background: var(--colorPrimary5);- }- }- }-- .bellMessage-content {- box-sizing: border-box;- height: 100%;- width: 100%;- overflow-y: auto;- &-item {- cursor: pointer;- padding: 15px;- border-bottom: 1px solid var(--grayColor2);- background: transparent;- transition: 0.3s;- &-title {- font-weight: 900;- text-overflow: ellipsis;- white-space: nowrap;- overflow: hidden;- width: 100%;- }- &-des {- margin: 5px 0;- }- &-time {- color: var(--grayColor6);- font-size: var(--fs-xs);- }- &:hover {- background: var(--grayColor0);- }- }- &-empty {- width: 100%;- height: 100%;- display: flex;- justify-content: center;- align-items: center;- }- }- }-}--.bellMessagePopover {- :global {- .ant-popover-inner {- padding: 0;- }- }-}\ No newline at end of filediff --git a/src/app/layout/BellMessage/index.tsx b/src/app/layout/BellMessage/index.tsxdeleted file mode 100644index 2675e904..00000000--- a/src/app/layout/BellMessage/index.tsx+++ /dev/null@@ -1,155 +0,0 @@-import { ForwardedRef, forwardRef, memo, useMemo, useState } from "react";-import styles from "./bellMessage.module.scss";-import { Empty, Menu, MenuProps, Popover, Tag } from "antd";-import { useShallow } from "zustand/react/shallow";-import { NoticeType, useBellMessageStroe } from "@/store/bellMessageStroe";-import { formatTime } from "@/utils";-import PubProgressModule from "@/app/[lng]/publish/components/PubProgressModule/PubProgressModule";-import { PubStatus } from "@/app/config/publishConfig";--export interface IBellmessageRef {}--export interface IBellmessageProps {- children?: React.ReactNode;-}--type MenuItem = Required<MenuProps>["items"][number];-const menuItems: MenuItem[] = [- {- key: NoticeType.PubNotice,- label: "发布通知",- },- // {- // key: '1',- // label: '系统通知',- // },- // {- // key: `2`,- // label: '更新公告',- // },- // {- // key: `3`,- // label: '私信通知',- // },- // {- // key: `4`,- // label: '任务通知',- // },-];--export const PubRecordStatusTag = ({ status }: { status: PubStatus }) => {- switch (status) {- case 2:- return <Tag color="error">全部发布失败</Tag>;- case 1:- return <Tag color="success">全部发布成功</Tag>;- case 3:- return <Tag color="warning">部分发布成功</Tag>;- case 0:- return <Tag color="processing">正在发布</Tag>;- }-};--const Bellmessage = memo(- forwardRef(- ({ children }: IBellmessageProps, ref: ForwardedRef<IBellmessageRef>) => {- const [menuKey, setMenuKey] = useState<string>(NoticeType.PubNotice);- const { noticeMap } = useBellMessageStroe(- useShallow((state) => ({- noticeMap: state.noticeMap,- })),- );- const [progressOpen, setProgressOpen] = useState(false);- const [pubProgressData, setPubProgressData] = useState<any[]>([]);- const [open, setOpen] = useState(false);-- const noticeList = useMemo(() => {- return noticeMap.get(NoticeType.PubNotice) || [];- }, [noticeMap]);-- return (- <>- <PubProgressModule- pubProgressData={pubProgressData}- open={progressOpen}- onClose={() => setProgressOpen(false)}- />- <Popover- open={open}- onOpenChange={(newOpen) => setOpen(newOpen)}- rootClassName={styles.bellMessagePopover}- placement="bottomLeft"- content={- <>- <div className={styles.bellMessage}>- <div className="bellMessage-menu">- <p className="bellMessage-menu-title">消息中心</p>- <Menu- selectedKeys={[NoticeType.PubNotice]}- inlineIndent={15}- mode="inline"- items={menuItems}- onClick={(e) => {- setMenuKey(e.key);- }}- />- </div>-- <div className="bellMessage-content">- {noticeList.length === 0 ? (- <div className="bellMessage-content-empty">- <Empty />- </div>- ) : (- <>- {noticeList.map((v) => {- return (- <div- className="bellMessage-content-item"- onClick={() => {- switch (menuKey) {- case NoticeType.PubNotice:- setOpen(false);- setPubProgressData(v.pub!.progressList);- setProgressOpen(true);- break;- }- }}- key={v.id}- >- <div- className="bellMessage-content-item-title"- title={v.title}- >- {v.title}- </div>- <div className="bellMessage-content-item-des">- {menuKey === NoticeType.PubNotice ? (- <PubRecordStatusTag status={v.pub!.status} />- ) : (- <></>- )}- </div>- <div className="bellMessage-content-item-time">- {formatTime(v.time)}- </div>- </div>- );- })}- </>- )}- </div>- </div>- </>- }- >- {children}- </Popover>- </>- );- },- ),-);-Bellmessage.displayName = "Bellmessage";--export default Bellmessage;diff --git a/src/app/layout/LyaoutHeader.tsx b/src/app/layout/LyaoutHeader.tsxindex aeff36da..2ad77162 100644--- a/src/app/layout/LyaoutHeader.tsx+++ b/src/app/layout/LyaoutHeader.tsx@@ -17,7 +17,6 @@ import {} from "@ant-design/icons";import { useRouter } from "next/navigation";import { useTransClient } from "@/app/i18n/client";-import Bellmessage from "@/app/layout/BellMessage";export interface ILyaoutHeaderRef {}@@ -146,12 +145,6 @@ const LyaoutHeader = memo(className={styles["layoutHeader_wrapper-right"]}suppressHydrationWarning={true}>- <Bellmessage>- <div style={{ cursor: "pointer" }}>- <BellOutlined />- <span style={{ marginLeft: "5px" }}>消息</span>- </div>- </Bellmessage><Buttontype="text"icon={<GlobalOutlined />}diff --git a/src/app/layout/routerData.ts b/src/app/layout/routerData.tsindex a8edf779..210cb823 100644--- a/src/app/layout/routerData.ts+++ b/src/app/layout/routerData.ts@@ -27,11 +27,6 @@ export const routerData: IRouterDataItem[] = [translationKey: "accounts",path: "/accounts",},- {- name: "发布",- translationKey: "publish",- path: "/publish",- },{name: "热门内容",translationKey: "hotContent",diff --git a/src/app/plat/PlatBase.ts b/src/app/plat/PlatBase.tsdeleted file mode 100644index a98bfe8c..00000000--- a/src/app/plat/PlatBase.ts+++ /dev/null@@ -1,29 +0,0 @@-import { SocialAccount } from "@/api/types/account.type";-import {- IPlatConstrParams,- IPublishResult,- IVideoPublishItem,- PubProgressType,-} from "@/app/plat/plat.type";--export abstract class PlatBase {- access_token: string;- refresh_token: string;- account: SocialAccount;-- // 用户账户信息- abstract getAccountInfo(): Promise<Partial<SocialAccount> | null>;-- constructor(params: IPlatConstrParams) {- this.access_token = params.access_token;- this.refresh_token = params.refresh_token;- this.account = params.account!;- }-- publishVideo(- videoPubParams: IVideoPublishItem,- onProgress: PubProgressType,- ): Promise<IPublishResult> {- throw new Error("Method not implemented.");- }-}diff --git a/src/app/plat/PlatManage.ts b/src/app/plat/PlatManage.tsdeleted file mode 100644index 749534fa..00000000--- a/src/app/plat/PlatManage.ts+++ /dev/null@@ -1,67 +0,0 @@-import { PlatType } from "@/app/config/platConfig";-import { KwaiPlat } from "@/app/plat/platChildren/kwai/KwaiPlat";-import { BilibiliPlat } from "@/app/plat/platChildren/bilibili/BilibiliPlat";-import { YoutubePlat } from "@/app/plat/platChildren/youtube/YoutubePlat";-import { PlatBase } from "@/app/plat/PlatBase";-import {- IPlatConstrParams,- IPublishResult,- PublishVideoParams,-} from "@/app/plat/plat.type";-import { useBellMessageStroe } from "@/store/bellMessageStroe";-import { parseTopicString } from "@/utils";--class PlatManage {- private getPlat(type: PlatType, params: IPlatConstrParams): PlatBase {- switch (type) {- case PlatType.KWAI:- return new KwaiPlat(params);- case PlatType.BILIBILI:- return new BilibiliPlat(params);- case PlatType.YouTube:- return new YoutubePlat(params);- }- return new KwaiPlat(params);- }-- /**- * 发布视频- * @param pubArr 发布参数数组- * @param id 本次操作的唯一标识- */- public async publishVideo(- pubArr: PublishVideoParams[],- id: string,- ): Promise<IPublishResult[]> {- const task: Promise<IPublishResult>[] = [];- for (const pub of pubArr) {- const { topics, cleanedString } = parseTopicString(- pub.videoPubParams.describe || "",- );- pub.videoPubParams = {- ...pub.videoPubParams,- describe: cleanedString,- topics,- };-- task.push(- this.getPlat(pub.account.type, {- access_token: pub.access_token,- refresh_token: pub.refresh_token,- account: pub.account,- }).publishVideo(pub.videoPubParams, (progress, msg) => {- useBellMessageStroe.getState().publishProgressSet({- id,- account: pub.account,- progress,- msg,- });- }),- );- }- const pubRes = await Promise.all(task);- console.log(pubRes);- return pubRes;- }-}-export const platManage = new PlatManage();diff --git a/src/app/plat/plat.type.ts b/src/app/plat/plat.type.tsdeleted file mode 100644index 3b8023ed..00000000--- a/src/app/plat/plat.type.ts+++ /dev/null@@ -1,64 +0,0 @@-// plat构造器参数-import { SocialAccount } from "@/api/types/account.type";-import { IPubParams } from "@/app/[lng]/publish/videoPage/videoPage.type";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";--export interface IPlatConstrParams {- access_token: string;- refresh_token: string;- account?: SocialAccount;-}--export interface IMixItem {- id: string;- name: string;- coverImg: string;- // 作品数量- feedCount: number;-}--// 用户数据-export interface IUsersItem {- image: string;- id: string;- name: string;- des?: string;- unique_id?: string;- follower_count?: number;-}--// 发布进度返回值-export interface PublishProgressRes {- // 为 -1 表示失败- progress: number;- msg: string;- account: SocialAccount;- id: string;-}--// 视频发布-export interface IVideoPublishItem extends IPubParams {- video: IVideoFile;-}--// 发布进度-export type PubProgressType = (progress: number, msg: string) => void;--// 发布结果-export interface IPublishResult {- // 是否成功- success: boolean;- // 失败消息- failMsg?: string;- worksId: string;- worksUrl: string;-}--// 视频发布参数-export interface PublishVideoParams {- videoPubParams: IVideoPublishItem;- access_token: string;- refresh_token: string;- // 账户- account: SocialAccount;-}diff --git a/src/app/plat/plat.util.ts b/src/app/plat/plat.util.tsdeleted file mode 100644index e4be212c..00000000--- a/src/app/plat/plat.util.ts+++ /dev/null@@ -1,32 +0,0 @@-// 读取 blob 的文件流-export function readBlobRange(- blob: Blob,- start: number,- end: number,-): Promise<ArrayBuffer> {- return new Promise((resolve, reject) => {- const sliced = blob.slice(start, end);- const reader = new FileReader();- reader.onload = () => resolve(reader.result as ArrayBuffer);- reader.onerror = reject;- reader.readAsArrayBuffer(sliced);- });-}--type ChunkRange = { start: number; end: number };-/**- * 根据总大小和每片大小,计算每一片的 start 和 end 位置- * @param size 视频的总字节数- * @param chunkSize 每一片的字节数- * @returns 每一片的 {start, end} 数组- */-export function calculateChunks(size: number, chunkSize: number): ChunkRange[] {- const chunks: ChunkRange[] = [];- let start = 0;- while (start < size) {- const end = Math.min(start + chunkSize, size);- chunks.push({ start, end });- start = end;- }- return chunks;-}diff --git a/src/app/plat/platChildren/bilibili/BilibiliPlat.ts b/src/app/plat/platChildren/bilibili/BilibiliPlat.tsdeleted file mode 100644index c20d617c..00000000--- a/src/app/plat/platChildren/bilibili/BilibiliPlat.ts+++ /dev/null@@ -1,57 +0,0 @@-import { PlatBase } from "@/app/plat/PlatBase";-import { SocialAccount } from "@/api/types/account.type";-import { RequestParams } from "@/utils/FetchService/types";-import { requestPlatApi } from "@/utils/otherRequest";-import { KwaiApiProxyUrl } from "@/constant";-import { kwaiAppId } from "@/app/[lng]/accounts/plat/kwaiLogin";-import { PlatType } from "@/app/config/platConfig";-import {- IPublishResult,- IVideoPublishItem,- PubProgressType,-} from "@/app/plat/plat.type";-import { BilibiliPubCore } from "@/app/plat/platChildren/bilibili/BilibiliPubCore";--export class BilibiliPlat extends PlatBase {- public async getAccountInfo(): Promise<Partial<SocialAccount> | null> {- const { user_info } = await this.request({- url: "openapi/user_info",- method: "GET",- });- return {- avatar: user_info.bigHead,- forwardCount: user_info.follow,- fansCount: user_info.fan,- nickname: user_info.name,- type: PlatType.BILIBILI,- account: "",- uid: "",- };- }-- request(params: RequestParams, isPrefix = true) {- params.url = `${(isPrefix && KwaiApiProxyUrl) || ""}${params.url}`;- params.params = {- access_token: this.access_token,- app_id: kwaiAppId,- ...(params.params ?? {}),- };- return requestPlatApi(params);- }-- public async publishVideo(- videoPubParams: IVideoPublishItem,- onProgress: PubProgressType,- ): Promise<IPublishResult> {- const kwaiPubCore = new BilibiliPubCore(this, videoPubParams, onProgress);- const pubRes = await kwaiPubCore.publishVideo();-- if (pubRes.success) {- onProgress(100, "视频发布完成");- } else {- onProgress(-1, "视频发布失败");- }-- return pubRes;- }-}diff --git a/src/app/plat/platChildren/bilibili/BilibiliPubCore.ts b/src/app/plat/platChildren/bilibili/BilibiliPubCore.tsdeleted file mode 100644index e761e9af..00000000--- a/src/app/plat/platChildren/bilibili/BilibiliPubCore.ts+++ /dev/null@@ -1,233 +0,0 @@-import { BilibiliPlat } from "@/app/plat/platChildren/bilibili/BilibiliPlat";-import {- IPublishResult,- IVideoPublishItem,- PubProgressType,-} from "@/app/plat/plat.type";-import { calculateChunks } from "@/app/plat/plat.util";-import {- apiInitBilibiliVideo,- apiUploadBilibiliCover,- apiSubmitBilibiliArchive,- apiUploadBilibiliVideoPart,- apiCompleteBilibiliVideo,-} from "@/api/bilibili";-import { apiCreatePublish, AccountType, PubStatus } from "@/api/publish";-import { PubType } from "@/app/config/publishConfig";--export class BilibiliPubCore {- private thisPlat: BilibiliPlat;- private videoPubParams: IVideoPublishItem;- private fileBlockSize = 4194304;- // 发布进度- private readonly onProgress: PubProgressType;-- constructor(- thisPlat: BilibiliPlat,- pubParams: IVideoPublishItem,- onProgress: PubProgressType,- ) {- this.thisPlat = thisPlat;- this.videoPubParams = pubParams;- this.onProgress = onProgress;- }-- // 获取caption- getCaption() {- const { title, describe, topics } = this.videoPubParams;- let caption = "";- if (title) {- caption += `${title} `;- }-- if (describe) {- caption += `${describe} `;- }-- if (topics?.length !== 0) {- for (const topic of topics!) {- caption += `#${topic} `;- }- }-- return caption.trim();- }-- // 创建发布记录- private async createPublishRecord(result: any, coverUrl: string) {- try {- const publishData = {- flowId: `bilibili_${Date.now()}`, // 生成唯一的流程ID- type: PubType.VIDEO,- title: this.videoPubParams.title || "",- desc: this.videoPubParams.describe || "",- accountId: this.thisPlat.account.id,- uid: this.thisPlat.account.uid || "",- accountType: AccountType.BILIBILI,- videoUrl: result.worksUrl, // 使用构建的视频地址- coverUrl: coverUrl, // 使用实际上传的封面地址- imgList: [],- publishTime: new Date().toISOString(),- status: result.success ? PubStatus.RELEASED : PubStatus.FAIL,- option: {- worksId: result.worksId,- worksUrl: result.worksUrl,- platform: "bilibili",- publishResult: result,- },- };-- const res = await apiCreatePublish(publishData);- console.log("发布记录创建成功:", res);- return res;- } catch (error) {- console.error("创建发布记录失败:", error);- // 不抛出错误,避免影响主流程- }- }-- // 视频发布- async publishVideo(): Promise<IPublishResult> {- console.log("视频发布");- console.log(this.videoPubParams);- console.log(this.thisPlat.account);-- try {- // 1. 获取上传token- const initRes = await apiInitBilibiliVideo({- accountId: this.thisPlat.account.id,- name: this.videoPubParams.video.filename,- });-- if (!initRes?.data?.data) {- throw new Error("获取上传token失败");- }-- const uploadToken = initRes.data.data;- console.log("获取上传token成功:", uploadToken);- this.onProgress?.(0.1, "获取上传token成功");-- // 2. 上传视频(分片上传)- if (!this.videoPubParams.video.file) {- throw new Error("视频文件不存在");- }-- const file = this.videoPubParams.video.file;- const chunkRange = calculateChunks(file.size, this.fileBlockSize);- console.log(`文件将被分为 ${chunkRange.length} 个分片`);-- // 分片上传- for (let i = 0; i < chunkRange.length; i++) {- const range = chunkRange[i];- const sliced = file.slice(range.start, range.end);- console.log(`上传分片 ${i + 1}/${chunkRange.length}`);-- const res = await apiUploadBilibiliVideoPart(- this.thisPlat.account.id,- uploadToken,- i + 1,- sliced,- );-- if (res?.code !== 0) {- throw new Error(`分片 ${i + 1} 上传失败`);- }-- // 更新进度- const progress = 0.1 + (0.6 * (i + 1)) / chunkRange.length;- this.onProgress?.(progress, `上传分片 ${i + 1}/${chunkRange.length}`);- }-- // 合并分片- console.log("开始合并分片...");- this.onProgress?.(0.7, "开始合并分片");- const completeRes = await apiCompleteBilibiliVideo(- this.thisPlat.account.id,- uploadToken,- );- if (completeRes?.code !== 0) {- throw new Error("分片合并失败");- }- this.onProgress?.(0.8, "分片合并完成");-- // 3. 上传封面- let coverUrl: any = "";- if (this.videoPubParams.cover?.file) {- const formData = new FormData();- formData.append("file", this.videoPubParams.cover.file);- const coverRes = await apiUploadBilibiliCover(- this.thisPlat.account.id,- formData,- );- if (coverRes?.data) {- coverUrl = coverRes.data;- console.log("封面上传成功:", coverUrl);- this.onProgress?.(0.9, "封面上传成功");- }- }-- // 4. 提交稿件- const archiveData = {- accountId: this.thisPlat.account.id,- uploadToken,- title: this.videoPubParams.title || "开心快乐每一天",- cover: coverUrl,- tid: 21, // 默认使用日常分区- // noReprint: this.videoPubParams.noReprint || 0,- noReprint: 0,- desc: this.videoPubParams.describe || "开心快乐每一天",- tag: this.videoPubParams.topics || [],- copyright: 1,- };-- this.onProgress?.(0.95, "正在提交稿件");- const submitRes: any = await apiSubmitBilibiliArchive(archiveData);- console.log("稿件提交结果:", submitRes);-- if (submitRes?.code !== 0) {- throw new Error("稿件提交失败");- }-- this.onProgress?.(1, "发布成功");-- const result = {- worksId: submitRes.data?.data || "",- worksUrl: `https://www.bilibili.com/video/${submitRes.data?.data}`,- success: true,- };-- // 5. 创建发布记录- await this.createPublishRecord(result, coverUrl);-- return result;- } catch (error: any) {- console.error("发布视频失败:", error);- this.onProgress?.(0, "发布失败");-- const result = {- worksId: "",- worksUrl: "",- success: false,- failMsg: error instanceof Error ? error.message : "发布失败",- };-- // 即使发布失败也创建记录- await this.createPublishRecord(result, "");-- return result;- }- }-- // 发起上传- private async _startUploadVideo() {- const res = await this.thisPlat.request({- url: "openapi/photo/start_upload",- method: "POST",- });- return res as {- result: number;- upload_token: string;- endpoint: string;- };- }-}diff --git a/src/app/plat/platChildren/kwai/KwaiPlat.ts b/src/app/plat/platChildren/kwai/KwaiPlat.tsdeleted file mode 100644index a80607e6..00000000--- a/src/app/plat/platChildren/kwai/KwaiPlat.ts+++ /dev/null@@ -1,57 +0,0 @@-import { PlatBase } from "@/app/plat/PlatBase";-import { SocialAccount } from "@/api/types/account.type";-import { RequestParams } from "@/utils/FetchService/types";-import { requestPlatApi } from "@/utils/otherRequest";-import { KwaiApiProxyUrl } from "@/constant";-import { kwaiAppId } from "@/app/[lng]/accounts/plat/kwaiLogin";-import { PlatType } from "@/app/config/platConfig";-import {- IPublishResult,- IVideoPublishItem,- PubProgressType,-} from "@/app/plat/plat.type";-import { KwaiPubCore } from "@/app/plat/platChildren/kwai/KwaiPubCore";--export class KwaiPlat extends PlatBase {- public async getAccountInfo(): Promise<Partial<SocialAccount> | null> {- const { user_info } = await this.request({- url: "openapi/user_info",- method: "GET",- });- return {- avatar: user_info.bigHead,- forwardCount: user_info.follow,- fansCount: user_info.fan,- nickname: user_info.name,- type: PlatType.KWAI,- account: "",- uid: "",- };- }-- request(params: RequestParams, isPrefix = true) {- params.url = `${(isPrefix && KwaiApiProxyUrl) || ""}${params.url}`;- params.params = {- access_token: this.access_token,- app_id: kwaiAppId,- ...(params.params ?? {}),- };- return requestPlatApi(params);- }-- public async publishVideo(- videoPubParams: IVideoPublishItem,- onProgress: PubProgressType,- ): Promise<IPublishResult> {- const kwaiPubCore = new KwaiPubCore(this, videoPubParams, onProgress);- const pubRes = await kwaiPubCore.publishVideo();-- if (pubRes.success) {- onProgress(100, "视频发布完成");- } else {- onProgress(-1, "视频发布失败");- }-- return pubRes;- }-}diff --git a/src/app/plat/platChildren/kwai/KwaiPubCore.ts b/src/app/plat/platChildren/kwai/KwaiPubCore.tsdeleted file mode 100644index c3f99b07..00000000--- a/src/app/plat/platChildren/kwai/KwaiPubCore.ts+++ /dev/null@@ -1,157 +0,0 @@-import { KwaiPlat } from "@/app/plat/platChildren/kwai/KwaiPlat";-import {- IPublishResult,- IVideoPublishItem,- PubProgressType,-} from "@/app/plat/plat.type";-import { calculateChunks, readBlobRange } from "@/app/plat/plat.util";-import { KwaiApiUploadProxyUrl } from "@/constant";--export class KwaiPubCore {- private kwaiPlat: KwaiPlat;- private videoPubParams: IVideoPublishItem;- private fileBlockSize = 4194304;- // 发布进度- private readonly onProgress: PubProgressType;-- constructor(- kwaiPlat: KwaiPlat,- pubParams: IVideoPublishItem,- onProgress: PubProgressType,- ) {- this.kwaiPlat = kwaiPlat;- this.videoPubParams = pubParams;- this.onProgress = onProgress;- }-- // 获取caption- getCaption() {- const { title, describe, topics } = this.videoPubParams;- let caption = "";- if (title) {- caption += `${title} `;- }-- if (describe) {- caption += `${describe} `;- }-- if (topics?.length !== 0) {- for (const topic of topics!) {- caption += `#${topic} `;- }- }-- return caption.trim();- }-- // 视频发布- async publishVideo(): Promise<IPublishResult> {- try {- const startUploadInfo = await this._startUploadVideo();- this.onProgress(10, "发起上传完成...");-- // 获取分片的大小- const chunkRange = calculateChunks(- this.videoPubParams.video.size,- this.fileBlockSize,- );- this.onProgress(20, "分片大小获取完成...");-- // 分片上传- for (let i = 0; i < chunkRange.length; i++) {- this.onProgress(50, `正在分片上传视频:${i} / ${chunkRange.length}`);-- const range = chunkRange[i];- // 获取要上传的视频分片- const chunk = await readBlobRange(- this.videoPubParams.video.file,- range.start,- range.end,- );- // 发起分片上传- const chunkUploadRes = await this.kwaiPlat.request(- {- url: `${KwaiApiUploadProxyUrl}api/upload/fragment`,- method: "POST",- headers: {- "Content-Type": "application/octet-stream",- },- params: {- fragment_id: i,- upload_token: startUploadInfo.upload_token,- },- body: chunk,- },- false,- );- if (chunkUploadRes.result !== 1) {- throw new Error("分片上传失败!");- }- console.log(- `${i} / ${chunkRange.length} 分片上传结果:${chunkUploadRes}`,- );- }-- // 分片上传完成- const completeRes = await this.kwaiPlat.request(- {- url: `${KwaiApiUploadProxyUrl}api/upload/complete`,- method: "POST",- params: {- fragment_count: chunkRange.length,- upload_token: startUploadInfo.upload_token,- },- },- false,- );- this.onProgress(70, `正在发布视频...`);- if (completeRes.result !== 1) {- throw new Error("分片合并失败!");- }- console.log("分片上传完成:", completeRes);-- const formData = new FormData();- formData.append("caption", this.getCaption());- formData.append("cover", this.videoPubParams.cover!.file);- const pubRes = await this.kwaiPlat.request({- url: "/openapi/photo/publish",- method: "POST",- params: {- upload_token: startUploadInfo.upload_token,- },- data: formData,- });- if (pubRes.result !== 1) {- throw new Error(`视频发布失败:${pubRes.error}`);- }-- return {- worksId: "",- worksUrl: "",- success: true,- };- } catch (e) {- console.error(e);- return {- worksId: "",- worksUrl: "",- success: false,- failMsg: e instanceof Error ? e.message : "未知错误",- };- }- }-- // 发起上传- private async _startUploadVideo() {- const res = await this.kwaiPlat.request({- url: "openapi/photo/start_upload",- method: "POST",- });- return res as {- result: number;- upload_token: string;- endpoint: string;- };- }-}diff --git a/src/app/plat/platChildren/youtube/YoutubePlat.ts b/src/app/plat/platChildren/youtube/YoutubePlat.tsdeleted file mode 100644index 7a10bc97..00000000--- a/src/app/plat/platChildren/youtube/YoutubePlat.ts+++ /dev/null@@ -1,57 +0,0 @@-import { PlatBase } from "@/app/plat/PlatBase";-import { SocialAccount } from "@/api/types/account.type";-import { RequestParams } from "@/utils/FetchService/types";-import { requestPlatApi } from "@/utils/otherRequest";-import { KwaiApiProxyUrl } from "@/constant";-import { kwaiAppId } from "@/app/[lng]/accounts/plat/kwaiLogin";-import { PlatType } from "@/app/config/platConfig";-import {- IPublishResult,- IVideoPublishItem,- PubProgressType,-} from "@/app/plat/plat.type";-import { YoutubePubCore } from "@/app/plat/platChildren/youtube/YoutubePubCore";--export class YoutubePlat extends PlatBase {- public async getAccountInfo(): Promise<Partial<SocialAccount> | null> {- const { user_info } = await this.request({- url: "openapi/user_info",- method: "GET",- });- return {- avatar: user_info.bigHead,- forwardCount: user_info.follow,- fansCount: user_info.fan,- nickname: user_info.name,- type: PlatType.BILIBILI,- account: "",- uid: "",- };- }-- request(params: RequestParams, isPrefix = true) {- params.url = `${(isPrefix && KwaiApiProxyUrl) || ""}${params.url}`;- params.params = {- access_token: this.access_token,- app_id: kwaiAppId,- ...(params.params ?? {}),- };- return requestPlatApi(params);- }-- public async publishVideo(- videoPubParams: IVideoPublishItem,- onProgress: PubProgressType,- ): Promise<IPublishResult> {- const kwaiPubCore = new YoutubePubCore(this, videoPubParams, onProgress);- const pubRes = await kwaiPubCore.publishVideo();-- if (pubRes.success) {- onProgress(100, "视频发布完成");- } else {- onProgress(-1, "视频发布失败");- }-- return pubRes;- }-}diff --git a/src/app/plat/platChildren/youtube/YoutubePubCore.ts b/src/app/plat/platChildren/youtube/YoutubePubCore.tsdeleted file mode 100644index 1eced8f7..00000000--- a/src/app/plat/platChildren/youtube/YoutubePubCore.ts+++ /dev/null@@ -1,170 +0,0 @@-import { YoutubePlat } from "./YoutubePlat";-import {- IPublishResult,- IVideoPublishItem,- PubProgressType,-} from "@/app/plat/plat.type";-import { calculateChunks } from "@/app/plat/plat.util";-import {- // apiInitBilibiliVideo,- // apiUploadBilibiliCover,- // apiSubmitBilibiliArchive,- // apiUploadBilibiliVideoPart,- // apiCompleteBilibiliVideo,- uploadYouTubeVideoSmallApi,- getYouTubeChannelSectionsApi-} from "@/api/youtube";-import { apiCreatePublish, AccountType, PubStatus } from "@/api/publish";-import { PubType } from "@/app/config/publishConfig";--export class YoutubePubCore {- private thisPlat: YoutubePlat;- private videoPubParams: IVideoPublishItem;- private fileBlockSize = 4194304;- // 发布进度- private readonly onProgress: PubProgressType;-- constructor(- thisPlat: YoutubePlat,- pubParams: IVideoPublishItem,- onProgress: PubProgressType,- ) {- this.thisPlat = thisPlat;- this.videoPubParams = pubParams;- this.onProgress = onProgress;- }-- // 获取caption- getCaption() {- const { title, describe, topics } = this.videoPubParams;- let caption = "";- if (title) {- caption += `${title} `;- }-- if (describe) {- caption += `${describe} `;- }-- if (topics?.length !== 0) {- for (const topic of topics!) {- caption += `#${topic} `;- }- }-- return caption.trim();- }-- // 创建发布记录- private async createPublishRecord(result: any, cheng: any,coverUrl: string, worksUrl:any, worksId:any) {- try {- const publishData = {- flowId: `youtube_${Date.now()}`, // 生成唯一的流程ID- type: PubType.VIDEO,- title: this.videoPubParams.title || "",- desc: this.videoPubParams.describe || "",- accountId: this.thisPlat.account.id,- uid: this.thisPlat.account.uid || "",- accountType: AccountType.YOUTUBE,- videoUrl: worksUrl || '', // 使用构建的视频地址- coverUrl: coverUrl, // 使用实际上传的封面地址- imgList: [],- publishTime: new Date().toISOString(),- status: cheng ? PubStatus.RELEASED : PubStatus.FAIL,- option: {- worksId: worksId || '',- worksUrl: worksUrl || '',- platform: "youtube",- publishResult: result,- },- };-- const res = await apiCreatePublish(publishData);- console.log("发布记录创建成功:", res);- return res;- } catch (error) {- console.error("创建发布记录失败:", error);- // 不抛出错误,避免影响主流程- }- }-- // 视频发布- async publishVideo(): Promise<IPublishResult> {- console.log("视频发布");- console.log(this.videoPubParams);- console.log(this.thisPlat.account);-- try {--- // 获取频道分区-- const response1: any = await getYouTubeChannelSectionsApi({- accountId: this.thisPlat.account.id,- mine: true,- });- console.log('response1',response1)--- const formData = new FormData();- formData.append("file", this.videoPubParams.video.file);- formData.append("accountId", this.thisPlat.account.id);- formData.append("title", this.videoPubParams.title || "开心快乐每一天");- formData.append("description", this.videoPubParams.describe || "开心快乐每一天");- formData.append("privacyStatus", "private");- // if (selectedSection) {- // formData.append("sectionId", selectedSection);- // }- this.onProgress?.(0.95, "正在提交稿件");-- const submitRes:any = await uploadYouTubeVideoSmallApi(formData);-- console.log("稿件提交结果:", submitRes);-- if (submitRes?.code !== 0) {- throw new Error("稿件提交失败");- }-- this.onProgress?.(1, "发布成功");-- const result = {- worksId: submitRes.data?.id || "",- worksUrl: `https://www.youtube.com/watch?v=${submitRes.data?.id}`,- success: true,- };-- // 5. 创建发布记录- await this.createPublishRecord(result, true, submitRes.data?.id, `https://www.youtube.com/watch?v=${submitRes.data?.id}`, submitRes.data?.id);-- return result;- } catch (error: any) {- console.error("发布视频失败:", error);- this.onProgress?.(0, "发布失败");-- const result = {- worksId: "",- worksUrl: "",- success: false,- failMsg: error instanceof Error ? error.message : "发布失败",- };-- // 即使发布失败也创建记录- await this.createPublishRecord(result, true, '', '', '');-- return result;- }- }-- // 发起上传- private async _startUploadVideo() {- const res = await this.thisPlat.request({- url: "openapi/photo/start_upload",- method: "POST",- });- return res as {- result: number;- upload_token: string;- endpoint: string;- };- }-}diff --git a/src/app/[lng]/publish/components/Choose/videoChoose.util.ts b/src/components/PublishDialog/PublishDialog.util.tssimilarity index 67%rename from src/app/[lng]/publish/components/Choose/videoChoose.util.tsrename to src/components/PublishDialog/PublishDialog.util.tsindex 2b20bf15..ccca01c3 100644--- a/src/app/[lng]/publish/components/Choose/videoChoose.util.ts+++ b/src/components/PublishDialog/PublishDialog.util.ts@@ -1,8 +1,9 @@-// 视频截帧-import { formatImg } from "@/app/[lng]/publish/components/Choose/ImgChoose.util";-import { IImgFile } from "@/app/[lng]/publish/components/Choose/ImgChoose";import { RcFile } from "antd/es/upload";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";+import {+ IImgFile,+ IVideoFile,+} from "@/components/PublishDialog/publishDialog.type";+import { generateUUID, getFilePathName } from "@/utils";export const formatVideo = async (file: RcFile): Promise<IVideoFile> => {const videoUrl = URL.createObjectURL(file);@@ -71,3 +72,38 @@ export function VideoGrabFrame(video.load();});}++export const formatImg = async ({+ path,+ file,+ blob,+}: {+ path: string;+ file?: Uint8Array;+ blob?: Blob;+}): Promise<IImgFile> => {+ return new Promise((resolve) => {+ const { filename, suffix } = getFilePathName(path);+ if (!blob) {+ blob = new Blob([file!], {+ type: `image/${suffix}`,+ });+ }+ const imgUrl = URL.createObjectURL(blob);++ const img = new Image();+ img.onload = () => {+ resolve({+ id: generateUUID(),+ width: img.width,+ height: img.height,+ imgPath: path,+ size: blob!.size,+ filename,+ file: blob!,+ imgUrl,+ });+ };+ img.src = imgUrl;+ });+};diff --git a/src/app/[lng]/publish/components/Choose/ImgChoose.tsx b/src/components/PublishDialog/compoents/Choose/ImgChoose.tsxsimilarity index 78%rename from src/app/[lng]/publish/components/Choose/ImgChoose.tsxrename to src/components/PublishDialog/compoents/Choose/ImgChoose.tsxindex 24b573f0..b0bd1e6a 100644--- a/src/app/[lng]/publish/components/Choose/ImgChoose.tsx+++ b/src/components/PublishDialog/compoents/Choose/ImgChoose.tsx@@ -1,14 +1,8 @@-/*- * @Author: nevin- * @Date: 2025-01-22 21:59:36- * @LastEditTime: 2025-02-11 21:45:34- * @LastEditors: nevin- * @Description: 选择图片- */import { Button, message, Upload } from "antd";import { FC, useRef } from "react";import { RcFile } from "antd/es/upload";-import { formatImg } from "@/app/[lng]/publish/components/Choose/ImgChoose.util";+import { formatImg } from "@/components/PublishDialog/PublishDialog.util";+import { IImgFile } from "@/components/PublishDialog/publishDialog.type";interface ImgChooseProps {// 单选就使用单选方法,多选就使用单选方法@@ -20,21 +14,6 @@ interface ImgChooseProps {children?: React.ReactNode;}-export interface IImgFile {- id: string;- size: number;- file: Blob;- // 前端临时路径,注意不要存到数据库- imgUrl: string;- filename: string;- // 图片在硬盘上的路径- imgPath: string;- // 图片宽度- width: number;- // 图片高度- height: number;-}-const ImgChoose: FC<ImgChooseProps> = ({onChoose,onMultipleChoose,diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/plats.type.ts b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/plats.type.tsindex 8ecfd5a4..b9f789fd 100644--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/plats.type.ts+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/plats.type.ts@@ -1,4 +1,4 @@-import { PubItem } from "@/components/PublishDialog/usePublishDialog";+import { PubItem } from "@/components/PublishDialog/publishDialog.type";export interface IPlatsParamsRef {}diff --git a/src/app/[lng]/publish/videoPage/components/VideoCoverSeting.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/VideoCoverSeting.tsxsimilarity index 73%rename from src/app/[lng]/publish/videoPage/components/VideoCoverSeting.tsxrename to src/components/PublishDialog/compoents/PubParmasTextarea/VideoCoverSeting.tsxindex 81d35e22..9d04ed5b 100644--- a/src/app/[lng]/publish/videoPage/components/VideoCoverSeting.tsx+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/VideoCoverSeting.tsx@@ -6,16 +6,19 @@ import {useRef,useState,} from "react";-import ImgChoose, { IImgFile } from "../../components/Choose/ImgChoose";import styles from "./videoCoverSeting.module.scss";import { Alert, Button, Modal, Slider, Spin } from "antd";-import { IVideoFile } from "../../components/Choose/VideoChoose";import Cropper from "cropperjs";import "cropperjs/dist/cropper.css";-import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";-import { useShallow } from "zustand/react/shallow";-import { formatImg } from "@/app/[lng]/publish/components/Choose/ImgChoose.util";-import { VideoGrabFrame } from "@/app/[lng]/publish/components/Choose/videoChoose.util";+import {+ formatImg,+ VideoGrabFrame,+} from "@/components/PublishDialog/PublishDialog.util";+import {+ IImgFile,+ IVideoFile,+} from "@/components/PublishDialog/publishDialog.type";+import ImgChoose from "@/components/PublishDialog/compoents/Choose/ImgChoose";export interface IVideoCoverSetingRef {}@@ -52,11 +55,6 @@ const VideoCoverSeting = memo(const cropperImg = useRef<HTMLImageElement>(null);const [videoCoverLoading, setVideoCoverLoading] = useState(false);const [sliderVal, setSliderVal] = useState(0);- const { operateId } = useVideoPageStore(- useShallow((state) => ({- operateId: state.operateId,- })),- );useEffect(() => {if (!videoCoverSetingModal) return;@@ -111,31 +109,6 @@ const VideoCoverSeting = memo(return (<>- {/*<div*/}- {/* className={styles.videoCoverSeting}*/}- {/* onClick={() => {*/}- {/* if (!videoFile) return message.warning("您必须上传一个视频!");*/}- {/* setVideoCoverSetingModal(true);*/}- {/* }}*/}- {/*>*/}- {/* <div className="videoCoverSeting-img">*/}- {/* {value && (*/}- {/* <div className="videoCoverSeting-choosed">*/}- {/* <img src={value?.imgUrl} />*/}- {/* {onClose && (*/}- {/* <CloseCircleOutlined*/}- {/* onClick={(e) => {*/}- {/* e.stopPropagation();*/}- {/* onClose();*/}- {/* }}*/}- {/* />*/}- {/* )}*/}- {/* </div>*/}- {/* )}*/}- {/* </div>*/}- {/* <div className="videoCoverSeting-text">上传图片</div>*/}- {/*</div>*/}-<Modalwidth={600}title="设置封面"@@ -147,7 +120,7 @@ const VideoCoverSeting = memo(canvas.toBlob(async function (blob) {const cover = await formatImg({blob: blob!,- path: `${operateId}_${saveImgId}.${imgFile?.file.type.split("/")[1]}`,+ path: `${saveImgId}.${imgFile?.file.type.split("/")[1]}`,});onChoosed(cover);close();diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsxindex 26a0f116..9feaa1d0 100644--- a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx@@ -18,13 +18,17 @@ import {CloseOutlined,PlusOutlined,} from "@ant-design/icons";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";-import { IImgFile } from "@/app/[lng]/publish/components/Choose/ImgChoose";-import { formatVideo } from "@/app/[lng]/publish/components/Choose/videoChoose.util";-import { formatImg } from "@/app/[lng]/publish/components/Choose/ImgChoose.util";-import VideoCoverSeting from "@/app/[lng]/publish/videoPage/components/VideoCoverSeting";import isEqual from "lodash/isEqual";import { TextAreaRef } from "antd/es/input/TextArea";+import {+ IImgFile,+ IVideoFile,+} from "@/components/PublishDialog/publishDialog.type";+import {+ formatImg,+ formatVideo,+} from "@/components/PublishDialog/PublishDialog.util";+import VideoCoverSeting from "@/components/PublishDialog/compoents/PubParmasTextarea/VideoCoverSeting";const { TextArea } = Input;const { Dragger } = Upload;diff --git a/src/app/[lng]/publish/videoPage/components/videoCoverSeting.module.scss b/src/components/PublishDialog/compoents/PubParmasTextarea/videoCoverSeting.module.scsssimilarity index 100%rename from src/app/[lng]/publish/videoPage/components/videoCoverSeting.module.scssrename to src/components/PublishDialog/compoents/PubParmasTextarea/videoCoverSeting.module.scssdiff --git a/src/components/PublishDialog/publishDialog.type.ts b/src/components/PublishDialog/publishDialog.type.tsindex 4b5cde5b..0394ac9f 100644--- a/src/components/PublishDialog/publishDialog.type.ts+++ b/src/components/PublishDialog/publishDialog.type.ts@@ -1,7 +1,36 @@-import { IImgFile } from "@/app/[lng]/publish/components/Choose/ImgChoose";-import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";import { SocialAccount } from "@/api/types/account.type";+export interface IImgFile {+ id: string;+ size: number;+ file: Blob;+ // 前端临时路径,注意不要存到数据库+ imgUrl: string;+ filename: string;+ // 图片在硬盘上的路径+ imgPath: string;+ // 图片宽度+ width: number;+ // 图片高度+ height: number;+}++export interface IVideoFile {+ size: number;+ file: Blob;+ // 前端临时路径,注意不要存到数据库+ videoUrl: string;+ filename: string;+ // 视频宽度+ width: number;+ // 视频高度+ height: number;+ // 视频下取整的时长,单位秒+ duration: number;+ // 视频首帧图片+ cover: IImgFile;+}+export interface IPubParams {des: string;// 视频和图片不能同时存在,存在图片本次发布则为图文,存在视频则本次发布为视频发布 --------------