"use client"; import React, { useState, useEffect } from "react"; import { Toast, Modal } from "antd-mobile"; import baseRequest from "@/utils/baseRequest"; import { generateSignature } from "@/utils/crypto"; import copy from "@/utils/copy"; import { setCookie } from "cookies-next"; import InOtherApp from "@/components/InOtherApp"; import { useRouter } from "next/navigation"; export default function Zone({ params }) { const router = useRouter(); const [deviceType, setDeviceType] = useState(""); useEffect(() => { const userAgent = navigator.userAgent; //区分设备类型 if (/Android/i.test(userAgent)) { setDeviceType("Android"); } else if (/iPhone|iPad|iPod/i.test(userAgent)) { setDeviceType("ios"); } else { setDeviceType("pc"); } }, []); //页面数据 const [data, setData] = useState({}); useEffect(() => { const getData = async () => { try { const base = baseRequest(); const body = { user_id: parseInt(params.user_id, 10), ...base, }; const signature = generateSignature(body); const _response = await fetch( `/api/zone/list_by_user_id_from_outside?signature=${signature}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(body), } ); const _data = await _response.json(); if (_data.ret === -1) { Toast.show({ content: _data.msg, }); return; } setData(_data.data.list[0]); } catch (error) { console.error(error); } }; getData(); }, []); //将主播链接复制到剪贴板,并存cookie,并打开modal const showModal = () => { setCookie("inviter", data?.streamer_ext?.user_id); copy( `【${data?.streamer_ext?.name}】『ID:${data?.streamer_ext?.user_id}』,复制此条消息,打开铁粉空间APP,查看详情https://tiefen.fun/zone/${data?.streamer_ext?.user_id}` ); Modal.show( deviceType === "ios" ? { showCloseButton: true, closeOnAction: true, actions: [ { key: "download", text: "前往下载", primary: true, onClick: () => router.push("/"), }, { key: "web", text: "手机网页版", onClick: () => router.push( `https://app.tiefen.fun?inviter=${data?.streamer_ext?.user_id}` ), }, ], content: (

{`请打开或下载【铁粉空间】APP,根据APP内弹窗指引加入空间。如未弹出,请在APP搜索ID:${data?.streamer_ext?.user_id},加入空间。`}

), } : { showCloseButton: true, closeOnAction: true, actions: [ { key: "download", text: "前往下载", primary: true, onClick: () => router.push("/"), }, ], content: (

{`请打开或下载【铁粉空间】APP,根据APP内弹窗指引加入空间。如未弹出,请在APP搜索ID:${data?.streamer_ext?.user_id},加入空间。`}

), } ); }; return (

{data?.streamer_ext?.name}

{data?.streamer_ext?.user_id}

{data?.zone_moment_count}

动态

{data?.image_count}

照片

{data?.video_count}

视频

空间介绍

{data?.profile}

{data?.streamer_ext?.album?.images?.map((item, index) => { if (index > 2) return; return (
); })}

查看更多内容

解锁Ta的微信

立即加入

加入须知

1、加入后,您可以查看空间内相关内容;

2、本空间由空间主人自行创建,加入空间前请确认相关风险,本平台不提供相关保证,请避免上当受骗;

3、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理。

); }