From bf90b352244e570e4a589e903fad13a879343ef9 Mon Sep 17 00:00:00 2001 From: al Date: Tue, 11 Feb 2025 18:14:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/BlockUser/index.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/BlockUser/index.jsx b/src/pages/BlockUser/index.jsx index 2f85c12..bd7670d 100644 --- a/src/pages/BlockUser/index.jsx +++ b/src/pages/BlockUser/index.jsx @@ -52,6 +52,8 @@ const BlockUserContent = (props) => {

{data === 5 && "主播发现隐藏"}

{data === 6 && "主播广场隐藏"}

{data === 7 && "禁止付款"}

+

{data === 8 && "试运营限制广场发帖"}

+

{data === 9 && "试运营主播发现隐藏"}

), }, @@ -402,6 +404,8 @@ const BlockUserContent = (props) => { + + Date: Wed, 19 Feb 2025 15:09:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B6=85=E7=B2=89=E6=A1=A3=E4=BD=8D?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/StreamerSpace/index.jsx | 468 +++++++++++++++++++++--------- 1 file changed, 327 insertions(+), 141 deletions(-) diff --git a/src/pages/StreamerSpace/index.jsx b/src/pages/StreamerSpace/index.jsx index 58f54f3..962b67a 100644 --- a/src/pages/StreamerSpace/index.jsx +++ b/src/pages/StreamerSpace/index.jsx @@ -18,6 +18,7 @@ import { useNavigate } from "react-router-dom"; const StreamerSpaceContent = () => { const navigate = useNavigate(); const { TextArea } = Input; + const [superSingles, setSuperSingles] = useState([]); //展示的表头 const [showColumns, setShowColumns] = useState([ "baseInfo", @@ -26,6 +27,8 @@ const StreamerSpaceContent = () => { "active", "ratio", ]); + // 搜索表单 + const [searchForm] = Form.useForm(); //动态的表头 const dynamicColumns = showColumns.map((item) => { switch (item) { @@ -73,43 +76,38 @@ const StreamerSpaceContent = () => {

是否开启超粉功能: - {data.is_superfanship_enabled === 1 ? "是" : "否"} + {data.is_superfanship_enabled === "1" ? "是" : "否"}

- {data.is_superfanship_enabled === 1 && ( - <> -

- 超粉价格: - - ¥{data.superfanship_price} +


+ {data.is_superfanship_enabled === "1" && + data?.superPriceList?.map((item, index) => ( +

+ {item.period === 4 + ? "年度超粉" + : item.period === 3 + ? "半年度超粉" + : item.period === 2 + ? "一季度超粉" + : item.period === 1 + ? "一个月超粉" + : "永久超粉"} + + {item.enable === "1" ? "开启" : "关闭"} -

-

- 超粉有效期: - {data.superfanship_valid_period === 0 && ( - 永久 - )} - {data.superfanship_valid_period === 1 && ( - 月度 - )} - {data.superfanship_valid_period === 2 && ( - 季度 - )} - {data.superfanship_valid_period === 3 && ( - 半年 - )} - {data.superfanship_valid_period === 4 && ( - 年度 + {item.enable === "1" && ( + + ,¥{item.price} + {item.is_superfanship_give_wechat === "1" && + ",赠送微信"} + )}

-

- 开通超粉是否送微信: - - {data.is_superfanship_give_wechat === 1 ? "是" : "否"} - -

- - )} + ))} ), }; @@ -300,14 +298,26 @@ const StreamerSpaceContent = () => { ct: new Date(zone.ct * 1000).toLocaleString(), }, profile: zone.profile, - paymentSettings: { - admission_price: zone.admission_price / 100, - ironfanship_price: zone.ironfanship_price / 100, - is_superfanship_enabled: zone.is_superfanship_enabled, - superfanship_price: zone.superfanship_price / 100, - superfanship_valid_period: zone.superfanship_valid_period, - is_superfanship_give_wechat: zone.is_superfanship_give_wechat, - }, + paymentSettings: + // { + // admission_price: zone.admission_price / 100, + // ironfanship_price: zone.ironfanship_price / 100, + // is_superfanship_enabled: zone.is_superfanship_enabled, + // superfanship_price: zone.superfanship_price / 100, + // superfanship_valid_period: zone.superfanship_valid_period, + // is_superfanship_give_wechat: zone.is_superfanship_give_wechat, + // }, + { + superPriceList: zone.superfan_price_list?.map((item) => ({ + ...item, + price: item.price / 100, + enable: `${item.enable}`, + is_superfanship_give_wechat: `${item.is_superfanship_give_wechat}`, + })), + admission_price: zone.admission_price / 100, + ironfanship_price: zone.ironfanship_price / 100, + is_superfanship_enabled: `${zone.is_superfanship_enabled}`, + }, active: { zone_moment_count: zone.zone_moment_count, image_count: zone.image_count, @@ -345,7 +355,7 @@ const StreamerSpaceContent = () => { }, body: JSON.stringify({ offset: 0, - limit: 2000, + limit: 100, ...base, }), }); @@ -365,14 +375,26 @@ const StreamerSpaceContent = () => { ct: new Date(item.ct * 1000).toLocaleString(), }, profile: item.profile, - paymentSettings: { - admission_price: item.admission_price / 100, - ironfanship_price: item.ironfanship_price / 100, - is_superfanship_enabled: item.is_superfanship_enabled, - superfanship_price: item.superfanship_price / 100, - superfanship_valid_period: item.superfanship_valid_period, - is_superfanship_give_wechat: item.is_superfanship_give_wechat, - }, + paymentSettings: + // { + // admission_price: item.admission_price / 100, + // ironfanship_price: item.ironfanship_price / 100, + // is_superfanship_enabled: item.is_superfanship_enabled, + // superfanship_price: item.superfanship_price / 100, + // superfanship_valid_period: item.superfanship_valid_period, + // is_superfanship_give_wechat: item.is_superfanship_give_wechat, + // }, + { + superPriceList: item.superfan_price_list?.map((item) => ({ + ...item, + price: item.price / 100, + enable: `${item.enable}`, + is_superfanship_give_wechat: `${item.is_superfanship_give_wechat}`, + })), + admission_price: item.admission_price / 100, + ironfanship_price: item.ironfanship_price / 100, + is_superfanship_enabled: `${item.is_superfanship_enabled}`, + }, active: { zone_moment_count: item.zone_moment_count, image_count: item.image_count, @@ -403,9 +425,10 @@ const StreamerSpaceContent = () => { const [isModalOpen, setIsModalOpen] = useState(false); //点击modal取消按钮 const handleCancel = () => { - setShowData([]); + // setShowData([]); setDefaultValues({}); setIsModalOpen(false); + setSuperSingles([]); }; //modal打开时的默认值 const [defaultValues, setDefaultValues] = useState({}); @@ -413,6 +436,68 @@ const StreamerSpaceContent = () => { const handleModal = (record) => { setDefaultValues(record); setIsModalOpen(true); + const superList = [ + { + period: "0", + text: "永久超粉", + enable: "0", + price: 0, + is_superfanship_give_wechat: "0", + }, + { + period: "1", + text: "一个月超粉", + enable: "0", + price: 0, + is_superfanship_give_wechat: "0", + }, + { + period: "2", + text: "一季度超粉", + enable: "0", + price: 0, + is_superfanship_give_wechat: "0", + }, + { + period: "3", + text: "半年度超粉", + enable: "0", + price: 0, + is_superfanship_give_wechat: "0", + }, + { + period: "4", + text: "年度超粉", + enable: "0", + price: 0, + is_superfanship_give_wechat: "0", + }, + ]; + if (record.paymentSettings?.superPriceList.length > 0) { + setSuperSingles( + record.paymentSettings?.superPriceList.map((item) => { + return { + period: item.period.toString(), + text: + item.period === 4 + ? "年度超粉" + : item.period === 3 + ? "半年度超粉" + : item.period === 2 + ? "一季度超粉" + : item.period === 1 + ? "一个月超粉" + : "永久超粉", + enable: item.enable.toString(), + price: item.price, + is_superfanship_give_wechat: + item.is_superfanship_give_wechat.toString(), + }; + }) + ); + } else { + setSuperSingles(superList); + } }; //表单提交成功 const onModalFormFinish = async (value) => { @@ -426,15 +511,15 @@ const StreamerSpaceContent = () => { alert("请完善表单信息"); return; } - if ( - parseInt(value.is_superfanship_enabled) === 1 && - (!value.superfanship_price?.toString() || - !value.superfanship_valid_period?.toString() || - !value.is_superfanship_give_wechat?.toString()) - ) { - alert("请完善表单信息"); - return; - } + // if ( + // parseInt(value.is_superfanship_enabled) === 1 && + // (!value.superfanship_price?.toString() || + // !value.superfanship_valid_period?.toString() || + // !value.is_superfanship_give_wechat?.toString()) + // ) { + // alert("请完善表单信息"); + // return; + // } const _spacePrice = parseInt(value.admission_price * 100, 10); if (isNaN(_spacePrice) || _spacePrice < 0) { alert("请输入有效的解锁空间价格"); @@ -445,19 +530,52 @@ const StreamerSpaceContent = () => { alert("请输入有效的铁粉价格"); return; } - const _superFanPrice = parseInt(value.superfanship_price * 100, 10); - if ( - parseInt(value.is_superfanship_enabled) === 1 && - (isNaN(_superFanPrice) || _superFanPrice < 100 || _superFanPrice > 388800) - ) { - alert("请输入有效的超粉价格"); - return; + // const _superFanPrice = parseInt(value.superfanship_price * 100, 10); + // if ( + // parseInt(value.is_superfanship_enabled) === 1 && + // (isNaN(_superFanPrice) || _superFanPrice < 100 || _superFanPrice > 388800) + // ) { + // alert("请输入有效的超粉价格"); + // return; + // } + // if ( + // parseInt(value.is_superfanship_enabled) === 1 && + // _superFanPrice <= _ironFanPrice + // ) { + // alert("请输入大于铁粉价格的超粉价格"); + // return; + // } + const superPriceList = superSingles.map((item) => { + return { + period: parseInt(item.period), // int, 0:永久 + enable: parseInt(item.enable), // int, 1:开启, 0:未开启 + price: parseInt(value[`superPrice${item.period}`] * 100, 10), + is_superfanship_give_wechat: parseInt( + value[`isSuperfanshipGiveWechat${item.period}`] + ), + }; + }); + //检查超粉价格是否正确 + let pass = true; + if (value.is_superfanship_enabled === "1") { + superPriceList.forEach((item) => { + if (!pass) { + return; + } + if (item.enable && item.price <= _ironFanPrice) { + alert("请输入大于铁粉价格的超粉价格"); + pass = false; + return; + } + }); } - if ( - parseInt(value.is_superfanship_enabled) === 1 && - _superFanPrice <= _ironFanPrice - ) { - alert("请输入大于铁粉价格的超粉价格"); + + if (!pass) return; + const allClose = superPriceList.every((item) => { + return item.enable === 0; + }); + if (allClose) { + alert("请至少开启一个超粉价格"); return; } try { @@ -473,15 +591,16 @@ const StreamerSpaceContent = () => { admission_price: parseInt(value.admission_price * 100, 10), ironfanship_price: parseInt(value.ironfanship_price * 100, 10), is_superfanship_enabled: parseInt(value.is_superfanship_enabled), - superfanship_price: parseInt(value.superfanship_price * 100, 10), - superfanship_valid_period: parseInt( - value.superfanship_valid_period, - 10 - ), - is_superfanship_give_wechat: parseInt( - value.is_superfanship_give_wechat, - 10 - ), + // superfanship_price: parseInt(value.superfanship_price * 100, 10), + // superfanship_valid_period: parseInt( + // value.superfanship_valid_period, + // 10 + // ), + // is_superfanship_give_wechat: parseInt( + // value.is_superfanship_give_wechat, + // 10 + // ), + superfan_price_list: superPriceList, ...base, }), }); @@ -490,11 +609,17 @@ const StreamerSpaceContent = () => { alert(detailData.msg); return; } + const searchValue = searchForm.getFieldsValue(); + if (searchValue.id) { + search(searchValue); + } else { + getAllSpace(); + } } catch (error) { console.error(error); } //关闭模态 - setShowData([]); + // setShowData([]); setDefaultValues({}); setIsModalOpen(false); }; @@ -561,13 +686,13 @@ const StreamerSpaceContent = () => { console.error(error); } //关闭模态 - setShowData([]); + // setShowData([]); setDefaultValues({}); setIsAddAgencyModalOpen(false); }; //点击添加代运营Modal取消按钮 const handleAddAgencyModalCancel = () => { - setShowData([]); + // setShowData([]); setIsAddAgencyModalOpen(false); }; //在modal中搜索用户 @@ -677,7 +802,7 @@ const StreamerSpaceContent = () => { console.error(error); } //关闭模态 - setShowData([]); + // setShowData([]); setDefaultValues({}); setIsAgencyModalOpen(false); }; @@ -703,7 +828,7 @@ const StreamerSpaceContent = () => { } message.success("删除成功"); //关闭模态 - setShowData([]); + // setShowData([]); setDefaultValues({}); setIsAgencyModalOpen(false); } catch (error) { @@ -712,10 +837,10 @@ const StreamerSpaceContent = () => { }; //点击编辑代运营Modal取消按钮 const handleAgencyModalCancel = () => { - setShowData([]); + // setShowData([]); setIsAgencyModalOpen(false); }; - + const messageEle = (message) =>

{message}

; return (
@@ -726,7 +851,12 @@ const StreamerSpaceContent = () => { onChange={(value) => setShowColumns(value)} />
-
+ @@ -745,7 +875,12 @@ const StreamerSpaceContent = () => { /> {/* 编辑空间模态框是否显示 */} {isModalOpen && ( - + { borderRadius: 4, outline: "none", }} - > - - - - - - - - - - +
+
- - + {superSingles.map((item) => ( +
+ + + +
+ + + + + + +
+
+ ))} +
+ -- 2.41.0