From c0558bca36b2f27fc5a28217801fcfe49827d176 Mon Sep 17 00:00:00 2001 From: yezian Date: Thu, 18 Apr 2024 18:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=A9=BA=E9=97=B4=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=A1=B5=E9=9D=A2=EF=BC=9B=E5=A2=9E=E5=8A=A0=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E5=88=86=E4=BA=AB=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[user_id]/page.jsx | 4 +- app/zone/[user_id]/page.jsx | 35 ++-- .../[zid]/[product_id]/[moment_id]/page.jsx | 58 +++++-- app/zone/share/[user_id]/page.jsx | 159 ++++++++++++++++++ 4 files changed, 222 insertions(+), 34 deletions(-) create mode 100644 app/zone/share/[user_id]/page.jsx diff --git a/app/[user_id]/page.jsx b/app/[user_id]/page.jsx index 9e5dd09..a79cd62 100644 --- a/app/[user_id]/page.jsx +++ b/app/[user_id]/page.jsx @@ -65,11 +65,11 @@ export default function StreamerDetail({ params }) {
-
+
diff --git a/app/zone/[user_id]/page.jsx b/app/zone/[user_id]/page.jsx index 015c4c0..17ead5e 100644 --- a/app/zone/[user_id]/page.jsx +++ b/app/zone/[user_id]/page.jsx @@ -60,14 +60,12 @@ export default function Zone({ params }) { return (
-
-
- -
+
+
@@ -119,17 +117,20 @@ export default function Zone({ params }) {
-
+

{data?.profile}

-
+
{data?.streamer_ext?.album?.images?.map((item, index) => { if (index > 2) return; return ( -
+
); @@ -175,9 +176,15 @@ export default function Zone({ params }) {
-
+

- 阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴 + 1、加入后,您可以查看空间内相关内容; +

+

+ 2、本空间由空间主人自行创建,加入空间前请确认相关风险,本平台不提供相关保证,请避免上当受骗; +

+

+ 3、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理。

diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx index 3fe929f..c5ef67d 100644 --- a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -14,7 +14,7 @@ export default function Pay({ params }) { //当前选购的商品数据 const [data, setData] = useState({}); //超粉商品数据 - const [superfanshipData, setSuperfanshipData] = useState({}); + const [superfanshipData, setSuperfanshipData] = useState(); const [isFetching, setIsFetching] = useState(true); useEffect(() => { const getData = async () => { @@ -72,12 +72,7 @@ export default function Pay({ params }) { ); const temData = await response.json(); console.log(temData); - if (temData.ret === -1) { - Toast.show({ - content: temData.msg, - }); - return; - } + if (temData.ret === -1) return; setSuperfanshipData(temData.data); } catch (error) { console.error(error); @@ -159,14 +154,37 @@ export default function Pay({ params }) { ); } + if (data?.has_bought === 1) { + return ( +
+ + + + +

+ 您已购买成功,请返回空间刷新查看。 +

+
+ ); + } + return (
{isLoading && ( )}
-

- ¥ {checked ? superfanshipData?.price / 100 : data?.price / 100} +

+ ¥{" "} + {checked + ? (superfanshipData?.price / 100).toFixed(2) + : (data?.price / 100).toFixed(2)}

付费商品:

@@ -182,7 +200,7 @@ export default function Pay({ params }) {

- {params.product_id === "h5_zone_moment" && ( + {params.product_id === "h5_zone_moment" && superfanshipData && (

@@ -233,13 +251,13 @@ export default function Pay({ params }) {

1、开通超粉后可在有效期内免费查看当前空间内的所有动态内容;
- 2、当前开通的超粉仅在当前空间内生效,请确认空间主人与超粉有效期; + 2、当前开通的超粉仅在当前空间内生效,请确认空间名称与超粉有效期;
3、若空间主人提供了开通超粉赠送微信服务,请在开通后在空间内点击【查看微信】;
4、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买;
- 5、本项特权内容最终解释权归铁粉空间运营方所有。 + 5、本项权益内容最终解释权归铁粉空间运营方所有。

) : params.product_id === "h5_zone_moment" ? ( @@ -248,24 +266,28 @@ export default function Pay({ params }) {

1、当前购买内容为本空间内特定单条动态的查阅权限,如需要查阅空间内全部动态请开通超粉;
- 2、本次消费将计入本空间内铁粉进度,铁粉进度达标后,可查看本空间内铁粉专享动态内容; + 2、本次消费将计入当前空间内铁粉进度,铁粉进度达标后,可查看当前空间内铁粉专享动态内容;
3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买;
- 4、本项特权内容最终解释权归铁粉空间运营方所有。 + 4、本项权益内容最终解释权归铁粉空间运营方所有。

) : (

购买须知:

- 1、当前购买内容为本空间成员身份; + 1、本空间由空间主人自行创建,加入空间前请确认相关风险,避免上当受骗;
- 2、成为空间成员后可查看本空间内成员可见内容查阅权限; + 2、当前开通的空间成员身份仅针对当前空间生效,请确认空间名称与与空间主人;
- 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; + 3、当前购买内容为空间成员身份,开通后可获得当前空间内成员身份查阅权限;
- 4、本项特权内容最终解释权归铁粉空间运营方所有。 + 4、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 5、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理; +
+ 6、本项权益内容最终解释权归铁粉空间运营方所有。

)} diff --git a/app/zone/share/[user_id]/page.jsx b/app/zone/share/[user_id]/page.jsx new file mode 100644 index 0000000..cdea7f7 --- /dev/null +++ b/app/zone/share/[user_id]/page.jsx @@ -0,0 +1,159 @@ +"use client"; + +import React, { useState, useEffect } from "react"; +import html2canvas from "html2canvas"; +import baseRequest from "@/utils/baseRequest"; +import { Toast } from "antd-mobile"; +import Divider from "@/components/Divider"; +import { generateSignature } from "@/utils/crypto"; +import Image from "next/image"; +import icon_without_bg from "@/public/images/icon_without_bg.png"; +import invite_girl from "@/public/images/invite_girl.png"; +import ID from "@/public/images/ID.png"; + +export default function Share({ params }) { + //获取页面数据、生成二维码 + const [data, setData] = useState({}); + const [qrcodeUrl, setQrcodeUrl] = useState(""); + useEffect(() => { + const getData = async () => { + try { + const base = baseRequest(); + const signature = generateSignature({ + user_id: parseInt(params.user_id, 10), + ...base, + }); + const detailResponse = await fetch( + `/api/streamer/list_ext_by_user_id?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + user_id: parseInt(params.user_id, 10), + ...base, + }), + } + ); + const detailData = await detailResponse.json(); + if (detailData.ret === -1) { + Toast.show({ + content: detailData.msg, + }); + return; + } + setData(detailData.data.streamer_ext); + var QRCode = require("qrcode"); + QRCode.toDataURL( + `https://tiefen.fun/zone/${params.user_id}`, + function (err, url) { + setQrcodeUrl(url); + } + ); + } catch (error) { + console.error(error); + } + }; + getData(); + }, []); + + //分享海报组件 + const Poster = () => { + return ( +
+
+
+ +
+
+
+
+
+ +
+
+

+ {data?.name} +

+
+
+ +

+ {data?.user_id} +

+
+
+
+
+
+

+ 邀您加入我的 + + 「铁粉空间」 + +

+
+
+
+ +
+
+
+ + +
+ ); + }; + + //保存图片 + const saveImage = async () => { + const element = document.getElementById("print"); + const canvas = await html2canvas(element, { + useCORS: true, + }); + const data = canvas.toDataURL("image/jpg"); + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: "SAVE_IMAGE", + data: data, + }) + ); + }; + + //复制链接 + const copyUrl = () => { + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: "COPY_URL", + data: `https://tiefen.fun/${params.user_id}`, + }) + ); + }; + + return ( +
+
+ +
+
+ ); +}