feat: 新闻编辑
This commit is contained in:
parent
0592d97e39
commit
58ace4514b
@ -27,12 +27,12 @@
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #999;
|
||||
background: #ccc;
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
|
||||
&:hover {
|
||||
background: #666;
|
||||
background: #999;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
@ -11,19 +11,46 @@ type Props = {
|
||||
errorMessage?: string;
|
||||
}
|
||||
|
||||
|
||||
function pushBlocksToGroup(blocks: BlockContent[],groups: BlockContent[][]){
|
||||
const lastGroup = groups[groups.length - 1]
|
||||
if (lastGroup && lastGroup.filter(s=>s.type == 'text') == 0) {
|
||||
// 如果上一个group中没有文本则直接合并
|
||||
lastGroup.push(...blocks)
|
||||
} else {
|
||||
groups.push(blocks)
|
||||
}
|
||||
}
|
||||
|
||||
function rebuildGroups(groups: BlockContent[][]) {
|
||||
if (groups.length < 2) {
|
||||
Array(2 - groups.length).fill([{type: 'text', content: ''}]).forEach((it) => {
|
||||
groups.push(it)
|
||||
const _groups: BlockContent[][] = [];
|
||||
if (!groups || groups.length == 0) return _groups;
|
||||
groups.forEach((blocks,index) => {
|
||||
if(!blocks) return;
|
||||
if (blocks.length == 1) {
|
||||
if(index == 0) _groups.push(blocks)
|
||||
else pushBlocksToGroup(blocks,_groups)
|
||||
} else {
|
||||
if(index == 0){
|
||||
_groups.push([blocks[0]])
|
||||
_groups.push(blocks.slice(1))
|
||||
}else{
|
||||
pushBlocksToGroup(blocks,_groups)
|
||||
}
|
||||
}
|
||||
});
|
||||
if (_groups.length < 2) {
|
||||
Array(2 - _groups.length).fill([{type: 'text', content: ''}]).forEach((it) => {
|
||||
_groups.push(it)
|
||||
})
|
||||
}
|
||||
|
||||
return groups;
|
||||
console.log('rebuildGroups', _groups)
|
||||
return _groups;
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default function ArticleGroup({groups: _groups, editable, onChange,errorMessage}: Props) {
|
||||
export default function ArticleGroup({groups: _groups, editable, onChange, errorMessage}: Props) {
|
||||
const groups = rebuildGroups(_groups)
|
||||
/**
|
||||
* 添加一个组
|
||||
|
@ -2,7 +2,7 @@ import {useSortable} from "@dnd-kit/sortable";
|
||||
import {useSetState} from "ahooks";
|
||||
import React, {useEffect} from "react";
|
||||
import {clsx} from "clsx";
|
||||
import {Popconfirm} from "antd";
|
||||
import {Image, Popconfirm} from "antd";
|
||||
import {CheckCircleFilled, MenuOutlined, MinusCircleFilled} from "@ant-design/icons";
|
||||
|
||||
import ImageCover from '@/assets/images/cover.png'
|
||||
@ -50,8 +50,8 @@ export const VideoListItem = (
|
||||
<div
|
||||
className={`video-item-info flex gap-2 flex-1 bg-gray-100 h-[80px] overflow-hidden rounded-lg p-3 shadow-blue-500 ${active ? 'video-item-shadow' : ''}`}>
|
||||
<div className={'video-title leading-7 flex-1'}>{video.title || video.video_title}</div>
|
||||
<div className={'video-item-cover'}>
|
||||
<img className="w-[100px] rounded-md" src={video.cover_url || ImageCover} alt={video.video_title}/>
|
||||
<div className={'video-item-cover bg-white rounded-md overflow-hidden'}>
|
||||
<img className="w-[100px] h-[56px] object-cover" src={video.cover_url || video.cover || ImageCover} alt={video.video_title}/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="operation flex items-center ml-2 gap-3 text-lg text-gray-400">
|
||||
|
@ -1,13 +1,12 @@
|
||||
import {useState} from "react";
|
||||
import {Checkbox, Empty, Modal, Pagination, Space} from "antd";
|
||||
import {useRequest, useSetState} from "ahooks";
|
||||
import {useRequest} from "ahooks";
|
||||
|
||||
import {Card} from "@/components/card";
|
||||
import {getList} from "@/service/api/article.ts";
|
||||
|
||||
import SearchPanel from "@/pages/news/components/search-panel.tsx";
|
||||
import styles from './style.module.scss'
|
||||
import {getById} from "@/service/api/news.ts";
|
||||
import {getById,getList} from "@/service/api/news.ts";
|
||||
import {showLoading} from "@/components/message.ts";
|
||||
import {formatTime} from "@/util/strings.ts";
|
||||
import ButtonPushNews2Article from "@/pages/news/components/button-push-news2article.tsx";
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {post} from "@/service/request.ts";
|
||||
|
||||
export function getList(data: ApiArticleSearchParams & ApiRequestPageParams) {
|
||||
return post<DataList<ListCrawlerNewsItem>>({url: '/article/search', data})
|
||||
return post<DataList<ListCrawlerNewsItem>>({url: '/spider/search', data})
|
||||
}
|
||||
|
||||
export function getById(id: Id) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user