"use client"; import OwnInput from "@/components/OwnInput"; import { Button, Divider, TextArea, Toast } from "antd-mobile"; import React, { useEffect, useState } from "react"; import { useRouter, useSearchParams, useParams } from "next/navigation"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleRight, faAngleLeft } from "@fortawesome/free-solid-svg-icons"; import { getStreamerInfo } from "@/api/space"; import requireAPI from "@/utils/requireAPI"; export default function SpaceIntroSetting() { const params = useParams(); const router = useRouter(); const [data, setData] = useState({}); const [isSubmitting, setIsSubmitting] = useState(false); //空间介绍 const [spaceIntro, setSpaceIntro] = useState(""); useEffect(() => { // const _data = decodeURIComponent(searchParams.get("data")); const { mid } = params; getStreamerInfo(parseInt(mid, 10)).then((res) => { setData(res); setSpaceIntro(res?.profile); }); }, []); const handleSubmit = async () => { if (!spaceIntro) { Toast.show({ icon: "fail", content: "请完善内容后提交", position: "top", }); return; } if (isSubmitting) return; setIsSubmitting(true); try { const body = { id: data.id, profile: spaceIntro, }; const _data = await requireAPI("POST", "/api/zone/update", { body, }); if (_data.ret === -1) { Toast.show({ icon: "fail", content: _data.msg, position: "top", }); return; } Toast.show({ icon: "success", content: "提交成功,等耐心等待审核", position: "top", }); router.back(); } catch (error) { console.error(error); } finally { setIsSubmitting(false); } }; return (
{/* 头部标题 */}
{ router.back(); }} />

空间信息设置

{/* 内容 */}

*空间介绍