Skip to content

Let's use AI to Earn!

feat: 1. 导入发布记录支持通用发布参数。 2. 添加了视频发布时关闭“发布进度弹框”会自动关闭“预览及发布弹框”。

gaoSir14f249962f65
diff --git a/electron/main/publish/controller.ts b/electron/main/publish/controller.ts
index 18fdea10..1c24227d 100644
--- a/electron/main/publish/controller.ts
+++ b/electron/main/publish/controller.ts
@@ -8,7 +8,7 @@
import { Controller, Icp, Inject } from '../core/decorators';
import { PublishService } from './service';
import { getUserInfo } from '../user/comment';
-import { Between, FindOptionsWhere, Not } from 'typeorm';
+import { Between, FindOptionsWhere } from 'typeorm';
import {
backPageData,
type CorrectQuery,
@@ -59,7 +59,7 @@ export class PublishController {
: {
...(query.type !== undefined && { type: query.type }),
...(query.status === undefined
- ? { status: Not(PubStatus.UNPUBLISH) }
+ ? {}
: {
status: query.status,
}),
diff --git a/src/icp/publish.ts b/src/icp/publish.ts
index 0723707c..38c021c6 100644
--- a/src/icp/publish.ts
+++ b/src/icp/publish.ts
@@ -37,9 +37,13 @@ import type { pubRecordListQuery } from '../../electron/global/table';
// 创建发布记录
export async function icpCreatePubRecord(pubRecord: Partial<PubRecordModel>) {
+ console.log('创建发布记录:', pubRecord);
const res: PubRecordModel = await window.ipcRenderer.invoke(
'ICP_PUBLISH_CREATE_PUB_RECORD',
- pubRecord,
+ {
+ ...pubRecord,
+ id: undefined,
+ },
);
return res;
}
@@ -53,10 +57,13 @@ export async function icpCreateImgTextPubRecord(
0,
platInfo.commonPubParamsConfig.imgTextConfig?.imagesMax,
);
- console.log(pubRecord);
+ console.log('创建图文发布记录:', pubRecord);
const res: ImgTextModel = await window.ipcRenderer.invoke(
'ICP_PUBLISH_CREATE_IMG_TEXT_PUL',
- pubRecord,
+ {
+ pubRecord,
+ id: undefined,
+ },
);
return res;
}
@@ -71,9 +78,13 @@ export async function icpCreateVideoPubRecord(pubRecord: Partial<VideoPul>) {
const { topics, cleanedString } = parseTopicString(pubRecord.desc || '');
pubRecord.topics = [...new Set(pubRecord.topics?.concat(topics))];
pubRecord.desc = cleanedString;
+ console.log('创建视频发布记录:', pubRecord);
const res: VideoPul = await window.ipcRenderer.invoke(
'ICP_PUBLISH_CREATE_VIDEO_PUL',
- pubRecord,
+ {
+ ...pubRecord,
+ id: undefined,
+ },
);
return res;
}
diff --git a/src/icp/receiveMsg.ts b/src/icp/receiveMsg.ts
index c5c136f8..34c4056e 100644
--- a/src/icp/receiveMsg.ts
+++ b/src/icp/receiveMsg.ts
@@ -9,7 +9,6 @@ const bindEventCore = (
channel: SendChannelEnum,
listener: (event: IpcRendererEvent, ...args: any[]) => void,
): (() => void) => {
- console.log('--------------------------');
const e = window.ipcRenderer.on(channel, listener);
// @ts-ignore
const events: any[] = e._events[channel];
diff --git a/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx b/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx
index e7901d77..93b8ee08 100644
--- a/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx
+++ b/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx
@@ -142,59 +142,61 @@ const PubRecordDetails = memo(
</div>
</div>
<div className="pubRecord-record-item-btns">
- {v.status !== 1 ? (
- <Button
- type="link"
- onClick={() => {
- if (
- currPubRecordModel?.type === PubType.VIDEO
- ) {
- setRecordLoaidng(true);
- const prl = pubRecordList.filter(
- (v) => v.status === 2,
- );
- restartPub(
- prl as VideoModel[],
- prl.map(
- (k) => accountMap.get(k.accountId)!,
- ),
- currPubRecordModel,
- );
- setRecordLoaidng(false);
- navigate('/publish/video');
- } else if (
- currPubRecordModel?.type === PubType.ImageText
- ) {
- }
- }}
- >
- 重新发布
- </Button>
- ) : (
- <Button
- type="link"
- onClick={async () => {
- if (!v.dataId) return;
- const newState: IExamineVideo = {
- jsCode: '',
- open: true,
- url: '',
- account,
- };
- if (account?.type === AccountType.WxSph) {
- const videoFile = await getVideoFile(
- (v as VideoModel).videoPath!,
- );
- newState['videoSrc'] = videoFile.videoUrl;
- } else {
- newState['url'] = v.previewVideoLink || '';
- }
- onExamineVideoClick(newState);
- }}
- >
- 查看
- </Button>
- )}
+ {v.status !== 0 &&
+ (v.status !== 1 ? (
+ <Button
+ type="link"
+ onClick={() => {
+ if (
+ currPubRecordModel?.type === PubType.VIDEO
+ ) {
+ setRecordLoaidng(true);
+ const prl = pubRecordList.filter(
+ (v) => v.status === 2,
+ );
+ restartPub(
+ prl as VideoModel[],
+ prl.map(
+ (k) => accountMap.get(k.accountId)!,
+ ),
+ currPubRecordModel,
+ );
+ setRecordLoaidng(false);
+ navigate('/publish/video');
+ } else if (
+ currPubRecordModel?.type ===
+ PubType.ImageText
+ ) {
+ }
+ }}
+ >
+ 重新发布
+ </Button>
+ ) : (
+ <Button
+ type="link"
+ onClick={async () => {
+ if (!v.dataId) return;
+ const newState: IExamineVideo = {
+ jsCode: '',
+ open: true,
+ url: '',
+ account,
+ };
+ if (account?.type === AccountType.WxSph) {
+ const videoFile = await getVideoFile(
+ (v as VideoModel).videoPath!,
+ );
+ newState['videoSrc'] = videoFile.videoUrl;
+ } else {
+ newState['url'] = v.previewVideoLink || '';
+ }
+ onExamineVideoClick(newState);
+ }}
+ >
+ 查看
+ </Button>
+ ))}
</div>
</li>
);
diff --git a/src/views/publish/children/pubRecord/pubRecord.module.scss b/src/views/publish/children/pubRecord/pubRecord.module.scss
index b92e1fe1..60234f91 100644
--- a/src/views/publish/children/pubRecord/pubRecord.module.scss
+++ b/src/views/publish/children/pubRecord/pubRecord.module.scss
@@ -25,6 +25,7 @@
&-btns {
display: flex;
justify-content: right;
+ min-height: 30px;
button {
margin: 0;
padding: 0;
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
index a8f76afd..fa8a8dea 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
@@ -185,6 +185,7 @@ const VideoPubSetModal = memo(
setLoading(false);
message.error('网络繁忙,请稍后重试!');
};
+ usePubStroe.getState().clearVideoPubSaveData();
// 创建一级记录
const recordRes = await icpCreatePubRecord({
title: commonPubParams.title,
@@ -266,7 +267,7 @@ const VideoPubSetModal = memo(
const close = () => {
setVideoPubSetModalOpen(false);
- videoPubSetModalVideoRef.current!.pause();
+ videoPubSetModalVideoRef.current?.pause();
};
return (
@@ -274,7 +275,12 @@ const VideoPubSetModal = memo(
<PubProgressModule
pubProgressData={pubProgressData}
open={pubProgressModuleOpen}
- onClose={() => setPubProgressModuleOpen(false)}
+ onClose={() => {
+ setPubProgressModuleOpen(false);
+ if (loading) {
+ close();
+ }
+ }}
/>
<PubAccountDetModule
ref={pubAccountDetModuleRef}
diff --git a/src/views/publish/children/videoPage/useVideoPageStore.ts b/src/views/publish/children/videoPage/useVideoPageStore.ts
index 4e4612e8..278c7d95 100644
--- a/src/views/publish/children/videoPage/useVideoPageStore.ts
+++ b/src/views/publish/children/videoPage/useVideoPageStore.ts
@@ -397,10 +397,15 @@ export const useVideoPageStore = create(
try {
methods.setOperateId();
+ commonPubParams = {
+ ...pubRecord,
+ describe: pubRecord?.desc,
+ };
+
if (pubRecord!.commonCoverPath) {
const cover = await getImgFile(pubRecord!.commonCoverPath);
commonPubParams = {
- ...pubRecord,
+ ...commonPubParams,
cover,
};
}
diff --git a/src/views/publish/components/PubProgressModule/PubProgressModule.tsx b/src/views/publish/components/PubProgressModule/PubProgressModule.tsx
index 0feff04b..3181631c 100644
--- a/src/views/publish/components/PubProgressModule/PubProgressModule.tsx
+++ b/src/views/publish/components/PubProgressModule/PubProgressModule.tsx
@@ -40,7 +40,10 @@ const PubProgressModule = memo(
footer={null}
closeIcon={<MinusOutlined />}
>
- <Alert message="关闭此弹框和页面不会影响发布流程" type="success" />
+ <Alert
+ message="关闭此弹框和页面不会影响发布流程,但请不要关闭爱团团哦~"
+ type="success"
+ />
<div className={styles.pubProgressModule}>
{pubProgressData.map((v) => {
const { account } = v;