|
|
@ -1,31 +1,68 @@
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 邀请 分享页
|
|
|
|
|
|
|
|
*/
|
|
|
|
'use client';
|
|
|
|
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
import { useEffect, useState, useCallback } from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import Image from 'next/image';
|
|
|
|
|
|
|
|
|
|
|
|
import DownloadButton from '@/components/DownloadButton';
|
|
|
|
import DownloadButton from '@/components/DownloadButton';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function fetchInviteInfo(code: string) {
|
|
|
|
|
|
|
|
const res = await fetch(`${process.env.NEXT_PUBLIC_HOST}/user/my/userInfo/invite?inviteCode=${code}`);
|
|
|
|
|
|
|
|
return res.json();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default function Invite() {
|
|
|
|
export default function Invite() {
|
|
|
|
|
|
|
|
const [inviteCode, setInviteCode] = useState<string | null>(null);
|
|
|
|
|
|
|
|
const [userInfo, setUserInfo] = useState<{ nickName: string; avatar: string; inviteCode: string } | null>(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getInviteInfo = useCallback(
|
|
|
|
|
|
|
|
(code: string) => {
|
|
|
|
|
|
|
|
fetchInviteInfo(code).then((res) => {
|
|
|
|
|
|
|
|
if (res.data) setUserInfo(res.data);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
[inviteCode],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
document.title = '加入雀乐';
|
|
|
|
document.title = '加入雀乐';
|
|
|
|
|
|
|
|
const searchParams = new URLSearchParams(window.location.search);
|
|
|
|
|
|
|
|
const code = searchParams.get('code');
|
|
|
|
|
|
|
|
if (code) {
|
|
|
|
|
|
|
|
setInviteCode(code);
|
|
|
|
|
|
|
|
getInviteInfo(code);
|
|
|
|
|
|
|
|
}
|
|
|
|
}, []);
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<main className="max-w-screen-sm min-h-screen mx-auto flex flex-col justify-between items-center font-normal text-#000/95 bg-#f3f2f7 px-18px pb-50px">
|
|
|
|
<main className="max-w-screen-sm min-h-screen mx-auto flex flex-col justify-between items-center font-normal text-#000/95 bg-#f3f2f7 px-18px pb-50px">
|
|
|
|
<div className="flex flex-col justify-between mx-auto">
|
|
|
|
<div className="flex flex-col justify-between items-center">
|
|
|
|
<div className="mt-34px"></div>
|
|
|
|
<Image
|
|
|
|
|
|
|
|
width="56"
|
|
|
|
|
|
|
|
height="56"
|
|
|
|
|
|
|
|
className="mt-34px object-cover rounded-full"
|
|
|
|
|
|
|
|
src={userInfo?.avatar ?? ''}
|
|
|
|
|
|
|
|
alt=""
|
|
|
|
|
|
|
|
unoptimized
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mt-13px flex flex-col justify-between items-center">
|
|
|
|
<div className="mt-13px flex flex-col justify-between items-center">
|
|
|
|
<p className="text-17px leading-23.8px">{`${1},邀请你加入雀乐`}</p>
|
|
|
|
<p className="text-17px leading-23.8px">{`${userInfo?.nickName ?? ''},邀请你加入雀乐`}</p>
|
|
|
|
<p className="w-fit mt-1px text-12px leading-16.8px text-#000/40">一起 记录独立音乐</p>
|
|
|
|
<p className="w-fit mt-1px text-12px leading-16.8px text-#000/40">一起 记录独立音乐</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="flex justify-between items-center w-278px h-103px mt-14px pl-30px pr-25px bg-#fff">
|
|
|
|
<div className="flex justify-between items-center w-278px h-103px mt-14px pl-30px pr-25px rounded-6px bg-#fff">
|
|
|
|
<img className="w-42px h-42px rounded-full" src="/img/share.png" alt="" />
|
|
|
|
<Image width="42" height="42" className="rounded-full" src="/img/share.png" alt="" unoptimized />
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div className="flex items-center text-17px leading-23.8px">
|
|
|
|
<div className="flex items-center text-17px leading-23.8px">
|
|
|
|
<div>推荐码</div>
|
|
|
|
<div>推荐码</div>
|
|
|
|
<div className="w-1px h-14.5px mx-9px bg-#000/10" />
|
|
|
|
<div className="w-1px h-14.5px mx-9px bg-#000/10" />
|
|
|
|
<div>xxxxxxx</div>
|
|
|
|
<div>{userInfo?.inviteCode ?? ''}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<p className="text-12px leading-16.8px text-#000/40">填写邀请码,双方均可获得积分</p>
|
|
|
|
<p className="text-12px leading-16.8px text-#000/40">填写邀请码,双方均可获得积分</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|