From 6261c3a57c537f42d6a7d13777ca3ceffe94cccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Thu, 23 Mar 2023 15:07:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/system/index.tsx | 406 ++++++++++++++++++++----------------- 1 file changed, 219 insertions(+), 187 deletions(-) diff --git a/src/pages/system/index.tsx b/src/pages/system/index.tsx index 8a36394..93b13bc 100644 --- a/src/pages/system/index.tsx +++ b/src/pages/system/index.tsx @@ -1,6 +1,7 @@ import React, { useState, useEffect } from "react"; import { Row, + Col, Form, Input, Image, @@ -9,17 +10,23 @@ import { message, Switch, Checkbox, + Slider, } from "antd"; +import styles from "./index.module.less"; import { appConfig } from "../../api/index"; +import { useParams, useNavigate } from "react-router-dom"; import { UploadImageButton } from "../../compenents"; import type { TabsProps } from "antd"; import type { CheckboxChangeEvent } from "antd/es/checkbox"; export const SystemIndexPage: React.FC = () => { + const params = useParams(); + const navigate = useNavigate(); const [form] = Form.useForm(); const [loading, setLoading] = useState(false); const [logo, setLogo] = useState(""); const [thumb, setThumb] = useState(""); + const [tabKey, setTabKey] = useState(1); useEffect(() => { getDetail(); @@ -75,8 +82,12 @@ export const SystemIndexPage: React.FC = () => { "player.bullet_secret_color": configData[i].key_value, }); } else if (configData[i].key_name === "player.bullet_secret_opacity") { + let value = 0; + if (configData[i].key_value !== "") { + value = Number(configData[i].key_value) * 100; + } form.setFieldsValue({ - "player.bullet_secret_opacity": configData[i].key_value, + "player.bullet_secret_opacity": value, }); } } @@ -94,7 +105,7 @@ export const SystemIndexPage: React.FC = () => { const addName = (e: CheckboxChangeEvent) => { var value = form.getFieldValue("player.bullet_secret_text"); if (e.target.checked) { - value += "${user.mobile}"; + value += "{name}"; console.log(value); form.setFieldsValue({ "player.bullet_secret_text": value, @@ -107,6 +118,8 @@ export const SystemIndexPage: React.FC = () => { return; } setLoading(true); + values["player.bullet_secret_opacity"] = + values["player.bullet_secret_opacity"][0] / 100; appConfig.saveAppConfig(values).then((res: any) => { message.success("保存成功!"); setLoading(false); @@ -122,107 +135,26 @@ export const SystemIndexPage: React.FC = () => { { key: "1", label: `网站设置`, - children: ( -
-
- {logo && ( - -
- -
- { - setLogo(url); - form.setFieldsValue({ "system.logo": url }); - }} - > -
-
- (推荐尺寸:240x80px,支持JPG、PNG) -
-
-
- )} - {!logo && ( - -
-
- { - setLogo(url); - form.setFieldsValue({ "system.logo": url }); - }} - > -
-
- (推荐尺寸:240x80px,支持JPG、PNG) -
-
-
- )} - - - - - - - - - - - - - - - -
-
- ), }, { key: "2", label: `播放设置`, - children: ( + }, + ]; + + const onChange = (key: string) => { + setTabKey(Number(key)); + }; + + return ( + <> + +
{ labelCol={{ span: 3 }} wrapperCol={{ span: 21 }} style={{ width: 1000 }} - initialValues={{ remember: true }} onFinish={onFinish} onFinishFailed={onFinishFailed} autoComplete="off" > - -
- -
- (打开后播放器会随机出现跑马灯水印,以防录屏传播) -
-
-
- -
- - - 姓名 - - 邮箱 - 身份证号 -
-
- - - - - {/* */} - - {thumb && ( - -
- -
- { - setThumb(url); - form.setFieldsValue({ "player.poster": url }); - }} - > -
- (推荐尺寸:19200x1080px,视频播放未开始时展示) + {tabKey === 1 && ( + <> + {logo && ( + +
+ +
+ { + setLogo(url); + form.setFieldsValue({ "system.logo": url }); + }} + > +
+
+ (推荐尺寸:240x80px,支持JPG、PNG) +
-
-
- + + )} + {!logo && ( + +
+
+ { + setLogo(url); + form.setFieldsValue({ "system.logo": url }); + }} + > +
+
+ (推荐尺寸:240x80px,支持JPG、PNG) +
+
+
+ )} + + + + + + + + + + + + + )} - {!thumb && ( - -
+ {tabKey === 2 && ( + <> +
- { - setThumb(url); - form.setFieldsValue({ "player.poster": url }); - }} - > +
- (推荐尺寸:19200x1080px,视频播放未开始时展示) + (打开后播放器会随机出现跑马灯水印,以防录屏传播)
-
-
+ + +
+ + + 姓名 + + 邮箱 + 身份证号 +
+
+ + + + + + + {thumb && ( + +
+ +
+ { + setThumb(url); + form.setFieldsValue({ "player.poster": url }); + }} + > +
+ (推荐尺寸:19200x1080px,视频播放未开始时展示) +
+
+
+
+ )} + {!thumb && ( + +
+
+ { + setThumb(url); + form.setFieldsValue({ "player.poster": url }); + }} + > +
+ (推荐尺寸:19200x1080px,视频播放未开始时展示) +
+
+
+
+ )} + )} - +
- ), - }, - ]; - - return ( - <> - - );