tiefen_space_h5/app/my/streamerVerification/joinEntrance/page.jsx

95 lines
2.8 KiB
JavaScript

"use client";
import React, { useEffect, useState } from "react";
import { Button, Toast, Mask, SpinLoading } 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";
export default function JoinEntrance() {
const router = useRouter();
const [guildState, setGuildState] = useState(null);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
checkGuildState();
}, []);
const checkGuildState = async () => {
setIsLoading(true);
//上传表单
try {
const streamerData = await requireAPI(
"POST",
"/api/guild_registration/list",
null,
true
);
if (streamerData.ret === -1) {
Toast.show({
icon: "fail",
content: streamerData.msg,
position: 60,
});
return;
}
setGuildState(streamerData.data.list[0]?.status);
} catch (error) {
console.error(error);
} finally {
setIsLoading(false);
}
};
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="absolute inset-x-0 bottom-24 top-24 flex flex-col items-center justify-center gap-12">
<Button
size="middle"
shape="rounded"
block
style={{
"--background-color": "#FF669E",
paddingLeft: "32px",
paddingRight: "32px",
}}
onClick={() => router.push("joinStreamer")}
>
我是达人
</Button>
<Button
size="middle"
shape="rounded"
block
style={{
"--background-color": "#FF669E",
paddingLeft: "32px",
paddingRight: "32px",
}}
disabled={guildState === 0}
onClick={() => router.push("joinGuild")}
>
{guildState === 0 ? "已提交,资料审核中..." : "我是公会"}
</Button>
</div>
<LoadingMask isLoading={isLoading} />
</div>
</div>
);
}