"use client"; import React, { useState, useEffect } from "react"; import AuthBar from "@/components/AuthBar"; import WechatBar from "./_components/WechatBar"; import baseRequest from "@/utils/baseRequest"; import { Toast } from "antd-mobile"; import InOtherApp from "@/components/InOtherApp"; import { generateSignature } from "@/utils/crypto"; import Image from "next/image"; import verification from "@/public/icon/verification.png"; import icon_border from "@/public/images/icon_border.png"; import Link from "next/link"; import { setCookie } from "cookies-next"; import copy from "@/utils/copy"; export default function StreamerDetail({ params }) { //页面数据 const [data, setData] = useState({}); useEffect(() => { const getData = async () => { try { const base = baseRequest(); const signature = generateSignature({ user_id: parseInt(params.user_id, 10), ...base, }); const detailResponse = await fetch( `/api/streamer/list_ext_by_user_id?signature=${signature}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ user_id: parseInt(params.user_id, 10), ...base, }), } ); const detailData = await detailResponse.json(); if (detailData.ret === -1) { Toast.show({ content: detailData.msg, }); return; } setData(detailData.data.streamer_ext); } catch (error) { console.error(error); } }; getData(); }, []); //将主播链接复制到剪贴板,并存cookie const copyAndSetCookieInviter = () => { setCookie("inviter", data?.user_id); copy( `【${data?.name}】『ID:${data?.user_id}』,复制此条消息,打开铁粉空间APP,查看详情https://tiefen.fun/${data?.user_id}` ); }; return (

{data?.name}

{data?.bio}

{data?.platforms?.map((item, index) => (
window.open(item.url, "_blank")} className="flex flex-row cursor-pointer bg-[#07050A] border-2 border-[#FFFFFF26] rounded-2xl h-12 items-center justify-center mt-4" >

{item.link_name}|{item.nickname}

))}

铁粉空间

下载APP探索更多

立即下载

); }