From b95f6abdcc6f7ebf84678ad516b041cfa1649643 Mon Sep 17 00:00:00 2001 From: zhangjianjun Date: Thu, 9 Apr 2026 13:35:33 +0800 Subject: [PATCH] update --- public/index.html | 2 ++ src/api/app.ts | 2 +- src/components/layout/TopTabsSection/TopTabs.tsx | 3 +-- .../layout/TopTabsSection/index.module.css | 2 +- src/pages/Home/Home.module.css | 2 +- src/pages/Home/index.tsx | 14 +++++++++----- src/pages/News/NewsPublic.tsx | 2 +- src/pages/Others/Search.tsx | 2 +- src/pages/Social/Foundation.tsx | 2 +- src/pages/Social/Sustainability.tsx | 2 +- 10 files changed, 19 insertions(+), 14 deletions(-) diff --git a/public/index.html b/public/index.html index 40854a4..2b760f2 100644 --- a/public/index.html +++ b/public/index.html @@ -25,6 +25,8 @@ Learn how to configure a non-root public URL by running `npm run build`. --> 银泰 + + diff --git a/src/api/app.ts b/src/api/app.ts index 9715577..c8055c1 100644 --- a/src/api/app.ts +++ b/src/api/app.ts @@ -43,7 +43,7 @@ const app = { }); }, // 新闻列表 - getNewsList(params: Params & { title?: string, category_id?: string }) { + getNewsList(params: Params & { title?: string, category_id?: string, pinned?: string }) { return requests({ url: "/yt/api/news", method: "get", diff --git a/src/components/layout/TopTabsSection/TopTabs.tsx b/src/components/layout/TopTabsSection/TopTabs.tsx index 978e9f4..edf9fda 100644 --- a/src/components/layout/TopTabsSection/TopTabs.tsx +++ b/src/components/layout/TopTabsSection/TopTabs.tsx @@ -123,10 +123,9 @@ export default function TopTabs({ data, activeIndex, setActiveIndex, className } )} */}
-
{data.tabItems.map((item, index) => (
{banner?.content}} - backgroundImage={banner?.backgroundImage } + backgroundImage={banner?.backgroundImage} /> {/* Commercial */} @@ -82,7 +82,7 @@ export default function Home() { } -function News({data}: any) { +function News({ data }: any) { const locale = useStore((s) => s.locale); const categoryList = useStore((s) => s.categoryList); const [newsData, setNewsData] = useState([]); @@ -97,7 +97,11 @@ function News({data}: any) { const handleVideoPlay = () => { if (videoRef.current) { - videoRef.current.play(); + try { + videoRef.current.play(); + } catch (err) { + console.log('---video play error', err) + } } }; @@ -109,7 +113,7 @@ function News({data}: any) { }; const handleSearch = useCallback((category_id: any) => { - appApi.getNewsList({ page: 1, size: 6, sort: "create_time DESC", category_id }).then((res) => { + appApi.getNewsList({ page: 1, size: 6, sort: "weight DESC", pinned: "1", category_id }).then((res) => { const data = res.data.items.map((item: any) => { return { id: item.id, @@ -174,7 +178,7 @@ function News({data}: any) { {locale.startsWith("zh") ? dateFormat(item.date, "yyyy年MM月dd日") : dateFormat(item.date, "yyyy-MM-dd") - } + }
diff --git a/src/pages/News/NewsPublic.tsx b/src/pages/News/NewsPublic.tsx index 2a7780a..862edca 100644 --- a/src/pages/News/NewsPublic.tsx +++ b/src/pages/News/NewsPublic.tsx @@ -36,7 +36,7 @@ export default function NewsPublic() { const [searchValue, setSearchValue] = useState(""); const handleSearch = useCallback(() => { appApi.getNewsList({ - page, size, sort: "create_time DESC", title: searchValue, + page, size, sort: "weight DESC", title: searchValue, category_id: categoryId, }).then((res) => { const data = res.data.items.map((item: any) => { diff --git a/src/pages/Others/Search.tsx b/src/pages/Others/Search.tsx index aa216b5..0e2fd23 100644 --- a/src/pages/Others/Search.tsx +++ b/src/pages/Others/Search.tsx @@ -48,7 +48,7 @@ export default function Search() { size, title: searchKeyword, category_id: categoryId, - sort: "create_time DESC", + sort: "weight DESC", }).then((res) => { setSearched(true); const data = res.data.items.map((item: any) => { diff --git a/src/pages/Social/Foundation.tsx b/src/pages/Social/Foundation.tsx index d03a7e6..c434462 100644 --- a/src/pages/Social/Foundation.tsx +++ b/src/pages/Social/Foundation.tsx @@ -29,7 +29,7 @@ export default function Foundation() { }, [newsList, locale]) const getNewsList = useCallback(() => { appApi.getNewsList({ - page: 1, size: 1000, sort: "create_time DESC", + page: 1, size: 1000, sort: "weight DESC", category_id: String(categoryList?.find((item: any) => item.name.includes('【银泰公益基金会】公益传播'))?.id ?? ''), }).then((res: any) => { setNewsList(res.data.items.map((item: any) => { diff --git a/src/pages/Social/Sustainability.tsx b/src/pages/Social/Sustainability.tsx index f450971..d1b6233 100644 --- a/src/pages/Social/Sustainability.tsx +++ b/src/pages/Social/Sustainability.tsx @@ -46,7 +46,7 @@ export default function Sustainability() { appApi.getNewsList({ page: 1, size: 8, - sort: "create_time DESC", + sort: "weight DESC", category_id: String(categoryList?.find((item: any) => item.name.includes('【可持续发展】社会责任案例集'))?.id ?? ''), }).then((res) => { const items = res.data.items.map((item: any) => {