From 647bbe9ff3afda5d765aff3bfa81bcd62ba9f6ef Mon Sep 17 00:00:00 2001
From: al
Date: Thu, 21 Nov 2024 18:37:48 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=B9=BF=E5=9C=BA=E5=8A=A8?=
=?UTF-8?q?=E6=80=81=E5=AE=A1=E6=A0=B8=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/ImageUploader/index.jsx | 66 +-
src/components/PagesManage/index.js | 93 +++
src/components/UploadImgs/index.js | 141 ++++
src/components/VideoPlayer/index.js | 13 +-
src/pages/Notices/index.jsx | 752 ++++++++++++++++++
src/pages/Op/index.jsx | 4 +-
src/pages/PostMachineReview/index.jsx | 122 +--
src/pages/StreamerInformation/index.jsx | 11 +-
.../StreamerVideoMachineReview/index.jsx | 8 +-
src/pages/ZonePostMachineReview/index.jsx | 6 +-
src/routes/index.js | 5 +
src/utils/tools.js | 12 +
tailwind.config.js | 29 +-
13 files changed, 1161 insertions(+), 101 deletions(-)
create mode 100644 src/components/PagesManage/index.js
create mode 100644 src/components/UploadImgs/index.js
create mode 100644 src/pages/Notices/index.jsx
create mode 100644 src/utils/tools.js
diff --git a/src/components/ImageUploader/index.jsx b/src/components/ImageUploader/index.jsx
index 0b7bfdd..a72fa54 100644
--- a/src/components/ImageUploader/index.jsx
+++ b/src/components/ImageUploader/index.jsx
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { uploadImage } from "../../utils/upload";
-const ImageUploader = ({ setIds }) => {
+const ImageUploader = ({ setIds, uploadOne }) => {
const [selectedImages, setSelectedImages] = useState([]);
const [uploading, setUploading] = useState(false);
@@ -86,40 +86,42 @@ const ImageUploader = ({ setIds }) => {
)}
))}
-
+ >
+
+ {uploading ? "正在上传..." : "添加图片"}
+
+
+
+ )}
);
diff --git a/src/components/PagesManage/index.js b/src/components/PagesManage/index.js
new file mode 100644
index 0000000..88ee036
--- /dev/null
+++ b/src/components/PagesManage/index.js
@@ -0,0 +1,93 @@
+import React, { useState, useRef, useEffect, useMemo } from "react";
+import {
+ List,
+ Input,
+ Button,
+ message,
+ // Spin,
+} from "antd";
+import baseRequest from "../../utils/baseRequest";
+export default function PagesManage() {
+ const [pages, setPages] = useState([
+ { title: "主播空间", name: "streamerSpace", params: "name=text" },
+ { title: "主播主页", name: "streamerProfile", params: "" },
+ { title: "充值页面", name: "payCenter", params: "" },
+ { title: "主播空间", name: "streamerSpace", params: "" },
+ { title: "主播空间", name: "streamerSpace", params: "" },
+ { title: "主播空间", name: "streamerSpace", params: "" },
+ ]);
+ //创建页面路由
+ const handleCreate = async ({ id, route_path, action, desc }) => {
+ try {
+ const base = baseRequest();
+ const response = await fetch("/op/frontend_route/create", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ id,
+ route_path,
+ action,
+ desc,
+ ...base,
+ }),
+ });
+ const _data = await response.json();
+ if (_data.ret === -1) {
+ alert(_data.msg);
+ return;
+ }
+ message.success("创建成功");
+ } catch (error) {
+ console.error(error);
+ }
+ };
+ return (
+
+
+
+ {pages.map((it) => (
+
+
+
+
+
+ {it.title}
+ |
+ {it.name}
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+ {it.params && (
+
+ 参数:
+ {`?${it.params}`}
+
+ )}
+
+
+
+
+ ))}
+
+
+ );
+}
diff --git a/src/components/UploadImgs/index.js b/src/components/UploadImgs/index.js
new file mode 100644
index 0000000..4d5ed0b
--- /dev/null
+++ b/src/components/UploadImgs/index.js
@@ -0,0 +1,141 @@
+import React, { useEffect, useState } from "react";
+import { Spin, Image, ImageViewer } from "antd";
+import { uploadImage } from "../../utils/upload";
+// import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+// import { faAdd, faClose } from "@fortawesome/free-solid-svg-icons";
+import { FileAddFilled, CloseCircleFilled } from "@ant-design/icons";
+export default function UploadImgs({ assets, getImgs, multiple }) {
+ const maxCount = 6;
+ const [fileList, setFileList] = useState([]);
+ const [loading, setLoading] = useState(false);
+ // useEffect(() => {
+ // if (!assets) {
+ // setFileList([]);
+ // }
+ // }, assets);
+ const handleUploadImage = async (e) => {
+ let file = e.target.files[0];
+ if (!file) return;
+ setLoading(true);
+ if (file.type.indexOf("image/") != -1) {
+ // const image = await uploadImage(file);
+ // getImgs((old) => [...old, image.id]);
+ const newFiles = [file];
+ const newAssets = newFiles.map((item) => ({
+ type: "img",
+ src: URL.createObjectURL(item),
+ }));
+ const uploadPromise = uploadImage(file);
+ const uploadResult = await Promise.race([
+ uploadPromise,
+ new Promise((_, reject) =>
+ setTimeout(() => reject(new Error("Upload timeout")), 30000)
+ ),
+ ]);
+ console.log("uploadResult", uploadResult);
+ setFileList(newAssets);
+ getImgs(uploadResult);
+ } else if (file.type.indexOf("video/") != -1) {
+ if (typeof window == "undefined") return;
+ const videoD = document.getElementById("videoD");
+ const videoC = document.getElementById("videoC");
+ // console.log("videoC", videoC);
+ const ctx = videoC?.getContext("2d");
+ // 设置Canvas的宽度和高度与视频一致
+ videoC.width = videoD.videoWidth;
+ videoC.height = videoD.videoHeight;
+ // 在Canvas上绘制当前视频帧
+ ctx.drawImage(videoD, 0, 0, videoC.width, videoC.height);
+ // 将Canvas转换为图片URL
+ const frameImageUrl = videoC.toDataURL();
+
+ // 输出图片URL
+ // console.log(frameImageUrl);
+ // console.log("ddddd", file, {
+ // type: "video",
+ // src: frameImageUrl,
+ // });
+ // const video = await uploadVideo(file);
+ // getImgs((old) => [...old, video.id]);
+ // setFileList((old) => [...old, video]);
+ const newFiles = [...assets, file];
+ const newAssets = newFiles.map((item) => ({
+ type: "video",
+ src: URL.createObjectURL(item),
+ }));
+ setFileList(newAssets);
+ }
+
+ setLoading(false);
+ };
+ const handleRemoveItem = (index) => {
+ // console.log(index);
+ let newArr = [...fileList];
+ newArr.splice(index, 1);
+ setFileList(newArr);
+ getImgs(newArr);
+ };
+ return (
+
+
+ {fileList.map((item, index) => {
+ return (
+
+
+
handleRemoveItem(index)}
+ >
+
+
+
+ );
+ })}
+ {loading && (
+
+ )}
+ {(multiple || (!multiple && !fileList.length)) && !loading && (
+
+ )}
+
+
+
+
+
+
+
+ );
+}
+// export async function mockUpload(file) {
+// await sleep(3000)
+// return {
+// url: URL.createObjectURL(file),
+// }
+// }
diff --git a/src/components/VideoPlayer/index.js b/src/components/VideoPlayer/index.js
index bac9773..fece0a3 100644
--- a/src/components/VideoPlayer/index.js
+++ b/src/components/VideoPlayer/index.js
@@ -1,11 +1,18 @@
import React, { useState } from "react";
import { Select } from "antd";
import ReactPlayer from "react-player";
-export default function VideoPlayer({url,key,style}) {
+export default function VideoPlayer({ url, key, style }) {
const [rate, setRate] = useState(1);
return (
-
-
+
+
@@ -68,7 +68,7 @@ const PostMachineReviewContent = (props) => {
))}
{data.media?.videos?.map((item, index) => (
-
+
))}
@@ -247,16 +247,10 @@ const PostMachineReviewContent = (props) => {
render: (_, record) => (
-
-
-
-
+
),
@@ -268,12 +262,14 @@ const PostMachineReviewContent = (props) => {
render: (_, record) => (
-
-
-
-
+ {current === "operatorReviewing" && (
+
+
+
+
+ )}
),
@@ -294,7 +290,14 @@ const PostMachineReviewContent = (props) => {
formRef.current.submit();
};
//提交表单
- const handleSubmit = async () => {
+ const handleSubmit = async (value) => {
+ const cc = {
+ moment_ids: [parseInt(formRef.current.record.momentId, 10)],
+ op_type: formRef.current.type,
+ manually_review_opinion: value[formRef.current.record.momentId]
+ ? value[formRef.current.record.momentId]
+ : "",
+ };
try {
//通过图片审核,如果是视频直接跳过
const base = baseRequest();
@@ -306,6 +309,9 @@ const PostMachineReviewContent = (props) => {
body: JSON.stringify({
moment_ids: [parseInt(formRef.current.record.momentId, 10)],
op_type: formRef.current.type,
+ manually_review_opinion: value[formRef.current.record.momentId]
+ ? value[formRef.current.record.momentId]
+ : "",
...base,
}),
});
@@ -332,14 +338,14 @@ const PostMachineReviewContent = (props) => {
if (!more) return;
let querryStatus;
switch (current) {
- case "rollbackbymachine":
+ case "operatorReviewing":
querryStatus = 4;
break;
- case "machinereviewfail":
- querryStatus = 10;
+ case "machineReviewing":
+ querryStatus = 3;
break;
- case "passbymachine":
- querryStatus = 2;
+ case "onlySelfCanSee":
+ querryStatus = 6;
break;
default:
break;
@@ -386,23 +392,31 @@ const PostMachineReviewContent = (props) => {
media: item.moment_audit_task.audited_media,
text: item.moment_audit_task.audited_text,
},
- info: {
- mediaType:
- item.moment_audit_task.audited_media.videos.length === 0
- ? "image"
- : "video",
- media:
- item.moment_audit_task.audited_media.videos.length === 0
- ? item.image_audit_task_vo.image_audits
- : item.moment_audit_task.image_audit_opinion,
- text: item.text_audit_task_vo.text_audit,
- },
+ info: item.moment_audit_task.audited_media
+ ? {
+ mediaType:
+ item.moment_audit_task.audited_media.videos.length === 0
+ ? "image"
+ : "video",
+ media:
+ item.moment_audit_task.audited_media.videos.length === 0
+ ? item.image_audit_task_vo.image_audits
+ : item.moment_audit_task.image_audit_opinion,
+ text: item.text_audit_task_vo.text_audit,
+ }
+ : { text: item.text_audit_task_vo.text_audit },
submitTime: new Date(
item.moment_audit_task.ct * 1000
).toLocaleString(),
remarks: {
- media: item.image_audit_task_vo.remarks,
- text: item.text_audit_task_vo.remarks,
+ // media: item.image_audit_task_vo.remarks,
+ // text: item.moment_audit_task.remarks,
+ manually_review_status:
+ item.moment_audit_task?.manually_review_status,
+ manually_review_opinion:
+ item.moment_audit_task?.manually_review_opinion,
+ manually_review_operator:
+ item.moment_audit_task?.manually_review_operator,
},
others: {
media: {
@@ -455,8 +469,8 @@ const PostMachineReviewContent = (props) => {
return (
- {current === "rollbackbymachine" && `机审核违规${showData.length}条`}
- {current === "passbymachine" && `机审核通过${showData.length}条`}
+ {current === "operatorReviewing" && `运营待审核${showData.length}条`}
+ {current === "onlySelfCanSee" && `审核未通过${showData.length}条`}
diff --git a/src/pages/StreamerInformation/index.jsx b/src/pages/StreamerInformation/index.jsx
index aa3c2c9..8c2e2d7 100644
--- a/src/pages/StreamerInformation/index.jsx
+++ b/src/pages/StreamerInformation/index.jsx
@@ -13,7 +13,7 @@ import Modal from "../../components/Modal";
import VideoUploader from "../../components/VideoUploader";
import ImageUploader from "../../components/ImageUploader";
import baseRequest from "../../utils/baseRequest";
-import VideoPlayer from '../../components/VideoPlayer';
+import VideoPlayer from "../../components/VideoPlayer";
//tab内容
const StreamerInformationContent = () => {
const { TextArea } = Input;
@@ -119,9 +119,7 @@ const StreamerInformationContent = () => {
title: "封面视频",
dataIndex: "displayVideo",
key: "displayVideo",
- render: (data) => (
-
- ),
+ render: (data) => ,
};
case "displayGallery":
return {
@@ -753,7 +751,10 @@ const StreamerInformationContent = () => {
{defaultMedia.displayVideo.length !== 0 && (
-
+
媒体:
- item.urls[0])}>
+ item.urls[0])}
+ >
{data.media.images.map((item, index) => (
))}
@@ -146,7 +148,7 @@ const ZonePostMachineReviewContent = (props) => {
name={record.momentId}
initialValue={record.remarks.manually_review_opinion}
>
-
+
),
diff --git a/src/routes/index.js b/src/routes/index.js
index 7da7f7d..fe5252f 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -7,6 +7,7 @@ import StreamerJoin from "../pages/StreamerJoin";
import StreamerJoinNew from "../pages/StreamerJoinNew";
import StreamerInformationCompleteNew from "../pages/StreamerInformationCompleteNew";
import Feedback from "../pages/Feedback";
+import Notices from "../pages/Notices";
import Contact from "../pages/Contact";
import UploadMedia from "../pages/UploadMedia";
import GoodsReview from "../pages/GoodsReview";
@@ -71,6 +72,10 @@ const routes = [
path: "streamerVerification/*",
element: ,
},
+ {
+ path: "notices/*",
+ element: ,
+ },
{
path: "feedback/*",
element: ,
diff --git a/src/utils/tools.js b/src/utils/tools.js
new file mode 100644
index 0000000..031ff4d
--- /dev/null
+++ b/src/utils/tools.js
@@ -0,0 +1,12 @@
+//格式化时间戳
+export function formatDeadline(timestamp) {
+ const date = new Date(timestamp); // 时间戳以秒为单位,需要乘以1000转换成毫秒
+ const year = date.getFullYear();
+ const month = ("0" + (date.getMonth() + 1)).slice(-2);
+ const day = ("0" + date.getDate()).slice(-2);
+ const hours = ("0" + date.getHours()).slice(-2);
+ const minutes = ("0" + date.getMinutes()).slice(-2);
+ const seconds = ("0" + date.getSeconds()).slice(-2);
+
+ return `${year}年${month}月${day}日 ${hours}:${minutes}:${seconds}`;
+}
diff --git a/tailwind.config.js b/tailwind.config.js
index 814f3b5..7f21cfd 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -2,7 +2,34 @@
module.exports = {
content: ["./src/**/*.{js,jsx,ts,tsx}"],
theme: {
- extend: {},
+ extend: {
+ colors: {
+ primary: { DEFAULT: "#FF669E", 500: "#FF669E50" },
+ secondary: { DEFAULT: "#838284" },
+ neutral: { DEFAULT: "#2c2b2f" },
+ info: { DEFAULT: "#3B69B8" },
+ success: { DEFAULT: "#27F5B7" },
+ warning: { DEFAULT: "#FFF04C" },
+ error: { DEFAULT: "#F53030" },
+ deepBg: { DEFAULT: "#07050A" },
+ btn: { DEFAULT: "#3763b7" },
+ super: {
+ DEFAULT: "#FFD685",
+ 500: "#FFD68550",
+ },
+ },
+ backgroundImage: {
+ "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
+ "gradient-conic":
+ "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
+ },
+ },
+ backgroundSize: {
+ auto: "auto",
+ cover: "cover",
+ contain: "contain",
+ "40%": "40%",
+ },
},
plugins: [],
corePlugins: {