修复空间页面bug

This commit is contained in:
yezian 2024-04-22 17:42:04 +08:00
parent 2500fda652
commit 74c5afca5d
2 changed files with 20 additions and 15 deletions

View File

@ -81,7 +81,7 @@ export default function Pay({ params }) {
setTimeout(() => { setTimeout(() => {
getData(); getData();
getSuperfanshipData(); getSuperfanshipData();
}, 1000); }, 500);
}, []); }, []);
//switch //switch
@ -154,7 +154,7 @@ export default function Pay({ params }) {
); );
} }
if (data?.has_bought === 1) { if (data?.has_bought === 1 || superfanshipData?.has_bought === 1) {
return ( return (
<section className="container flex flex-col flex-1 p-4 items-center"> <section className="container flex flex-col flex-1 p-4 items-center">
<svg className="mt-32" viewBox="0 0 1024 1024" width="120" height="120"> <svg className="mt-32" viewBox="0 0 1024 1024" width="120" height="120">

View File

@ -4,17 +4,13 @@ import React, { useState, useEffect } from "react";
import html2canvas from "html2canvas"; import html2canvas from "html2canvas";
import baseRequest from "@/utils/baseRequest"; import baseRequest from "@/utils/baseRequest";
import { Toast } from "antd-mobile"; import { Toast } from "antd-mobile";
import Divider from "@/components/Divider";
import { generateSignature } from "@/utils/crypto"; 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 }) { export default function Share({ params }) {
// //
const [data, setData] = useState({}); const [data, setData] = useState({});
const [qrcodeUrl, setQrcodeUrl] = useState(""); const [qrcodeUrl, setQrcodeUrl] = useState("");
const [isFetching, setIsFetching] = useState(true);
useEffect(() => { useEffect(() => {
const getData = async () => { const getData = async () => {
try { try {
@ -51,6 +47,7 @@ export default function Share({ params }) {
setQrcodeUrl(url); setQrcodeUrl(url);
} }
); );
setIsFetching(false);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
@ -62,10 +59,10 @@ export default function Share({ params }) {
const Poster = () => { const Poster = () => {
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
<div id="print" className="flex flex-col overflow-hidden rounded-lg"> <div id="print" className="flex flex-col overflow-hidden bg-[#07050A]">
<div className="flex w-full aspect-square overflow-hidden"> <div className="flex w-full justify-center items-center aspect-square overflow-hidden">
<img <img
className="object-cover w-full" className="w-full"
src={data?.cover?.images[0].urls[0]} src={data?.cover?.images[0].urls[0]}
alt="" alt=""
/> />
@ -73,9 +70,9 @@ export default function Share({ params }) {
<div className="flex flex-row items-center w-full p-2 bg-[#07050A]"> <div className="flex flex-row items-center w-full p-2 bg-[#07050A]">
<div className="flex flex-col justify-around items-start shrink min-w-0"> <div className="flex flex-col justify-around items-start shrink min-w-0">
<div className="flex flex-row items-center w-full"> <div className="flex flex-row items-center w-full">
<div className="flex shrink-0 rounded-full overflow-hidden aspect-square w-12 border border-white"> <div className="flex items-center justify-center shrink-0 rounded-full overflow-hidden aspect-square w-12 border border-white">
<img <img
className="w-full object-cover" className="w-full"
src={data?.avatar?.images[0].urls[0]} src={data?.avatar?.images[0].urls[0]}
alt="" alt=""
/> />
@ -86,7 +83,7 @@ export default function Share({ params }) {
</p> </p>
<div className="flex justify-start flex-1"> <div className="flex justify-start flex-1">
<div className="flex flex-row items-center py-0.5 px-2 bg-[#FFFFFF1A] rounded-full"> <div className="flex flex-row items-center py-0.5 px-2 bg-[#FFFFFF1A] rounded-full">
<Image src={ID} alt="" className="w-4" /> <p className="text-xs text-white font-medium">ID</p>
<p className="text-white text-xs font-medium ml-0.5"> <p className="text-white text-xs font-medium ml-0.5">
{data?.user_id} {data?.user_id}
</p> </p>
@ -94,7 +91,7 @@ export default function Share({ params }) {
</div> </div>
</div> </div>
</div> </div>
<div className="flex flex-col px-2 mt-2 bg-[#FF61B030] rounded-full justify-center"> <div className="flex flex-col px-2 py-1 mt-2 bg-[#FF61B030] rounded-full justify-center">
<p className="text-xs text-[#FF669E] rounded-full text-center"> <p className="text-xs text-[#FF669E] rounded-full text-center">
邀您加入我的 邀您加入我的
<span className="text-xs text-[#FF669E] font-semibold"> <span className="text-xs text-[#FF669E] font-semibold">
@ -144,11 +141,19 @@ export default function Share({ params }) {
window.ReactNativeWebView.postMessage( window.ReactNativeWebView.postMessage(
JSON.stringify({ JSON.stringify({
type: "COPY_URL", type: "COPY_URL",
data: `https://tiefen.fun/${params.user_id}`, data: `https://tiefen.fun/zone/${params.user_id}`,
}) })
); );
}; };
if (isFetching) {
return (
<section className="flex flex-1 justify-center container">
<span className="absolute top-1/2 loading loading-spinner loading-lg"></span>
</section>
);
}
return ( return (
<section className="flex flex-1 flex-col items-center justify-center container"> <section className="flex flex-1 flex-col items-center justify-center container">
<div className="w-4/5"> <div className="w-4/5">