From 886ac93858890a8e1c648a78aea144e6a3857edd Mon Sep 17 00:00:00 2001 From: al Date: Wed, 30 Oct 2024 21:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=A5=E9=A9=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/my/createProfile/page.jsx | 133 ++++++++++-------- app/my/editprofile/editHome/page.jsx | 2 +- app/my/page.js | 68 +++++++-- app/my/relationship/page.js | 1 - app/my/settleIn/page.js | 7 +- .../afterSubmitStreamerVerification/page.jsx | 5 +- .../completeStreamerInformation/page.jsx | 128 ++++++++++------- .../joinStreamer/page.jsx | 14 +- .../setting/spacePaymentSetting/page.jsx | 53 ++++--- components/UploadImgs/index.js | 9 +- 10 files changed, 263 insertions(+), 157 deletions(-) diff --git a/app/my/createProfile/page.jsx b/app/my/createProfile/page.jsx index b5abc6c..f6a3f48 100644 --- a/app/my/createProfile/page.jsx +++ b/app/my/createProfile/page.jsx @@ -86,9 +86,9 @@ export default function CreateProfile() { const router = useRouter(); const searchParams = useSearchParams(); const [formData, setFormData] = useState({ - spacePrice: 0, - ironFanPrice: 0, - openSuper: true, + spacePrice: "", + ironFanPrice: "", + openSuper: false, superSingle: [ { enable: false, price: 0, wechatFree: false }, { enable: false, price: 0, wechatFree: false }, @@ -119,8 +119,15 @@ export default function CreateProfile() { const handleSubmit = async () => { const { spaceIntro, spacePrice, ironFanPrice, openSuper, superSingle } = formData; - - if (!spaceIntro || !spacePrice || !ironFanPrice) { + const openSuperEveryFalse = Object.values(superSingle).every( + (it) => !it.enable + ); + if ( + !spaceIntro || + !spacePrice || + !ironFanPrice || + (openSuper && openSuperEveryFalse) + ) { Toast.show({ icon: "fail", content: "请完善内容后提交", @@ -196,41 +203,41 @@ export default function CreateProfile() { })); setIsSubmitting(true); - try { - const body = { - profile: spaceIntro, - admission_price: parseInt(spacePrice * 100, 10), - ironfanship_price: parseInt(ironFanPrice * 100, 10), - is_superfanship_enabled: openSuper ? 1 : 0, - superfan_price_list, - }; - const _data = await requireAPI( - "POST", - "/api/zone/update", - { - body, - }, - true - ); - if (_data.ret === -1) { - Toast.show({ - icon: "error", - content: _data.msg, - position: "top", - }); - return; - } - Toast.show({ - icon: "success", - content: "修改成功,请重进空间刷新查看", - position: "top", - }); - router.back(); - } catch (error) { - console.error(error); - } finally { - setIsSubmitting(false); - } + // try { + // const body = { + // profile: spaceIntro, + // admission_price: parseInt(spacePrice * 100, 10), + // ironfanship_price: parseInt(ironFanPrice * 100, 10), + // is_superfanship_enabled: openSuper ? 1 : 0, + // superfan_price_list, + // }; + // const _data = await requireAPI( + // "POST", + // "/api/zone/create", + // { + // body, + // }, + // true + // ); + // 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 (
@@ -287,10 +294,13 @@ export default function CreateProfile() { id="spacePrice" type="number" fontSize="22" + placeholder="1~3888,仅支持整数" value={formData.spacePrice} onChange={(value) => setFormData((old) => ({ ...old, spacePrice: value })) } + inputClassName="placeholder:text-[14px]" + className={!formData.spacePrice ? "pb-1.5" : ""} />