"use client"; import React, { useState, useEffect } from "react"; 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"; export default function StreamerDetail({ params }) { //生成二维码 const [qrcodeUrl, setQrcodeUrl] = useState(""); useEffect(() => { var QRCode = require("qrcode"); QRCode.toDataURL( `https://tiefen.fun/${params.user_id}`, function (err, url) { setQrcodeUrl(url); } ); }, []); //页面数据 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(); }, []); 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}

))}
{qrcodeUrl && ( )}
); }