Compare commits

..

No commits in common. "015dc667cba0f7c80a89e3bd30129001401c571f" and "fbf95bbb66ac5885c099b3912367404c5a4ccddf" have entirely different histories.

14 changed files with 127 additions and 183 deletions

View File

@ -3,7 +3,7 @@ import { Row, Col, Empty, Table, Spin, Typography, Input, Button } from "antd";
import type { ColumnsType } from "antd/es/table"; import type { ColumnsType } from "antd/es/table";
import { resource } from "../../api"; import { resource } from "../../api";
import styles from "./index.module.less"; import styles from "./index.module.less";
import { TreeCategory } from "../../compenents"; import { TreeCategory, UploadCoursewareButton } from "../../compenents";
interface VideoItem { interface VideoItem {
id: number; id: number;
@ -181,7 +181,12 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
<Col span={17}> <Col span={17}>
<Row style={{ marginBottom: 24, paddingLeft: 10 }}> <Row style={{ marginBottom: 24, paddingLeft: 10 }}>
<div className="float-left j-b-flex"> <div className="float-left j-b-flex">
<div className="d-flex"></div> <UploadCoursewareButton
categoryIds={category_ids}
onUpdate={() => {
resetVideoList();
}}
></UploadCoursewareButton>
<div className="d-flex"> <div className="d-flex">
<div className="d-flex mr-24"> <div className="d-flex mr-24">
<Typography.Text></Typography.Text> <Typography.Text></Typography.Text>

View File

@ -64,18 +64,7 @@ export const UploadVideoFloatButton = () => {
const uploadProps = { const uploadProps = {
multiple: true, multiple: true,
beforeUpload: async (file: File, fileList: any) => { beforeUpload: async (file: File) => {
if (file.size > 2 * 1024 * 1024 * 1024) {
message.error(`${file.name} 大小超过2G`);
return Upload.LIST_IGNORE;
}
if (fileList.length > 10) {
message.config({ maxCount: 1 });
message.error("单次最多上传10个视频");
return Upload.LIST_IGNORE;
} else {
message.config({ maxCount: 10 });
}
if (file.type === "video/mp4") { if (file.type === "video/mp4") {
// 视频封面解析 || 视频时长解析 // 视频封面解析 || 视频时长解析
let videoInfo = await parseVideo(file); let videoInfo = await parseVideo(file);
@ -186,7 +175,7 @@ export const UploadVideoFloatButton = () => {
</p> </p>
<p className="ant-upload-text"></p> <p className="ant-upload-text"></p>
<p className="ant-upload-hint"> <p className="ant-upload-hint">
/ 2G以内的mp4文件 / mp4
</p> </p>
</Dragger> </Dragger>
</Col> </Col>

View File

@ -3,6 +3,7 @@ import { Row, Col, Empty, Table, Spin, Typography, Input, Button } from "antd";
import type { ColumnsType } from "antd/es/table"; import type { ColumnsType } from "antd/es/table";
import { resource } from "../../api"; import { resource } from "../../api";
import styles from "./index.module.less"; import styles from "./index.module.less";
import { UploadVideoButton } from "../upload-video-button";
import { DurationText, TreeCategory } from "../../compenents"; import { DurationText, TreeCategory } from "../../compenents";
interface VideoItem { interface VideoItem {
@ -172,7 +173,12 @@ export const UploadVideoSub = (props: PropsInterface) => {
<Col span={17}> <Col span={17}>
<Row style={{ marginBottom: 24, paddingLeft: 10 }}> <Row style={{ marginBottom: 24, paddingLeft: 10 }}>
<div className="float-left j-b-flex"> <div className="float-left j-b-flex">
<div className="d-flex"></div> <UploadVideoButton
categoryIds={category_ids}
onUpdate={() => {
resetVideoList();
}}
></UploadVideoButton>
<div className="d-flex"> <div className="d-flex">
<div className="d-flex mr-24"> <div className="d-flex mr-24">
<Typography.Text></Typography.Text> <Typography.Text></Typography.Text>

View File

@ -10,7 +10,6 @@ import {
message, message,
Image, Image,
TreeSelect, TreeSelect,
Spin,
} from "antd"; } from "antd";
import styles from "./create.module.less"; import styles from "./create.module.less";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
@ -53,7 +52,6 @@ export const CourseCreate: React.FC<PropInterface> = ({
const defaultThumb2 = courseDefaultThumbs[1]; const defaultThumb2 = courseDefaultThumbs[1];
const defaultThumb3 = courseDefaultThumbs[2]; const defaultThumb3 = courseDefaultThumbs[2];
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [init, setInit] = useState(true);
const [departments, setDepartments] = useState<Option[]>([]); const [departments, setDepartments] = useState<Option[]>([]);
const [categories, setCategories] = useState<Option[]>([]); const [categories, setCategories] = useState<Option[]>([]);
const [thumb, setThumb] = useState(""); const [thumb, setThumb] = useState("");
@ -73,9 +71,9 @@ export const CourseCreate: React.FC<PropInterface> = ({
const [attachments, setAttachments] = useState<number[]>([]); const [attachments, setAttachments] = useState<number[]>([]);
useEffect(() => { useEffect(() => {
setInit(true);
if (open) { if (open) {
initData(); getParams();
getCategory();
} }
}, [open, cateIds, depIds]); }, [open, cateIds, depIds]);
@ -98,48 +96,43 @@ export const CourseCreate: React.FC<PropInterface> = ({
setShowDrop(false); setShowDrop(false);
}, [form, open]); }, [form, open]);
const initData = async () => { const getParams = () => {
await getParams(); department.departmentList().then((res: any) => {
await getCategory(); const departments = res.data.departments;
setInit(false); const departCount: DepIdsModel = res.data.dep_user_count;
}; if (JSON.stringify(departments) !== "{}") {
const new_arr: any = checkArr(departments, 0, departCount);
const getParams = async () => { setDepartments(new_arr);
let res: any = await department.departmentList(); }
const departments = res.data.departments; let type = "open";
const departCount: DepIdsModel = res.data.dep_user_count; if (depIds.length !== 0 && depIds[0] !== 0) {
if (JSON.stringify(departments) !== "{}") { type = "elective";
const new_arr: any = checkArr(departments, 0, departCount); let item = checkChild(res.data.departments, depIds[0]);
setDepartments(new_arr); let arr: any[] = [];
} if (item === undefined) {
let type = "open"; arr.push(depIds[0]);
if (depIds.length !== 0 && depIds[0] !== 0) { } else if (item.parent_chain === "") {
type = "elective"; arr.push(depIds[0]);
let item = checkChild(res.data.departments, depIds[0]); } else {
let arr: any[] = []; let new_arr = item.parent_chain.split(",");
if (item === undefined) { new_arr.map((num: any) => {
arr.push(depIds[0]); arr.push(Number(num));
} else if (item.parent_chain === "") { });
arr.push(depIds[0]); arr.push(depIds[0]);
} else { }
let new_arr = item.parent_chain.split(","); form.setFieldsValue({
new_arr.map((num: any) => { dep_ids: arr,
arr.push(Number(num)); });
} else {
form.setFieldsValue({
dep_ids: depIds,
}); });
arr.push(depIds[0]);
} }
form.setFieldsValue({ form.setFieldsValue({
dep_ids: arr, type: type,
}); });
} else { setType(type);
form.setFieldsValue({
dep_ids: depIds,
});
}
form.setFieldsValue({
type: type,
}); });
setType(type);
}; };
const checkChild = (departments: any[], id: number) => { const checkChild = (departments: any[], id: number) => {
@ -152,36 +145,37 @@ export const CourseCreate: React.FC<PropInterface> = ({
} }
}; };
const getCategory = async () => { const getCategory = () => {
let res: any = await course.createCourse(); course.createCourse().then((res: any) => {
const categories = res.data.categories; const categories = res.data.categories;
if (JSON.stringify(categories) !== "{}") { if (JSON.stringify(categories) !== "{}") {
const new_arr: any = checkArr(categories, 0, null); const new_arr: any = checkArr(categories, 0, null);
setCategories(new_arr); setCategories(new_arr);
}
if (cateIds.length !== 0 && cateIds[0] !== 0) {
let item = checkChild(res.data.categories, cateIds[0]);
let arr: any[] = [];
if (item === undefined) {
arr.push(cateIds[0]);
} else if (item.parent_chain === "") {
arr.push(cateIds[0]);
} else {
let new_arr = item.parent_chain.split(",");
new_arr.map((num: any) => {
arr.push(Number(num));
});
arr.push(cateIds[0]);
} }
form.setFieldsValue({
category_ids: arr, if (cateIds.length !== 0 && cateIds[0] !== 0) {
}); let item = checkChild(res.data.categories, cateIds[0]);
} else { let arr: any[] = [];
form.setFieldsValue({ if (item === undefined) {
category_ids: cateIds, arr.push(cateIds[0]);
}); } else if (item.parent_chain === "") {
} arr.push(cateIds[0]);
} else {
let new_arr = item.parent_chain.split(",");
new_arr.map((num: any) => {
arr.push(Number(num));
});
arr.push(cateIds[0]);
}
form.setFieldsValue({
category_ids: arr,
});
} else {
form.setFieldsValue({
category_ids: cateIds,
});
}
});
}; };
const getNewTitle = (title: any, id: number, counts: any) => { const getNewTitle = (title: any, id: number, counts: any) => {
@ -509,15 +503,7 @@ export const CourseCreate: React.FC<PropInterface> = ({
} }
width={634} width={634}
> >
{init && ( <div className="float-left mt-24">
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left mt-24"
style={{ display: init ? "none" : "block" }}
>
<SelectResource <SelectResource
defaultKeys={ defaultKeys={
chapterType == 0 ? hours : changeChapterHours(chapterHours) chapterType == 0 ? hours : changeChapterHours(chapterHours)

View File

@ -103,6 +103,7 @@ export const CourseUpdate: React.FC<PropInterface> = ({
setType(type); setType(type);
setThumb(res.data.course.thumb); setThumb(res.data.course.thumb);
setInit(false); setInit(false);
console.log(dayjs(res.data.course.published_at, "YYYY-MM-DD HH:mm:ss"));
}); });
}; };

View File

@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect } from "react"; import React, { useState, useRef, useEffect } from "react";
import { Modal, Form, Input, Cascader, message, Spin } from "antd"; import { Modal, Form, Input, Cascader, message } from "antd";
import styles from "./create.module.less"; import styles from "./create.module.less";
import { department } from "../../../api/index"; import { department } from "../../../api/index";
@ -19,13 +19,11 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
onCancel, onCancel,
}) => { }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [departments, setDepartments] = useState<any>([]); const [departments, setDepartments] = useState<any>([]);
const [parent_id, setParentId] = useState<number>(0); const [parent_id, setParentId] = useState<number>(0);
useEffect(() => { useEffect(() => {
setInit(true);
if (open) { if (open) {
getParams(); getParams();
} }
@ -56,7 +54,6 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
}); });
setDepartments(new_arr); setDepartments(new_arr);
} }
setInit(false);
}); });
}; };
@ -128,15 +125,7 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
maskClosable={false} maskClosable={false}
okButtonProps={{ loading: loading }} okButtonProps={{ loading: loading }}
> >
{init && ( <div className="float-left mt-24">
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left mt-24"
style={{ display: init ? "none" : "block" }}
>
<Form <Form
form={form} form={form}
name="basic" name="basic"

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { Modal, Form, TreeSelect, Input, message, Spin } from "antd"; import { Modal, Form, TreeSelect, Input, message } from "antd";
import styles from "./create.module.less"; import styles from "./create.module.less";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { user, department } from "../../../api/index"; import { user, department } from "../../../api/index";
@ -24,7 +24,6 @@ export const MemberCreate: React.FC<PropInterface> = ({
onCancel, onCancel,
}) => { }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [departments, setDepartments] = useState<any>([]); const [departments, setDepartments] = useState<any>([]);
const memberDefaultAvatar = useSelector( const memberDefaultAvatar = useSelector(
@ -33,7 +32,6 @@ export const MemberCreate: React.FC<PropInterface> = ({
const [avatar, setAvatar] = useState<string>(memberDefaultAvatar); const [avatar, setAvatar] = useState<string>(memberDefaultAvatar);
useEffect(() => { useEffect(() => {
setInit(true);
if (open) { if (open) {
getParams(); getParams();
} }
@ -58,7 +56,6 @@ export const MemberCreate: React.FC<PropInterface> = ({
const new_arr: Option[] = checkArr(departments, 0); const new_arr: Option[] = checkArr(departments, 0);
setDepartments(new_arr); setDepartments(new_arr);
} }
setInit(false);
}); });
}; };
@ -128,15 +125,7 @@ export const MemberCreate: React.FC<PropInterface> = ({
maskClosable={false} maskClosable={false}
okButtonProps={{ loading: loading }} okButtonProps={{ loading: loading }}
> >
{init && ( <div className="member-form float-left mt-24">
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left mt-24"
style={{ display: init ? "none" : "block" }}
>
<Form <Form
form={form} form={form}
name="create-basic" name="create-basic"
@ -214,6 +203,13 @@ export const MemberCreate: React.FC<PropInterface> = ({
placeholder="请选择学员所属部门" placeholder="请选择学员所属部门"
/> />
</Form.Item> </Form.Item>
<Form.Item label="身份证号" name="idCard">
<Input
style={{ width: 274 }}
allowClear
placeholder="请填写学员身份证号"
/>
</Form.Item>
</Form> </Form>
</div> </div>
</Modal> </Modal>

View File

@ -239,6 +239,13 @@ export const MemberUpdate: React.FC<PropInterface> = ({
placeholder="请选择学员所属部门" placeholder="请选择学员所属部门"
/> />
</Form.Item> </Form.Item>
<Form.Item label="身份证号" name="idCard">
<Input
allowClear
style={{ width: 274 }}
placeholder="请填写学员身份证号"
/>
</Form.Item>
</Form> </Form>
</div> </div>
</Modal> </Modal>

View File

@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect } from "react"; import React, { useState, useRef, useEffect } from "react";
import { Modal, Form, Input, Cascader, message, Spin } from "antd"; import { Modal, Form, Input, Cascader, message } from "antd";
import styles from "./create.module.less"; import styles from "./create.module.less";
import { resourceCategory } from "../../../../api/index"; import { resourceCategory } from "../../../../api/index";
@ -19,13 +19,11 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
onCancel, onCancel,
}) => { }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [categories, setCategories] = useState<any>([]); const [categories, setCategories] = useState<any>([]);
const [parent_id, setParentId] = useState<number>(0); const [parent_id, setParentId] = useState<number>(0);
useEffect(() => { useEffect(() => {
setInit(true);
if (open) { if (open) {
getParams(); getParams();
} }
@ -56,7 +54,6 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
}); });
setCategories(new_arr); setCategories(new_arr);
} }
setInit(false);
}); });
}; };
@ -128,15 +125,7 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
onCancel={() => onCancel()} onCancel={() => onCancel()}
okButtonProps={{ loading: loading }} okButtonProps={{ loading: loading }}
> >
{init && ( <div className="float-left mt-24">
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left mt-24"
style={{ display: init ? "none" : "block" }}
>
<Form <Form
form={form} form={form}
name="basic" name="basic"

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { Modal, Select, Switch, Form, Input, message, Spin } from "antd"; import { Modal, Select, Switch, Form, Input, message } from "antd";
import styles from "./create.module.less"; import styles from "./create.module.less";
import { adminUser } from "../../../../api/index"; import { adminUser } from "../../../../api/index";
@ -22,12 +22,10 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
onCancel, onCancel,
}) => { }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [roles, setRoles] = useState<selRoleModel[]>([]); const [roles, setRoles] = useState<selRoleModel[]>([]);
useEffect(() => { useEffect(() => {
setInit(true);
if (open) { if (open) {
getParams(); getParams();
} }
@ -58,7 +56,6 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
}); });
} }
setRoles(arr); setRoles(arr);
setInit(false);
}); });
}; };
@ -113,15 +110,7 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
maskClosable={false} maskClosable={false}
okButtonProps={{ loading: loading }} okButtonProps={{ loading: loading }}
> >
{init && ( <div className="float-left mt-24">
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left mt-24"
style={{ display: init ? "none" : "block" }}
>
<Form <Form
form={form} form={form}
name="basic" name="basic"

View File

@ -107,10 +107,10 @@ const SystemLogPage = () => {
render: (_, record: any) => <span>{record.title}</span>, render: (_, record: any) => <span>{record.title}</span>,
}, },
{ {
title: "IP", title: "IP地区",
width: 250, width: 250,
dataIndex: "ip", dataIndex: "ip_area",
render: (ip: string) => <span>{ip}</span>, render: (ip_area: string) => <span>{ip_area}</span>,
}, },
{ {
title: "时间", title: "时间",

View File

@ -1,14 +1,5 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { import { Drawer, TreeSelect, Space, Button, Form, Input, message } from "antd";
Drawer,
TreeSelect,
Space,
Button,
Form,
Input,
message,
Spin,
} from "antd";
import styles from "./create.module.less"; import styles from "./create.module.less";
import { adminRole } from "../../../../api/index"; import { adminRole } from "../../../../api/index";
@ -28,13 +19,11 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
onCancel, onCancel,
}) => { }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [permissions, setPermissions] = useState<Option[]>([]); const [permissions, setPermissions] = useState<Option[]>([]);
const [actions, setActions] = useState<Option[]>([]); const [actions, setActions] = useState<Option[]>([]);
useEffect(() => { useEffect(() => {
setInit(true);
if (open) { if (open) {
getParams(); getParams();
} }
@ -100,7 +89,6 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
} }
setPermissions(arr); setPermissions(arr);
setActions(arr2); setActions(arr2);
setInit(false);
}); });
}; };
@ -160,15 +148,7 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
} }
width={634} width={634}
> >
{init && ( <div className="float-left mt-24">
<div className="float-left text-center mt-30">
<Spin></Spin>
</div>
)}
<div
className="float-left mt-24"
style={{ display: init ? "none" : "block" }}
>
<Form <Form
form={form} form={form}
name="adminroles-create" name="adminroles-create"

View File

@ -302,9 +302,9 @@ const SystemConfigPage = () => {
{logo && ( {logo && (
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
label="PC学员端Logo" label="网站Logo"
name="system.logo" name="system.logo"
labelCol={{ style: { marginTop: 4, marginLeft: 24 } }} labelCol={{ style: { marginTop: 4, marginLeft: 54 } }}
> >
<div className="d-flex"> <div className="d-flex">
<Image preview={false} height={40} src={logo} /> <Image preview={false} height={40} src={logo} />
@ -326,7 +326,7 @@ const SystemConfigPage = () => {
{!logo && ( {!logo && (
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
label="PC学员端Logo" label="网站Logo"
name="system.logo" name="system.logo"
> >
<div className="d-flex"> <div className="d-flex">
@ -354,38 +354,38 @@ const SystemConfigPage = () => {
</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 style={{ width: 274 }} placeholder="请填写PC学员端地址" /> <Input 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 style={{ width: 274 }} placeholder="请填写H5学员端地址" /> <Input style={{ width: 274 }} placeholder="请填写H5访问地址" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
label="学员端标题" label="网站标题"
name="system.name" name="system.name"
> >
<Input <Input
style={{ width: 274 }} style={{ width: 274 }}
allowClear allowClear
placeholder="请填写学员端标题" placeholder="请填写网站标题"
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
style={{ marginBottom: 30 }} style={{ marginBottom: 30 }}
label="学员端页脚" label="网站页脚"
name="system.pc_index_footer_msg" name="system.pc_index_footer_msg"
> >
<Input <Input
style={{ width: 274 }} style={{ width: 274 }}
allowClear allowClear
placeholder="请填写学员端页脚" placeholder="请填写网站页脚"
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -467,6 +467,13 @@ const SystemConfigPage = () => {
> >
</Checkbox> </Checkbox>
<Checkbox
checked={idCardchecked}
className="ml-24"
onChange={addIdCard}
>
</Checkbox>
</Space> </Space>
</Form.Item> </Form.Item>
<Form.Item <Form.Item