import React from "react"; import { formatTimestamp } from "@/utils/tools"; import { Toast } from "antd-mobile"; import { useRouter } from "next/navigation"; import OwnImage from "@/components/OwnImage"; import OwnIcon from "@/components/OwnIcon"; import baseRequest from "@/utils/baseRequest"; export default function NoticeItem({ leftIcon, hasLink, data }) { const router = useRouter(); const base = baseRequest(); return (
{/* 内容 */}
{/* 文本内容 */}
{/* 头像 */}
{/* */} {leftIcon}

{data?.title}

              {data?.message}
            
{/* 链接跳转 */} {data?.hyperlinks && data?.hyperlinks[0].action && (
{}} className="rounded-xl p-2 flex flex-row items-center my-2 bg-[#FFFFFF1A]" >
{ if (!data.is_valid) { Toast.show({ icon: "fail", content: "此链接已失效", position: "top", }); return; } const links = data?.hyperlinks; if (links) { if (links.length > 1) { links[1]?.action === "app_router_path"; router.push(links[1]?.params); } else { if (links[0]?.action === "outward") { // 在新的标签也打开 window.open(links[0]?.params); } else { // alert(links[0]?.params); // alert(encodeURIComponent(links[0]?.params)); router.push( `/webView/${encodeURIComponent( links[0]?.params + (links[0]?.action === "webViewWithOutHeaderInward" || links[0]?.action === "webViewHeaderInward" ? `?base=${encodeURIComponent( JSON.stringify(base) )}` : "") )}` ); } } } }} > {hasLink.text}
{/* */}
)}
{/* 时间 */}
{formatTimestamp(data?.push_time || data?.ct)}
); }