diff --git a/src/components/scoller/infinite-scroller.tsx b/src/components/scoller/infinite-scroller.tsx index d08ed1c..8fda0c3 100644 --- a/src/components/scoller/infinite-scroller.tsx +++ b/src/components/scoller/infinite-scroller.tsx @@ -61,8 +61,8 @@ const InfiniteScroller = React.forwardRef }> - {props.loading &&
}
{props.children}
+ {props.loading &&
} {props?.pagination && props.pagination.total > props.pagination.limit * props.pagination.page && (props.loadingPlaceholder ||
加载中...
diff --git a/src/pages/live/index.tsx b/src/pages/live/index.tsx index 6d052bf..9e261d4 100644 --- a/src/pages/live/index.tsx +++ b/src/pages/live/index.tsx @@ -128,7 +128,14 @@ export default function LiveIndex() { useEffect(initPlayingState, [videoData]) useEffect(() => { loadList() - return clearAllTimer; + return ()=>{ + clearAllTimer(); + try{ + Array.from(document.querySelectorAll('video')).forEach(v => v.pause()) + }catch (e){ + console.log(e) + } + } }, []) const processDeleteVideo = async (ids: Id[]) => { diff --git a/src/pages/news/components/edit-search-form.tsx b/src/pages/news/components/edit-search-form.tsx index 1730b32..9378fa4 100644 --- a/src/pages/news/components/edit-search-form.tsx +++ b/src/pages/news/components/edit-search-form.tsx @@ -1,18 +1,20 @@ import {Input} from "antd"; import {SearchOutlined} from "@ant-design/icons"; -import React, {useState} from "react"; +import React, {useEffect, useState} from "react"; import {useSetState} from "ahooks"; import useArticleTags from "@/hooks/useArticleTags.ts"; import TagSelect from "@/components/form/tag-select.tsx"; export default function EditSearchForm(props: { onSubmit: (values: ApiArticleSearchParams) => void; + defaultParams?: Partial; }) { const articleTags = useArticleTags() const [tags, _setTags] = useState([]); - const [prevSearchName, setPrevSearchName] = useState() + const [prevSearchName, setPrevSearchName] = useState(props.defaultParams?.title||'') const [params, setParams] = useSetState({ pagination: {limit: 10, page: 1}, + title:props.defaultParams?.title||'' }); const handleSubmit = (_tags?:Id[][],from?:'input') => { @@ -40,6 +42,20 @@ export default function EditSearchForm(props: { } }) } + useEffect(()=>{ + const {defaultParams} = props; + if(!defaultParams){ + return; + } + const tags = [] + + if(defaultParams.tags){ + defaultParams.tags.forEach(it=>{ + tags.push([it.level1, it.level2]) + }) + _setTags(tags) + } + },[articleTags]) const setTags = (_tags: Id[][])=>{ console.log(_tags) diff --git a/src/pages/news/components/search-panel.tsx b/src/pages/news/components/search-panel.tsx index cc6e889..e0c0a09 100644 --- a/src/pages/news/components/search-panel.tsx +++ b/src/pages/news/components/search-panel.tsx @@ -59,7 +59,6 @@ export default function SearchPanel({onSearch,defaultParams}: SearchPanelProps) if(defaultParams.tag_level_2_id){ _state.tag_level_2_id = defaultParams.tag_level_2_id } - console.log('xaf',_state) setState(_state) },[tags]) const [pinnedTag, setPinnedTag] = useLocalStorageState( diff --git a/src/pages/news/edit.tsx b/src/pages/news/edit.tsx index 05b7073..72b9d95 100644 --- a/src/pages/news/edit.tsx +++ b/src/pages/news/edit.tsx @@ -16,7 +16,9 @@ import ButtonToTop from "@/components/scoller/button-to-top.tsx"; import ButtonDeleteBatch from "@/pages/news/components/button-delete-batch.tsx"; import {showErrorToast, showToast} from "@/components/message.ts"; - +const FilterCache: Partial = { + tags: [], +} export default function NewEdit() { const [state, setState] = useState<{ checkAll?: boolean; @@ -26,12 +28,15 @@ export default function NewEdit() { const [selectedRowKeys, setSelectedRowKeys] = useState([]) const [params, setParams] = useState({ - pagination: {page: 1, limit: 10} + pagination: {page: 1, limit: 10}, + ...FilterCache }) const [data, setData] = useState>() const {refresh, loading} = useRequest(() => getList(params), { refreshDeps: [params], onSuccess: (data) => { + FilterCache.title = params.title; + FilterCache.tags = params.tags; setData(prev => { // 判断页码是否是第1页 if (data.pagination.page == 1) return data; @@ -69,7 +74,7 @@ export default function NewEdit() { return (
- + {/**/}
diff --git a/src/pages/video/index.tsx b/src/pages/video/index.tsx index 12fd083..4481ebd 100644 --- a/src/pages/video/index.tsx +++ b/src/pages/video/index.tsx @@ -88,6 +88,14 @@ export default function VideoIndex() { loadList(); showToast('调整视频顺序失败,请重试!', 'warning') }) + + return ()=>{ + try{ + Array.from(document.querySelectorAll('video')).forEach(v => v.pause()) + }catch (e){ + console.log(e) + } + } } // useEffect(loadList, [])