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