Skip to content

Let's use AI to Earn!

fix: 解决了发布失败进度条没有反馈的问题

gaoSir69b5984f2046
diff --git a/electron/main/plat/pub/PubItemVideo.ts b/electron/main/plat/pub/PubItemVideo.ts
index 9871eaeb..c7112021 100644
--- a/electron/main/plat/pub/PubItemVideo.ts
+++ b/electron/main/plat/pub/PubItemVideo.ts
@@ -17,6 +17,7 @@ import { SendChannelEnum } from '../../../../commont/UtilsEnum';
// 视频发布进度返回值
export interface VideoPublishProgressRes {
+ // 为 -1 表示失败
progress: number;
msg: string;
account: AccountModel;
diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.ts
index 103aaa25..8058ab50 100644
--- a/electron/plat/douyin/index.ts
+++ b/electron/plat/douyin/index.ts
@@ -948,7 +948,7 @@ export class DouyinService {
method: string = 'PUT',
): Promise<any> {
return new Promise((resolve, reject) => {
- console.log(`开始请求 [${new Date().toLocaleString()}]`, fileContent);
+ console.log(`开始请求 [${new Date().toLocaleString()}]`);
console.log('请求URL:', url);
console.log('请求方法:', method);
console.log('请求头:', headers);
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.tsx
index 26c92f35..55ed38c6 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
@@ -144,9 +144,11 @@ const ActivitySelect = ({ currChooseAccount }: IVideoPubSetModalChildProps) => {
useEffect(() => {
init();
- }, []);
- onAccountLoginFinish(() => init());
+ onAccountLoginFinish(() => {
+ init();
+ });
+ }, []);
return (
<>
@@ -258,7 +260,7 @@ const ActivitySelect = ({ currChooseAccount }: IVideoPubSetModalChildProps) => {
</div>
);
}}
- options={options.map((v) => {
+ options={options?.map((v) => {
return {
...v,
label: v.activity_name,
diff --git a/src/views/publish/components/PubProgressModule.tsx b/src/views/publish/components/PubProgressModule.tsx
index 6ace3596..425cca82 100644
--- a/src/views/publish/components/PubProgressModule.tsx
+++ b/src/views/publish/components/PubProgressModule.tsx
@@ -12,6 +12,16 @@ export interface IPubProgressModuleProps {
onClose: () => void;
}
+function getMsg(progressData: VideoPublishProgressRes) {
+ if (progressData.progress === 100) {
+ return '发布成功';
+ } else if (progressData.progress === -1) {
+ return '发布错误';
+ } else {
+ return progressData.msg || '正在加载...';
+ }
+}
+
// 发布进度展示
const PubProgressModule = memo(
forwardRef(
@@ -49,9 +59,12 @@ const PubProgressModule = memo(
</div>
<div className="pubProgressModule-item-right">
- <Progress percent={v.progress} />
+ <Progress
+ percent={v.progress}
+ status={v.progress === -1 ? 'exception' : undefined}
+ />
<p className="pubProgressModule-item-right-msg">
- {v.msg || '正在加载...'}
+ {getMsg(v)}
</p>
</div>
</div>