2024-07-10 16:50:53 +08:00
|
|
|
|
"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 (
|
|
|
|
|
<div className="">
|
|
|
|
|
<div className="p-4 fixed top-0 z-10 w-full">
|
2024-07-30 22:53:41 +08:00
|
|
|
|
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full float-left absolute">
|
2024-07-10 16:50:53 +08:00
|
|
|
|
<FontAwesomeIcon
|
|
|
|
|
icon={faAngleLeft}
|
|
|
|
|
size="xl"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
router.back();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-base text-center leading-9">分享空间</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="w-full flex flex-col p-4 pt-16">
|
|
|
|
|
<div onClick={copyShareCode} className="flex justify-between pt-4 pb-2">
|
|
|
|
|
<span className="text-base text-white">复制口令</span>
|
|
|
|
|
<FontAwesomeIcon
|
|
|
|
|
icon={faAngleRight}
|
|
|
|
|
size="xl"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Divider />
|
|
|
|
|
<div
|
|
|
|
|
onClick={copyShareUrl}
|
|
|
|
|
className="flex justify-between w-full pt-4 pb-2"
|
|
|
|
|
>
|
|
|
|
|
<span className="text-base text-white">复制邀请链接</span>
|
|
|
|
|
<FontAwesomeIcon
|
|
|
|
|
icon={faAngleRight}
|
|
|
|
|
size="xl"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Divider />
|
|
|
|
|
<div
|
|
|
|
|
onClick={() => {
|
2024-07-18 23:20:42 +08:00
|
|
|
|
router.push("/space/share/" + streamerInfo?.streamer_ext?.user_id)
|
2024-07-10 16:50:53 +08:00
|
|
|
|
}}
|
|
|
|
|
className="flex justify-between pt-4 pb-2"
|
|
|
|
|
>
|
|
|
|
|
<span className="text-base text-white">生成分享卡片</span>
|
|
|
|
|
<FontAwesomeIcon
|
|
|
|
|
icon={faAngleRight}
|
|
|
|
|
size="xl"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Divider />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|