增加用户重新购空间页面;优化代码格式

This commit is contained in:
yezian 2024-08-27 12:22:51 +03:00
parent 61a3492ac8
commit 4c1b1631f4
7 changed files with 95 additions and 11 deletions

View File

@ -4,13 +4,18 @@ import baseRequest from "../../utils/baseRequest";
import ImageUploader from "../../components/ImageUploader"; import ImageUploader from "../../components/ImageUploader";
import VideoUploader from "../../components/VideoUploader"; import VideoUploader from "../../components/VideoUploader";
import { useSearchParams } from "react-router-dom"; import { useSearchParams } from "react-router-dom";
import VideoPlayer from '../../components/VideoPlayer'; import VideoPlayer from "../../components/VideoPlayer";
const EditSpacePostContent = (props) => { const EditSpacePostContent = (props) => {
const { TextArea } = Input; const { TextArea } = Input;
const [searchParams, setSearchParams] = useSearchParams(); const [searchParams, setSearchParams] = useSearchParams();
const userId = searchParams.get("user_id"); const userId = searchParams.get("user_id");
// //
const columns = [ const columns = [
{
title: "id",
dataIndex: "momentId",
key: "momentId",
},
{ {
title: "发帖人", title: "发帖人",
dataIndex: "creator", dataIndex: "creator",
@ -55,13 +60,15 @@ const EditSpacePostContent = (props) => {
</div> </div>
<p className="text-red-400">媒体</p> <p className="text-red-400">媒体</p>
<div className="flex flex-wrap gap-1"> <div className="flex flex-wrap gap-1">
<Image.PreviewGroup items={data.media.images?.map((item) => item.urls[0])}> <Image.PreviewGroup
items={data.media.images?.map((item) => item.urls[0])}
>
{data.media.images.map((item, index) => ( {data.media.images.map((item, index) => (
<Image key={index} src={item.urls[0]} width={100} /> <Image key={index} src={item.urls[0]} width={100} />
))} ))}
</Image.PreviewGroup> </Image.PreviewGroup>
{data.media.videos.map((item, index) => ( {data.media.videos.map((item, index) => (
<VideoPlayer key={index} url={item.urls[0]}/> <VideoPlayer key={index} url={item.urls[0]} />
))} ))}
</div> </div>
</div> </div>
@ -511,8 +518,8 @@ const EditSpacePostContent = (props) => {
{defaultMedia.video_ids.length !== 0 && ( {defaultMedia.video_ids.length !== 0 && (
<div className="flex flex-row mt-4"> <div className="flex flex-row mt-4">
<div className="relative"> <div className="relative">
<div className="mr-auto" > <div className="mr-auto">
<VideoPlayer url={defaultMedia.videos[0].urls[0]}/> <VideoPlayer url={defaultMedia.videos[0].urls[0]} />
</div> </div>
<Button <Button
className="absolute top-0 left-0 w-full" className="absolute top-0 left-0 w-full"

View File

@ -72,6 +72,7 @@ export default function Op() {
getItem("退款", "refund"), getItem("退款", "refund"),
getItem("空间成员退款查询", "spaceMemberRefundQuerry"), getItem("空间成员退款查询", "spaceMemberRefundQuerry"),
getItem("用户误退空间恢复", "rollbackUserLeaveSpace"), getItem("用户误退空间恢复", "rollbackUserLeaveSpace"),
getItem("用户重购空间", "rollbackUserRefundSpaceStatus"),
]), ]),
getItem("社区治理", "communityManagement", <UsergroupAddOutlined />, [ getItem("社区治理", "communityManagement", <UsergroupAddOutlined />, [
getItem("用户封禁", "blockUser"), getItem("用户封禁", "blockUser"),

View File

@ -10,7 +10,7 @@ const RefundContent = (props) => {
try { try {
const base = baseRequest(); const base = baseRequest();
const _response = await fetch( const _response = await fetch(
`op/vas/${ `/op/vas/${
value.type === "coin" ? "refund_coin_order" : "refund_order" value.type === "coin" ? "refund_coin_order" : "refund_order"
}`, }`,
{ {

View File

@ -12,7 +12,7 @@ export default function RollbackUserLeaveSpace() {
} }
try { try {
const base = baseRequest(); const base = baseRequest();
const response = await fetch(`op/vas/rollback_zone_exit_status`, { const response = await fetch(`/op/vas/rollback_zone_exit_status`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

View File

@ -0,0 +1,71 @@
import React from "react";
import { Form, Input, Space, Button, message } from "antd";
import baseRequest from "../../utils/baseRequest";
export default function RollbackUserRefundSpaceStatus() {
const [form] = Form.useForm();
const rollback = async (value) => {
if (!value.userid || !value.streamer_userid) {
alert("请填写用户和主播的ID");
return;
}
try {
const base = baseRequest();
const response = await fetch(`/op/vas/rollback_zone_refund_status`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
userid: parseInt(value.userid, 10),
streamer_userid: parseInt(value.streamer_userid, 10),
...base,
}),
});
const data = await response.json();
console.log(data);
if (data.ret === -1) {
alert(data.msg);
return;
}
form.resetFields();
message.success("恢复成功");
} catch (error) {
console.error(error);
}
};
//
const onFinishFailed = (errorInfo) => {
console.log("Failed:", errorInfo);
};
return (
<div className="mt-4" style={{ marginLeft: 20, marginRight: 20 }}>
<p className="text-red-400 mb-4">
该功能只适用于用户加入空间主动退款后希望重新购买空间的情况
</p>
<Form
name="rollback"
form={form}
onFinish={rollback}
onFinishFailed={onFinishFailed}
>
<Space direction="vertical" style={{ marginBottom: 20 }}>
<Form.Item label="请输入用户ID" name="userid" style={{ margin: 0 }}>
<Input type="number" />
</Form.Item>
<Form.Item
label="请输入主播ID"
name="streamer_userid"
style={{ margin: 0 }}
>
<Input type="number" />
</Form.Item>
<Button type="primary" htmlType="submit">
恢复
</Button>
</Space>
</Form>
</div>
);
}

View File

@ -92,7 +92,7 @@ export default function SpaceMemberRefundQuerry() {
try { try {
const base = baseRequest(); const base = baseRequest();
// //
const response = await fetch(`op/vas/zone_refund_list`, { const response = await fetch(`/op/vas/zone_refund_list`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

View File

@ -33,6 +33,7 @@ import StreamerImageMachineReview from "../pages/StreamerImageMachineReview";
import StreamerTextMachineReview from "../pages/StreamerTextMachineReview"; import StreamerTextMachineReview from "../pages/StreamerTextMachineReview";
import StreamerVideoMachineReview from "../pages/StreamerVideoMachineReview"; import StreamerVideoMachineReview from "../pages/StreamerVideoMachineReview";
import RollbackUserLeaveSpace from "../pages/RollbackUserLeaveSpace"; import RollbackUserLeaveSpace from "../pages/RollbackUserLeaveSpace";
import RollbackUserRefundSpaceStatus from "../pages/RollbackUserRefundSpaceStatus/index";
const routes = [ const routes = [
{ {
@ -175,6 +176,10 @@ const routes = [
path: "rollbackUserLeaveSpace/*", path: "rollbackUserLeaveSpace/*",
element: <RollbackUserLeaveSpace />, element: <RollbackUserLeaveSpace />,
}, },
{
path: "rollbackUserRefundSpaceStatus/*",
element: <RollbackUserRefundSpaceStatus />,
},
], ],
}, },
]; ];