import React, { useMemo } from "react"; import { formatTimestamp, goToPage } from "@/utils/tools"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleRight } from "@fortawesome/free-solid-svg-icons"; import { useRouter } from "next/navigation"; import { Image } from "antd-mobile"; export default function NoticeItem({ navigation, leftIcon, hasLink, data }) { const router = useRouter(); const currentLink = useMemo(() => { if (hasLink && data?.hyperlinks) { const hasAppLink = data.hyperlinks.filter( (it) => it.action === "app_router_path" )[0]; return hasAppLink ?? null; } }, [data]); return (
{/* 内容 */}
{/* 文本内容 */}
{/* 头像 */}
{/* */} {leftIcon}

{data?.title}

              {data?.message}
            
{/* 链接跳转 */} {!!data?.hyperlinks && (
{}} className="rounded-xl p-2 flex flex-row items-center my-2 bg-[#FFFFFF1A]" >
{ const links = data?.hyperlinks; if (links) { // const linkAndParams = goToPage( // links[1]?.params // ); // if (linkAndParams) { // typeof linkAndParams === "object" // ? router.push(...linkAndParams) // : router.push(linkAndParams); // } if (links.length > 1) { links[1]?.action === "app_router_path"; router.push(links[1]?.params); } else { links[0]?.action === "outward"; router.push(links[0]?.params); } } }} > {hasLink.text}
)}
{/* 时间 */}
{formatTimestamp(data?.push_time || data?.ct)}
); }