"use client"; import React, { useState, useEffect } from "react"; import html2canvas from "html2canvas"; import baseRequest from "@/utils/baseRequest"; import { Toast } from "antd-mobile"; import Divider from "@/components/Divider"; import { generateSignature } from "@/utils/crypto"; import Image from "next/image"; import icon_without_bg from "@/public/images/icon_without_bg.png"; import invite_girl from "@/public/images/invite_girl.png"; export default function Invite({ params }) { return (

邀请功能施工中,请等待开放。

); //获取页面数据、生成二维码 const [data, setData] = useState({}); const [qrcodeUrl, setQrcodeUrl] = 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(); var QRCode = require("qrcode"); QRCode.toDataURL("https://tiefen.fun", function (err, url) { setQrcodeUrl(url); }); }, []); //分享海报组件 const InvitePoster = () => { return (

{data?.name}

邀请码:{data?.user_id}

邀您加入 「铁粉空间」

); }; //保存图片 const saveImage = async () => { const element = document.getElementById("print"); const canvas = await html2canvas(element, { useCORS: true, }); const data = canvas.toDataURL("image/jpg"); window.ReactNativeWebView.postMessage( JSON.stringify({ type: "SAVE_IMAGE", data: data, }) ); }; //复制链接 const copyUrl = () => { window.ReactNativeWebView.postMessage( JSON.stringify({ type: "COPY_URL", data: `https://tiefen.fun/${params.user_id}`, }) ); }; return (

邀请好友
额外收益

5%

邀请Ta在“申请入驻”时填写您的邀请码

我的邀请成绩

5

邀请人数

100000

钻石收益

注意事项:

1.需要被邀请人在“申请入驻”时填写您的邀请码,并成功入驻才算邀请成功;

2.邀请收益为平台补助,不影响被邀请人原本钻石获取;

3.新增钻石收益需等待7x24小时方可提现;

4.如有其他疑问,请联系人工客服。

); }