2024-06-29 12:07:37 +08:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import React, { useRef, useState } from "react";
|
|
|
|
import { Image } from "antd-mobile";
|
2024-07-22 14:38:59 +08:00
|
|
|
import { useRouter } from "next/navigation";
|
|
|
|
import baseRequest from "@/utils/baseRequest";
|
2024-11-05 20:37:22 +08:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faAngleRight } from "@fortawesome/free-solid-svg-icons";
|
2024-07-10 16:50:53 +08:00
|
|
|
export default function PaySpacePost({
|
|
|
|
type = "ironFan",
|
|
|
|
status = 0,
|
2024-07-25 19:52:30 +08:00
|
|
|
is_ironfan_visible = false,
|
2024-07-10 16:50:53 +08:00
|
|
|
data = {},
|
2024-07-17 20:30:33 +08:00
|
|
|
isCreator,
|
2024-07-10 16:50:53 +08:00
|
|
|
}) {
|
2024-07-22 14:38:59 +08:00
|
|
|
const base = baseRequest();
|
|
|
|
const router = useRouter();
|
2024-06-29 12:07:37 +08:00
|
|
|
return (
|
2024-07-17 20:30:33 +08:00
|
|
|
<>
|
|
|
|
{isCreator ? (
|
|
|
|
<div
|
2024-11-05 20:37:22 +08:00
|
|
|
className={`w-full flex flex-col px-2 py-2 my-2 rounded-md bg-[${
|
|
|
|
type === "ironFan" ? "#301024" : "#331F0B"
|
|
|
|
}]`}
|
2024-07-17 20:30:33 +08:00
|
|
|
>
|
2024-07-25 19:52:30 +08:00
|
|
|
<div
|
|
|
|
className="flex flex-row justify-between items-center"
|
|
|
|
style={{
|
|
|
|
color: data.is_ironfan_visible === 1 ? "#FF669E" : "#FFD685",
|
|
|
|
}}
|
2024-11-05 20:37:22 +08:00
|
|
|
onClick={() => {
|
|
|
|
router.push("/space/postPurchasers?id=" + data?.id);
|
|
|
|
}}
|
2024-07-25 19:52:30 +08:00
|
|
|
>
|
2024-07-17 20:30:33 +08:00
|
|
|
<div className="flex flex-row items-center">
|
|
|
|
<Image
|
2024-07-25 19:52:30 +08:00
|
|
|
src={
|
|
|
|
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
|
2024-07-24 19:08:22 +08:00
|
|
|
(data.is_ironfan_visible === 1
|
2024-07-17 20:30:33 +08:00
|
|
|
? "/icons/money_pink.png"
|
2024-07-24 19:08:22 +08:00
|
|
|
: "/icons/money_gold.png")
|
2024-07-17 20:30:33 +08:00
|
|
|
}
|
2024-11-05 20:37:22 +08:00
|
|
|
width={20}
|
|
|
|
className="mr-1"
|
2024-07-17 20:30:33 +08:00
|
|
|
/>
|
2024-07-25 19:52:30 +08:00
|
|
|
<span className={`text-base font-semibold ml-1`}>
|
2024-07-17 20:30:33 +08:00
|
|
|
{data.price / 100}
|
|
|
|
</span>
|
2024-07-25 19:52:30 +08:00
|
|
|
<span className={`text-sm`}>元</span>
|
2024-07-17 20:30:33 +08:00
|
|
|
</div>
|
2024-11-05 20:37:22 +08:00
|
|
|
<div className="flex items-center">
|
2024-07-25 19:52:30 +08:00
|
|
|
<p className={`text-sm font-medium`}>共{data.buyer_cnt}人购买</p>
|
2024-11-05 20:37:22 +08:00
|
|
|
<div className="ml-1 flex items-center">
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
color={data.is_ironfan_visible === 1 ? "#FF669E" : "#FFD685"}
|
|
|
|
style={{ maxWidth: "12px" }}
|
|
|
|
size="sm"
|
|
|
|
/>
|
|
|
|
</div>
|
2024-07-17 20:30:33 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{data.is_ironfan_visible === 1 && (
|
|
|
|
<p className="text-xs text-[#FFFFFF40] mt-1">
|
|
|
|
空间内任意消费满{data.ironfanship_price / 100}元即可成为铁粉
|
|
|
|
</p>
|
2024-07-06 11:05:19 +08:00
|
|
|
)}
|
2024-06-29 12:07:37 +08:00
|
|
|
</div>
|
2024-07-17 20:30:33 +08:00
|
|
|
) : (
|
|
|
|
<div
|
|
|
|
className={`rounded-md ${
|
|
|
|
type === "ironFan" ? "bg-primary-500" : "bg-super-500"
|
|
|
|
} px-2 py-2 my-2 text-sm`}
|
2024-07-06 11:05:19 +08:00
|
|
|
>
|
2024-07-17 20:30:33 +08:00
|
|
|
<div
|
|
|
|
className={`flex justify-between items-center text-sm ${
|
|
|
|
type === "ironFan" ? "text-primary" : "text-super"
|
|
|
|
}`}
|
2024-07-25 19:52:30 +08:00
|
|
|
onClick={() => {
|
|
|
|
if (!data.is_zone_moment_unlocked) {
|
|
|
|
router.push(
|
|
|
|
"/webView/" +
|
|
|
|
encodeURIComponent(
|
|
|
|
"/zone/pay/" +
|
|
|
|
data?.zid +
|
|
|
|
"/h5_zone_moment/" +
|
|
|
|
data?.id +
|
|
|
|
"?base=" +
|
|
|
|
encodeURIComponent(JSON.stringify(base))
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}}
|
2024-07-17 20:30:33 +08:00
|
|
|
>
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
width={18}
|
|
|
|
height={18}
|
|
|
|
placeholder=""
|
|
|
|
className="mr-2"
|
2024-07-25 19:52:30 +08:00
|
|
|
src={
|
|
|
|
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
|
2024-07-24 19:08:22 +08:00
|
|
|
(type === "ironFan"
|
2024-07-17 20:30:33 +08:00
|
|
|
? "/icons/money_pink.png"
|
2024-07-24 19:08:22 +08:00
|
|
|
: "/icons/money_gold.png")
|
2024-07-17 20:30:33 +08:00
|
|
|
}
|
|
|
|
/>
|
2024-07-25 19:52:30 +08:00
|
|
|
<p className="flex justify-center items-center">
|
|
|
|
<span className="text-base font-semibold ml-1">
|
|
|
|
{data.price / 100}
|
|
|
|
</span>
|
|
|
|
<span className="text-sm">元</span>
|
|
|
|
</p>
|
2024-07-17 20:30:33 +08:00
|
|
|
</div>
|
|
|
|
<div className="flex items-center">
|
|
|
|
{!data.is_zone_moment_unlocked ? (
|
2024-07-25 19:52:30 +08:00
|
|
|
<span>
|
2024-07-17 20:30:33 +08:00
|
|
|
{data.is_ironfan_visible === 1
|
|
|
|
? "铁粉免费查看"
|
|
|
|
: data.is_superfanship_enabled === 1
|
|
|
|
? "超粉免费查看"
|
|
|
|
: "付费解锁"}
|
|
|
|
</span>
|
|
|
|
) : (
|
|
|
|
<span>
|
|
|
|
{data.is_ironfanship_unlocked === 1 &&
|
|
|
|
data.is_ironfan_visible === 1 &&
|
|
|
|
"已使用铁粉特权解锁"}
|
|
|
|
{data.is_superfanship_unlocked === 1 &&
|
|
|
|
data.is_ironfan_visible === 0 &&
|
|
|
|
"已使用超粉特权解锁"}
|
|
|
|
{data.is_superfanship_unlocked === 0 &&
|
|
|
|
data.is_ironfan_visible === 0 &&
|
|
|
|
"已付费解锁"}
|
|
|
|
{data.is_ironfanship_unlocked === 0 &&
|
|
|
|
data.is_ironfan_visible === 1 &&
|
|
|
|
"已付费解锁"}
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
<Image
|
2024-07-19 14:14:40 +08:00
|
|
|
height={12}
|
|
|
|
fit="contain"
|
2024-07-17 20:30:33 +08:00
|
|
|
placeholder=""
|
|
|
|
className="ml-2"
|
2024-07-25 19:52:30 +08:00
|
|
|
src={
|
|
|
|
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
|
2024-07-24 19:08:22 +08:00
|
|
|
(type === "ironFan"
|
2024-07-17 20:30:33 +08:00
|
|
|
? "/icons/pinklink.png"
|
2024-07-24 19:08:22 +08:00
|
|
|
: "/icons/goldlink.png")
|
2024-07-17 20:30:33 +08:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-23 20:56:25 +08:00
|
|
|
{is_ironfan_visible && (
|
2024-07-17 20:30:33 +08:00
|
|
|
<p
|
2024-07-23 20:56:25 +08:00
|
|
|
className="text-xs mt-2 text-[#FFFFFF40]"
|
|
|
|
// style={{ color: type === "ironFan" ? "#ff669e54" : "#FFD68554" }}
|
2024-07-17 20:30:33 +08:00
|
|
|
>
|
2024-08-22 12:33:03 +08:00
|
|
|
空间内任意消费满{data.ironfanship_price / 100}元即可成为铁粉
|
2024-07-17 20:30:33 +08:00
|
|
|
</p>
|
|
|
|
)}
|
|
|
|
</div>
|
2024-06-29 12:07:37 +08:00
|
|
|
)}
|
2024-07-17 20:30:33 +08:00
|
|
|
</>
|
2024-06-29 12:07:37 +08:00
|
|
|
);
|
|
|
|
}
|