"use client"; import React, { useEffect, useState } from "react"; import { Divider, Toast } from "antd-mobile"; import { useRouter, useParams, useSearchParams } from "next/navigation"; import clipboard from "copy-to-clipboard"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleLeft, faAngleRight, faWallet, faPrint, faDollar, } from "@fortawesome/free-solid-svg-icons"; import { getStreamerInfo } from "@/api/space"; export default function ShareSpace({ data }) { const router = useRouter(); const { mid } = useParams(); const searchParams = useSearchParams(); const webUrl = process.env.NEXT_PUBLIC_WEB_URL; const [streamerInfo, setStreamerInfo] = useState(null); useEffect(() => { getStreamerInfo(Number(mid)).then((res) => { setStreamerInfo(res); }); }, []); //保存内容到剪贴板 const copy = (_data) => { // console.log("_data",_data) clipboard(_data); Toast.show({ icon: "success", content: "已复制到剪贴板", position: "top", }); }; //复制口令 const copyShareCode = () => { const shareCode = `【${streamerInfo?.streamer_ext?.name}】『ID:${streamerInfo?.streamer_ext?.user_id}』,复制此条消息,打开铁粉空间APP,查看详情${webUrl}/zone/${streamerInfo?.streamer_ext?.user_id}`; copy(shareCode); }; //复制邀请链接 const copyShareUrl = () => { const shareCode = `${webUrl}/zone/${streamerInfo?.streamer_ext?.user_id}`; // console.log("shareCode", shareCode); copy(shareCode); }; return (
{ router.back(); }} />

分享空间

复制口令
复制邀请链接
{ router.push("/space/share/" + streamerInfo?.streamer_ext?.user_id) }} className="flex justify-between pt-4 pb-2" > 生成分享卡片
); }