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

115 lines
3.5 KiB
React
Raw Normal View History

2024-11-26 16:18:39 +08:00
"use client";
import React, { useEffect, useState } from "react";
2024-12-13 18:24:36 +08:00
import { Toast, Image } from "antd-mobile";
2024-11-26 16:18:39 +08:00
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";
2024-12-13 18:24:36 +08:00
import { get, clear } from "@/utils/storeInfo";
2024-11-26 16:18:39 +08:00
export default function JoinEntrance() {
const router = useRouter();
2024-11-26 16:43:04 +08:00
const [guildState, setGuildState] = useState(null);
2024-11-26 16:18:39 +08:00
const [isLoading, setIsLoading] = useState(true);
2024-12-13 18:24:36 +08:00
const [account, setAccount] = useState(null);
2024-11-26 16:18:39 +08:00
useEffect(() => {
2024-12-13 18:24:36 +08:00
const getAccount = async () => {
const account = await get("account");
if (account) {
setAccount(account);
checkGuildState();
}
};
getAccount();
2024-11-26 16:18:39 +08:00
}, []);
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">
2024-11-27 17:27:27 +08:00
<div className="absolute inset-x-0 bottom-24 top-24 flex flex-col items-center justify-center gap-12">
2024-12-13 18:24:36 +08:00
<div
className="max-w-80"
onClick={() => account?.role !== 3 && router.push("joinStreamer")}
2024-11-26 16:18:39 +08:00
>
2024-12-13 18:24:36 +08:00
<Image
src={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
`/images/${
account?.role === 3 ? "streamerJoined" : "streamerJoin"
}.png`
}
placeholder=""
/>
</div>
<div className="max-w-80" onClick={() => router.push("joinGuild")}>
<Image
src={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
`/images/${guildState === 0 ? "guildJoined" : "guildJoin"}.png`
}
placeholder=""
/>
</div>
{/* <Button
2024-11-26 16:18:39 +08:00
size="middle"
shape="rounded"
block
style={{
2024-12-13 18:24:36 +08:00
backgroundImage: "url(../../../../images/streamerJoin.png)",
2024-11-26 16:18:39 +08:00
paddingLeft: "32px",
paddingRight: "32px",
}}
2024-11-26 16:43:04 +08:00
disabled={guildState === 0}
2024-11-26 16:18:39 +08:00
onClick={() => router.push("joinGuild")}
>
{guildState === 0 ? "已提交,资料审核中..." : "我是公会"}
2024-12-13 18:24:36 +08:00
</Button> */}
2024-11-26 16:18:39 +08:00
</div>
<LoadingMask isLoading={isLoading} />
</div>
</div>
);
}