15 Commits

Author SHA1 Message Date
xxx
b49c73f338 版本号 2024-02-20 15:30:03 +08:00
xxx
6ccf595984 移除 web-vitals 2024-02-20 15:01:33 +08:00
xxx
7c0decf82a project name 2024-02-20 14:51:58 +08:00
xxx
97c5540d96 fixed: pnpm build报错 2024-02-20 14:48:56 +08:00
xxx
c94c5106e5 fixed: pnpm install之后运行报错bug 2024-02-20 14:40:36 +08:00
xxx
5670e23d27 移除xgplayer 2024-02-20 14:31:04 +08:00
unknown
65ed275964 学员添加编辑优化 2024-01-30 11:56:59 +08:00
unknown
015dc667cb 系统配置优化 2024-01-26 10:16:40 +08:00
unknown
6ecd1de62a 去除各资源选择器中上传资源的按钮 2024-01-25 10:14:01 +08:00
unknown
b257fa8e30 去除各资源选择器中上传资源的按钮 2024-01-25 10:11:17 +08:00
unknown
09d2051c19 跑马灯配置去除身份证号选择 2024-01-25 10:07:45 +08:00
unknown
1fc70f3494 系统配置文案优化 2024-01-25 10:04:03 +08:00
unknown
123c19126a 几个页面添加组件增加loading 2024-01-22 10:25:48 +08:00
unknown
40e1dd03ad 学员添加、编辑去除身份证号 2024-01-22 10:12:38 +08:00
unknown
6ed4d50006 视频上传增加限制 2024-01-09 11:10:51 +08:00
21 changed files with 195 additions and 182 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"name": "playedu-admin-interface",
"private": false,
"version": "1.6.0",
"type": "module",
"scripts": {
"dev": "vite",
@@ -14,6 +14,7 @@
"ahooks": "^3.7.6",
"antd": "^5.3.2",
"axios": "^1.3.4",
"dayjs": "^1.11.10",
"echarts": "^5.4.2",
"localforage": "^1.10.0",
"match-sorter": "^6.3.1",
@@ -24,12 +25,11 @@
"react-router-dom": "^6.9.0",
"redux": "^4.2.1",
"sort-by": "^1.2.0",
"web-vitals": "^3.3.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react-swc": "^3.0.0",
"less": "^4.1.3",
"rollup-plugin-gzip": "^3.1.0",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -14,7 +14,7 @@ export const BackBartment = (props: PropInterface) => {
return (
<div className={styles["back-bar-box"]}>
<Button
style={{paddingLeft:0}}
style={{ paddingLeft: 0 }}
icon={<LeftOutlined />}
type="link"
danger

View File

@@ -35,7 +35,7 @@ export const Footer: React.FC<PropInterface> = ({ type }) => {
className="ml-5"
style={{ color: "#D7D7D7", fontSize: 12, marginTop: -5 }}
>
Version 1.5
Version 1.6
</span>
</Link>
</Layout.Footer>

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

View File

@@ -64,7 +64,18 @@ export const UploadVideoFloatButton = () => {
const uploadProps = {
multiple: true,
beforeUpload: async (file: File) => {
beforeUpload: async (file: File, fileList: any) => {
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") {
// 视频封面解析 || 视频时长解析
let videoInfo = await parseVideo(file);
@@ -175,7 +186,7 @@ export const UploadVideoFloatButton = () => {
</p>
<p className="ant-upload-text"></p>
<p className="ant-upload-hint">
/ mp4
/ 2G以内的mp4文件
</p>
</Dragger>
</Col>

View File

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

View File

@@ -2,7 +2,6 @@ import ReactDOM from "react-dom/client";
import "./assets/iconfont/iconfont.css";
import "./index.less";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { BrowserRouter } from "react-router-dom";
import { Provider } from "react-redux";
import store from "./store";
@@ -25,8 +24,3 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
</ConfigProvider>
</Provider>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View File

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

View File

@@ -103,7 +103,6 @@ export const CourseUpdate: React.FC<PropInterface> = ({
setType(type);
setThumb(res.data.course.thumb);
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 { Modal, Form, Input, Cascader, message } from "antd";
import { Modal, Form, Input, Cascader, message, Spin } from "antd";
import styles from "./create.module.less";
import { department } from "../../../api/index";
@@ -19,11 +19,13 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
onCancel,
}) => {
const [form] = Form.useForm();
const [init, setInit] = useState(true);
const [loading, setLoading] = useState(false);
const [departments, setDepartments] = useState<any>([]);
const [parent_id, setParentId] = useState<number>(0);
useEffect(() => {
setInit(true);
if (open) {
getParams();
}
@@ -54,6 +56,7 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
});
setDepartments(new_arr);
}
setInit(false);
});
};
@@ -125,7 +128,15 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
maskClosable={false}
okButtonProps={{ loading: loading }}
>
<div className="float-left mt-24">
{init && (
<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}
name="basic"

View File

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

View File

@@ -108,10 +108,10 @@ export const MemberUpdate: React.FC<PropInterface> = ({
if (loading) {
return;
}
if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
message.error("请输入正确的身份证号!");
return;
}
// if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
// message.error("请输入正确的身份证号!");
// return;
// }
setLoading(true);
user
.updateUser(
@@ -239,13 +239,6 @@ export const MemberUpdate: React.FC<PropInterface> = ({
placeholder="请选择学员所属部门"
/>
</Form.Item>
<Form.Item label="身份证号" name="idCard">
<Input
allowClear
style={{ width: 274 }}
placeholder="请填写学员身份证号"
/>
</Form.Item>
</Form>
</div>
</Modal>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,15 +0,0 @@
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;