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

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: "必修/选修",
dataIndex: "isRequired",
render: (isRequired: number) => (
<span>{isRequired === 1 ? "必修课" : "选修课"}</span>
dataIndex: "is_required",
render: (is_required: number) => (
<span>{is_required === 1 ? "必修课" : "选修课"}</span>
),
},
{

View File

@ -108,29 +108,35 @@ const SystemConfigPage = () => {
var value = form.getFieldValue("player.bullet_secret_text");
if (e.target.checked) {
value += "{name}";
form.setFieldsValue({
"player.bullet_secret_text": value,
});
} else {
value = value.replace("{name}", "");
}
form.setFieldsValue({
"player.bullet_secret_text": value,
});
};
const addEmail = (e: CheckboxChangeEvent) => {
var value = form.getFieldValue("player.bullet_secret_text");
if (e.target.checked) {
value += "{email}";
form.setFieldsValue({
"player.bullet_secret_text": value,
});
} else {
value = value.replace("{email}", "");
}
form.setFieldsValue({
"player.bullet_secret_text": value,
});
};
const addIdCard = (e: CheckboxChangeEvent) => {
var value = form.getFieldValue("player.bullet_secret_text");
if (e.target.checked) {
value += "{idCard}";
form.setFieldsValue({
"player.bullet_secret_text": value,
});
} else {
value = value.replace("{idCard}", "");
}
form.setFieldsValue({
"player.bullet_secret_text": value,
});
};
const onFinish = (values: any) => {
@ -155,10 +161,218 @@ const SystemConfigPage = () => {
{
key: "1",
label: `网站设置`,
children: (
<Form
form={form}
name="basic"
labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }}
style={{ width: 1000, paddingTop: 30 }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
autoComplete="off"
>
{logo && (
<Form.Item
style={{ marginBottom: 30 }}
label="网站Logo"
name="system.logo"
labelCol={{ style: { marginTop: 8, marginLeft: 54 } }}
>
<div className="d-flex">
<Image preview={false} width={150} height={50} src={logo} />
<div className="d-flex ml-24">
<UploadImageButton
onSelected={(url) => {
setLogo(url);
form.setFieldsValue({ "system.logo": url });
}}
></UploadImageButton>
</div>
<div className="helper-text ml-24">
推荐尺寸:240x80pxJPGPNG
</div>
</div>
</Form.Item>
)}
{!logo && (
<Form.Item
style={{ marginBottom: 30 }}
label="网站Logo"
name="system.logo"
>
<div className="d-flex">
<div className="d-flex ml-24">
<UploadImageButton
onSelected={(url) => {
setLogo(url);
form.setFieldsValue({ "system.logo": url });
}}
></UploadImageButton>
</div>
<div className="helper-text ml-24">
推荐尺寸:240x80pxJPGPNG
</div>
</div>
</Form.Item>
)}
<Form.Item
style={{ marginBottom: 30 }}
label="网站标题"
name="system.name"
>
<Input style={{ width: 274 }} placeholder="请填写网站标题" />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="网站页脚"
name="system.pc_index_footer_msg"
>
<Input style={{ width: 274 }} placeholder="请填写网站页脚" />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="API访问地址"
name="system.api_url"
>
<Input style={{ width: 274 }} placeholder="请填写API访问地址" />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="PC端访问地址"
name="system.pc_url"
>
<Input style={{ width: 274 }} placeholder="请填写PC端访问地址" />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="H5端访问地址"
name="system.h5_url"
>
<Input style={{ width: 274 }} placeholder="请填写H5端访问地址" />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
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="播放器跑马灯">
<Space align="baseline" style={{ height: 32 }}>
<Form.Item
name="player.is_enabled_bullet_secret"
valuePropName="checked"
>
<Switch onChange={onSwitchChange} />
</Form.Item>
<div className="helper-text ml-24">
</div>
</Space>
</Form.Item>
<Form.Item style={{ marginBottom: 30 }} label="跑马灯内容">
<Space align="baseline" style={{ height: 32 }}>
<Form.Item name="player.bullet_secret_text">
<Input style={{ width: 274 }} placeholder="自定义跑马灯内容" />
</Form.Item>
<Checkbox className="ml-24" onChange={addName}>
</Checkbox>
<Checkbox className="ml-24" onChange={addEmail}>
</Checkbox>
<Checkbox className="ml-24" onChange={addIdCard}>
</Checkbox>
</Space>
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="跑马灯文字颜色"
name="player.bullet_secret_color"
>
<Input type="color" style={{ width: 32, padding: 0 }} />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="跑马灯不透明度"
name="player.bullet_secret_opacity"
>
<Slider style={{ width: 400 }} range defaultValue={[0, 100]} />
</Form.Item>
{thumb && (
<Form.Item
style={{ marginBottom: 30 }}
label="播放器封面"
name="player.poster"
labelCol={{ style: { marginTop: 75, marginLeft: 42 } }}
>
<div className="d-flex">
<Image preview={false} width={320} height={180} src={thumb} />
<div className="d-flex ml-24">
<UploadImageButton
onSelected={(url) => {
setThumb(url);
form.setFieldsValue({ "player.poster": url });
}}
></UploadImageButton>
<div className="helper-text ml-24">
推荐尺寸:19200x1080px
</div>
</div>
</div>
</Form.Item>
)}
{!thumb && (
<Form.Item
style={{ marginBottom: 30 }}
label="播放器封面"
name="player.poster"
>
<div className="d-flex">
<div className="d-flex">
<UploadImageButton
onSelected={(url) => {
setThumb(url);
form.setFieldsValue({ "player.poster": url });
}}
></UploadImageButton>
<div className="helper-text ml-24">
推荐尺寸:19200x1080px
</div>
</div>
</div>
</Form.Item>
)}
<Form.Item
style={{ marginBottom: 30 }}
wrapperCol={{ offset: 2, span: 21 }}
>
<Button type="primary" htmlType="submit" loading={loading}>
</Button>
</Form.Item>
</Form>
),
},
];
@ -175,227 +389,6 @@ const SystemConfigPage = () => {
items={items}
onChange={onChange}
/>
<div className="float-left mt-24">
<Form
form={form}
name="basic"
labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }}
style={{ width: 1000 }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
autoComplete="off"
>
{tabKey === 1 && (
<>
{logo && (
<Form.Item
style={{ marginBottom: 30 }}
label="网站Logo"
name="system.logo"
labelCol={{ style: { marginTop: 8, marginLeft: 54 } }}
>
<div className="d-flex">
<Image
preview={false}
width={150}
height={50}
src={logo}
/>
<div className="d-flex ml-24">
<UploadImageButton
onSelected={(url) => {
setLogo(url);
form.setFieldsValue({ "system.logo": url });
}}
></UploadImageButton>
</div>
<div className="helper-text ml-24">
推荐尺寸:240x80pxJPGPNG
</div>
</div>
</Form.Item>
)}
{!logo && (
<Form.Item
style={{ marginBottom: 30 }}
label="网站Logo"
name="system.logo"
>
<div className="d-flex">
<div className="d-flex ml-24">
<UploadImageButton
onSelected={(url) => {
setLogo(url);
form.setFieldsValue({ "system.logo": url });
}}
></UploadImageButton>
</div>
<div className="helper-text ml-24">
推荐尺寸:240x80pxJPGPNG
</div>
</div>
</Form.Item>
)}
<Form.Item
style={{ marginBottom: 30 }}
label="网站标题"
name="system.name"
>
<Input style={{ width: 274 }} placeholder="请填写网站标题" />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="网站页脚"
name="system.pc_index_footer_msg"
>
<Input style={{ width: 274 }} placeholder="请填写网站页脚" />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="API访问地址"
name="system.api_url"
>
<Input
style={{ width: 274 }}
placeholder="请填写API访问地址"
/>
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="PC端访问地址"
name="system.pc_url"
>
<Input
style={{ width: 274 }}
placeholder="请填写PC端访问地址"
/>
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="H5端访问地址"
name="system.h5_url"
>
<Input
style={{ width: 274 }}
placeholder="请填写H5端访问地址"
/>
</Form.Item>
</>
)}
{tabKey === 2 && (
<>
<Form.Item style={{ marginBottom: 30 }} label="播放器跑马灯">
<Space align="baseline" style={{ height: 32 }}>
<Form.Item
name="player.is_enabled_bullet_secret"
valuePropName="checked"
>
<Switch onChange={onSwitchChange} />
</Form.Item>
<div className="helper-text ml-24">
</div>
</Space>
</Form.Item>
<Form.Item style={{ marginBottom: 30 }} label="跑马灯内容">
<Space align="baseline" style={{ height: 32 }}>
<Form.Item name="player.bullet_secret_text">
<Input
style={{ width: 274 }}
placeholder="自定义跑马灯内容"
/>
</Form.Item>
<Checkbox className="ml-24" onChange={addName}>
</Checkbox>
<Checkbox className="ml-24" onChange={addEmail}>
</Checkbox>
<Checkbox className="ml-24" onChange={addIdCard}>
</Checkbox>
</Space>
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="跑马灯文字颜色"
name="player.bullet_secret_color"
>
<Input type="color" style={{ width: 32, padding: 0 }} />
</Form.Item>
<Form.Item
style={{ marginBottom: 30 }}
label="跑马灯不透明度"
name="player.bullet_secret_opacity"
>
<Slider
style={{ width: 400 }}
range
defaultValue={[0, 100]}
/>
</Form.Item>
{thumb && (
<Form.Item
style={{ marginBottom: 30 }}
label="播放器封面"
name="player.poster"
labelCol={{ style: { marginTop: 75, marginLeft: 42 } }}
>
<div className="d-flex">
<Image
preview={false}
width={320}
height={180}
src={thumb}
/>
<div className="d-flex ml-24">
<UploadImageButton
onSelected={(url) => {
setThumb(url);
form.setFieldsValue({ "player.poster": url });
}}
></UploadImageButton>
<div className="helper-text ml-24">
推荐尺寸:19200x1080px
</div>
</div>
</div>
</Form.Item>
)}
{!thumb && (
<Form.Item
style={{ marginBottom: 30 }}
label="播放器封面"
name="player.poster"
>
<div className="d-flex">
<div className="d-flex">
<UploadImageButton
onSelected={(url) => {
setThumb(url);
form.setFieldsValue({ "player.poster": url });
}}
></UploadImageButton>
<div className="helper-text ml-24">
推荐尺寸:19200x1080px
</div>
</div>
</div>
</Form.Item>
)}
</>
)}
<Form.Item
style={{ marginBottom: 30 }}
wrapperCol={{ offset: 2, span: 21 }}
>
<Button type="primary" htmlType="submit" loading={loading}>
</Button>
</Form.Item>
</Form>
</div>
</Row>
</>
);