系统配置优化和线上课列表选修、必修渲染

This commit is contained in:
禺狨 2023-03-28 15:43:06 +08:00
parent 3663d7da1f
commit b03c3be59a
2 changed files with 226 additions and 233 deletions

View File

@ -156,9 +156,9 @@ const CoursePage = () => {
}, },
{ {
title: "必修/选修", title: "必修/选修",
dataIndex: "isRequired", dataIndex: "is_required",
render: (isRequired: number) => ( render: (is_required: number) => (
<span>{isRequired === 1 ? "必修课" : "选修课"}</span> <span>{is_required === 1 ? "必修课" : "选修课"}</span>
), ),
}, },
{ {

View File

@ -108,29 +108,35 @@ const SystemConfigPage = () => {
var value = form.getFieldValue("player.bullet_secret_text"); var value = form.getFieldValue("player.bullet_secret_text");
if (e.target.checked) { if (e.target.checked) {
value += "{name}"; value += "{name}";
} else {
value = value.replace("{name}", "");
}
form.setFieldsValue({ form.setFieldsValue({
"player.bullet_secret_text": value, "player.bullet_secret_text": value,
}); });
}
}; };
const addEmail = (e: CheckboxChangeEvent) => { const addEmail = (e: CheckboxChangeEvent) => {
var value = form.getFieldValue("player.bullet_secret_text"); var value = form.getFieldValue("player.bullet_secret_text");
if (e.target.checked) { if (e.target.checked) {
value += "{email}"; value += "{email}";
} else {
value = value.replace("{email}", "");
}
form.setFieldsValue({ form.setFieldsValue({
"player.bullet_secret_text": value, "player.bullet_secret_text": value,
}); });
}
}; };
const addIdCard = (e: CheckboxChangeEvent) => { const addIdCard = (e: CheckboxChangeEvent) => {
var value = form.getFieldValue("player.bullet_secret_text"); var value = form.getFieldValue("player.bullet_secret_text");
if (e.target.checked) { if (e.target.checked) {
value += "{idCard}"; value += "{idCard}";
} else {
value = value.replace("{idCard}", "");
}
form.setFieldsValue({ form.setFieldsValue({
"player.bullet_secret_text": value, "player.bullet_secret_text": value,
}); });
}
}; };
const onFinish = (values: any) => { const onFinish = (values: any) => {
@ -155,39 +161,17 @@ const SystemConfigPage = () => {
{ {
key: "1", key: "1",
label: `网站设置`, label: `网站设置`,
}, children: (
{
key: "2",
label: `播放设置`,
},
];
const onChange = (key: string) => {
setTabKey(Number(key));
};
return (
<>
<Row className="playedu-main-body">
<Tabs
className="float-left"
defaultActiveKey="1"
items={items}
onChange={onChange}
/>
<div className="float-left mt-24">
<Form <Form
form={form} form={form}
name="basic" name="basic"
labelCol={{ span: 3 }} labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }} wrapperCol={{ span: 21 }}
style={{ width: 1000 }} style={{ width: 1000, paddingTop: 30 }}
onFinish={onFinish} onFinish={onFinish}
onFinishFailed={onFinishFailed} onFinishFailed={onFinishFailed}
autoComplete="off" autoComplete="off"
> >
{tabKey === 1 && (
<>
{logo && ( {logo && (
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
@ -196,12 +180,7 @@ const SystemConfigPage = () => {
labelCol={{ style: { marginTop: 8, marginLeft: 54 } }} labelCol={{ style: { marginTop: 8, marginLeft: 54 } }}
> >
<div className="d-flex"> <div className="d-flex">
<Image <Image preview={false} width={150} height={50} src={logo} />
preview={false}
width={150}
height={50}
src={logo}
/>
<div className="d-flex ml-24"> <div className="d-flex ml-24">
<UploadImageButton <UploadImageButton
onSelected={(url) => { onSelected={(url) => {
@ -256,35 +235,47 @@ const SystemConfigPage = () => {
label="API访问地址" label="API访问地址"
name="system.api_url" name="system.api_url"
> >
<Input <Input style={{ width: 274 }} placeholder="请填写API访问地址" />
style={{ width: 274 }}
placeholder="请填写API访问地址"
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
label="PC端访问地址" label="PC端访问地址"
name="system.pc_url" name="system.pc_url"
> >
<Input <Input style={{ width: 274 }} placeholder="请填写PC端访问地址" />
style={{ width: 274 }}
placeholder="请填写PC端访问地址"
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
label="H5端访问地址" label="H5端访问地址"
name="system.h5_url" name="system.h5_url"
> >
<Input <Input style={{ width: 274 }} placeholder="请填写H5端访问地址" />
style={{ width: 274 }}
placeholder="请填写H5端访问地址"
/>
</Form.Item> </Form.Item>
</> <Form.Item
)} style={{ marginBottom: 30 }}
{tabKey === 2 && ( wrapperCol={{ offset: 2, span: 21 }}
<> >
<Button type="primary" htmlType="submit" loading={loading}>
</Button>
</Form.Item>
</Form>
),
},
{
key: "2",
label: `播放设置`,
children: (
<Form
form={form}
name="n-basic"
labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }}
style={{ width: 1000, paddingTop: 30 }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
autoComplete="off"
>
<Form.Item style={{ marginBottom: 30 }} label="播放器跑马灯"> <Form.Item style={{ marginBottom: 30 }} label="播放器跑马灯">
<Space align="baseline" style={{ height: 32 }}> <Space align="baseline" style={{ height: 32 }}>
<Form.Item <Form.Item
@ -301,10 +292,7 @@ const SystemConfigPage = () => {
<Form.Item style={{ marginBottom: 30 }} label="跑马灯内容"> <Form.Item style={{ marginBottom: 30 }} label="跑马灯内容">
<Space align="baseline" style={{ height: 32 }}> <Space align="baseline" style={{ height: 32 }}>
<Form.Item name="player.bullet_secret_text"> <Form.Item name="player.bullet_secret_text">
<Input <Input style={{ width: 274 }} placeholder="自定义跑马灯内容" />
style={{ width: 274 }}
placeholder="自定义跑马灯内容"
/>
</Form.Item> </Form.Item>
<Checkbox className="ml-24" onChange={addName}> <Checkbox className="ml-24" onChange={addName}>
@ -329,11 +317,7 @@ const SystemConfigPage = () => {
label="跑马灯不透明度" label="跑马灯不透明度"
name="player.bullet_secret_opacity" name="player.bullet_secret_opacity"
> >
<Slider <Slider style={{ width: 400 }} range defaultValue={[0, 100]} />
style={{ width: 400 }}
range
defaultValue={[0, 100]}
/>
</Form.Item> </Form.Item>
{thumb && ( {thumb && (
<Form.Item <Form.Item
@ -343,12 +327,7 @@ const SystemConfigPage = () => {
labelCol={{ style: { marginTop: 75, marginLeft: 42 } }} labelCol={{ style: { marginTop: 75, marginLeft: 42 } }}
> >
<div className="d-flex"> <div className="d-flex">
<Image <Image preview={false} width={320} height={180} src={thumb} />
preview={false}
width={320}
height={180}
src={thumb}
/>
<div className="d-flex ml-24"> <div className="d-flex ml-24">
<UploadImageButton <UploadImageButton
onSelected={(url) => { onSelected={(url) => {
@ -384,8 +363,6 @@ const SystemConfigPage = () => {
</div> </div>
</Form.Item> </Form.Item>
)} )}
</>
)}
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
wrapperCol={{ offset: 2, span: 21 }} wrapperCol={{ offset: 2, span: 21 }}
@ -395,7 +372,23 @@ const SystemConfigPage = () => {
</Button> </Button>
</Form.Item> </Form.Item>
</Form> </Form>
</div> ),
},
];
const onChange = (key: string) => {
setTabKey(Number(key));
};
return (
<>
<Row className="playedu-main-body">
<Tabs
className="float-left"
defaultActiveKey="1"
items={items}
onChange={onChange}
/>
</Row> </Row>
</> </>
); );