"use client"; import React, { useEffect, useRef, useState } from "react"; import { Image, Swiper, Divider, ImageViewer, Popover, Toast, } from "antd-mobile"; import { useRouter, useParams } from "next/navigation"; import Link from "next/link"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleLeft, faAngleRight, faEllipsisVertical, faCopy, faWarning, } from "@fortawesome/free-solid-svg-icons"; import require from "@/utils/require"; import AddWeChat from "@/components/AddWeChat"; import { handleFollow, checkRelation } from "@/api/public"; import { getStreamerDetailInfo } from "@/api/space"; import { get } from "@/utils/storeInfo"; import { handleShowVideos } from "@/utils/tools/handleFuns"; import clipboard from "copy-to-clipboard"; // import * as Clipboard from "expo-clipboard"; export default function PersonSpace() { const { mid } = useParams(); const router = useRouter(); const [streamerInfo, setStreamerInfo] = useState(null); const [spaceData, setSpaceData] = useState(null); const [loading, setLoading] = useState(false); const [visible, setVisible] = useState(false); const [isFollow, setIsFollow] = useState(false); const [topPhotos, setTopPhotos] = useState([]); // 获取屏幕高度 // const scrollHeight = 600; useEffect(() => { handleGetStreamerInfo(); getSpaceData(); getRelationData(); }, []); const showPhotos = (photos, index) => { ImageViewer.Multi.show({ images: photos.map((item) => item.url), defaultIndex: index, }); }; const handleGetStreamerInfo = async () => { try { setLoading(true); const data = await getStreamerDetailInfo(Number(mid)); setStreamerInfo({ ...data, }); const photosArr = [ ...data?.streamer_ext?.cover?.images?.map((item) => ({ url: item.urls[0], type: "video", })), ...data?.streamer_ext?.album?.images.map((item) => ({ url: item.urls[0], type: "img", })), ]; // console.log("photosArr", photosArr); setTopPhotos(photosArr); setLoading(false); } catch (error) { console.error(error); } }; const getSpaceData = async () => { try { const data = await require("POST", "/api/zone/list_by_mid", { body: { mid: Number(mid), }, }); if (data.ret === -1) { Toast.show({ icon: "fail", content: data.msg, position: "top", }); return; } setSpaceData(data.data.list[0]); } catch (error) { console.error(error); } }; const getRelationData = async () => { const account = get("account"); const subMid = account.mid; const objMid = Number(mid); const temIsFollowed = await checkRelation(subMid, objMid, 0); setIsFollow(temIsFollowed); }; //保存内容到剪贴板 const copy = (_data) => { console.log("_data", _data); clipboard(_data); Toast.show({ icon: "success", content: "已复制到剪贴板", position: "top", }); }; return (
{streamerInfo?.streamer_ext?.name}
个性签名| {streamerInfo?.streamer_ext?.bio}
)}来这找我玩