Compare commits

...

14 Commits

Author SHA1 Message Date
al 427f1cc9b5 修改超粉档位 2025-01-16 12:41:10 +08:00
al 8024ac7994 修改样式问题 2025-01-10 16:07:47 +08:00
al 8a2ef9b2e5 更改组件名 2025-01-08 14:54:33 +08:00
al 3a35b23299 add_superfan_prices 2025-01-07 18:41:32 +08:00
yezian c903dcb46c 再次修改错别字 2025-01-04 11:11:23 +08:00
al bb7d419520 修改图标尺寸 2025-01-04 10:06:34 +08:00
yezian c045400190 下掉退款审核入口 2025-01-04 09:22:18 +08:00
yezian 92fd681cc8 更改错别字 2025-01-04 09:09:57 +08:00
al 7cf4a739e8 修改样式问题 2025-01-03 17:45:33 +08:00
al 0567162885 修复代运营问题 2025-01-03 11:42:14 +08:00
al 293557d6dd 恢复退款审核 2024-12-28 16:06:31 +08:00
al 3dc7204f8c 解决偶发报错 2024-12-27 18:38:46 +08:00
al bd7469f7fa 清除console log 2024-12-27 13:01:04 +08:00
al ef7dab7897 修复会员问题 2024-12-27 12:56:18 +08:00
20 changed files with 580 additions and 375 deletions

View File

@ -5,10 +5,12 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faAngleRight } from "@fortawesome/free-solid-svg-icons";
import { Avatar, Toast, Space } from "antd-mobile";
import { useRouter } from "next/navigation";
import { get } from "@/utils/storeInfo";
import { get, save } from "@/utils/storeInfo";
import requireAPI from "@/utils/requireAPI";
import OwnIcon from "@/components/OwnIcon";
import OwnImage from "@/components/OwnImage";
import { getVipPrice } from "@/utils/auth";
import baseRequest from "@/utils/baseRequest";
const My = () => {
const [userInfo, setUserInfo] = useState({});
const router = useRouter();
@ -27,6 +29,7 @@ const My = () => {
null,
true
);
console.log("------", data);
if (data.ret === -1) {
Toast.show({
icon: "fail",
@ -63,6 +66,7 @@ const My = () => {
});
return;
}
save("account", account.data.account);
const statuses = await requireAPI(
"POST",
"/api/streamer_auth_approval/get_statuses",
@ -76,6 +80,7 @@ const My = () => {
});
return;
}
const vipPrice = await getVipPrice();
const isInJoinProgress =
(statuses.data.basic_status === 0 ||
statuses.data.basic_status === 1 ||
@ -115,13 +120,13 @@ const My = () => {
subTitle:
account.data.account.role == 3 ? "创作者功能" : "完善资料后解锁",
},
// {
// url: `my/refund/refundList`,
// iconUrl: "/icons/32DP/wallet.png",
// title: "退款审核",
// subTitle:
// account.data.account.role == 3 ? "创作者功能" : "完善资料后解锁",
// },
{
url: `my/refund/refundList`,
iconUrl: "/icons/32DP/wallet.png",
title: "退款审核",
subTitle:
account.data.account.role == 3 ? "创作者功能" : "完善资料后解锁",
},
// ...currentOld,
];
if (isInJoinProgress) {
@ -208,7 +213,12 @@ const My = () => {
// }
return currentOld;
});
setUserInfo({ ...data.data, ...account.data.account, ...streamer.data });
setUserInfo({
...data.data,
...account.data.account,
...streamer.data,
vipPrice,
});
};
const ItemEle = ({
url,
@ -406,7 +416,44 @@ const My = () => {
<p className="text-[#ffffff88]">钻石</p>
</li>
</ul>
{/*会员功能*/}
<div
// activeOpacity={1}
onClick={() => {
const base = baseRequest();
router.push(
`/webView/${encodeURIComponent(
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`
)}`
);
}}
className="flex flex-col p-2.5 rounded-2xl mt-3.5 bg-[#301024] mb-4"
>
<div className="flex flex-row justify-between items-center">
<div className="flex flex-col">
<div className="flex gap-1 items-center mb-1">
<OwnIcon src="/icons/vipbig.png" className="w-[32px] h-[32px]" />
<span className="text-base text-[#FF669E] font-medium">
{userInfo?.is_a_member !== 1
? "开通会员保存图片"
: "尊贵的永久会员"}
</span>
</div>
<span className="text-sm text-[#FFFFFF40] font-medium">
{userInfo?.is_a_member !== 1
? "限时优惠活动"
: "已解锁全部会员权益"}
</span>
</div>
{userInfo?.is_a_member !== 1 && (
<div className="flex justify-center items-center h-9 bg-[#FF669E] rounded-full px-4">
<span className="text-white text-sm font-medium">
¥{userInfo.vipPrice}/永久
</span>
</div>
)}
</div>
</div>
{/* 主播用户 */}
{!!streamerNavigates.length && (
<div className="rounded-xl p-2 border-2 border-[#2c2b2f] mb-4">

View File

@ -142,7 +142,11 @@ export default function RefundDetail() {
<Radio.Group
className="flex flex-col"
onChange={setIndex}
value={data && data?.refunds_status === 4 ? 2 : selectedIndex}
value={
data && [2, 3, 4].includes(data?.refunds_status)
? 2
: selectedIndex
}
disabled={!checkAble}
>
<div className="flex flex-row items-start mt-4 pr-6">

View File

@ -23,7 +23,7 @@ export default function Reviewed({ currentIndex }) {
const account = get("account");
try {
const body = {
b_mid: account.mid,
b_mid: account?.mid,
audit_type: 1,
offset: offset,
limit: 10,

View File

@ -66,7 +66,7 @@ export default function PendingReview({ currentIndex }) {
roundedFull
/>
<div className="ml-2 flex flex-col gap-1">
<div className="flex flex-row items-center flex-1 ">
<div className="flex flex-row flex-wrap items-center flex-1 ">
<div style={{ maxWidth: 100 }} className="truncate">
<span className="mr-2 text-base text-white font-medium whitespace-nowrap">
{item.account.name}
@ -99,9 +99,9 @@ export default function PendingReview({ currentIndex }) {
</div>
</div>
<div className="flex flex-col justify-center items-center">
<div className="flex flex-col justify-center items-start">
<div className="px-4 py-1 rounded-full bg-[#FFFFFF1A] flex-row items-center">
<span className="text-white text-sm">
<span className="text-white text-sm whitespace-nowrap">
{item?.refunds_status === 4
? "已自动退款"
: item?.refunds_status === -1

View File

@ -28,8 +28,12 @@ export default function AboutUs() {
<p className="text-base text-center leading-9">关于我们</p>
</div>
{/* 内容 */}
<div className="pt-16 p-4 flex flex-col justify-center items-center">
<OwnIcon className="my-16" width="46%" src="/images/logo.png" />
<div className="w-full pt-16 p-4 flex flex-col justify-center items-center">
<OwnIcon
outClassName="w-1/2"
className="my-16 w-1/2"
src="/images/logo.png"
/>
<div className="rounded-xl p-2 border-2 border-[#2c2b2f] w-full">
<ul>

View File

@ -11,7 +11,8 @@ import { multiUploadImage } from "@/utils/upload";
import requireAPI from "@/utils/requireAPI";
export default function Feedback() {
const [value, setValue] = useState();
const [assets, setAssets] = useState([]);
const [imgAssets, setImgAssets] = useState([]);
const [videoAssets, setVideoAssets] = useState([]);
const [isSubmitting, setIsSubmitting] = useState(false);
const router = useRouter();
//提交反馈
@ -24,13 +25,26 @@ export default function Feedback() {
});
return;
}
if (imgAssets.length + videoAssets.length > 9) {
Toast.show({
icon: "fail",
content: "最多上传9个图片或视频",
position: "top",
});
return;
}
//提交数据
setIsSubmitting(true);
// const media = await multiUpload(assets);
const media = await multiUploadImage(assets, 1);
const { image_ids } = await multiUploadImage(imgAssets, 1);
const { video_ids } = await multiUploadImage(videoAssets, 2);
const media = { image_ids, video_ids };
// console.log("media",media)
const account = await get("account");
debugger;
try {
const data = await requireAPI(
"POST",
@ -93,9 +107,24 @@ export default function Feedback() {
style={{ "--placeholder-color": "#FFFFFF80", "--font-size": "16px" }}
/>
<p className="text-base font-medium text-white mt-4 mb-1">
截图最多9张
截图或录屏最多9张
</p>
<UploadImgs assets={assets} getImgs={setAssets} />
<div className="mb-4">
<p className="my-2">图片</p>
<UploadImgs
accept="image/png, image/jpeg, image/jpg"
assets={imgAssets}
getImgs={setImgAssets}
/>
</div>
<p className="my-2">视频</p>
<UploadImgs
accept="video/*"
type={2}
id="uploadVideoBtn3"
assets={videoAssets}
getImgs={setVideoAssets}
/>
<div className="mt-16">
<Button
shape="rounded"

View File

@ -53,6 +53,7 @@ const MessageList = ({ mid, changeNoticeCount, refInstance, noticeCount }) => {
]);
useImperativeHandle(refInstance, () => ({
readAllMsg: async (types) => {
if (!data.session_id) return;
try {
const body = {
n_types: types,
@ -68,6 +69,7 @@ const MessageList = ({ mid, changeNoticeCount, refInstance, noticeCount }) => {
});
return;
}
const _data2 = await requireAPI(
"POST",
"/api/contact_customer_service/read_all",
@ -83,6 +85,7 @@ const MessageList = ({ mid, changeNoticeCount, refInstance, noticeCount }) => {
});
return;
}
changeNoticeCount(0);
} catch (error) {
console.error(error);

View File

@ -1,7 +1,7 @@
"use client";
import React, { useEffect, useRef, useState } from "react";
import { Tabs, Swiper, Toast } from "antd-mobile";
import { Tabs, Swiper, Toast, Dialog } from "antd-mobile";
import Link from "next/link";
import requireAPI from "@/utils/requireAPI";
import MessageList from "./components/MessageList";
@ -112,8 +112,48 @@ export default function Space() {
}
}
const handleReadAll = () => {
if (mesListEl.current) mesListEl.current.readAllMsg([0, 1, 2, 3]);
const showMobal = Dialog.show({
title: "提示",
content: <div className="text-center">是否确认清除所有未读消息</div>,
bodyStyle: {
maxHeight: "none",
width: "80vw",
position: "fixed",
top: "200px",
left: "10vw",
"--text-color": "#fff",
color: "#fff",
},
// cancelText:"确认",
// confirmText:"取消",
style: {
"--text-color": "#fff",
},
closeOnAction: true,
actions: [
[
{
key: "close",
text: "取消",
bold: true,
style: { color: "#ffffff80" },
onClick: () => {
showMobal?.close();
},
},
{
key: "submit",
text: "确认",
style: { color: "#fff" },
onClick: () => {
if (mesListEl.current) mesListEl.current.readAllMsg([0, 1, 2, 3]);
},
},
],
],
});
};
return (
<div className="">
<div className="flex justify-between items-center px-2 custom-tabs text-gray-400 sticky top-0 z-10 bg-deepBg">
@ -134,7 +174,7 @@ export default function Space() {
/>
))}
</Tabs>
<div className="flex space-x-4">
<div className="flex space-x-4 mt-1">
<Link
href="search"
className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full"
@ -142,10 +182,13 @@ export default function Space() {
<OwnIcon src="/icons/search.png" className="scale-90" />
</Link>
<div
className="w-9 h-9 flex items-center justify-center rounded-full"
className="w-10 h-10 flex items-center justify-center rounded-full"
onClick={handleReadAll}
>
<OwnIcon src="/icons/32DP/remove.png" className="scale-90" />
<OwnIcon
src="/icons/32DP/remove.png"
className="w-full h-full -mt-1 -ml-1"
/>
</div>
</div>
</div>

View File

@ -59,10 +59,12 @@ export default function PersonSpace() {
const photosArr = [
...data?.streamer_ext?.cover?.images?.map((item) => ({
url: item.urls[0],
id: item.id,
type: "video",
})),
...data?.streamer_ext?.album?.images.map((item) => ({
url: item.urls[0],
id: item.id,
type: "img",
})),
];

View File

@ -64,9 +64,13 @@ export default function HostList() {
style={{ "--padding-left": 0 }}
>
<div
onClick={() =>
router.push(`space/person_space_introduce/${item.mid}`)
}
onClick={() => {
if (item.hyperlinks[0].action === "outward") {
window.open(item.hyperlinks[0].url);
} else {
router.push(`space/person_space_introduce/${item.mid}`);
}
}}
className="grid grid-cols-[48px,calc(100vw-48px-2rem)]"
>
<div className="relative">

View File

@ -27,6 +27,7 @@ import { useRouter, useSearchParams } from "next/navigation";
import OwnInput from "@/components/OwnInput";
import { get } from "@/utils/storeInfo";
import OwnIcon from "@/components/OwnIcon";
import baseRequest from "@/utils/baseRequest";
export default function CollaboratorSetting() {
const [data, setData] = useState(null);
const [selfMid, setSelfMid] = useState();

View File

@ -1,7 +1,7 @@
"use client";
import React, { useState, useEffect, useRef, useMemo, Fragment } from "react";
import { Switch, Space, Checkbox, Button, Toast, Radio } from "antd-mobile";
import { Switch, Space, Checkbox, Button, Toast, Form } from "antd-mobile";
import { useRouter, useSearchParams } from "next/navigation";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faAngleLeft } from "@fortawesome/free-solid-svg-icons";
@ -10,11 +10,11 @@ import requireAPI from "@/utils/requireAPI";
import { get } from "@/utils/storeInfo";
import { getStreamerInfo } from "@/api/space";
const superSingles = [
{ key: 0, text: "永久" },
{ key: 1, text: "按月生效" },
{ key: 2, text: "按季度生效" },
{ key: 3, text: "按半年生效" },
{ key: 4, text: "按年生效" },
{ key: 0, index: 0, text: "永久" },
{ key: 4, index: 1, text: "按年生效" },
{ key: 3, index: 2, text: "按半年生效" },
{ key: 2, index: 3, text: "按季度生效" },
{ key: 1, index: 4, text: "按月生效" },
];
// const superSingles = [
// { key: 0, text: "" },
@ -25,62 +25,61 @@ const superSingles = [
// ];
const ListItemWithCheckbox = ({
superSingle,
formData,
setFormData,
superSinglesContr,
setSuperSinglesContr,
superSingleCheckeds,
index,
}) => {
return (
<li className="mt-4" onClick={() => {}}>
<div onClick={(e) => e.stopPropagation()}>
<Radio
value={superSingle.key}
{/* <Radio
value={index}
onChange={(value) => {
const newFormData = { ...formData };
newFormData.superSingle.forEach((el) => {
el.enable = 0;
});
newFormData.superSingle[superSingle.key].enable = value;
// newFormData.superSingle[superSingle.key].price = 0;
// newFormData.superSingle[superSingle.key].wechatFree = false;
newFormData.superSingle[index].enable = value;
// newFormData.superSingle[index].price = 0;
// newFormData.superSingle[index].wechatFree = false;
setFormData(newFormData);
}}
>
{superSingle.text}
</Radio>
{/* <Checkbox
value={superSingle.key}
</Radio> */}
<Checkbox
value={index}
onChange={(value) => {
const newFormData = { ...formData };
newFormData.superSingle[superSingle.key].enable = value;
newFormData.superSingle[superSingle.key].price = 0;
newFormData.superSingle[superSingle.key].wechatFree = false;
setFormData(newFormData);
const newSuperSinglesContr = [...superSinglesContr];
newSuperSinglesContr[index].enable = value;
// newSuperSinglesContr[index].price = 0;
// newSuperSinglesContr[index].wechatFree = false;
setSuperSinglesContr(newSuperSinglesContr);
}}
>
{superSingle.text}
</Checkbox> */}
</Checkbox>
<div
className={`mt-2 px-4 h-12 py-3 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center ${
superSingleCheckeds != superSingle.key
? "mt-0 px-0 py-0 hidden"
: ""
}`}
// className={`mt-2 px-4 h-12 py-3 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center ${
// !superSingleCheckeds.includes(superSingle.key)
// superSingleCheckeds != index
// ? "mt-0 px-0 py-0 hidden"
// : ""
// }`}
className={`mt-2 px-4 h-12 py-3 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center ${
!superSingleCheckeds.includes(index) ? "mt-0 px-0 py-0 hidden" : ""
}`}
>
<div className="flex items-center">
<span className="mr-1 text-[#ffffffae] text-sm">¥</span>
<OwnInput
type="number"
className="text-2xl"
value={formData.superSingle[superSingle.key].price}
value={superSinglesContr[index].price}
onChange={(value) => {
const newFormData = { ...formData };
newFormData.superSingle[superSingle.key].price = value;
setFormData(newFormData);
const newSuperSinglesContr = [...superSinglesContr];
newSuperSinglesContr[index].price = value;
setSuperSinglesContr(newSuperSinglesContr);
}}
/>
</div>
@ -88,126 +87,107 @@ const ListItemWithCheckbox = ({
<span className="text-[#ffffff26] mr-2">|</span>
<Checkbox
block
checked={formData.superSingle[superSingle.key].wechatFree}
checked={superSinglesContr[index].wechatFree}
onChange={(value) => {
const newFormData = { ...formData };
newFormData.superSingle[superSingle.key].wechatFree = value;
setFormData(newFormData);
const newSuperSinglesContr = [...superSinglesContr];
newSuperSinglesContr[index].wechatFree = value;
setSuperSinglesContr(newSuperSinglesContr);
}}
>
<p className="text-sm whitespace-nowrap">赠送微信</p>
</Checkbox>
{/* <Checkbox
block
checked={formData.superSingle[superSingle.key].wechatFree}
onChange={(value) => {
const newFormData = { ...formData };
newFormData.superSingle[superSingle.key].wechatFree = value;
setFormData(newFormData);
}}
>
<p className="text-sm whitespace-nowrap">赠送微信</p>
</Checkbox> */}
</div>
</div>
</div>
</li>
);
};
export default function spacePaymentSetting() {
export default function SpacePaymentSetting() {
const [form] = Form.useForm();
const router = useRouter();
const searchParams = useSearchParams();
const [formData, setFormData] = useState({
spacePrice: "",
ironFanPrice: "",
openSuper: true,
superSingle: [
{ enable: false, price: 0, wechatFree: false },
{ enable: false, price: 0, wechatFree: false },
{ enable: false, price: 0, wechatFree: false },
{ enable: false, price: 0, wechatFree: false },
{ enable: false, price: 0, wechatFree: false },
],
});
const [openSuper, setOpenSuper] = useState(false);
const [spacePriceAble, setSpacePriceAble] = useState(false);
const [tiefenPriceAble, setTiefenPriceAble] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
// const [superSingleCheckeds, setSuperSingleCheckeds] = useState([]);
const [superSingleChecked, setSuperSingleChecked] = useState(null);
const [superSingleCheckeds, setSuperSingleCheckeds] = useState([]);
const [superSinglesContr, setSuperSinglesContr] = useState([
{ enable: false, price: 0, wechatFree: false, key: 0 },
{ enable: false, price: 0, wechatFree: false, key: 4 },
{ enable: false, price: 0, wechatFree: false, key: 3 },
{ enable: false, price: 0, wechatFree: false, key: 2 },
{ enable: false, price: 0, wechatFree: false, key: 1 },
]);
const [spacePriceInfo, setSpacePriceInfo] = useState(null);
useEffect(() => {
const account = get("account");
getStreamerInfo(Number(account.mid)).then((res) => {
//
const haveChecked = res.is_superfanship_enabled;
if (haveChecked) {
setSuperSingleChecked(res.superfanship_valid_period);
}
const newFormData = {
spacePrice: `${res.admission_price / 100}`,
ironFanPrice: res.ironfanship_price / 100,
openSuper: !!res.is_superfanship_enabled,
superSingle: formData.superSingle.map((it, index) => {
if (index == res.superfanship_valid_period) {
return {
enable: !!res.is_superfanship_enabled,
price: res.superfanship_price / 100,
wechatFree: !!res.is_superfanship_give_wechat,
};
} else {
return it;
}
}),
spaceIntro: res.profile,
};
setFormData(newFormData);
//
// const haveChecked = res.superfan_price_list
// .map((it, index) => ({ ...it, index }))
// .filter((it) => it.enable);
const priceList = res.superfan_price_list ?? [
{ enable: false, price: 0, is_superfanship_give_wechat: false, key: 0 },
{ enable: false, price: 0, is_superfanship_give_wechat: false, key: 4 },
{ enable: false, price: 0, is_superfanship_give_wechat: false, key: 3 },
{ enable: false, price: 0, is_superfanship_give_wechat: false, key: 2 },
{ enable: false, price: 0, is_superfanship_give_wechat: false, key: 1 },
];
const haveChecked = priceList
.map((it, index) => ({ ...it, index }))
.filter((it) => it.enable);
// if (haveChecked.length > 0) {
// setSuperSingleChecked(haveChecked[0].period);
// }
// setSuperSingleCheckeds(
// res.superfan_price_list
// .map((it, index) => ({ ...it, index }))
// .filter((it) => it.enable)
// .map((it) => superSingles[it.index].key)
// );
// setFormData({
// spacePrice: res.admission_price / 100,
// ironFanPrice: res.ironfanship_price / 100,
// openSuper: !!res.is_superfanship_enabled,
// superSingle: res.superfan_price_list.map((it) => ({
// enable: !!it.enable,
// price: it.price / 100,
// wechatFree: !!it.is_superfanship_give_wechat,
// })),
// spaceIntro: res.profile,
// });
setSuperSingleCheckeds(
priceList
.map((it, index) => ({ ...it, index }))
.filter((it) => it.enable)
.map((it) => superSingles[it.index].index)
);
setOpenSuper(!!res.is_superfanship_enabled);
setSuperSinglesContr(
priceList.map((it, index) => ({
enable: !!it.enable,
price: it.price / 100,
wechatFree: !!it.is_superfanship_give_wechat,
key: index ? 5 - index : index,
}))
);
setSpacePriceInfo(res);
});
}, []);
useEffect(() => {
if (!spacePriceInfo) return;
form.setFieldsValue({
spacePrice: spacePriceInfo.admission_price / 100,
ironFanPrice: spacePriceInfo.ironfanship_price / 100,
});
}, [form, spacePriceInfo]);
const listItemWithCheckboxMemo = useMemo(() => {
return superSingles.map((item, index) => (
<Fragment key={item.key}>
<ListItemWithCheckbox
superSingle={item}
formData={formData}
setFormData={setFormData}
superSingleCheckeds={superSingleChecked}
// superSingleCheckeds={superSingleCheckeds}
superSinglesContr={superSinglesContr}
setSuperSinglesContr={setSuperSinglesContr}
// superSingleCheckeds={superSingleChecked}
superSingleCheckeds={superSingleCheckeds}
index={index}
/>
</Fragment>
));
}, [formData, superSingleChecked]);
const handleSubmit = async () => {
const { spacePrice, ironFanPrice, openSuper, superSingle } = formData;
}, [superSingleCheckeds, superSinglesContr]);
const handleSubmit = async (newFormData) => {
const { spacePrice, ironFanPrice } = newFormData;
const superSingle = [...superSinglesContr];
const openSuperEveryFalse = Object.values(superSingle).every(
(it) => !it.enable
);
if (!spacePrice || !ironFanPrice || (openSuper && openSuperEveryFalse)) {
if (openSuper && openSuperEveryFalse) {
Toast.show({
icon: "fail",
content: "请完善内容后提交",
content: "请完善档位内容后提交",
position: "top",
});
return;
@ -233,57 +213,9 @@ export default function spacePaymentSetting() {
}
let isPrice = false;
if (openSuper) {
// Object.values(superSingle).forEach((it) => {
// if (it.enable) {
// const superFanPrice = it.price;
// if (!superFanPrice) {
// Toast.show({
// icon: "fail",
// content: "",
// position: "top",
// });
// isPrice = true;
// return;
// } else {
// const _superFanPrice = parseInt(superFanPrice * 100, 10);
// if (
// openSuper &&
// (isNaN(_superFanPrice) ||
// _superFanPrice < 100 ||
// _superFanPrice > 388800)
// ) {
// isPrice = true;
// Toast.show({
// icon: "fail",
// content: "",
// position: "top",
// });
// return;
// }
// if (openSuper && _superFanPrice <= _ironFanPrice) {
// isPrice = true;
// Toast.show({
// icon: "fail",
// content: "",
// position: "top",
// });
// return;
// }
// }
// }
// });
if (superSingleChecked == null) {
Toast.show({
icon: "fail",
content: "请选择铁粉类型",
position: "top",
});
} else {
const superChecked = superSingle.filter(
(_, index) => index == superSingleChecked
)[0];
if (superChecked) {
const superFanPrice = superChecked.price;
Object.values(superSingle).forEach((it) => {
if (it.enable) {
const superFanPrice = it.price;
if (!superFanPrice) {
Toast.show({
icon: "fail",
@ -319,7 +251,55 @@ export default function spacePaymentSetting() {
}
}
}
}
});
// if (superSingleChecked == null) {
// Toast.show({
// icon: "fail",
// content: "",
// position: "top",
// });
// } else {
// const superChecked = superSingle.filter(
// (_, index) => index == superSingleChecked
// )[0];
// if (superChecked) {
// const superFanPrice = superChecked.price;
// if (!superFanPrice) {
// Toast.show({
// icon: "fail",
// content: "",
// position: "top",
// });
// isPrice = true;
// return;
// } else {
// const _superFanPrice = parseInt(superFanPrice * 100, 10);
// if (
// openSuper &&
// (isNaN(_superFanPrice) ||
// _superFanPrice < 100 ||
// _superFanPrice > 388800)
// ) {
// isPrice = true;
// Toast.show({
// icon: "fail",
// content: "",
// position: "top",
// });
// return;
// }
// if (openSuper && _superFanPrice <= _ironFanPrice) {
// isPrice = true;
// Toast.show({
// icon: "fail",
// content: "",
// position: "top",
// });
// return;
// }
// }
// }
// }
}
if (isPrice) return;
// if (
@ -340,20 +320,21 @@ export default function spacePaymentSetting() {
if (isSubmitting) return;
//
const superfanList = superSingle.map((it, index) => ({
period: index,
enable: it.enable ? 1 : 0,
price: parseInt(it.price * 100, 10),
is_superfanship_give_wechat: it.wechatFree ? 1 : 0,
}));
const superfanObj = superfanList.filter((it) => it.enable)[0];
//
// const superfan_price_list = superSingle.map((it, index) => ({
// const superfanList = superSingle.map((it, index) => ({
// period: index,
// enable: it.enable ? 1 : 0,
// price: parseInt(it.price * 100, 10),
// is_superfanship_give_wechat: it.wechatFree ? 1 : 0,
// }));
// const superfanObj = superfanList.filter((it) => it.enable)[0];
//
const superfan_price_list = superSinglesContr.map((it, index) => ({
period: it.key,
enable: it.enable ? 1 : 0,
price: parseInt(it.price * 100, 10),
is_superfanship_give_wechat: it.wechatFree ? 1 : 0,
}));
setIsSubmitting(true);
try {
const body = {
@ -362,13 +343,12 @@ export default function spacePaymentSetting() {
ironfanship_price: parseInt(ironFanPrice * 100, 10),
is_superfanship_enabled: openSuper ? 1 : 0,
//
superfanship_price: superfanObj.price,
superfanship_valid_period: superfanObj.period,
is_superfanship_give_wechat: superfanObj.is_superfanship_give_wechat,
// superfanship_price: superfanObj.price,
// superfanship_valid_period: superfanObj.period,
// is_superfanship_give_wechat: superfanObj.is_superfanship_give_wechat,
//
// superfan_price_list,
superfan_price_list,
};
// console.log("body", body);
const _data = await requireAPI(
"POST",
"/api/zone/update",
@ -397,6 +377,7 @@ export default function spacePaymentSetting() {
setIsSubmitting(false);
}
};
const messageEle = (message) => <p className="text-right">{message}</p>;
return (
<div>
{/* 头部标题 */}
@ -415,10 +396,35 @@ export default function spacePaymentSetting() {
</div>
{/* 内容 */}
<div className="pt-16 p-4 mt-4">
<div>
<Form
requiredMarkStyle="none"
form={form}
initialValues={{
spacePrice: 0,
ironFanPrice: 0,
}}
onFinishFailed={(error) => {
Toast.show({
icon: "fail",
content: "请检查所填内容",
position: "top",
});
}}
onFinish={handleSubmit}
onValuesChange={(values) => {
console.log("onValuesChange:", values);
// setFormData(values);
}}
// hasFeedback={false}
validateMessages={{
required: (name) => {
return <p className="text-right">{`请输入${name}`}</p>;
},
}}
>
<div className="flex justify-between items-center">
<p className="text-sm whitespace-nowrap">
<span>解锁空间价格</span>
<span className="text-white">解锁空间价格</span>
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffb3] text-xs">
@ -428,28 +434,31 @@ export default function spacePaymentSetting() {
<div className="mt-2 px-4 py-3 h-12 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center">
<div className="flex items-center">
<span className="mr-1 text-[#ffffffae] text-sm">¥</span>
{/* {!spacePriceAble ? (
<span className="text-2xl">{formData.spacePrice}</span>
) : (
<Form.Item
required
name="spacePrice"
// childElementPosition="left"
layout="vertical"
rules={[
{
required: true,
message: messageEle("请填写解锁空间的价格"),
pattern: /^[1-9]\d*$/,
// validator: (rule, value) => {
// if (value.length === 0) {
// return Promise.reject(messageEle(""));
// }
// },
},
]}
>
<OwnInput
id="spacePrice"
type="number"
value={formData.spacePrice}
onChange={(value) =>
setFormData((old) => ({ ...old, spacePrice: value }))
}
placeholder="0~3888仅支持整数"
inputClassName="placeholder:text-[14px]"
/>
)} */}
<OwnInput
id="spacePrice"
type="number"
placeholder="0~3888仅支持整数"
value={formData.spacePrice}
onChange={(value) =>
setFormData((old) => ({ ...old, spacePrice: value }))
}
className={!formData.spacePrice ? "pb-1.5" : ""}
inputClassName="placeholder:text-[14px]"
/>
</Form.Item>
</div>
<label
htmlFor="spacePrice"
@ -459,119 +468,131 @@ export default function spacePaymentSetting() {
点击编辑
</label>
</div>
</div>
<div className="mt-3">
<div className="flex justify-between items-center">
<p className="text-sm whitespace-nowrap">
<span>铁粉价格</span>
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffb3] text-xs">
累计消费达成后解锁铁粉权益
</p>
</div>
<div className="mt-2 px-4 py-3 h-12 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center">
<div className="flex items-center">
<span className="mr-1 text-[#ffffffae] text-sm">¥</span>
{/* {!tiefenPriceAble ? (
<span className="text-2xl">{formData.ironFanPrice}</span>
) : (
)} */}
<OwnInput
id="ironPrice"
type="number"
placeholder="1~3888仅支持整数"
value={formData.ironFanPrice}
onChange={(value) =>
setFormData((old) => ({ ...old, ironFanPrice: value }))
}
className={!formData.ironFanPrice ? "pb-1.5" : ""}
inputClassName="placeholder:text-[14px]"
/>
<Form.Item
name="ironFanPrice"
// childElementPosition="left"
label={
<div className="flex justify-between items-center">
<p className="text-sm whitespace-nowrap">
<span className="text-white">铁粉价格</span>
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffb3] text-xs">
累计消费达成后解锁铁粉权益
</p>
</div>
}
layout="vertical"
rules={[
{
required: true,
message: messageEle("请填写铁粉价格"),
// validator: (rule, value) => {
// if (value.length === 0) {
// return Promise.reject(messageEle(""));
// }
// },
},
]}
>
<div className="mt-2 px-4 py-3 h-12 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center">
<div className="flex items-center">
<span className="mr-1 text-[#ffffffae] text-sm">¥</span>
<Form.Item name="ironFanPrice">
<OwnInput
id="ironFanPrice"
type="number"
placeholder="1~3888仅支持整数"
inputClassName="placeholder:text-[14px]"
/>
</Form.Item>
</div>
<label
htmlFor="ironFanPrice"
className="text-[#ffffff40] text-xs whitespace-nowrap"
onClick={() => setTiefenPriceAble(true)}
>
点击编辑
</label>
</div>
<label
htmlFor="ironPrice"
className="text-[#ffffff40] text-xs whitespace-nowrap"
onClick={() => setTiefenPriceAble(true)}
>
点击编辑
</label>
</div>
</div>
<div className="mt-3">
</Form.Item>
<div className="flex justify-between items-center">
<p className="text-sm">
<span>超粉功能</span>
<span className="text-[#f00]">*</span>
<span className="text-white">超粉功能</span>
</p>
<div className="flex items-center">
<p className="text-[#ffffffae] text-xs mr-2">是否启用</p>
<Switch
checked={formData.openSuper}
onChange={(value) => {
setFormData((old) => ({
...old,
openSuper: value,
}));
}}
style={{
"--checked-color": "#FF669E",
"--height": "24px",
"--width": "36px",
}}
/>
<Form.Item>
<Switch
checked={openSuper}
onChange={() => setOpenSuper((old) => !old)}
style={{
"--checked-color": "#FF669E",
"--height": "24px",
"--width": "36px",
}}
/>
</Form.Item>
</div>
</div>
</div>
{formData.openSuper && (
<div className="mt-3">
<div className="flex justify-between items-center">
<p className="text-sm">
<span>超粉单次开通类型</span>
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffb3] text-xs">
付费后解锁对应期限超粉权益
</p>
</div>
<Space direction="vertical" block>
<Radio.Group
value={superSingleChecked}
// value={superSingleCheckeds}
onChange={(values) => {
setSuperSingleChecked(values);
// setSuperSingleCheckeds(values);
}}
>
<ul>{listItemWithCheckboxMemo}</ul>
</Radio.Group>
{/* <Checkbox.Group
value={superSingleCheckeds}
onChange={(values) => {
setSuperSingleCheckeds(values);
}}
>
<ul>{listItemWithCheckboxMemo}</ul>
</Checkbox.Group> */}
</Space>
</div>
)}
<div className="mt-10 flex justify-center">
<Button
size="middle"
shape="rounded"
style={{
"--background-color": "#FF669E",
paddingLeft: "32px",
paddingRight: "32px",
{openSuper && (
<Form.Item
name="superSingleCheckeds"
// childElementPosition="left"
label={
<div className="flex justify-between items-center">
<p className="text-sm">
<span className="text-white">超粉单次开通类型</span>
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffb3] text-xs">
付费后解锁对应期限超粉权益
</p>
</div>
}
layout="vertical"
>
<Space direction="vertical" block>
{/* <Radio.Group
value={superSingleChecked}
// value={superSingleCheckeds}
onChange={(values) => {
setSuperSingleChecked(values);
// setSuperSingleCheckeds(values);
}}
onClick={handleSubmit}
>
{isSubmitting ? "正在保存..." : "保存设置"}
</Button>
</div>
<ul>{listItemWithCheckboxMemo}</ul>
</Radio.Group> */}
<Checkbox.Group
value={superSingleCheckeds}
onChange={(values) => {
setSuperSingleCheckeds(values);
}}
>
<ul>{listItemWithCheckboxMemo}</ul>
</Checkbox.Group>
</Space>
</Form.Item>
)}
<Form.Item label={null} className="mt-10 flex-1 flex justify-center">
<Button
size="middle"
shape="rounded"
block
style={{
"--background-color": "#FF669E",
paddingLeft: "32px",
paddingRight: "32px",
}}
type="primary"
htmlType="submit"
disabled={isSubmitting}
>
{isSubmitting ? "正在保存..." : "保存设置"}
</Button>
</Form.Item>
</Form>
</div>
</div>
);

View File

@ -1,7 +1,8 @@
"use client";
import React, { useEffect } from "react";
import React from "react";
import { Dialog } from "antd-mobile";
import { checkRole } from "@/utils/auth";
// import { useRouter } from "next/navigation";
import baseRequest from "@/utils/baseRequest";
import { save } from "@/utils/storeInfo";
@ -9,13 +10,8 @@ import { getUserInfo } from "@/api/public";
export default function CheckVip({ children, isVipToPassFun, router }) {
const base = baseRequest();
useEffect(() => {}, []);
const handleCheck = async () => {
//
const account = await getUserInfo();
save("account", JSON.stringify(account));
const isVip = account?.is_a_member;
const isVip = await checkRole();
if (!isVip) {
const showMobal = Dialog.show({
title: "是否开通会员",
@ -56,7 +52,6 @@ export default function CheckVip({ children, isVipToPassFun, router }) {
style: { color: "#fff" },
onClick: () => {
showMobal.close();
console.log("showMobal", showMobal);
router.push(
`/webView/${encodeURIComponent(
`/vip?base=${encodeURIComponent(JSON.stringify(base))}`

View File

@ -21,7 +21,7 @@ import OwnImage from "../OwnImage";
import { saveImage } from "@/utils/tools/handleFuns";
import requireAPI from "@/utils/requireAPI";
import CheckVip from "@/components/CheckVip";
function ImagesMask({}, ref) {
function ImagesMask({ isEditing = false }, ref) {
const [visible, setVisible] = useState(false);
const [images, setImages] = useState([]);
const [data, setData] = useState(null);
@ -32,6 +32,7 @@ function ImagesMask({}, ref) {
return (
<ImagesMaskContaint
images={images}
isEditing={isEditing}
visible={visible}
ref={scrollRef}
setVisible={setVisible}
@ -77,6 +78,7 @@ function ImagesMask({}, ref) {
const ImagesMaskContaint = forwardRef(
(
{
isEditing,
visible,
images,
setVisible,
@ -263,27 +265,35 @@ const ImagesMaskContaint = forwardRef(
</div>
</div>
<div className="flex gap-2">
<CheckVip
isVipToPassFun={() => getOriginImg(images[currentIndex]?.id)}
router={router}
>
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] font-medium rounded-full">
原图
</div>
</CheckVip>
{!isEditing && (
<>
<CheckVip
isVipToPassFun={() => {
getOriginImg(images[currentIndex]?.id);
}}
router={router}
>
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] font-medium rounded-full">
原图
</div>
</CheckVip>
<CheckVip
isVipToPassFun={() => saveImage(images[currentIndex]?.url)}
router={router}
>
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] rounded-full">
<FontAwesomeIcon
icon={faDownload}
size="xl"
// className="h-[14px]"
/>
</div>
</CheckVip>
<CheckVip
isVipToPassFun={() =>
saveImage(images[currentIndex]?.url)
}
router={router}
>
<div className="flex justify-center items-center w-[38px] h-[38px] bg-[#ffffff1a] text-[#fff] rounded-full">
<FontAwesomeIcon
icon={faDownload}
size="xl"
// className="h-[14px]"
/>
</div>
</CheckVip>
</>
)}
<div
onClick={() => {

View File

@ -13,7 +13,7 @@ export default function OwnIcon({
<div
className={`flex flex-col justify-center items-center relative ${outClassName}`}
>
<div className={`w-12 h-12 ${className} z-[0]`}>
<div className={`${className} z-[0]`}>
<Image
height={height}
width={width}

View File

@ -284,6 +284,7 @@ export default function PostItem({
{type == "post" ? (
<div
className="flex items-center"
style={{ display: !isOwn ? "flex" : "none" }}
onClick={() =>
router.push("/space/person_space_introduce/" + data.mid)
}
@ -324,8 +325,7 @@ export default function PostItem({
/>
</>
) : (
data?.streamer_ext?.zones?.length !== 0 &&
!isOwn && (
data?.streamer_ext?.zones?.length !== 0 && (
<div className="text-[#FFFFFFB2] font-medium text-xs flex items-center">
<span className="mr-1">查看TA的空间</span>
<FontAwesomeIcon

View File

@ -322,7 +322,7 @@ export default function UploadImgs({
</>
)}
</div>
<ImagesMask ref={imagesMaskRef} />
<ImagesMask ref={imagesMaskRef} isEditing={true} />
</div>
);
}

View File

@ -61,7 +61,7 @@ const WebSocketComponent = ({ getData, authInfo }) => {
// socket.send('Hello Server!');
retryInterval = 1000;
sendMessageQueue();
socketRef.current.send(JSON.stringify({ t: 1 }));
socketRef.current?.send(JSON.stringify({ t: 1 }));
};
//
socketRef.current.onmessage = (event) => {

View File

@ -1,6 +1,6 @@
import { setCookie, deleteCookie, getCookie } from "cookies-next";
import requireAPI from "./requireAPI";
import { get } from "./storeInfo";
import { get, save } from "./storeInfo";
export async function checkAuth() {
try {
const data = await requireAPI("POST", `/api/login/validate`);
@ -24,9 +24,51 @@ export function signOut() {
deleteCookie("mid");
}
export function checkRole() {
const account = get("account");
const role = account?.role;
const isVip = account?.is_a_member;
return role !== 0 && isVip === 1;
export async function getUserInfo(mid) {
if (!mid) return;
try {
const data = await requireAPI("POST", `/api/account/list_by_mid`, {
body: { mid },
});
if (data.ret === 1) {
return data.data.account;
}
} catch (e) {
// console.log(e);
}
}
export async function getVipPrice() {
try {
const data = await requireAPI(
"POST",
`/api/vas/get_membership_product_list`
);
if (data.ret === -1) {
Toast.show({
icon: "fail",
content: data.msg,
position: "top",
});
return;
} else {
return data.data.product.real_price / 100;
}
} catch (e) {
// console.log(e);
}
}
export async function checkRole() {
const account = get("account");
const userInfo = await getUserInfo(account.mid);
if (userInfo) {
if (userInfo.is_a_member !== account) {
save("account", userInfo);
}
}
const role = userInfo?.role;
const isVip = userInfo?.is_a_member;
return role !== 0 || isVip === 1;
}

View File

@ -183,7 +183,7 @@ export const saveImage = async (url) => {
.catch((error) => console.log(error));
};
export const saveFile = async (href) => {
const isVip = checkRole();
const isVip = await checkRole();
if (!isVip) {
// setIsVipModalVisible(true);
Toast.show({