Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 视频发布有效性重构、图文发布前端添加有效性参数、发布记录兼容图文发布,添加发布类型筛选
gaoSir02937acb99b0
diff --git a/electron/db/models/workData.ts b/electron/db/models/workData.tsindex 46f4631b..cc154f69 100644--- a/electron/db/models/workData.ts+++ b/electron/db/models/workData.ts@@ -141,9 +141,8 @@ export class WorkData extends TempModel {// 状态@Column({type: 'tinyint',- nullable: false,+ nullable: true,comment: '状态 0 未发布/草稿 1 已发布 2=发布失败 3=部分成功',- enum: PubStatus,default: PubStatus.UNPUBLISH,})status!: PubStatus;diff --git a/electron/global/table.ts b/electron/global/table.tsindex 673cd6fb..d7997525 100644--- a/electron/global/table.ts+++ b/electron/global/table.ts@@ -6,11 +6,20 @@* @Description: 表格状数据*/+import { PubStatus } from '../db/models/pubRecord';+import { PubType } from '../../commont/publish/PublishEnum';+export interface CorrectQuery {page_size: number;page_no: number;}+export interface pubRecordListQuery {+ time?: [string, string];+ status?: PubStatus;+ type?: PubType;+}+export interface CorrectResponse<T> {list: T[];total_count: number;diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.tsindex 125b4587..146f7be0 100644--- a/electron/main/plat/platforms/douyin/index.ts+++ b/electron/main/plat/platforms/douyin/index.ts@@ -572,6 +572,15 @@ export class Douyin extends PlatformBase {});});}++ getCreatorSecondCommentListByOther(+ account: AccountModel,+ dataId: string,+ root_comment_id: string,+ pcursor?: string,+ ): Promise<any> {+ return Promise.resolve(undefined);+ }}const douyin = new Douyin();diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.tsindex 3d4d5ff6..d150122f 100644--- a/electron/main/plat/platforms/xhs/index.ts+++ b/electron/main/plat/platforms/xhs/index.ts@@ -291,14 +291,21 @@ export class Xhs extends PlatformBase {pcursor?: string,) {const cookie: CookiesType = JSON.parse(account.loginCookie);- console.log('------ getCreatorSecondCommentListByOther xhs dataId---', dataId);- const res = await xiaohongshuService.getSecondCommentList(cookie, dataId, root_comment_id, pcursor );+ console.log(+ '------ getCreatorSecondCommentListByOther xhs dataId---',+ dataId,+ );+ const res = await xiaohongshuService.getSecondCommentList(+ cookie,+ dataId,+ root_comment_id,+ pcursor,+ );console.log('------ getCreatorSecondCommentListByOther xhs res---', res);const list: CommentData[] = [];for (const v of res.data.data.comments) {-list.push({userId: v.user_info.user_id,dataId: v.note_id,@@ -519,7 +526,12 @@ export class Xhs extends PlatformBase {topicName: v,})) || [],timingTime: params.timingTime?.getTime(),- privacy: params.visibleType !== VisibleTypeEnum.Public,+ visibility_type:+ params.visibleType === VisibleTypeEnum.Public+ ? 0+ : params.visibleType === VisibleTypeEnum.Private+ ? 1+ : 2,// 位置poiInfo: params.location? {diff --git a/electron/main/publish/controller.ts b/electron/main/publish/controller.tsindex be064077..4d902fe7 100644--- a/electron/main/publish/controller.ts+++ b/electron/main/publish/controller.ts@@ -9,7 +9,11 @@ import { Controller, Icp, Inject } from '../core/decorators';import { PublishService } from './service';import { getUserInfo } from '../user/comment';import { Between, FindOptionsWhere, Not } from 'typeorm';-import { backPageData, type CorrectQuery } from '../../global/table';+import {+ backPageData,+ type CorrectQuery,+ type pubRecordListQuery,+} from '../../global/table';import { PubRecordModel, PubStatus } from '../../db/models/pubRecord';import { PubType } from '../../../commont/publish/PublishEnum';import { VideoPubService } from './video/service';@@ -47,11 +51,7 @@ export class PublishController {async getPubRecordList(event: Electron.IpcMainInvokeEvent,page: CorrectQuery,- query?: {- time?: [string, string];- status?: PubStatus;- type?: PubType;- },+ query?: pubRecordListQuery,): Promise<any> {const userInfo = getUserInfo();const filters: FindOptionsWhere<PubRecordModel> = !querydiff --git a/electron/main/publish/imgText/controller.ts b/electron/main/publish/imgText/controller.tsindex b7aad925..8ebaa0d0 100644--- a/electron/main/publish/imgText/controller.ts+++ b/electron/main/publish/imgText/controller.ts@@ -32,6 +32,17 @@ export class ImgTextPubController {await this.imgTextService.updateImgTextPul(imgTextModel);}+ // 根据发布记录ID获取图文发布列表+ @Icp('ICP_PUBLISH_GET_IMG_TEXT_LIST')+ async getImgTextList(+ event: Electron.IpcMainInvokeEvent,+ pubRecordId: number,+ ) {+ return await this.imgTextService.getImgTextPulListByPubRecordId(+ pubRecordId,+ );+ }+// 发布图文@Icp('ICP_PUBLISH_IMG_TEXT')async pubImgText(event: Electron.IpcMainInvokeEvent, pubRecordId: number) {@@ -50,8 +61,6 @@ export class ImgTextPubController {imgTextModels.map((v) => v.accountId),);- console.log(imgTextModels);-// 发布const pubRes = await platController.imgTextPublish(imgTextModels,diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.tsindex bd5275aa..14c48a9d 100644--- a/electron/plat/xiaohongshu/index.ts+++ b/electron/plat/xiaohongshu/index.ts@@ -39,11 +39,11 @@ export type XSLPlatformSettingType = {poiAddress: string;};cover: string;- // true=私有 flase=公开- privacy: boolean;+ // 0 公共 1 私密 2 好友+ visibility_type: 0 | 1 | 2;};-let esec_token = 'ABrmhLmsdmsu9bCQ80qvGPN2CYSjEqwi5G1l2dirNUjaw%3D';+const esec_token = 'ABrmhLmsdmsu9bCQ80qvGPN2CYSjEqwi5G1l2dirNUjaw%3D';export class XiaohongshuService {private defaultUserAgent =@@ -1115,8 +1115,9 @@ export class XiaohongshuService {post_loc: post_loc,privacy_info: {op_type: 1,- type: platformSetting['privacy'] ? 1 : 0,- user_ids: platformSetting['privacy'] ? [] : undefined,+ type: platformSetting['visibility_type'],+ user_ids:+ platformSetting['visibility_type'] !== 0 ? [] : undefined,},},image_info: xhs_image_info,@@ -1446,39 +1447,37 @@ export class XiaohongshuService {return res;}+ // 获取二级评论列表+ async getSecondCommentList(+ cookie: Electron.Cookie[],+ noteId: string,+ root_comment_id: string,+ cursor?: string,+ ) {+ const url = `/api/sns/web/v2/comment/sub/page?note_id=${noteId}&root_comment_id=${root_comment_id}&num=10&cursor=${cursor || ''}&top_comment_id=&image_formats=jpg,webp,avif&xsec_token=${esec_token}`;+ const reverseRes: any = await this.getReverseResult({+ url,+ a1: CookieToString(cookie),+ });- // 获取二级评论列表- async getSecondCommentList(- cookie: Electron.Cookie[],- noteId: string,- root_comment_id: string,- cursor?: string,- ) {- const url = `/api/sns/web/v2/comment/sub/page?note_id=${noteId}&root_comment_id=${root_comment_id}&num=10&cursor=${cursor || ''}&top_comment_id=&image_formats=jpg,webp,avif&xsec_token=${esec_token}`;- const reverseRes: any = await this.getReverseResult({- url,- a1: CookieToString(cookie),- });-- const res = await requestNet<XhsCommentListResponse>({- url: `https://edith.xiaohongshu.com${url}`,- headers: {- cookie: CookieToString(cookie),- Referer: this.loginUrlHome,- origin: this.loginUrlHome,- 'X-S': reverseRes['X-s'],- 'X-T': reverseRes['X-t'],- userAgent:- 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36 Edg/100.0.1185.36',- },- method: 'GET',- });-- console.log('------- xhs getSecondCommentList ---', res);-- return res;- }+ const res = await requestNet<XhsCommentListResponse>({+ url: `https://edith.xiaohongshu.com${url}`,+ headers: {+ cookie: CookieToString(cookie),+ Referer: this.loginUrlHome,+ origin: this.loginUrlHome,+ 'X-S': reverseRes['X-s'],+ 'X-T': reverseRes['X-t'],+ userAgent:+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36 Edg/100.0.1185.36',+ },+ method: 'GET',+ });+ console.log('------- xhs getSecondCommentList ---', res);++ return res;+ }/*** 点赞作品diff --git a/src/icp/publish.ts b/src/icp/publish.tsindex ba786979..a404d3d0 100644--- a/src/icp/publish.ts+++ b/src/icp/publish.ts@@ -32,6 +32,7 @@ import { WeChatVideoApiResponse } from '../../electron/plat/shipinhao/wxShp.typeimport { parseTopicString } from '../utils';import { PublishVideoResult } from '../../electron/main/plat/module';import { ImgTextModel } from '../../electron/db/models/imgText';+import type { pubRecordListQuery } from '../../electron/global/table';// 创建发布记录export async function icpCreatePubRecord(pubRecord: Partial<PubRecordModel>) {@@ -75,6 +76,15 @@ export async function icpCreateVideoPubRecord(pubRecord: Partial<VideoPul>) {return res;}+// 获取图文发布记录+export async function icpGetImgTextList(pubRecordId: number) {+ const res: ImgTextModel[] = await window.ipcRenderer.invoke(+ 'ICP_PUBLISH_GET_IMG_TEXT_LIST',+ pubRecordId,+ );+ return res;+}+// 获取视频发布记录export async function icpGetPubVideoRecord(pubRecordId: number) {const res: VideoPul[] = await window.ipcRenderer.invoke(@@ -103,7 +113,10 @@ export async function icpPubImgText(pubRecordId: number) {}// 获取发布记录列表-export async function icpGetPubRecordList(page: CorrectQuery, query?: any) {+export async function icpGetPubRecordList(+ page: CorrectQuery,+ query?: pubRecordListQuery,+) {const res: CorrectResponse<PubRecordModel> = await window.ipcRenderer.invoke('ICP_PUBLISH_GET_PUB_RECORD_LIST',page,diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsxindex ab781ef4..55160824 100644--- a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx@@ -21,7 +21,11 @@ import CommonScheduledTimeSelect, {ICommonScheduledTimeSelectProps,} from '../../../../../components/CommonComponents/CommonScheduledTimeSelect';import dayjs from 'dayjs';-import { AccountRestartLogin } from '../../../../../components/CommonComponents/CommonComponents';+import {+ AccountRestartLogin,+ PubPermission,+ PubPermissionProps,+} from '../../../../../components/CommonComponents/CommonComponents';import { AccountPlatInfoMap } from '../../../../../../account/comment';interface DebounceSelectProps<ValueType = any>@@ -267,6 +271,35 @@ export const ImgTextDescTextArea = ({);};+// 权限设置+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 = ({...propsdiff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsxindex 31925cef..1e4736f4 100644--- a/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsx+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsx@@ -3,6 +3,7 @@ import { ImageRightSettingChildProps } from '../ImageParamsSet.type';import {ImgTextDescTextArea,ImgTextLocationSelect,+ ImgTextPubPermission,ImgTextPubRestartLogin,ImgTextScheduledTimeSelect,ImgTextTitleInput,@@ -112,6 +113,8 @@ const ImageParamsSet_Douyin = memo(<ImgTextLocationSelect />+ <ImgTextPubPermission />+<ImgTextScheduledTimeSelect /></>);diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_XHS.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_XHS.tsxindex 56107c76..c7c78093 100644--- a/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_XHS.tsx+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_XHS.tsx@@ -1,8 +1,9 @@-import { forwardRef, memo } from 'react';+import React, { forwardRef, memo } from 'react';import { ImageRightSettingChildProps } from '../ImageParamsSet.type';import {ImgTextDescTextArea,ImgTextLocationSelect,+ ImgTextPubPermission,ImgTextScheduledTimeSelect,ImgTextTitleInput,ImgTextTopicSelect,@@ -23,6 +24,8 @@ const ImageParamsSet_XHS = memo(<ImgTextLocationSelect />+ <ImgTextPubPermission />+<ImgTextScheduledTimeSelect /></>);diff --git a/src/views/publish/children/imagePage/image.module.scss b/src/views/publish/children/imagePage/image.module.scssindex b4e963d6..57fadbe8 100644--- a/src/views/publish/children/imagePage/image.module.scss+++ b/src/views/publish/children/imagePage/image.module.scss@@ -19,6 +19,7 @@.image-footer {border-top: 1px solid var(--superLightGreyColor);padding: 15px 0;+ text-align: center;}}}diff --git a/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx b/src/views/publish/children/pubRecord/components/PubRecordDetails.tsxnew file mode 100644index 00000000..5bd106ae--- /dev/null+++ b/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx@@ -0,0 +1,204 @@+import {+ ForwardedRef,+ forwardRef,+ memo,+ useImperativeHandle,+ useState,+} from 'react';+import { Avatar, Button, Drawer, Spin, Tooltip } from 'antd';+import styles from '../pubRecord.module.scss';+import { AccountPlatInfoMap } from '../../../../account/comment';+import { formatTime } from '../../../../../utils';+import { getVideoFile } from '../../../../../components/Choose/VideoChoose';+import { AccountType } from '../../../../../../commont/AccountEnum';+import { IExamineVideo, ImageView } from '../page';+import { PubRecordModel } from '../../../comment';+import { useAccountStore } from '../../../../../store/account';+import { useShallow } from 'zustand/react/shallow';+import { useVideoPageStore } from '../../videoPage/useVideoPageStore';+import { useNavigate } from 'react-router-dom';+import { WorkData } from '../../../../../../electron/db/models/workData';+import { VideoModel } from '../../../../../../electron/db/models/video';+import { PubType } from '../../../../../../commont/publish/PublishEnum';+import {+ icpGetImgTextList,+ icpGetPubVideoRecord,+} from '../../../../../icp/publish';++export interface IPubRecordDetailsRef {+ // 打开详情+ oepnPubRecordDetails: (pubRecordModel: PubRecordModel) => void;+}++export interface IPubRecordDetailsProps {+ onExamineVideoClick: (examineVideo: IExamineVideo) => void;+}++const PubRecordDetails = memo(+ forwardRef(+ (+ { onExamineVideoClick }: IPubRecordDetailsProps,+ ref: ForwardedRef<IPubRecordDetailsRef>,+ ) => {+ const [recordLoaidng, setRecordLoaidng] = useState(false);+ const [currPubRecordModel, setCurrPubRecordModel] =+ useState<PubRecordModel>();+ const [open, setOpen] = useState(false);+ // 视频发布记录列表+ const [pubRecordList, setPubRecordList] = useState<WorkData[]>([]);+ const { accountMap } = useAccountStore(+ useShallow((state) => ({+ accountMap: state.accountMap,+ })),+ );+ const { restartPub } = useVideoPageStore(+ useShallow((state) => ({+ restartPub: state.restartPub,+ })),+ );+ const navigate = useNavigate();++ const imperativeHandle: IPubRecordDetailsRef = {+ async oepnPubRecordDetails(pubRecordModel) {+ setCurrPubRecordModel(pubRecordModel);+ setRecordLoaidng(true);+ if (pubRecordModel.type === PubType.VIDEO) {+ const res = await icpGetPubVideoRecord(pubRecordModel.id);+ setPubRecordList(res);+ } else if (pubRecordModel.type === PubType.ImageText) {+ const res = await icpGetImgTextList(pubRecordModel.id);+ setPubRecordList(res);+ }+ setRecordLoaidng(false);+ setOpen(true);+ },+ };+ useImperativeHandle(ref, () => imperativeHandle);++ return (+ <>+ <Drawer+ title="发布记录"+ onClose={() => {+ setOpen(false);+ onExamineVideoClick({+ open: false,+ jsCode: '',+ url: '',+ account: undefined,+ });+ }}+ open={open}+ width={600}+ >+ <Spin spinning={recordLoaidng}>+ <div className={styles.pubRecord} style={{ padding: '0' }}>+ <ImageView+ prm={currPubRecordModel!}+ width="auto"+ height={150}+ />++ <ul className="pubRecord-record">+ {pubRecordList?.map((v) => {+ const account = accountMap.get(v.accountId);+ const plat = AccountPlatInfoMap.get(v.type);+ return (+ <li className="pubRecord-record-item" key={v.id}>+ <div+ className={[+ 'pubRecord-record-item-status',+ v.status === 1+ ? 'pubRecord-record-item--success'+ : v.status === 0+ ? 'pubRecord-record-item--processing'+ : 'pubRecord-record-item--fail',+ ].join(' ')}+ >+ {v.status === 1+ ? '发布成功'+ : v.status === 0+ ? '发布中'+ : '发布失败'}+ </div>+ <div className="pubRecord-record-item-con">+ <div className="pubRecord-record-item-con-avatar">+ <Avatar size="large" src={account?.avatar} />+ <img src={plat?.icon} />+ </div>+ <div className="pubRecord-record-item-userinfo">+ <b>{account?.nickname}</b>+ {v.failMsg ? (+ <Tooltip title={v.failMsg}>+ <div className="pubRecord-record-item-failMsg">+ {v.failMsg}+ </div>+ </Tooltip>+ ) : (+ <p className="pubRecord-record-item-userinfo-time">+ {formatTime(v.publishTime!)}+ </p>+ )}+ </div>+ </div>+ <div className="pubRecord-record-item-btns">+ {v.status !== 1 ? (+ <Button+ type="link"+ onClick={() => {+ setRecordLoaidng(true);+ const prl = pubRecordList.filter(+ (v) => v.status === 2,+ );+ restartPub(+ prl,+ prl.map((k) => accountMap.get(k.accountId)!),+ );+ setRecordLoaidng(false);+ navigate('/publish/video');+ }}+ >+ 重新发布+ </Button>+ ) : (+ <Button+ type="link"+ onClick={async () => {+ if (!v.dataId) return;+ const videoFile = await getVideoFile(+ (v as VideoModel).videoPath!,+ );++ const newState: IExamineVideo = {+ jsCode: '',+ open: true,+ url: '',+ account,+ };+ if (account?.type === AccountType.WxSph) {+ newState['videoSrc'] = videoFile.videoUrl;+ } else {+ newState['url'] = v.previewVideoLink || '';+ }+ onExamineVideoClick(newState);+ }}+ >+ 查看+ </Button>+ )}+ </div>+ </li>+ );+ })}+ </ul>+ </div>+ </Spin>+ </Drawer>+ </>+ );+ },+ ),+);+PubRecordDetails.displayName = 'PubRecordDetails';++export default PubRecordDetails;diff --git a/src/views/publish/children/pubRecord/page.tsx b/src/views/publish/children/pubRecord/page.tsxindex 658ef8bf..852cd6fa 100644--- a/src/views/publish/children/pubRecord/page.tsx+++ b/src/views/publish/children/pubRecord/page.tsx@@ -1,30 +1,16 @@-import { useEffect, useMemo, useState } from 'react';+import { useEffect, useMemo, useRef, useState } from 'react';import { PubRecordModel } from '../../comment';import styles from './pubRecord.module.scss';-import { icpGetPubRecordList, icpGetPubVideoRecord } from '@/icp/publish';-import {- Avatar,- Button,- Drawer,- Image,- Modal,- Spin,- Table,- TableProps,- Tag,- Tooltip,-} from 'antd';+import { icpGetPubRecordList } from '@/icp/publish';+import { Button, Image, Modal, Select, Table, TableProps, Tag } from 'antd';import { getImgFile, IImgFile } from '@/components/Choose/ImgChoose';import { formatTime, getFilePathName } from '@/utils';-import { VideoPul } from '@/views/publish/children/videoPage/comment';-import { AccountInfo, AccountPlatInfoMap } from '@/views/account/comment';-import { useVideoPageStore } from '../videoPage/useVideoPageStore';-import { useShallow } from 'zustand/react/shallow';-import { useNavigate } from 'react-router-dom';-import { AccountType } from '../../../../../commont/AccountEnum';+import { AccountInfo } from '@/views/account/comment';import WebView from '../../../../components/WebView';-import { getVideoFile } from '../../../../components/Choose/VideoChoose';-import { useAccountStore } from '../../../../store/account';+import { PubType } from '../../../../../commont/publish/PublishEnum';+import PubRecordDetails, {+ IPubRecordDetailsRef,+} from './components/PubRecordDetails';export const ImageView = ({prm,@@ -57,27 +43,25 @@ export const ImageView = ({);};+export interface IExamineVideo {+ account?: AccountInfo;+ url: string;+ open: boolean;+ jsCode: string;+ videoSrc?: string;+}+export default function Page({- hegiht = '78vh',+ hegiht = '75vh',onChange,+ defaultPubType,}: {hegiht?: string;onChange?: (pubRecordModel: PubRecordModel) => void;+ defaultPubType?: PubType;}) {const [pulRecardList, setRecardList] = useState<PubRecordModel[]>([]);- const [open, setOpen] = useState(false);- const [currPubRecordModel, setCurrPubRecordModel] =- useState<PubRecordModel>();- const [recordLoaidng, setRecordLoaidng] = useState(false);- const [pubRecordList, setPubRecordList] = useState<VideoPul[]>([]);- const navigate = useNavigate();- const [examineVideo, setExamineVideo] = useState<{- account?: AccountInfo;- url: string;- open: boolean;- jsCode: string;- videoSrc?: string;- }>({+ const [examineVideo, setExamineVideo] = useState<IExamineVideo>({videoSrc: '',account: undefined,url: '',@@ -85,16 +69,9 @@ export default function Page({jsCode: '',});const [selectedRowKeys, setSelectedRowKeys] = useState<number[]>([]);- const { accountMap } = useAccountStore(- useShallow((state) => ({- accountMap: state.accountMap,- })),- );- const { restartPub } = useVideoPageStore(- useShallow((state) => ({- restartPub: state.restartPub,- })),- );+ const pubRecordDetailsRef = useRef<IPubRecordDetailsRef>(null);+ // 发布类型的筛选+ const [pubType, setPubType] = useState<PubType | undefined>(defaultPubType);const columns = useMemo(() => {const columns: TableProps<PubRecordModel>['columns'] = [@@ -117,6 +94,22 @@ export default function Page({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 <>图文发布</>;+ }+ },+ width: 200,+ },{title: '状态',dataIndex: 'status',@@ -145,12 +138,7 @@ export default function Page({type="link"onClick={async (e) => {e.stopPropagation();- setOpen(true);- setCurrPubRecordModel(prm);- setRecordLoaidng(true);- const res = await icpGetPubVideoRecord(prm.id);- setRecordLoaidng(false);- setPubRecordList(res);+ pubRecordDetailsRef.current?.oepnPubRecordDetails(prm);}}>详情@@ -164,20 +152,21 @@ export default function Page({useEffect(() => {GetPubList();- }, []);+ }, [pubType]);async function GetPubList() {- const res = await icpGetPubRecordList({- page_no: 1,- page_size: 10,- });+ const res = await icpGetPubRecordList(+ {+ page_no: 1,+ page_size: 10,+ },+ {+ type: pubType,+ },+ );setRecardList(res.list);}- const close = () => {- setOpen(false);- };-useEffect(() => {if (onChange)onChange(pulRecardList.find((v) => v.id === selectedRowKeys[0])!);@@ -214,6 +203,7 @@ export default function Page({newState.open = false;newState.url = '';newState.videoSrc = '';+ newState.account = undefined;return newState;});}}@@ -232,7 +222,7 @@ export default function Page({</>) : (<>- {examineVideo.account && open ? (+ {examineVideo.account ? (<WebViewurl={examineVideo.url}cookieParams={{@@ -248,6 +238,24 @@ export default function Page({</div></Modal>+ {!onChange && (+ <div className="pubRecord-options">+ <Select+ style={{ width: 120 }}+ placeholder="发布类型"+ allowClear+ 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={pulRecardList}@@ -261,104 +269,17 @@ export default function Page({})}/>- {/*发布记录详情*/}- <Drawer title="发布记录" onClose={close} open={open} width={600}>- <Spin spinning={recordLoaidng}>- <div className={styles.pubRecord} style={{ padding: '0' }}>- <ImageView prm={currPubRecordModel!} width="auto" height={150} />-- <ul className="pubRecord-record">- {pubRecordList.map((v) => {- const account = accountMap.get(v.accountId);- const plat = AccountPlatInfoMap.get(v.type);- return (- <li className="pubRecord-record-item" key={v.id}>- <div- className={[- 'pubRecord-record-item-status',- v.status === 1- ? 'pubRecord-record-item--success'- : v.status === 0- ? 'pubRecord-record-item--processing'- : 'pubRecord-record-item--fail',- ].join(' ')}- >- {v.status === 1- ? '发布成功'- : v.status === 0- ? '发布中'- : '发布失败'}- </div>- <div className="pubRecord-record-item-con">- <div className="pubRecord-record-item-con-avatar">- <Avatar size="large" src={account?.avatar} />- <img src={plat?.icon} />- </div>- <div className="pubRecord-record-item-userinfo">- <b>{account?.nickname}</b>- {v.failMsg ? (- <Tooltip title={v.failMsg}>- <div className="pubRecord-record-item-failMsg">- {v.failMsg}- </div>- </Tooltip>- ) : (- <p className="pubRecord-record-item-userinfo-time">- {formatTime(v.publishTime!)}- </p>- )}- </div>- </div>- <div className="pubRecord-record-item-btns">- {v.status !== 1 ? (- <Button- type="link"- onClick={() => {- setRecordLoaidng(true);- const prl = pubRecordList.filter(- (v) => v.status === 2,- );- restartPub(- prl,- prl.map((k) => accountMap.get(k.accountId)!),- );- setRecordLoaidng(false);- navigate('/publish/video');- }}- >- 重新发布- </Button>- ) : (- <Button- type="link"- onClick={async () => {- if (!v.dataId) return;- const videoFile = await getVideoFile(v.videoPath!);- setExamineVideo((prevState) => {- const newState = { ...prevState };- newState.open = true;- newState.account = account;-- if (account?.type === AccountType.WxSph) {- newState.videoSrc = videoFile.videoUrl;- } else {- newState.url = v.previewVideoLink || '';- }- return newState;- });- }}- >- 查看- </Button>- )}- </div>- </li>- );- })}- </ul>- </div>- </Spin>- </Drawer>+ <PubRecordDetails+ ref={pubRecordDetailsRef}+ onExamineVideoClick={(e) => {+ setExamineVideo((prevState) => {+ return {+ ...prevState,+ ...e,+ };+ });+ }}+ /></div>);}diff --git a/src/views/publish/children/pubRecord/pubRecord.module.scss b/src/views/publish/children/pubRecord/pubRecord.module.scssindex d0a7b61f..b92e1fe1 100644--- a/src/views/publish/children/pubRecord/pubRecord.module.scss+++ b/src/views/publish/children/pubRecord/pubRecord.module.scss@@ -4,6 +4,9 @@padding: 20px;box-sizing: border-box;:global {+ .pubRecord-options {+ margin-bottom: 10px;+ }.pubRecord-record {margin-top: 20px;display: flex;diff --git a/src/views/publish/children/videoPage/components/NoChoosePage.tsx b/src/views/publish/children/videoPage/components/NoChoosePage.tsxindex 684ddd47..143fd01e 100644--- a/src/views/publish/children/videoPage/components/NoChoosePage.tsx+++ b/src/views/publish/children/videoPage/components/NoChoosePage.tsx@@ -61,6 +61,7 @@ const NoChoosePage = memo(<Alert message="选择一条发布记录" /><PubRecordhegiht="55vh"+ defaultPubType={PubType.VIDEO}onChange={async (pubRecordModel) => {pubRecord.current = pubRecordModel;}}diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsxindex 6272e7c4..f1c1024a 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsx@@ -3,10 +3,9 @@ import {IVideoPubSetModalChildProps,IVideoPubSetModalChildRef,} from '@/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.type';-import { Radio, Select } from 'antd';+import { Select } from 'antd';import { useVideoPageStore } from '@/views/publish/children/videoPage/useVideoPageStore';import { useShallow } from 'zustand/react/shallow';-import { VisibleTypeEnum } from '@@/publish/PublishEnum';import TopicSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect';import LocationSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect';import { AccountType } from '@@/AccountEnum';@@ -14,6 +13,7 @@ import {DescTextArea,ScheduledTimeSelect,TitleInput,+ VideoPubPermission,VideoPubRestartLogin,} from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon';import UserSelect from '../components/UserSelect';@@ -177,28 +177,9 @@ const VideoPubSetModal_DouYin = memo(}}/>- <h1>谁可以看</h1>- <Radio.Group- options={[- {- label: '公开(所有人可见)',- value: VisibleTypeEnum.Public,- },- { label: '好友可见', value: VisibleTypeEnum.Friend },- {- label: '私密(仅自己可见)',- value: VisibleTypeEnum.Private,- },- ]}- onChange={(e) => {- setOnePubParams(- {- visibleType: e.target.value,- },- currChooseAccount!.id,- );- }}- value={currChooseAccount?.pubParams.visibleType}+ <VideoPubPermission+ currChooseAccount={currChooseAccount}+ title="谁可以看"/></>);diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsxindex dbe00645..176ae7f8 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_KWAI.tsx@@ -3,14 +3,13 @@ import {IVideoPubSetModalChildProps,IVideoPubSetModalChildRef,} from '@/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.type';-import { Radio } from 'antd';-import { VisibleTypeEnum } from '@@/publish/PublishEnum';import TopicSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect';import LocationSelect from '../components/LocationSelect';import UserSelect from '../components/UserSelect';import {DescTextArea,ScheduledTimeSelect,+ VideoPubPermission,} from '../components/VideoPubSetModalCommon';import useVideoPubSetModal from './hooks/useVideoPubSetModal';@@ -42,29 +41,7 @@ const VideoPubSetModal_KWAI = memo(<LocationSelect currChooseAccount={currChooseAccount} />- <h1>查看权限</h1>- <Radio.Group- options={[- {- label: '公开(所有人可见)',- value: VisibleTypeEnum.Public,- },- { label: '好友可见', value: VisibleTypeEnum.Friend },- {- label: '私密(仅自己可见)',- value: VisibleTypeEnum.Private,- },- ]}- onChange={(e) => {- setOnePubParams(- {- visibleType: e.target.value,- },- currChooseAccount!.id,- );- }}- value={currChooseAccount?.pubParams.visibleType}- />+ <VideoPubPermission currChooseAccount={currChooseAccount} /><ScheduledTimeSelect currChooseAccount={currChooseAccount} /></>diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsxindex e452303c..12f995c6 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsx@@ -3,14 +3,13 @@ import {IVideoPubSetModalChildProps,IVideoPubSetModalChildRef,} from '@/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.type';-import { Radio } from 'antd';-import { VisibleTypeEnum } from '@@/publish/PublishEnum';import TopicSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect';import LocationSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect';import {DescTextArea,ScheduledTimeSelect,TitleInput,+ VideoPubPermission,} from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon';import UserSelect from '../components/UserSelect';import useVideoPubSetModal from './hooks/useVideoPubSetModal';@@ -45,27 +44,9 @@ const VideoPubSetModal_WxSph = memo(<LocationSelect currChooseAccount={currChooseAccount} />- <h1>权限设置</h1>- <Radio.Group- options={[- {- label: '公开(所有人可见)',- value: VisibleTypeEnum.Public,- },- {- label: '私密(仅自己可见)',- value: VisibleTypeEnum.Private,- },- ]}- onChange={(e) => {- setOnePubParams(- {- visibleType: e.target.value,- },- currChooseAccount!.id,- );- }}- value={currChooseAccount?.pubParams.visibleType}+ <VideoPubPermission+ currChooseAccount={currChooseAccount}+ title="谁可以看"/><ScheduledTimeSelect currChooseAccount={currChooseAccount} /></>diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsxindex bc958435..56ad91bd 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx@@ -11,7 +11,12 @@ import AICreateTitle from '../../../../../components/AICreateTitle/AICreateTitleimport CommonScheduledTimeSelect, {ICommonScheduledTimeSelectProps,} from '../../../../../components/CommonComponents/CommonScheduledTimeSelect';-import { AccountRestartLogin } from '../../../../../components/CommonComponents/CommonComponents';+import {+ AccountRestartLogin,+ PubPermission,+ PubPermissionProps,+} from '../../../../../components/CommonComponents/CommonComponents';+import useVideoPubSetModal from '../children/hooks/useVideoPubSetModal';const { TextArea } = Input;@@ -196,3 +201,28 @@ export const DescTextArea = ({</>);};++// 可见性+export const VideoPubPermission = ({+ currChooseAccount,+ ...props+}: PubPermissionProps & {+ currChooseAccount?: IVideoChooseItem;+}) => {+ if (!currChooseAccount) return;+ const { setOnePubParams } = useVideoPubSetModal(currChooseAccount);+ return (+ <PubPermission+ onChange={(e) => {+ setOnePubParams(+ {+ visibleType: e,+ },+ currChooseAccount!.id,+ );+ }}+ value={currChooseAccount?.pubParams.visibleType}+ {...props}+ />+ );+};diff --git a/src/views/publish/children/videoPage/video.module.scss b/src/views/publish/children/videoPage/video.module.scssindex 24d711e9..f3fca81c 100644--- a/src/views/publish/children/videoPage/video.module.scss+++ b/src/views/publish/children/videoPage/video.module.scss@@ -82,6 +82,7 @@overflow: auto;}&-footer {+ text-align: center;border-top: 1px solid var(--superLightGreyColor);padding: 15px;}diff --git a/src/views/publish/components/CommonComponents/CommonComponents.tsx b/src/views/publish/components/CommonComponents/CommonComponents.tsxindex 70f131b9..cd2f422b 100644--- a/src/views/publish/components/CommonComponents/CommonComponents.tsx+++ b/src/views/publish/components/CommonComponents/CommonComponents.tsx@@ -1,4 +1,4 @@-import { Button } from 'antd';+import { Button, Radio } from 'antd';import styles from './commonComponents.module.scss';import React, { useState } from 'react';import { Outlet } from 'react-router-dom';@@ -6,6 +6,7 @@ import { PlusOutlined, UserAddOutlined } from '@ant-design/icons';import { AccountInfo } from '../../../account/comment';import { AccountStatus } from '../../../../../commont/AccountEnum';+import { VisibleTypeEnum } from '../../../../../commont/publish/PublishEnum';// 本地上传、素材上传展示的块export const ChooseChunk = ({@@ -65,6 +66,45 @@ export const ChooseAccountChunk = ({ onClick }: { onClick: () => void }) => {);};+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,diff --git a/src/views/publish/components/CommonComponents/commonComponents.module.scss b/src/views/publish/components/CommonComponents/commonComponents.module.scssindex 2986d167..98fb8a16 100644--- a/src/views/publish/components/CommonComponents/commonComponents.module.scss+++ b/src/views/publish/components/CommonComponents/commonComponents.module.scss@@ -249,4 +249,4 @@padding: 0;height: auto;}-}\ No newline at end of file+}diff --git a/src/views/statistics/statistics.css b/src/views/statistics/statistics.cssindex d16044ee..51c64340 100644--- a/src/views/statistics/statistics.css+++ b/src/views/statistics/statistics.css@@ -1,7 +1,6 @@#root {margin: 0 auto;padding: 2rem;- text-align: center;}.logo-box {