|
|
@ -1,5 +1,7 @@ |
|
|
|
import { useTranslation } from '@/i18n.ts' |
|
|
|
import { Button, Form, Image, Popconfirm } from 'antd' |
|
|
|
import { getToken } from '@/store/system.ts' |
|
|
|
import { Button, DatePicker, Form, Image, Popconfirm } from 'antd' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import { useAtom, useAtomValue, useSetAtom } from 'jotai' |
|
|
|
import { |
|
|
|
deleteVideoAtom, getTypeName, |
|
|
@ -8,7 +10,14 @@ import { |
|
|
|
import { useEffect, useMemo, useState } from 'react' |
|
|
|
import Switch from '@/components/switch' |
|
|
|
import Action from '@/components/action/Action.tsx' |
|
|
|
import { BetaSchemaForm, ProColumns, ProFormColumnsType, ProTable } from '@ant-design/pro-components' |
|
|
|
import { |
|
|
|
BetaSchemaForm, |
|
|
|
ProColumns, |
|
|
|
ProFormColumnsType, |
|
|
|
ProFormDatePicker, |
|
|
|
ProFormUploadButton, |
|
|
|
ProTable |
|
|
|
} from '@ant-design/pro-components' |
|
|
|
import ListPageLayout from '@/layout/ListPageLayout.tsx' |
|
|
|
import { categoryByIdAtom, categoryIdAtom } from '@/store/videos/category.ts' |
|
|
|
import TagPro from '@/components/tag-pro/TagPro.tsx' |
|
|
@ -97,9 +106,57 @@ const Video = () => { |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.year`, 'Year'), |
|
|
|
'dataIndex': 'year', |
|
|
|
valueType: 'dateYear', |
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
}, |
|
|
|
render: (_dom, record) => { |
|
|
|
return record.year |
|
|
|
}, |
|
|
|
renderFormItem: (_schema, config) => { |
|
|
|
return <DatePicker |
|
|
|
picker={'year'} |
|
|
|
{...config} |
|
|
|
value={dayjs().set('year', config.value || new Date().getFullYear())} |
|
|
|
/> |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.category_id`, 'CategoryId'), |
|
|
|
'dataIndex': 'class_name', |
|
|
|
|
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.img`, '封面'), |
|
|
|
'dataIndex': 'pic', |
|
|
|
hideInSearch: true, |
|
|
|
hideInTable: true, |
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
}, |
|
|
|
renderFormItem: (_schema, _config, form) => { |
|
|
|
return <ProFormUploadButton |
|
|
|
fieldProps={{ |
|
|
|
name: 'file', |
|
|
|
listType: 'picture-card', |
|
|
|
data: { videoId: form.getFieldValue('video_id') }, |
|
|
|
headers: { |
|
|
|
'Authorization': `Bearer ${getToken()}` |
|
|
|
}, |
|
|
|
}} |
|
|
|
fileList={[]} |
|
|
|
action="/api/v1/videos/image/upload" |
|
|
|
/> |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.actor`, 'Actor'), |
|
|
|
'dataIndex': 'actor', |
|
|
@ -132,44 +189,7 @@ const Video = () => { |
|
|
|
'title': t(`${i18nPrefix}.columns.remarks`, 'Remarks'), |
|
|
|
'dataIndex': 'remarks' |
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.pubdate`, 'Pubdate'), |
|
|
|
'dataIndex': 'pubdate', |
|
|
|
valueType: 'dateTime', |
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.total`, 'Total'), |
|
|
|
'dataIndex': 'total', |
|
|
|
valueType: 'digit', |
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.serial`, 'Serial'), |
|
|
|
'dataIndex': 'serial', |
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.duration`, 'Duration'), |
|
|
|
'dataIndex': 'duration', |
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.year`, 'Year'), |
|
|
|
'dataIndex': 'year', |
|
|
|
valueType: 'dateYear', |
|
|
|
colProps: { |
|
|
|
span: 4 |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.tag`, 'Tag'), |
|
|
|
'dataIndex': 'tag', |
|
|
@ -181,7 +201,8 @@ const Video = () => { |
|
|
|
} |
|
|
|
}, |
|
|
|
renderFormItem: (schema, config) => { |
|
|
|
return <TagPro loading={isCategoryFetching} tags={category?.extend?.class?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
return <TagPro loading={isCategoryFetching} |
|
|
|
tags={category?.extend?.class?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
@ -194,7 +215,8 @@ const Video = () => { |
|
|
|
} |
|
|
|
}, |
|
|
|
renderFormItem: (schema, config) => { |
|
|
|
return <TagPro loading={isCategoryFetching} tags={category?.extend?.area?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
return <TagPro loading={isCategoryFetching} |
|
|
|
tags={category?.extend?.area?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
@ -207,24 +229,27 @@ const Video = () => { |
|
|
|
} |
|
|
|
}, |
|
|
|
renderFormItem: (schema, config) => { |
|
|
|
return <TagPro loading={isCategoryFetching} tags={category?.extend?.lang?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
return <TagPro loading={isCategoryFetching} |
|
|
|
tags={category?.extend?.lang?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
/*{ |
|
|
|
'title': t(`${i18nPrefix}.columns.version`, 'Version'), |
|
|
|
'dataIndex': 'version', |
|
|
|
|
|
|
|
renderFormItem: (schema, config) => { |
|
|
|
return <TagPro loading={isCategoryFetching} tags={category?.extend?.version?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
return <TagPro loading={isCategoryFetching} |
|
|
|
tags={category?.extend?.version?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.state`, 'State'), |
|
|
|
'dataIndex': 'state', |
|
|
|
renderFormItem: (schema, config) => { |
|
|
|
return <TagPro loading={isCategoryFetching} tags={category?.extend?.state?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
return <TagPro loading={isCategoryFetching} |
|
|
|
tags={category?.extend?.state?.split(',') ?? []} {...config} {...schema.fieldProps} /> |
|
|
|
} |
|
|
|
}, |
|
|
|
},*/ |
|
|
|
{ |
|
|
|
'title': t(`${i18nPrefix}.columns.douban_score`, 'DoubanScore'), |
|
|
|
'dataIndex': 'douban_score', |
|
|
|