"use client"; import React, { useEffect, useState } from "react"; import { Toast, Image } from "antd-mobile"; import { useRouter } from "next/navigation"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleLeft } from "@fortawesome/free-solid-svg-icons"; import requireAPI from "@/utils/requireAPI"; import LoadingMask from "@/components/LoadingMask"; import { get, clear } from "@/utils/storeInfo"; export default function JoinEntrance() { const router = useRouter(); const [guildState, setGuildState] = useState(null); const [isLoading, setIsLoading] = useState(true); const [streamerState, setStreamerState] = useState(null); useEffect(() => { setIsLoading(true); checkGuildState(); checkStreamerState(); setIsLoading(false); }, []); const checkStreamerState = async () => { //获取当前审批状态 const streamerData = await requireAPI( "POST", "/api/streamer_auth_approval/get_statuses", {} ); if (streamerData.ret === -1) { Toast.show({ icon: "fail", content: streamerData.msg, position: 60, }); return; } setStreamerState(streamerData.data); }; const checkGuildState = async () => { //上传表单 try { const guildData = await requireAPI( "POST", "/api/guild_registration/list", null, true ); if (guildData.ret === -1) { Toast.show({ icon: "fail", content: guildData.msg, position: 60, }); return; } setGuildState(guildData.data.list[0]?.status); } catch (error) { console.error(error); } }; return ( <div> {/* 头部标题 */} <div className="p-4 fixed top-0 z-10 w-full bg-black flex justify-between items-center"> <div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full"> <FontAwesomeIcon icon={faAngleLeft} style={{ maxWidth: "12px" }} size="xl" onClick={() => { router.back(); }} /> </div> <p className="text-base text-center leading-9">申请入驻</p> <div></div> </div> {/* 内容 */} <div className="h-screen relative"> <div className="mt-20 flex flex-col items-center justify-center gap-6"> <div className="max-w-80" onClick={() => (streamerState?.basic_status === 2 || streamerState?.basic_status === 4) && router.push("joinStreamer") } > <Image src={ process.env.NEXT_PUBLIC_WEB_ASSETS_URL + `/images/${ streamerState?.basic_status === 2 || streamerState?.basic_status === 4 ? "streamerJoin" : "streamerJoined" }.png` } placeholder="" /> </div> <div className="max-w-80" onClick={() => guildState !== 0 && router.push("joinGuild")} > <Image src={ process.env.NEXT_PUBLIC_WEB_ASSETS_URL + `/images/${guildState === 0 ? "guildJoined" : "guildJoin"}.png` } placeholder="" /> </div> {/* <Button size="middle" shape="rounded" block style={{ backgroundImage: "url(../../../../images/streamerJoin.png)", paddingLeft: "32px", paddingRight: "32px", }} disabled={guildState === 0} onClick={() => router.push("joinGuild")} > {guildState === 0 ? "已提交,资料审核中..." : "我是公会"} </Button> */} </div> <LoadingMask isLoading={isLoading} /> </div> </div> ); }