update: 跳过异常后加载新闻列表

This commit is contained in:
LittleBoy 2025-02-17 14:31:32 +08:00
parent 3ec2ae6d0e
commit 90bd5cbde6

View File

@ -35,6 +35,7 @@ export default function ButtonPush2Video(props: PushVideoProps) {
const skip = action === ProcessResult.Skip && state.errorIds.length > 0
const ids = !skip ? props.ids : props.ids.filter(id => !state.errorIds.includes(id));
push2video(ids).then(() => {
setState({modalVisible: false})
if (skip) {
props.onResult?.(ProcessResult.Skip, state.errorIds || [])
return;
@ -72,45 +73,10 @@ export default function ButtonPush2Video(props: PushVideoProps) {
// check article content
const result = checkArticleContent()
setState({modalVisible: true, errorTitle: result.errors, errorIds: result.ids})
//
// const instance = modal.confirm({
// title: <div className="text-base pt-0.5">{t('modal.warning')}</div>,
// wrapClassName: 'root-modal-confirm',
// centered: true,
// width: 440,
// icon: <span className="anticon anticon-exclamation-circle"><IconWarningCircle/></span>,
// content: <div className="confirm-message-wrapper pl-7">
// <div className="message text-gray-600">
// {t(
// errors && errors.length > 0
// ? (props.ids.length == 1 ? 'modal.push_article.content_error_single' : 'modal.push_article.content_error')
// : (props.ids.length == 1 ? 'modal.push_article.content_normal_single' : 'modal.push_article.content_normal'),
// {count: props.ids.length, error_count: errors?.length})}
// </div>
// {errors && errors.length > 0 && <div className="error-list text-red-400 mt-6">
// <div className="title">{t('modal.push_article.error_title')}:</div>
// <div className="max-h-[100px] overflow-auto" style={{lineHeight: '20px'}}>
// {errors.map(s => <div
// className="error-item overflow-hidden text-nowrap overflow-ellipsis">{s}</div>)}
// </div>
// </div>}
// </div>,
// footer: <div className="flex justify-end mt-6">
// <Space>
// <Button onClick={() => {
// instance.destroy()
// }}>{t('modal.push_article.action_cancel')}</Button>
// <Button type="primary">{t('modal.push_article.action_skip')}</Button>
// <Button>{t('modal.push_article.action_all')}</Button>
// </Space>
// </div>,
// })
// handlePush();
}
return (
<div>
<button
disabled={loading}
className='bg-[#4096ff] hover:bg-blue-600 text-white'
onClick={onPushClick}
>
@ -152,13 +118,13 @@ export default function ButtonPush2Video(props: PushVideoProps) {
</div>
<div className="flex justify-end mt-6">
<Space>
<Button onClick={() => {
<Button disabled={loading} onClick={() => {
setState({modalVisible: false})
}}>{t('modal.push_article.action_cancel')}</Button>
{state.errorIds?.length > 0 && <Button type="primary"
{state.errorIds?.length > 0 && <Button disabled={loading} type="primary"
onClick={() => handlePush(ProcessResult.Skip)}>{t('modal.push_article.action_skip')}</Button>}
<Button type={state.errorIds.length == 0 ? 'primary' : 'default'}
onClick={() => handlePush(ProcessResult.All)}>{t('modal.push_article.action_all')}</Button>
<Button disabled={loading} type={state.errorIds.length == 0 ? 'primary' : 'default'}
onClick={() => handlePush(ProcessResult.All)} >{t('modal.push_article.action_all')}</Button>
</Space>
</div>
</Modal>