支持隐藏代运营

This commit is contained in:
yezian 2024-05-17 22:46:54 +08:00
parent 88be15c308
commit 5bca3b71d6
1 changed files with 131 additions and 1 deletions

View File

@ -145,6 +145,10 @@ const StreamerSpaceContent = () => {
key: "ratio",
render: (data) => (
<div>
{data.is_hided === 1 && (
<p className="text-red-400">对主播隐藏代运营</p>
)}
<hr />
{data.zone_third_partner?.third_partner_account?.mid && (
<>
<p>
@ -198,6 +202,9 @@ const StreamerSpaceContent = () => {
<Button type="primary" onClick={() => handleModal(record)}>
修改
</Button>
<Button type="primary" onClick={() => handleAgencyModal(record)}>
编辑代运营
</Button>
<Button
onClick={() =>
navigate(`/editSpacePost?user_id=${record.baseInfo.id}`)
@ -289,6 +296,7 @@ const StreamerSpaceContent = () => {
ratio: {
zone_third_partner: zone.zone_third_partner,
zone_collaborator_list: zone.zone_collaborator_list,
is_hided: zone.zone_third_partner?.is_hided,
},
},
]);
@ -350,6 +358,7 @@ const StreamerSpaceContent = () => {
ratio: {
zone_third_partner: item.zone_third_partner,
zone_collaborator_list: item.zone_collaborator_list,
is_hided: item.zone_third_partner?.is_hided,
},
};
});
@ -465,6 +474,54 @@ const StreamerSpaceContent = () => {
console.log("Failed:", errorInfo);
};
//Modal
const [isAgencyModalOpen, setIsAgencyModalOpen] = useState(false);
//
const handleAgencyModal = (record) => {
setDefaultValues(record);
setIsAgencyModalOpen(true);
};
//
const handleSubmitAgencySetting = async (value) => {
if (!value.is_hided?.toString()) {
alert("请完善表单信息");
return;
}
try {
const base = baseRequest();
const detailResponse = await fetch(
`/op/zone_third_partner/set_is_hided`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
zid: defaultValues.key,
is_hided: parseInt(value.is_hided, 10),
...base,
}),
}
);
const detailData = await detailResponse.json();
if (detailData.ret === -1) {
alert(detailData.msg);
return;
}
} catch (error) {
console.error(error);
}
//
setShowData([]);
setDefaultValues({});
setIsAgencyModalOpen(false);
};
//Modal
const handleAgencyModalCancel = () => {
setShowData([]);
setIsAgencyModalOpen(false);
};
return (
<div style={{ marginLeft: 20, marginRight: 20 }}>
<div style={{ marginTop: 20, marginBottom: 10 }}>
@ -492,7 +549,7 @@ const StreamerSpaceContent = () => {
pagination={{ pageSize: 20 }}
scroll={{ y: window.innerHeight - 300 }}
/>
{/* 模态框是否显示 */}
{/* 编辑空间模态框是否显示 */}
{isModalOpen && (
<Form
name="change"
@ -661,6 +718,79 @@ const StreamerSpaceContent = () => {
/>
</Form>
)}
{/* 编辑代运营Modal是否可见 */}
{isAgencyModalOpen && (
<Form
name="agency"
onFinish={handleSubmitAgencySetting}
onFinishFailed={onModalFormFinishFailed}
autoComplete="off"
>
<Modal
title="修改代运营设置"
cancel={handleAgencyModalCancel}
content={
<div
className="flex flex-col overflow-y-scroll"
style={{ height: (window.innerHeight * 2) / 3 }}
>
<div className="flex flex-row">
<Image
width={80}
height={80}
className="rounded-full"
src={defaultValues.baseInfo.avatar}
/>
<div className="flex flex-col justify-between ml-2">
<p className="font-bold">ID{defaultValues.baseInfo.id}</p>
<p className="font-bold">
昵称{defaultValues.baseInfo.name}
</p>
<p className="font-bold">
创建时间{defaultValues.baseInfo.ct}
</p>
</div>
</div>
<div
className="flex flex-row flex-wrap"
style={{ width: (window.innerWidth * 2) / 3 }}
>
{defaultValues.ratio.zone_third_partner?.is_hided !==
undefined && (
<Form.Item
className="basis-1/2 px-2"
name="is_hided"
label="是否对主播隐藏代运营"
initialValue={
defaultValues.ratio.zone_third_partner?.is_hided
}
rules={[
{
required: true,
message: "请选择是否对主播隐藏代运营选项",
},
]}
>
<select
style={{
height: 32,
padding: "4px 11px",
border: "1px solid #d9d9d9",
borderRadius: 4,
outline: "none",
}}
>
<option value={1}></option>
<option value={0}></option>
</select>
</Form.Item>
)}
</div>
</div>
}
/>
</Form>
)}
</div>
);
};