((resolve)=>{
+ // const manualErrorCount = props.articles?.filter(s=>{
+ // return s.hot_news.replace(/,/ig,'').trim().length == 0
+ // })?.length || 0
+ // if(manualErrorCount == 0) {
+ // resolve('default')
+ // return;
+ // }
+ // modal.confirm({
+ // wrapClassName: 'root-modal-confirm',
+ // icon: ,
+ // title: t('modal.push_article.empty_notice_title'),
+ // content: t('modal.push_article.empty_notice_message'),
+ // centered:true,
+ // onOk: () => {
+ // resolve('auto')
+ // },
+ // onCancel: () => {
+ // resolve('reject')
+ // }
+ // })
+ // })
+ // }
+ const handlePush = async (action: ProcessResult) => {
+ const skip = action === ProcessResult.Skip && state.errorIds.length > 0
+ const ids = !skip ? props.ids : props.ids.filter(id => !state.errorIds.includes(id));
+ if (skip && (state.errorIds.length == props.ids.length || ids.length == 0)) {
+ setState({modalVisible: false})
return;
}
- showToast(t('news.push_stream_success'), 'success')
- navigate('/create?state=push-success', {
- state: 'push-success'
+ //
+ // const result = await checkHotNewsValid();
+ // // TODO: 有热点新闻自动?
+ // if(result == 'reject'){ // 有热点新闻未填写 但点击取消并终止后续操作
+ // return;
+ // }
+ setLoading(true)
+ push2video(ids).then(() => {
+ setState({modalVisible: false})
+ if (skip) {
+ props.onResult?.(ProcessResult.Skip, state.errorIds || [])
+ return;
+ }
+ showToast(t('news.push_stream_success'), 'success')
+ navigate('/create?state=push-success', {
+ state: 'push-success'
+ })
+ // props.onSuccess?.()
+ }).catch(() => {
+ showToast(t('service_error'), 'error')
+ //showErrorToast
+ }).finally(() => {
+ setLoading(false)
})
- // props.onSuccess?.()
- }).catch(()=>{
- showToast(t('service_error'), 'error')
- //showErrorToast
- }).finally(() => {
- setLoading(false)
- })
- }
+ }
// double check 25-02-15 https://pu7y37y121.feishu.cn/docx/FwRrddAFWotRZlxgbr5cP7b6nud
// 1.normal 数字人播报部分有内容,不少于50字;或者数字人播报部分无内容
// 2.error 数字人播报部分有内容,但是少于50字
@@ -114,13 +149,13 @@ export default function ButtonPush2Video(props: PushVideoProps) {
}}>
{state.errorTitle && state.errorTitle.length > 0 &&
-
-
{t('modal.push_article.error_title')}:
-
- {state.errorTitle.map(s =>
{s}
)}
-
-
}
+
+
{t('modal.push_article.error_title')}:
+
+ {state.errorTitle.map((s, idx) =>
{s}
)}
+
+
}
@@ -128,10 +163,15 @@ export default function ButtonPush2Video(props: PushVideoProps) {
- {state.errorIds?.length > 0 && }
-
+ {state.errorIds?.length > 0 && (
+
+ )}
+
diff --git a/src/types/api.d.ts b/src/types/api.d.ts
index b184103..585443b 100644
--- a/src/types/api.d.ts
+++ b/src/types/api.d.ts
@@ -67,6 +67,7 @@ interface BasicArticleInfo {
content_word_count?: number;
media_id: number;
fanwen_column_id: number;
+ hot_news: string;
}
/**