Compare commits

...

2 Commits

6 changed files with 29 additions and 11 deletions

View File

@ -144,7 +144,7 @@ export default function ArticleEditModal(props: Props) {
<div className="text-lg flex gap-10 ">
{props.type == 'news' ? <button className="text-gray-400 hover:text-gray-800"></button> : null}
<button className="text-gray-400 hover:text-gray-800" onClick={() => props.onClose?.()}></button>
<button className="text-gray-800 hover:text-blue-500">{props.type == 'news' ? '确定' : '重新生成'}</button>
<button onClick={handleSave} className="text-gray-800 hover:text-blue-500">{props.type == 'news' ? '确定' : '重新生成'}</button>
</div>
</div>
</Modal>);

View File

@ -10,11 +10,15 @@ export default function EditSearchForm(props: {
}) {
const articleTags = useArticleTags()
const [tags, _setTags] = useState<Id[][]>([]);
const [prevSearchName, setPrevSearchName] = useState<string>()
const [params, setParams] = useSetState<ApiArticleSearchParams>({
pagination: {limit: 10, page: 1},
});
const handleSubmit = (_tags?:Id[][]) => {
const handleSubmit = (_tags?:Id[][],from?:'input') => {
if (from == 'input' && (params.title == prevSearchName || (!params.title && !prevSearchName))) return
params.title = prevSearchName;
setParams({title: prevSearchName})
const __tags = _tags || tags;
params.tags = __tags.length == 0 ? undefined : __tags.map(it => {
if (Array.isArray(it)) {
@ -28,7 +32,6 @@ export default function EditSearchForm(props: {
}
}
});
console.log('tags',params.tags)
props.onSubmit({
...params,
pagination: {
@ -47,14 +50,13 @@ export default function EditSearchForm(props: {
return (
<div className="search-form-input flex gap-2 items-center">
<Input
onChange={(e) => {
setParams({title: e.target.value})
}}
allowClear
value={prevSearchName}
onChange={e => setPrevSearchName(e.target.value)}
type="text" className="rounded-3xl px-3 w-[270px]"
prefix={<SearchOutlined/>}
placeholder="请输入新闻标题关键词进行搜索"
onPressEnter={()=>handleSubmit()}
onPressEnter={()=>handleSubmit(undefined,'input')}
onBlur={()=>handleSubmit(undefined,'input')}
/>
{/*<span className="ml-5 text-sm">来源</span>*/}
{/*<ArticleCascader*/}

View File

@ -44,7 +44,7 @@
}
}
.col{
@apply flex items-center relative pl-6;
@apply flex items-center justify-center relative pl-6;
height: 54px;
&:after{
@apply absolute;
@ -56,7 +56,7 @@
}
}
.title{
@apply flex-1 pl-0;
@apply flex-1 pl-0 justify-start;
&:after{
display: none;
}
@ -64,6 +64,10 @@
.source{
width: 150px;
}
.count-picture,.count-words{
width: 120px;
text-align: center;
}
.time{
width: 150px;
}

View File

@ -86,6 +86,8 @@ export default function NewEdit() {
<div className="header row flex">
<div className="col title"></div>
<div className="col source source"></div>
<div className="col count-picture"></div>
<div className="col count-words"></div>
<div className="col time"></div>
<div className="col operations"></div>
</div>
@ -109,6 +111,12 @@ export default function NewEdit() {
<div className="col source">
<div className="text-sm">{item.media_name}</div>
</div>
<div className="col count-picture">
<div className="text-sm">{item.picture_count||'-'}</div>
</div>
<div className="col count-words">
<div className="text-sm">{item.words_count||'-'}</div>
</div>
<div className="col time">
<div
className="text-sm">{formatTime(item.publish_time, 'YYYY-MM-DD HH:mm')}</div>
@ -127,7 +135,7 @@ export default function NewEdit() {
<div className="page-action">
<ButtonToTop visible={state.showToTop} onClick={()=>scrollerRef.current?.scrollToPosition(0)} />
<ButtonDeleteBatch ids={selectedRowKeys} onSuccess={refresh}/>
{selectedRowKeys?.length >0 && <ButtonDeleteBatch ids={selectedRowKeys} onSuccess={refresh}/>}
<ButtonPush2Video ids={selectedRowKeys} onSuccess={refresh}/>
</div>
</div>

View File

@ -158,6 +158,8 @@ export default function NewsIndex() {
<div className="line-clamp-1">: <span>{item.data_source_name}</span></div>
<div className="extras flex items-center justify-between gap-3">
<div><span>{formatTime(item.publish_time,'min')}</span></div>
<div><span>: {item.picture_count || '-'}</span></div>
<div><span>: {item.words_count || '-'}</span></div>
<div
className={`checkbox mt-1`}>
{item.internal_article_id > 0 ?

2
src/types/api.d.ts vendored
View File

@ -60,6 +60,8 @@ interface BasicArticleInfo {
summary: string;
publish_time: string;
media_name: string;
picture_count?: number;
words_count?: number;
media_id: number;
fanwen_column_id: number;
}