From 7b1916b6206afc307deb95e05eb6fcc01e7f2b2f Mon Sep 17 00:00:00 2001 From: yezian Date: Tue, 25 Jun 2024 20:39:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2dialog=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E4=B8=BAModal=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[user_id]/_components/WechatBar/index.jsx | 52 ++++++++--------- app/layout.jsx | 5 +- app/purchased/page.jsx | 53 +++++++----------- app/zone/[user_id]/page.jsx | 56 +++++++------------ 4 files changed, 67 insertions(+), 99 deletions(-) diff --git a/app/[user_id]/_components/WechatBar/index.jsx b/app/[user_id]/_components/WechatBar/index.jsx index 64d4791..cda8682 100644 --- a/app/[user_id]/_components/WechatBar/index.jsx +++ b/app/[user_id]/_components/WechatBar/index.jsx @@ -5,7 +5,7 @@ import React, { useState } from "react"; import { useRouter } from "next/navigation"; import baseRequest from "@/utils/baseRequest"; import { generateSignature } from "@/utils/crypto"; -import { Toast } from "antd-mobile"; +import { Toast, Modal } from "antd-mobile"; import { checkAuth } from "@/utils/auth"; export default function WechatBar({ @@ -111,7 +111,29 @@ export default function WechatBar({ >
document.getElementById("comfirm_modal").showModal()} + onClick={() => + Modal.alert({ + showCloseButton: true, + confirmText: "立即购买", + onConfirm: () => handlePurchase("alipay_h5"), + content: ( +
+

+ 购买成功后请到"账号"-"已购"添加Ta的微信,若超72小时未添加成功请联系客服 +

+

+ 确认购买即视为同意 + + 《用户充值协议》 + +

+
+ ), + }) + } >
- -
-

- 购买成功后请到"账号"-"已购"添加Ta的微信,若超72小时未添加成功请联系客服 -

-

- 确认购买即视为同意 - - 《用户充值协议》 - -

-
- -
- -
-
-
-
); } diff --git a/app/layout.jsx b/app/layout.jsx index 62b5bb7..98f1b4c 100644 --- a/app/layout.jsx +++ b/app/layout.jsx @@ -31,7 +31,10 @@ export default function RootLayout({ children }) { className="bg-[#07050A]" data-prefers-color-scheme="dark" > - +
{children}
diff --git a/app/purchased/page.jsx b/app/purchased/page.jsx index a7c76b7..4782427 100644 --- a/app/purchased/page.jsx +++ b/app/purchased/page.jsx @@ -1,7 +1,7 @@ "use client"; import React, { useState, useEffect } from "react"; import AuthBar from "@/components/AuthBar"; -import { Toast } from "antd-mobile"; +import { Toast, Modal } from "antd-mobile"; import { checkAuth } from "@/utils/auth"; import { useRouter } from "next/navigation"; import baseRequest from "@/utils/baseRequest"; @@ -105,7 +105,24 @@ export default function Purchased() { const handleClick = async () => { await getWechat(item?.account.mid); setTimeout( - () => document.getElementById("get_wechat_modal").showModal(), + () => + Modal.alert({ + showCloseButton: true, + confirmText: "复制", + onConfirm: () => { + copy(currentWechat); + Toast.show({ + content: "复制成功", + }); + }, + content: ( +
+

+ Ta的微信号:{currentWechat} +

+
+ ), + }), 100 ); }; @@ -162,37 +179,6 @@ export default function Purchased() { ); }; - const GetWechatModal = () => { - const handleCopy = () => { - copy(currentWechat); - Toast.show({ - content: "复制成功", - }); - }; - return ( - -
-

- Ta的微信号:{currentWechat} -

-
-
- - -
-
-
-
- ); - }; - const SubmitUserWechatItem = ({ item }) => { const [wechat, setWechat] = useState(""); const [remarks, setRemarks] = useState(""); @@ -341,7 +327,6 @@ export default function Purchased() { return ; } })} - ); } diff --git a/app/zone/[user_id]/page.jsx b/app/zone/[user_id]/page.jsx index 9288dc6..acbde76 100644 --- a/app/zone/[user_id]/page.jsx +++ b/app/zone/[user_id]/page.jsx @@ -1,15 +1,16 @@ "use client"; import React, { useState, useEffect } from "react"; -import { Toast } from "antd-mobile"; +import { Toast, Modal } from "antd-mobile"; import baseRequest from "@/utils/baseRequest"; import { generateSignature } from "@/utils/crypto"; import copy from "@/utils/copy"; import { setCookie } from "cookies-next"; -import Link from "next/link"; import InOtherApp from "@/components/InOtherApp"; +import { useRouter } from "next/navigation"; export default function Zone({ params }) { + const router = useRouter(); //页面数据 const [data, setData] = useState({}); useEffect(() => { @@ -46,12 +47,24 @@ export default function Zone({ params }) { getData(); }, []); - //将主播链接复制到剪贴板,并存cookie - const copyAndSetCookieInviter = () => { + //将主播链接复制到剪贴板,并存cookie,并打开modal + const showModal = () => { setCookie("inviter", data?.streamer_ext?.user_id); copy( `【${data?.streamer_ext?.name}】『ID:${data?.streamer_ext?.user_id}』,复制此条消息,打开铁粉空间APP,查看详情https://tiefen.fun/zone/${data?.streamer_ext?.user_id}` ); + Modal.alert({ + showCloseButton: true, + confirmText: "前往下载", + onConfirm: () => router.push("/"), + content: ( +
+

+ {`请打开或下载【铁粉空间】APP,根据APP内弹窗指引加入空间。如未弹出,请在APP搜索ID:${data?.streamer_ext?.user_id},加入空间。`} +

+
+ ), + }); }; return ( @@ -143,10 +156,7 @@ export default function Zone({ params }) {
{ - copyAndSetCookieInviter(); - document.getElementById("comfirm_modal").showModal(); - }} + onClick={showModal} >
{ - copyAndSetCookieInviter(); - document.getElementById("comfirm_modal").showModal(); - }} + onClick={showModal} >
{ - copyAndSetCookieInviter(); - document.getElementById("comfirm_modal").showModal(); - }} + onClick={showModal} > 立即加入
@@ -206,26 +210,6 @@ export default function Zone({ params }) { 3、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理。

- -
-

- {`请打开或下载【铁粉空间】APP,根据APP内弹窗指引加入空间。如未弹出,请在APP搜索ID:${data?.streamer_ext?.user_id},加入空间。`} -

-
- -

确认

- -
- -
-
-
-
); }