mirror of
https://github.com/PlayEdu/backend
synced 2025-06-27 19:42:48 +08:00
Compare commits
70 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b49c73f338 | ||
|
6ccf595984 | ||
|
7c0decf82a | ||
|
97c5540d96 | ||
|
c94c5106e5 | ||
|
5670e23d27 | ||
|
65ed275964 | ||
|
015dc667cb | ||
|
6ecd1de62a | ||
|
b257fa8e30 | ||
|
09d2051c19 | ||
|
1fc70f3494 | ||
|
123c19126a | ||
|
40e1dd03ad | ||
|
6ed4d50006 | ||
|
fbf95bbb66 | ||
|
9534877350 | ||
|
7820448c0d | ||
|
895385c4d7 | ||
|
46e9949ce0 | ||
|
57e216fc07 | ||
|
1cf8b33a81 | ||
|
0666d9a769 | ||
|
5b124ca821 | ||
|
54b47dc105 | ||
|
3b3be12cac | ||
|
e479ec7848 | ||
|
2b8e8777c7 | ||
|
3d6ea85e41 | ||
|
d9850260e9 | ||
|
da6fc9639f | ||
|
d2e28b9548 | ||
|
e12c13e5cd | ||
|
b553659a95 | ||
|
f69b432b12 | ||
|
d6a0d2bfec | ||
|
42f5d77e4f | ||
|
aa8e1d88aa | ||
|
f7fe5e35f4 | ||
|
8013964441 | ||
|
caf377eb1a | ||
|
272e9a5d50 | ||
|
7d37329713 | ||
|
e0bd169069 | ||
|
d06214aec0 | ||
|
a8432cece7 | ||
|
c13bf7ef3c | ||
|
a5d579d3e7 | ||
|
61573f1891 | ||
|
295fe75b67 | ||
|
ad0a6d7095 | ||
|
b2820232b9 | ||
|
052ee5f9f8 | ||
|
f07741892a | ||
|
983b8c39bd | ||
|
1fd4f20ab0 | ||
|
3459016134 | ||
|
fd77180c35 | ||
|
37b6d5b0ab | ||
|
dea6712bbd | ||
|
f554f13945 | ||
|
f0d21a80eb | ||
|
7d45a2ea17 | ||
|
06ec74ab15 | ||
|
d6da505574 | ||
|
f580bc5ac7 | ||
|
6715d8cf50 | ||
|
c1adb96a0a | ||
|
36ab0200a0 | ||
|
5d5dc4dde6 |
@ -13,10 +13,5 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
<script
|
|
||||||
crossorigin="anonymous"
|
|
||||||
integrity="sha512-oHrfR/z2wkuRuaHrdZ9NhoT/o/1kteub+QvmQgVzOKK7NTvIKQMvnY9+/RR0+eW311o4lAE/YzzLXXmP2XUvig=="
|
|
||||||
src="https://lib.baomitu.com/hls.js/1.1.4/hls.min.js"
|
|
||||||
></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
12
package.json
12
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "playedu-admin-interface",
|
||||||
"private": true,
|
"private": false,
|
||||||
"version": "0.0.0",
|
"version": "1.6.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@ -14,6 +14,7 @@
|
|||||||
"ahooks": "^3.7.6",
|
"ahooks": "^3.7.6",
|
||||||
"antd": "^5.3.2",
|
"antd": "^5.3.2",
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.3.4",
|
||||||
|
"dayjs": "^1.11.10",
|
||||||
"echarts": "^5.4.2",
|
"echarts": "^5.4.2",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"match-sorter": "^6.3.1",
|
"match-sorter": "^6.3.1",
|
||||||
@ -24,12 +25,11 @@
|
|||||||
"react-router-dom": "^6.9.0",
|
"react-router-dom": "^6.9.0",
|
||||||
"redux": "^4.2.1",
|
"redux": "^4.2.1",
|
||||||
"sort-by": "^1.2.0",
|
"sort-by": "^1.2.0",
|
||||||
"web-vitals": "^3.3.0",
|
|
||||||
"xlsx": "^0.18.5"
|
"xlsx": "^0.18.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.0.28",
|
"@types/react": "^18.2.0",
|
||||||
"@types/react-dom": "^18.0.11",
|
"@types/react-dom": "^18.2.0",
|
||||||
"@vitejs/plugin-react-swc": "^3.0.0",
|
"@vitejs/plugin-react-swc": "^3.0.0",
|
||||||
"less": "^4.1.3",
|
"less": "^4.1.3",
|
||||||
"rollup-plugin-gzip": "^3.1.0",
|
"rollup-plugin-gzip": "^3.1.0",
|
||||||
|
1
public/js/xg/hls.min.js
vendored
1
public/js/xg/hls.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -54,3 +54,7 @@ export function dropDiffClass(id: number, parent_id: number, ids: number[]) {
|
|||||||
export function checkDestroy(id: number) {
|
export function checkDestroy(id: number) {
|
||||||
return client.get(`/backend/v1/department/${id}/destroy`, {});
|
return client.get(`/backend/v1/department/${id}/destroy`, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ldapSync() {
|
||||||
|
return client.post(`/backend/v1/department/ldap-sync`, {});
|
||||||
|
}
|
||||||
|
BIN
src/assets/images/commen/upload.png
Normal file
BIN
src/assets/images/commen/upload.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 919 B |
Binary file not shown.
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 64 KiB |
@ -14,7 +14,7 @@ export const BackBartment = (props: PropInterface) => {
|
|||||||
return (
|
return (
|
||||||
<div className={styles["back-bar-box"]}>
|
<div className={styles["back-bar-box"]}>
|
||||||
<Button
|
<Button
|
||||||
style={{paddingLeft:0}}
|
style={{ paddingLeft: 0 }}
|
||||||
icon={<LeftOutlined />}
|
icon={<LeftOutlined />}
|
||||||
type="link"
|
type="link"
|
||||||
danger
|
danger
|
||||||
|
@ -2,23 +2,41 @@ import React from "react";
|
|||||||
import { Layout } from "antd";
|
import { Layout } from "antd";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
export const Footer: React.FC = () => {
|
interface PropInterface {
|
||||||
|
type?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Footer: React.FC<PropInterface> = ({ type }) => {
|
||||||
return (
|
return (
|
||||||
<Layout.Footer
|
<Layout.Footer
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
backgroundColor: "#F6F6F6",
|
background: type === "none" ? "none" : "#F6F6F6",
|
||||||
height: 166,
|
height: 166,
|
||||||
paddingTop: 80,
|
paddingTop: 80,
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Link to="https://playedu.xyz/" target="blank">
|
<Link
|
||||||
|
to="https://playedu.xyz/"
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
target="blank"
|
||||||
|
>
|
||||||
<i
|
<i
|
||||||
style={{ fontSize: 30, color: "#cccccc" }}
|
style={{ fontSize: 30, color: "#cccccc" }}
|
||||||
className="iconfont icon-waterprint footer-icon"
|
className="iconfont icon-waterprint footer-icon"
|
||||||
onClick={() => {}}
|
onClick={() => {}}
|
||||||
></i>
|
></i>
|
||||||
|
<span
|
||||||
|
className="ml-5"
|
||||||
|
style={{ color: "#D7D7D7", fontSize: 12, marginTop: -5 }}
|
||||||
|
>
|
||||||
|
Version 1.6
|
||||||
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Layout.Footer>
|
</Layout.Footer>
|
||||||
);
|
);
|
||||||
|
@ -37,16 +37,16 @@ const items = [
|
|||||||
<i className="iconfont icon-icon-category" />,
|
<i className="iconfont icon-icon-category" />,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
"resource-category-menu"
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
"资源管理",
|
"资源管理",
|
||||||
"resource",
|
"resource",
|
||||||
<i className="iconfont icon-icon-file" />,
|
<i className="iconfont icon-icon-file" />,
|
||||||
[
|
[
|
||||||
getItem("视频", "/videos", null, null, null, null),
|
getItem("视频", "/videos", null, null, null, "resource-menu"),
|
||||||
getItem("图片", "/images", null, null, null, null),
|
getItem("图片", "/images", null, null, null, "resource-menu"),
|
||||||
getItem("课件", "/courseware", null, null, null, null),
|
getItem("课件", "/courseware", null, null, null, "resource-menu"),
|
||||||
],
|
],
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
@ -92,7 +92,6 @@ const items = [
|
|||||||
"admin-user-index"
|
"admin-user-index"
|
||||||
),
|
),
|
||||||
getItem("管理日志", "/system/adminlog", null, null, null, "admin-log"),
|
getItem("管理日志", "/system/adminlog", null, null, null, "admin-log"),
|
||||||
// getItem("角色配置", "/system/adminroles", null, null, null, null),
|
|
||||||
],
|
],
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
@ -120,6 +119,7 @@ export const LeftMenu: React.FC = () => {
|
|||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
|
|
||||||
const openKeyMerge = (pathname: string): string[] => {
|
const openKeyMerge = (pathname: string): string[] => {
|
||||||
let newOpenKeys = hit(pathname);
|
let newOpenKeys = hit(pathname);
|
||||||
for (let i = 0; i < openKeys.length; i++) {
|
for (let i = 0; i < openKeys.length; i++) {
|
||||||
@ -166,8 +166,14 @@ export const LeftMenu: React.FC = () => {
|
|||||||
|
|
||||||
for (let i in items) {
|
for (let i in items) {
|
||||||
let menuItem = items[i];
|
let menuItem = items[i];
|
||||||
if (!menuItem.children) {
|
// 一级菜单=>没有子菜单&配置了权限
|
||||||
// 一级菜单不做权限控制
|
if (menuItem.children === null) {
|
||||||
|
if (
|
||||||
|
menuItem.permission !== null &&
|
||||||
|
typeof permissions[menuItem.permission] === "undefined"
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
menus.push(menuItem);
|
menus.push(menuItem);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ interface PropInterface {
|
|||||||
text: string;
|
text: string;
|
||||||
p: string;
|
p: string;
|
||||||
class: string;
|
class: string;
|
||||||
icon: any;
|
icon?: any;
|
||||||
onClick: () => void;
|
onClick?: () => void;
|
||||||
disabled: any;
|
disabled: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ export const PerButton = (props: PropInterface) => {
|
|||||||
danger
|
danger
|
||||||
icon={props.icon}
|
icon={props.icon}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.onClick();
|
props.onClick && props.onClick();
|
||||||
}}
|
}}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
>
|
>
|
||||||
@ -43,7 +43,7 @@ export const PerButton = (props: PropInterface) => {
|
|||||||
type={props.type}
|
type={props.type}
|
||||||
icon={props.icon}
|
icon={props.icon}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.onClick();
|
props.onClick && props.onClick();
|
||||||
}}
|
}}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
>
|
>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Tree } from "antd";
|
import { Tree } from "antd";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { resourceCategory } from "../../api/index";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
interface Option {
|
interface Option {
|
||||||
key: string | number;
|
key: string | number;
|
||||||
@ -17,8 +17,10 @@ interface PropInterface {
|
|||||||
|
|
||||||
export const TreeCategory = (props: PropInterface) => {
|
export const TreeCategory = (props: PropInterface) => {
|
||||||
const [treeData, setTreeData] = useState<any>([]);
|
const [treeData, setTreeData] = useState<any>([]);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
|
||||||
const [selectKey, setSelectKey] = useState<number[]>([]);
|
const [selectKey, setSelectKey] = useState<number[]>([]);
|
||||||
|
const resourceCategories = useSelector(
|
||||||
|
(state: any) => state.systemConfig.value.resourceCategories
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.selected && props.selected.length > 0) {
|
if (props.selected && props.selected.length > 0) {
|
||||||
@ -27,21 +29,17 @@ export const TreeCategory = (props: PropInterface) => {
|
|||||||
}, [props.selected]);
|
}, [props.selected]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
resourceCategory.resourceCategoryList().then((res: any) => {
|
if (JSON.stringify(resourceCategories) !== "{}") {
|
||||||
const categories: CategoriesBoxModel = res.data.categories;
|
const new_arr: Option[] = checkArr(resourceCategories, 0);
|
||||||
if (JSON.stringify(categories) !== "{}") {
|
if (props.type === "no-cate") {
|
||||||
const new_arr: Option[] = checkArr(categories, 0);
|
new_arr.unshift({
|
||||||
if (props.type === "no-cate") {
|
key: 0,
|
||||||
new_arr.unshift({
|
title: <span className="tree-title-elli">未分类</span>,
|
||||||
key: 0,
|
});
|
||||||
title: <span className="tree-title-elli">未分类</span>,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setTreeData(new_arr);
|
|
||||||
}
|
}
|
||||||
});
|
setTreeData(new_arr);
|
||||||
}, []);
|
}
|
||||||
|
}, [resourceCategories]);
|
||||||
|
|
||||||
const checkArr = (categories: CategoriesBoxModel, id: number) => {
|
const checkArr = (categories: CategoriesBoxModel, id: number) => {
|
||||||
const arr = [];
|
const arr = [];
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Button, Input, message, Tree } from "antd";
|
import { Tree } from "antd";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { department } from "../../api/index";
|
import { department } from "../../api/index";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
interface Option {
|
interface Option {
|
||||||
key: string | number;
|
key: string | number;
|
||||||
@ -9,19 +10,21 @@ interface Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface PropInterface {
|
interface PropInterface {
|
||||||
type: string;
|
|
||||||
text: string;
|
text: string;
|
||||||
refresh: boolean;
|
|
||||||
showNum: boolean;
|
showNum: boolean;
|
||||||
selected: any;
|
selected: any;
|
||||||
|
depUserCount?: KeyNumberObject;
|
||||||
|
userCount?: number;
|
||||||
onUpdate: (keys: any, title: any) => void;
|
onUpdate: (keys: any, title: any) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TreeDepartment = (props: PropInterface) => {
|
export const TreeDepartment = (props: PropInterface) => {
|
||||||
const [treeData, setTreeData] = useState<any>([]);
|
const [treeData, setTreeData] = useState<any>([]);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
|
||||||
const [selectKey, setSelectKey] = useState<number[]>([]);
|
const [selectKey, setSelectKey] = useState<number[]>([]);
|
||||||
const [userTotal, setUserTotal] = useState(0);
|
// 本地缓存
|
||||||
|
const localDepartments = useSelector(
|
||||||
|
(state: any) => state.systemConfig.value.departments
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.selected && props.selected.length > 0) {
|
if (props.selected && props.selected.length > 0) {
|
||||||
@ -30,32 +33,25 @@ export const TreeDepartment = (props: PropInterface) => {
|
|||||||
}, [props.selected]);
|
}, [props.selected]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true);
|
if (JSON.stringify(localDepartments) !== "{}") {
|
||||||
department.departmentList().then((res: any) => {
|
let data: any[] = [];
|
||||||
const departments: DepartmentsBoxModel = res.data.departments;
|
if (props.depUserCount) {
|
||||||
const departCount: DepIdsModel = res.data.dep_user_count;
|
data = checkNewArr(localDepartments, 0, props.depUserCount);
|
||||||
setUserTotal(res.data.user_total);
|
|
||||||
if (JSON.stringify(departments) !== "{}") {
|
|
||||||
if (props.showNum) {
|
|
||||||
const new_arr: any[] = checkNewArr(departments, 0, departCount);
|
|
||||||
setTreeData(new_arr);
|
|
||||||
} else {
|
|
||||||
const new_arr: any[] = checkArr(departments, 0);
|
|
||||||
setTreeData(new_arr);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const new_arr: Option[] = [
|
data = checkArr(localDepartments, 0);
|
||||||
{
|
|
||||||
key: "",
|
|
||||||
title: "全部",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
setTreeData(new_arr);
|
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setTreeData(data);
|
||||||
});
|
} else {
|
||||||
}, [props.refresh]);
|
const data: Option[] = [
|
||||||
|
{
|
||||||
|
key: "",
|
||||||
|
title: "全部",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
setTreeData(data);
|
||||||
|
}
|
||||||
|
}, [localDepartments, props.depUserCount]);
|
||||||
|
|
||||||
const checkNewArr = (
|
const checkNewArr = (
|
||||||
departments: DepartmentsBoxModel,
|
departments: DepartmentsBoxModel,
|
||||||
@ -133,8 +129,10 @@ export const TreeDepartment = (props: PropInterface) => {
|
|||||||
if (info) {
|
if (info) {
|
||||||
label = info.node.title.props.children;
|
label = info.node.title.props.children;
|
||||||
}
|
}
|
||||||
props.onUpdate(selectedKeys, label);
|
if (selectedKeys.length <= 1) {
|
||||||
setSelectKey(selectedKeys);
|
props.onUpdate(selectedKeys, label);
|
||||||
|
setSelectKey(selectedKeys);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onExpand = (selectedKeys: any, info: any) => {
|
const onExpand = (selectedKeys: any, info: any) => {
|
||||||
@ -142,8 +140,10 @@ export const TreeDepartment = (props: PropInterface) => {
|
|||||||
if (info) {
|
if (info) {
|
||||||
label = info.node.title.props.children;
|
label = info.node.title.props.children;
|
||||||
}
|
}
|
||||||
props.onUpdate(selectedKeys, label);
|
if (selectedKeys.length <= 1) {
|
||||||
setSelectKey(selectedKeys);
|
props.onUpdate(selectedKeys, label);
|
||||||
|
setSelectKey(selectedKeys);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -157,7 +157,7 @@ export const TreeDepartment = (props: PropInterface) => {
|
|||||||
onClick={() => onSelect([], "")}
|
onClick={() => onSelect([], "")}
|
||||||
>
|
>
|
||||||
全部{props.text}
|
全部{props.text}
|
||||||
{props.showNum && userTotal ? "(" + userTotal + ")" : ""}
|
{props.showNum && props.userCount ? "(" + props.userCount + ")" : ""}
|
||||||
</div>
|
</div>
|
||||||
{treeData.length > 0 && (
|
{treeData.length > 0 && (
|
||||||
<Tree
|
<Tree
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Row, Col, Empty, Table, Spin } from "antd";
|
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, UploadCoursewareButton } from "../../compenents";
|
import { TreeCategory } from "../../compenents";
|
||||||
|
|
||||||
interface VideoItem {
|
interface VideoItem {
|
||||||
id: number;
|
id: number;
|
||||||
@ -47,6 +47,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
|||||||
const [size, setSize] = useState(10);
|
const [size, setSize] = useState(10);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([]);
|
||||||
|
const [title, setTitle] = useState("");
|
||||||
|
|
||||||
// 加载列表
|
// 加载列表
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -70,7 +71,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
|||||||
size,
|
size,
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
title,
|
||||||
"WORD,EXCEL,PPT,PDF,TXT,RAR,ZIP",
|
"WORD,EXCEL,PPT,PDF,TXT,RAR,ZIP",
|
||||||
categoryIds
|
categoryIds
|
||||||
)
|
)
|
||||||
@ -92,6 +93,7 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
|||||||
const resetVideoList = () => {
|
const resetVideoList = () => {
|
||||||
setPage(1);
|
setPage(1);
|
||||||
setVideoList([]);
|
setVideoList([]);
|
||||||
|
setTitle("");
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -178,14 +180,37 @@ export const UploadCoursewareSub = (props: PropsInterface) => {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col span={17}>
|
<Col span={17}>
|
||||||
<Row style={{ marginBottom: 24, paddingLeft: 10 }}>
|
<Row style={{ marginBottom: 24, paddingLeft: 10 }}>
|
||||||
<Col span={24}>
|
<div className="float-left j-b-flex">
|
||||||
<UploadCoursewareButton
|
<div className="d-flex"></div>
|
||||||
categoryIds={category_ids}
|
<div className="d-flex">
|
||||||
onUpdate={() => {
|
<div className="d-flex mr-24">
|
||||||
resetVideoList();
|
<Typography.Text>名称:</Typography.Text>
|
||||||
}}
|
<Input
|
||||||
></UploadCoursewareButton>
|
value={title}
|
||||||
</Col>
|
onChange={(e) => {
|
||||||
|
setTitle(e.target.value);
|
||||||
|
}}
|
||||||
|
allowClear
|
||||||
|
style={{ width: 160 }}
|
||||||
|
placeholder="请输入名称关键字"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="d-flex">
|
||||||
|
<Button className="mr-16" onClick={resetVideoList}>
|
||||||
|
重 置
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
setPage(1);
|
||||||
|
setRefresh(!refresh);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查 询
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
{init && (
|
{init && (
|
||||||
<div className="float-left text-center mt-30">
|
<div className="float-left text-center mt-30">
|
||||||
|
@ -1,20 +1,8 @@
|
|||||||
import { InboxOutlined } from "@ant-design/icons";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import {
|
import { useSelector } from "react-redux";
|
||||||
Button,
|
import { Button } from "antd";
|
||||||
Col,
|
import { useDispatch } from "react-redux";
|
||||||
message,
|
import { uploadAction } from "../../store/user/loginUserSlice";
|
||||||
Modal,
|
|
||||||
Progress,
|
|
||||||
Row,
|
|
||||||
Table,
|
|
||||||
Tag,
|
|
||||||
Upload,
|
|
||||||
} from "antd";
|
|
||||||
import Dragger from "antd/es/upload/Dragger";
|
|
||||||
import { useRef, useState } from "react";
|
|
||||||
import { generateUUID, parseVideo } from "../../utils";
|
|
||||||
import { minioMergeVideo, minioUploadId } from "../../api/upload";
|
|
||||||
import { UploadChunk } from "../../js/minio-upload-chunk";
|
|
||||||
|
|
||||||
interface PropsInterface {
|
interface PropsInterface {
|
||||||
categoryIds: number[];
|
categoryIds: number[];
|
||||||
@ -22,200 +10,32 @@ interface PropsInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const UploadVideoButton = (props: PropsInterface) => {
|
export const UploadVideoButton = (props: PropsInterface) => {
|
||||||
const [showModal, setShowModal] = useState(false);
|
const dispatch = useDispatch();
|
||||||
const localFileList = useRef<FileItem[]>([]);
|
const uploadStatus = useSelector(
|
||||||
const [fileList, setFileList] = useState<FileItem[]>([]);
|
(state: any) => state.loginUser.value.uploadStatus
|
||||||
|
);
|
||||||
|
|
||||||
const getMinioUploadId = async () => {
|
useEffect(() => {
|
||||||
let resp: any = await minioUploadId("mp4");
|
if (!uploadStatus) {
|
||||||
return resp.data;
|
props.onUpdate();
|
||||||
};
|
|
||||||
|
|
||||||
const uploadProps = {
|
|
||||||
multiple: true,
|
|
||||||
beforeUpload: async (file: File) => {
|
|
||||||
if (file.type === "video/mp4") {
|
|
||||||
// 视频封面解析 || 视频时长解析
|
|
||||||
let videoInfo = await parseVideo(file);
|
|
||||||
// 添加到本地待上传
|
|
||||||
let data = await getMinioUploadId();
|
|
||||||
let run = new UploadChunk(file, data["upload_id"], data["filename"]);
|
|
||||||
let item: FileItem = {
|
|
||||||
id: generateUUID(),
|
|
||||||
file: file,
|
|
||||||
upload: {
|
|
||||||
handler: run,
|
|
||||||
progress: 0,
|
|
||||||
status: 0,
|
|
||||||
remark: "",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
duration: videoInfo.duration,
|
|
||||||
poster: videoInfo.poster,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
item.upload.handler.on("success", () => {
|
|
||||||
minioMergeVideo(
|
|
||||||
data["filename"],
|
|
||||||
data["upload_id"],
|
|
||||||
props.categoryIds.join(","),
|
|
||||||
item.file.name,
|
|
||||||
"mp4",
|
|
||||||
item.file.size,
|
|
||||||
item.video?.duration || 0,
|
|
||||||
item.video?.poster || ""
|
|
||||||
).then(() => {
|
|
||||||
item.upload.progress = 100;
|
|
||||||
item.upload.status = item.upload.handler.getUploadStatus();
|
|
||||||
setFileList([...localFileList.current]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
item.upload.handler.on("progress", (p: number) => {
|
|
||||||
item.upload.status = item.upload.handler.getUploadStatus();
|
|
||||||
item.upload.progress = p >= 100 ? 99 : p;
|
|
||||||
setFileList([...localFileList.current]);
|
|
||||||
});
|
|
||||||
item.upload.handler.on("error", (msg: string) => {
|
|
||||||
item.upload.status = item.upload.handler.getUploadStatus();
|
|
||||||
item.upload.remark = msg;
|
|
||||||
setFileList([...localFileList.current]);
|
|
||||||
});
|
|
||||||
item.upload.handler.start();
|
|
||||||
// 先插入到ref
|
|
||||||
localFileList.current.push(item);
|
|
||||||
// 再更新list
|
|
||||||
setFileList([...localFileList.current]);
|
|
||||||
} else {
|
|
||||||
message.error(`${file.name} 并不是 mp4 视频文件`);
|
|
||||||
}
|
|
||||||
return Upload.LIST_IGNORE;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeWin = () => {
|
|
||||||
if (fileList.length > 0) {
|
|
||||||
fileList.forEach((item) => {
|
|
||||||
if (item.upload.status !== 5 && item.upload.status !== 7) {
|
|
||||||
item.upload.handler.cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
props.onUpdate();
|
}, [uploadStatus]);
|
||||||
localFileList.current = [];
|
|
||||||
setFileList([]);
|
|
||||||
setShowModal(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowModal(true);
|
dispatch(
|
||||||
|
uploadAction({
|
||||||
|
uploadStatus: true,
|
||||||
|
uploadCateIds: props.categoryIds,
|
||||||
|
})
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
上传视频
|
上传视频
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{showModal ? (
|
|
||||||
<Modal
|
|
||||||
width={800}
|
|
||||||
title="上传视频"
|
|
||||||
open={true}
|
|
||||||
onCancel={() => {
|
|
||||||
closeWin();
|
|
||||||
}}
|
|
||||||
maskClosable={false}
|
|
||||||
closable={false}
|
|
||||||
onOk={() => {
|
|
||||||
closeWin();
|
|
||||||
}}
|
|
||||||
okText="完成"
|
|
||||||
>
|
|
||||||
<Row gutter={[0, 10]}>
|
|
||||||
<Col span={24}>
|
|
||||||
<Dragger {...uploadProps}>
|
|
||||||
<p className="ant-upload-drag-icon">
|
|
||||||
<InboxOutlined />
|
|
||||||
</p>
|
|
||||||
<p className="ant-upload-text">请将视频拖拽到此处上传</p>
|
|
||||||
<p className="ant-upload-hint">
|
|
||||||
支持一次上传多个 / 支持 mp4 格式视频
|
|
||||||
</p>
|
|
||||||
</Dragger>
|
|
||||||
</Col>
|
|
||||||
<Col span={24}>
|
|
||||||
<Table
|
|
||||||
pagination={false}
|
|
||||||
rowKey="id"
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
title: "视频",
|
|
||||||
dataIndex: "name",
|
|
||||||
key: "name",
|
|
||||||
render: (_, record) => <span>{record.file.name}</span>,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "大小",
|
|
||||||
dataIndex: "size",
|
|
||||||
key: "size",
|
|
||||||
render: (_, record) => (
|
|
||||||
<span>
|
|
||||||
{(record.file.size / 1024 / 1024).toFixed(2)}M
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "进度",
|
|
||||||
dataIndex: "progress",
|
|
||||||
key: "progress",
|
|
||||||
render: (_, record: FileItem) => (
|
|
||||||
<>
|
|
||||||
{record.upload.status === 0 ? (
|
|
||||||
"等待上传"
|
|
||||||
) : (
|
|
||||||
<Progress
|
|
||||||
size="small"
|
|
||||||
steps={20}
|
|
||||||
percent={record.upload.progress}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "操作",
|
|
||||||
key: "action",
|
|
||||||
render: (_, record) => (
|
|
||||||
<>
|
|
||||||
{record.upload.status === 5 ? (
|
|
||||||
<>
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
size="small"
|
|
||||||
className="b-n-link c-red"
|
|
||||||
onClick={() => {
|
|
||||||
record.upload.handler.retry();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
失败.重试
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{record.upload.status === 7 ? (
|
|
||||||
<Tag color="success">上传成功</Tag>
|
|
||||||
) : null}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
dataSource={fileList}
|
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</Modal>
|
|
||||||
) : null}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
26
src/compenents/upload-video-float-button/index.module.less
Normal file
26
src/compenents/upload-video-float-button/index.module.less
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
.float-button {
|
||||||
|
width: auto;
|
||||||
|
height: 32px;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 16px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 6px 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
right: 24px;
|
||||||
|
bottom: 20px;
|
||||||
|
z-index: 50;
|
||||||
|
cursor: pointer;
|
||||||
|
img {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
margin-left: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #ff4d4f;
|
||||||
|
}
|
||||||
|
}
|
289
src/compenents/upload-video-float-button/index.tsx
Normal file
289
src/compenents/upload-video-float-button/index.tsx
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
import { InboxOutlined } from "@ant-design/icons";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Col,
|
||||||
|
message,
|
||||||
|
Modal,
|
||||||
|
Progress,
|
||||||
|
Row,
|
||||||
|
Table,
|
||||||
|
Tag,
|
||||||
|
Upload,
|
||||||
|
} from "antd";
|
||||||
|
import Dragger from "antd/es/upload/Dragger";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { generateUUID, parseVideo } from "../../utils";
|
||||||
|
import styles from "./index.module.less";
|
||||||
|
import { minioMergeVideo, minioUploadId } from "../../api/upload";
|
||||||
|
import { UploadChunk } from "../../js/minio-upload-chunk";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { uploadAction } from "../../store/user/loginUserSlice";
|
||||||
|
import upIcon from "../../assets/images/commen/upload.png";
|
||||||
|
|
||||||
|
export const UploadVideoFloatButton = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
const localFileList = useRef<FileItem[]>([]);
|
||||||
|
const intervalId = useRef<number>();
|
||||||
|
const intervalId2 = useRef<number>();
|
||||||
|
const [successNum, setSuccessNum] = useState(0);
|
||||||
|
const [fileList, setFileList] = useState<FileItem[]>([]);
|
||||||
|
const uploadStatus = useSelector(
|
||||||
|
(state: any) => state.loginUser.value.uploadStatus
|
||||||
|
);
|
||||||
|
const categoryIds = useSelector(
|
||||||
|
(state: any) => state.loginUser.value.uploadCateIds
|
||||||
|
);
|
||||||
|
|
||||||
|
const getMinioUploadId = async () => {
|
||||||
|
let resp: any = await minioUploadId("mp4");
|
||||||
|
return resp.data;
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (uploadStatus) {
|
||||||
|
setShowModal(true);
|
||||||
|
intervalId.current = setInterval(() => {
|
||||||
|
let num = localFileList.current.filter(
|
||||||
|
(it) => it.upload.status === 7
|
||||||
|
).length;
|
||||||
|
setSuccessNum(num);
|
||||||
|
}, 5000);
|
||||||
|
let timeDiv = document.createElement("div");
|
||||||
|
document.body.appendChild(timeDiv);
|
||||||
|
intervalId2.current = setInterval(() => {
|
||||||
|
timeDiv && timeDiv.click();
|
||||||
|
}, 10000);
|
||||||
|
} else {
|
||||||
|
window.clearInterval(intervalId.current);
|
||||||
|
window.clearInterval(intervalId2.current);
|
||||||
|
console.log("定时器已销毁");
|
||||||
|
}
|
||||||
|
}, [uploadStatus]);
|
||||||
|
|
||||||
|
const uploadProps = {
|
||||||
|
multiple: true,
|
||||||
|
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);
|
||||||
|
// 添加到本地待上传
|
||||||
|
let data = await getMinioUploadId();
|
||||||
|
let run = new UploadChunk(file, data["upload_id"], data["filename"]);
|
||||||
|
let item: FileItem = {
|
||||||
|
id: generateUUID(),
|
||||||
|
file: file,
|
||||||
|
upload: {
|
||||||
|
handler: run,
|
||||||
|
progress: 0,
|
||||||
|
status: 0,
|
||||||
|
remark: "",
|
||||||
|
},
|
||||||
|
video: {
|
||||||
|
duration: videoInfo.duration,
|
||||||
|
poster: videoInfo.poster,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
item.upload.handler.on("success", () => {
|
||||||
|
minioMergeVideo(
|
||||||
|
data["filename"],
|
||||||
|
data["upload_id"],
|
||||||
|
categoryIds.join(","),
|
||||||
|
item.file.name,
|
||||||
|
"mp4",
|
||||||
|
item.file.size,
|
||||||
|
item.video?.duration || 0,
|
||||||
|
item.video?.poster || ""
|
||||||
|
).then(() => {
|
||||||
|
item.upload.progress = 100;
|
||||||
|
item.upload.status = item.upload.handler.getUploadStatus();
|
||||||
|
setFileList([...localFileList.current]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
item.upload.handler.on("progress", (p: number) => {
|
||||||
|
item.upload.status = item.upload.handler.getUploadStatus();
|
||||||
|
item.upload.progress = p >= 100 ? 99 : p;
|
||||||
|
setFileList([...localFileList.current]);
|
||||||
|
});
|
||||||
|
item.upload.handler.on("error", (msg: string) => {
|
||||||
|
item.upload.status = item.upload.handler.getUploadStatus();
|
||||||
|
item.upload.remark = msg;
|
||||||
|
setFileList([...localFileList.current]);
|
||||||
|
});
|
||||||
|
item.upload.handler.start();
|
||||||
|
// 先插入到ref
|
||||||
|
localFileList.current.push(item);
|
||||||
|
// 再更新list
|
||||||
|
setFileList([...localFileList.current]);
|
||||||
|
} else {
|
||||||
|
message.error(`${file.name} 并不是 mp4 视频文件`);
|
||||||
|
}
|
||||||
|
return Upload.LIST_IGNORE;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeWin = () => {
|
||||||
|
if (fileList.length > 0) {
|
||||||
|
fileList.forEach((item) => {
|
||||||
|
if (item.upload.status !== 5 && item.upload.status !== 7) {
|
||||||
|
item.upload.handler.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
localFileList.current = [];
|
||||||
|
setFileList([]);
|
||||||
|
setSuccessNum(0);
|
||||||
|
setShowModal(false);
|
||||||
|
dispatch(
|
||||||
|
uploadAction({
|
||||||
|
uploadStatus: false,
|
||||||
|
uploadCateIds: [],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{uploadStatus ? (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
style={{ display: showModal ? "none" : "flex" }}
|
||||||
|
className={styles["float-button"]}
|
||||||
|
onClick={() => setShowModal(true)}
|
||||||
|
>
|
||||||
|
<img src={upIcon} />
|
||||||
|
<span>
|
||||||
|
视频上传成功 ({successNum}/{fileList.length})
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<Modal
|
||||||
|
width={800}
|
||||||
|
title="上传视频"
|
||||||
|
open={showModal}
|
||||||
|
maskClosable={false}
|
||||||
|
footer={null}
|
||||||
|
onCancel={() => {
|
||||||
|
closeWin();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Row gutter={[0, 10]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Dragger {...uploadProps}>
|
||||||
|
<p className="ant-upload-drag-icon">
|
||||||
|
<InboxOutlined />
|
||||||
|
</p>
|
||||||
|
<p className="ant-upload-text">请将视频拖拽到此处上传</p>
|
||||||
|
<p className="ant-upload-hint">
|
||||||
|
支持一次上传多个 / 支持2G以内的mp4文件
|
||||||
|
</p>
|
||||||
|
</Dragger>
|
||||||
|
</Col>
|
||||||
|
<Col span={24}>
|
||||||
|
<Table
|
||||||
|
pagination={false}
|
||||||
|
rowKey="id"
|
||||||
|
columns={[
|
||||||
|
{
|
||||||
|
title: "视频",
|
||||||
|
dataIndex: "name",
|
||||||
|
key: "name",
|
||||||
|
render: (_, record) => <span>{record.file.name}</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "大小",
|
||||||
|
dataIndex: "size",
|
||||||
|
key: "size",
|
||||||
|
render: (_, record) => (
|
||||||
|
<span>
|
||||||
|
{(record.file.size / 1024 / 1024).toFixed(2)}M
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "进度",
|
||||||
|
dataIndex: "progress",
|
||||||
|
key: "progress",
|
||||||
|
render: (_, record: FileItem) => (
|
||||||
|
<>
|
||||||
|
{record.upload.status === 0 ? (
|
||||||
|
"等待上传"
|
||||||
|
) : (
|
||||||
|
<Progress
|
||||||
|
size="small"
|
||||||
|
steps={20}
|
||||||
|
percent={record.upload.progress}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
key: "action",
|
||||||
|
render: (_, record) => (
|
||||||
|
<>
|
||||||
|
{record.upload.status === 5 ? (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
className="b-n-link c-red"
|
||||||
|
onClick={() => {
|
||||||
|
record.upload.handler.retry();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
失败.重试
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{record.upload.status === 7 ? (
|
||||||
|
<Tag color="success">上传成功</Tag>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={fileList}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={24}>
|
||||||
|
<div className="r-r-flex">
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
closeWin();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
完成
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
className="mr-16"
|
||||||
|
onClick={() => {
|
||||||
|
setShowModal(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
最小化
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
@ -1,9 +1,8 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Row, Col, Empty, Table, Spin } from "antd";
|
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 {
|
||||||
@ -48,6 +47,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
|||||||
const [size, setSize] = useState(10);
|
const [size, setSize] = useState(10);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([]);
|
||||||
|
const [title, setTitle] = useState("");
|
||||||
|
|
||||||
// 加载列表
|
// 加载列表
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -66,7 +66,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
let categoryIds = category_ids.join(",");
|
let categoryIds = category_ids.join(",");
|
||||||
resource
|
resource
|
||||||
.resourceList(page, size, "", "", "", "VIDEO", categoryIds)
|
.resourceList(page, size, "", "", title, "VIDEO", categoryIds)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
setTotal(res.data.result.total);
|
setTotal(res.data.result.total);
|
||||||
setVideoExtra(res.data.videos_extra);
|
setVideoExtra(res.data.videos_extra);
|
||||||
@ -85,6 +85,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
|||||||
const resetVideoList = () => {
|
const resetVideoList = () => {
|
||||||
setPage(1);
|
setPage(1);
|
||||||
setVideoList([]);
|
setVideoList([]);
|
||||||
|
setTitle("");
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -159,15 +160,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
|||||||
<>
|
<>
|
||||||
<Row style={{ width: 752, minHeight: 520 }}>
|
<Row style={{ width: 752, minHeight: 520 }}>
|
||||||
<Col span={7}>
|
<Col span={7}>
|
||||||
{init && (
|
<div className="float-left">
|
||||||
<div className="float-left text-center mt-30">
|
|
||||||
<Spin></Spin>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div
|
|
||||||
className="float-left"
|
|
||||||
style={{ display: init ? "none" : "block" }}
|
|
||||||
>
|
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
selected={[]}
|
selected={[]}
|
||||||
type="no-cate"
|
type="no-cate"
|
||||||
@ -178,14 +171,37 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col span={17}>
|
<Col span={17}>
|
||||||
<Row style={{ marginBottom: 24, paddingLeft: 10 }}>
|
<Row style={{ marginBottom: 24, paddingLeft: 10 }}>
|
||||||
<Col span={24}>
|
<div className="float-left j-b-flex">
|
||||||
<UploadVideoButton
|
<div className="d-flex"></div>
|
||||||
categoryIds={category_ids}
|
<div className="d-flex">
|
||||||
onUpdate={() => {
|
<div className="d-flex mr-24">
|
||||||
resetVideoList();
|
<Typography.Text>名称:</Typography.Text>
|
||||||
}}
|
<Input
|
||||||
></UploadVideoButton>
|
value={title}
|
||||||
</Col>
|
onChange={(e) => {
|
||||||
|
setTitle(e.target.value);
|
||||||
|
}}
|
||||||
|
allowClear
|
||||||
|
style={{ width: 160 }}
|
||||||
|
placeholder="请输入名称关键字"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="d-flex">
|
||||||
|
<Button className="mr-16" onClick={resetVideoList}>
|
||||||
|
重 置
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
setPage(1);
|
||||||
|
setRefresh(!refresh);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查 询
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
{init && (
|
{init && (
|
||||||
<div className="float-left text-center mt-30">
|
<div className="float-left text-center mt-30">
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
@import "./assets/iconfont/iconfont.css";
|
|
||||||
|
|
||||||
@primaryColor: #ff4d4f;
|
@primaryColor: #ff4d4f;
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@ -22,6 +20,10 @@ code {
|
|||||||
monospace;
|
monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.w-100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.w-174px {
|
.w-174px {
|
||||||
max-width: 134px;
|
max-width: 134px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -185,6 +187,11 @@ code {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.r-r-flex {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
|
import "./assets/iconfont/iconfont.css";
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
import reportWebVitals from "./reportWebVitals";
|
|
||||||
import { BrowserRouter } from "react-router-dom";
|
import { BrowserRouter } from "react-router-dom";
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import store from "./store";
|
import store from "./store";
|
||||||
@ -24,8 +24,3 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
</Provider>
|
</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();
|
|
||||||
|
@ -10,6 +10,7 @@ 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";
|
||||||
@ -52,6 +53,7 @@ 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("");
|
||||||
@ -71,9 +73,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) {
|
||||||
getParams();
|
initData();
|
||||||
getCategory();
|
|
||||||
}
|
}
|
||||||
}, [open, cateIds, depIds]);
|
}, [open, cateIds, depIds]);
|
||||||
|
|
||||||
@ -96,43 +98,48 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
setShowDrop(false);
|
setShowDrop(false);
|
||||||
}, [form, open]);
|
}, [form, open]);
|
||||||
|
|
||||||
const getParams = () => {
|
const initData = async () => {
|
||||||
department.departmentList().then((res: any) => {
|
await getParams();
|
||||||
const departments = res.data.departments;
|
await getCategory();
|
||||||
const departCount: DepIdsModel = res.data.dep_user_count;
|
setInit(false);
|
||||||
if (JSON.stringify(departments) !== "{}") {
|
};
|
||||||
const new_arr: any = checkArr(departments, 0, departCount);
|
|
||||||
setDepartments(new_arr);
|
const getParams = async () => {
|
||||||
}
|
let res: any = await department.departmentList();
|
||||||
let type = "open";
|
const departments = res.data.departments;
|
||||||
if (depIds.length !== 0 && depIds[0] !== 0) {
|
const departCount: DepIdsModel = res.data.dep_user_count;
|
||||||
type = "elective";
|
if (JSON.stringify(departments) !== "{}") {
|
||||||
let item = checkChild(res.data.departments, depIds[0]);
|
const new_arr: any = checkArr(departments, 0, departCount);
|
||||||
let arr: any[] = [];
|
setDepartments(new_arr);
|
||||||
if (item === undefined) {
|
}
|
||||||
arr.push(depIds[0]);
|
let type = "open";
|
||||||
} else if (item.parent_chain === "") {
|
if (depIds.length !== 0 && depIds[0] !== 0) {
|
||||||
arr.push(depIds[0]);
|
type = "elective";
|
||||||
} else {
|
let item = checkChild(res.data.departments, depIds[0]);
|
||||||
let new_arr = item.parent_chain.split(",");
|
let arr: any[] = [];
|
||||||
new_arr.map((num: any) => {
|
if (item === undefined) {
|
||||||
arr.push(Number(num));
|
arr.push(depIds[0]);
|
||||||
});
|
} else if (item.parent_chain === "") {
|
||||||
arr.push(depIds[0]);
|
arr.push(depIds[0]);
|
||||||
}
|
|
||||||
form.setFieldsValue({
|
|
||||||
dep_ids: arr,
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
form.setFieldsValue({
|
let new_arr = item.parent_chain.split(",");
|
||||||
dep_ids: depIds,
|
new_arr.map((num: any) => {
|
||||||
|
arr.push(Number(num));
|
||||||
});
|
});
|
||||||
|
arr.push(depIds[0]);
|
||||||
}
|
}
|
||||||
form.setFieldsValue({
|
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) => {
|
const checkChild = (departments: any[], id: number) => {
|
||||||
@ -145,37 +152,36 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCategory = () => {
|
const getCategory = async () => {
|
||||||
course.createCourse().then((res: any) => {
|
let res: any = await course.createCourse();
|
||||||
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) {
|
if (cateIds.length !== 0 && cateIds[0] !== 0) {
|
||||||
let item = checkChild(res.data.categories, cateIds[0]);
|
let item = checkChild(res.data.categories, cateIds[0]);
|
||||||
let arr: any[] = [];
|
let arr: any[] = [];
|
||||||
if (item === undefined) {
|
if (item === undefined) {
|
||||||
arr.push(cateIds[0]);
|
arr.push(cateIds[0]);
|
||||||
} else if (item.parent_chain === "") {
|
} else if (item.parent_chain === "") {
|
||||||
arr.push(cateIds[0]);
|
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 {
|
} else {
|
||||||
form.setFieldsValue({
|
let new_arr = item.parent_chain.split(",");
|
||||||
category_ids: cateIds,
|
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) => {
|
||||||
@ -330,6 +336,10 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setChapterType(e.target.value);
|
setChapterType(e.target.value);
|
||||||
|
setChapters([]);
|
||||||
|
setHours([]);
|
||||||
|
setChapterHours([]);
|
||||||
|
setTreeData([]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -499,7 +509,15 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
}
|
}
|
||||||
width={634}
|
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
|
<SelectResource
|
||||||
defaultKeys={
|
defaultKeys={
|
||||||
chapterType == 0 ? hours : changeChapterHours(chapterHours)
|
chapterType == 0 ? hours : changeChapterHours(chapterHours)
|
||||||
|
@ -234,7 +234,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
|
|||||||
const arr = [...chapters];
|
const arr = [...chapters];
|
||||||
if (arr[index].id) {
|
if (arr[index].id) {
|
||||||
courseChapter
|
courseChapter
|
||||||
.updateCourseChapter(id, Number(arr[index].id), value, arr.length)
|
.updateCourseChapter(id, Number(arr[index].id), value, index + 1)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
console.log("ok");
|
console.log("ok");
|
||||||
getDetail();
|
getDetail();
|
||||||
|
@ -65,6 +65,7 @@ export const TreeHours = (props: PropInterface) => {
|
|||||||
}
|
}
|
||||||
props.onRemoveItem(id);
|
props.onRemoveItem(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDrop: TreeProps["onDrop"] = (info) => {
|
const onDrop: TreeProps["onDrop"] = (info) => {
|
||||||
const dropKey = info.node.key;
|
const dropKey = info.node.key;
|
||||||
const dragKey = info.dragNode.key;
|
const dragKey = info.dragNode.key;
|
||||||
@ -96,23 +97,35 @@ export const TreeHours = (props: PropInterface) => {
|
|||||||
|
|
||||||
// Find dragObject
|
// Find dragObject
|
||||||
let dragObj: DataNode;
|
let dragObj: DataNode;
|
||||||
loop(data, dragKey, (item, index, arr) => {
|
let dragLength = (info.dragNode as any).props.pos.split("-").length;
|
||||||
arr.splice(index, 1);
|
let dropLength = (info.node as any).props.pos.split("-").length;
|
||||||
dragObj = item;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!info.dropToGap) {
|
if (!info.dropToGap) {
|
||||||
// Drop on the content
|
// Drop on the content
|
||||||
loop(data, dropKey, (item) => {
|
if (
|
||||||
item.children = item.children || [];
|
(dropPosition == 0 && dropPos.length == 3) ||
|
||||||
// where to insert 示例添加到头部,可以是随意位置
|
(dropPosition == 0 && dropPos.length == 2 && dragLength == 2)
|
||||||
item.children.unshift(dragObj);
|
) {
|
||||||
});
|
} else {
|
||||||
|
loop(data, dragKey, (item, index, arr) => {
|
||||||
|
arr.splice(index, 1);
|
||||||
|
dragObj = item;
|
||||||
|
});
|
||||||
|
loop(data, dropKey, (item) => {
|
||||||
|
item.children = item.children || [];
|
||||||
|
// where to insert 示例添加到头部,可以是随意位置
|
||||||
|
item.children.unshift(dragObj);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (
|
} else if (
|
||||||
((info.node as any).props.children || []).length > 0 && // Has children
|
((info.node as any).props.children || []).length > 0 && // Has children
|
||||||
(info.node as any).props.expanded && // Is expanded
|
(info.node as any).props.expanded && // Is expanded
|
||||||
dropPosition === 1 // On the bottom gap
|
dropPosition === 1 // On the bottom gap
|
||||||
) {
|
) {
|
||||||
|
loop(data, dragKey, (item, index, arr) => {
|
||||||
|
arr.splice(index, 1);
|
||||||
|
dragObj = item;
|
||||||
|
});
|
||||||
loop(data, dropKey, (item) => {
|
loop(data, dropKey, (item) => {
|
||||||
item.children = item.children || [];
|
item.children = item.children || [];
|
||||||
// where to insert 示例添加到头部,可以是随意位置
|
// where to insert 示例添加到头部,可以是随意位置
|
||||||
@ -121,6 +134,16 @@ export const TreeHours = (props: PropInterface) => {
|
|||||||
// item to the tail of the children
|
// item to the tail of the children
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
if (
|
||||||
|
(dragLength == 3 && dropLength == 2) ||
|
||||||
|
(dragLength == 2 && dropLength == 3)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loop(data, dragKey, (item, index, arr) => {
|
||||||
|
arr.splice(index, 1);
|
||||||
|
dragObj = item;
|
||||||
|
});
|
||||||
let ar: DataNode[] = [];
|
let ar: DataNode[] = [];
|
||||||
let i: number;
|
let i: number;
|
||||||
loop(data, dropKey, (_item, index, arr) => {
|
loop(data, dropKey, (_item, index, arr) => {
|
||||||
|
@ -103,7 +103,6 @@ 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"));
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
import type { MenuProps } from "antd";
|
import type { MenuProps } from "antd";
|
||||||
import type { ColumnsType } from "antd/es/table";
|
import type { ColumnsType } from "antd/es/table";
|
||||||
import { dateFormat } from "../../utils/index";
|
import { dateFormat } from "../../utils/index";
|
||||||
import { useNavigate, useLocation } from "react-router-dom";
|
import { useNavigate, useLocation, useSearchParams } from "react-router-dom";
|
||||||
import { TreeDepartment, TreeCategory, PerButton } from "../../compenents";
|
import { TreeDepartment, TreeCategory, PerButton } from "../../compenents";
|
||||||
import type { TabsProps } from "antd";
|
import type { TabsProps } from "antd";
|
||||||
import { CourseCreate } from "./compenents/create";
|
import { CourseCreate } from "./compenents/create";
|
||||||
@ -42,17 +42,30 @@ interface DataType {
|
|||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface LocalSearchParamsInterface {
|
||||||
|
page?: number;
|
||||||
|
size?: number;
|
||||||
|
title?: string;
|
||||||
|
}
|
||||||
|
|
||||||
const CoursePage = () => {
|
const CoursePage = () => {
|
||||||
const result = new URLSearchParams(useLocation().search);
|
const result = new URLSearchParams(useLocation().search);
|
||||||
|
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams({
|
||||||
|
page: "1",
|
||||||
|
size: "10",
|
||||||
|
title: "",
|
||||||
|
});
|
||||||
|
const page = parseInt(searchParams.get("page") || "1");
|
||||||
|
const size = parseInt(searchParams.get("size") || "10");
|
||||||
|
const title = searchParams.get("title");
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [list, setList] = useState<DataType[]>([]);
|
const [list, setList] = useState<DataType[]>([]);
|
||||||
const [refresh, setRefresh] = useState(false);
|
|
||||||
const [page, setPage] = useState(1);
|
|
||||||
const [size, setSize] = useState(10);
|
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
|
const [refresh, setRefresh] = useState(false);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [category_ids, setCategoryIds] = useState<number[]>([]);
|
const [category_ids, setCategoryIds] = useState<number[]>([]);
|
||||||
const [title, setTitle] = useState("");
|
|
||||||
const [dep_ids, setDepIds] = useState<number[]>([]);
|
const [dep_ids, setDepIds] = useState<number[]>([]);
|
||||||
const [selLabel, setLabel] = useState<string>(
|
const [selLabel, setLabel] = useState<string>(
|
||||||
result.get("label") ? String(result.get("label")) : "全部分类"
|
result.get("label") ? String(result.get("label")) : "全部分类"
|
||||||
@ -105,7 +118,9 @@ const CoursePage = () => {
|
|||||||
type=""
|
type=""
|
||||||
text={"分类"}
|
text={"分类"}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
setPage(1);
|
resetLocalSearchParams({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
setCategoryIds(keys);
|
setCategoryIds(keys);
|
||||||
if (typeof title === "string") {
|
if (typeof title === "string") {
|
||||||
setLabel(title);
|
setLabel(title);
|
||||||
@ -124,12 +139,12 @@ const CoursePage = () => {
|
|||||||
<div className="float-left">
|
<div className="float-left">
|
||||||
<TreeDepartment
|
<TreeDepartment
|
||||||
selected={dep_ids}
|
selected={dep_ids}
|
||||||
refresh={refresh}
|
|
||||||
showNum={false}
|
showNum={false}
|
||||||
type="no-course"
|
|
||||||
text={"部门"}
|
text={"部门"}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
setPage(1);
|
resetLocalSearchParams({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
setDepIds(keys);
|
setDepIds(keys);
|
||||||
setDepLabel(title);
|
setDepLabel(title);
|
||||||
}}
|
}}
|
||||||
@ -346,7 +361,7 @@ const CoursePage = () => {
|
|||||||
depIds = dep_ids.join(",");
|
depIds = dep_ids.join(",");
|
||||||
}
|
}
|
||||||
course
|
course
|
||||||
.courseList(page, size, "", "", title, depIds, categoryIds)
|
.courseList(page, size, "", "", title ? title : "", depIds, categoryIds)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
setTotal(res.data.total);
|
setTotal(res.data.total);
|
||||||
setList(res.data.data);
|
setList(res.data.data);
|
||||||
@ -362,10 +377,12 @@ const CoursePage = () => {
|
|||||||
};
|
};
|
||||||
// 重置列表
|
// 重置列表
|
||||||
const resetList = () => {
|
const resetList = () => {
|
||||||
setPage(1);
|
resetLocalSearchParams({
|
||||||
setSize(10);
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
title: "",
|
||||||
|
});
|
||||||
setList([]);
|
setList([]);
|
||||||
setTitle("");
|
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -379,8 +396,28 @@ const CoursePage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handlePageChange = (page: number, pageSize: number) => {
|
const handlePageChange = (page: number, pageSize: number) => {
|
||||||
setPage(page);
|
resetLocalSearchParams({
|
||||||
setSize(pageSize);
|
page: page,
|
||||||
|
size: pageSize,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetLocalSearchParams = (params: LocalSearchParamsInterface) => {
|
||||||
|
setSearchParams(
|
||||||
|
(prev) => {
|
||||||
|
if (typeof params.title !== "undefined") {
|
||||||
|
prev.set("title", params.title);
|
||||||
|
}
|
||||||
|
if (typeof params.page !== "undefined") {
|
||||||
|
prev.set("page", params.page + "");
|
||||||
|
}
|
||||||
|
if (typeof params.size !== "undefined") {
|
||||||
|
prev.set("size", params.size + "");
|
||||||
|
}
|
||||||
|
return prev;
|
||||||
|
},
|
||||||
|
{ replace: true }
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (key: string) => {
|
const onChange = (key: string) => {
|
||||||
@ -419,9 +456,11 @@ const CoursePage = () => {
|
|||||||
<div className="d-flex mr-24">
|
<div className="d-flex mr-24">
|
||||||
<Typography.Text>课程名称:</Typography.Text>
|
<Typography.Text>课程名称:</Typography.Text>
|
||||||
<Input
|
<Input
|
||||||
value={title}
|
value={title || ""}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setTitle(e.target.value);
|
resetLocalSearchParams({
|
||||||
|
title: e.target.value,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
allowClear
|
allowClear
|
||||||
style={{ width: 160 }}
|
style={{ width: 160 }}
|
||||||
@ -435,7 +474,9 @@ const CoursePage = () => {
|
|||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPage(1);
|
resetLocalSearchParams({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -60,6 +60,22 @@ type HourCountModel = {
|
|||||||
[key: number]: string;
|
[key: number]: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type PerCourseRecordsModel = {
|
||||||
|
[key: number]: {
|
||||||
|
course_id: number;
|
||||||
|
created_at: string;
|
||||||
|
finished_at: string;
|
||||||
|
finished_duration: number;
|
||||||
|
hour_id: number;
|
||||||
|
id: number;
|
||||||
|
is_finished: number;
|
||||||
|
real_duration: number;
|
||||||
|
total_duration: number;
|
||||||
|
updated_at: string;
|
||||||
|
user_id: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const CourseUserPage = () => {
|
const CourseUserPage = () => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const result = new URLSearchParams(useLocation().search);
|
const result = new URLSearchParams(useLocation().search);
|
||||||
@ -69,6 +85,7 @@ const CourseUserPage = () => {
|
|||||||
const [hourCount, setHourCount] = useState<HourCountModel>({});
|
const [hourCount, setHourCount] = useState<HourCountModel>({});
|
||||||
const [userDepIds, setUserDepIds] = useState<DepIdsModel>({});
|
const [userDepIds, setUserDepIds] = useState<DepIdsModel>({});
|
||||||
const [departments, setDepartments] = useState<DepartmentsModel>({});
|
const [departments, setDepartments] = useState<DepartmentsModel>({});
|
||||||
|
const [perRecords, setPerRecords] = useState<PerCourseRecordsModel>({});
|
||||||
const [refresh, setRefresh] = useState(false);
|
const [refresh, setRefresh] = useState(false);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [size, setSize] = useState(10);
|
const [size, setSize] = useState(10);
|
||||||
@ -135,8 +152,8 @@ const CourseUserPage = () => {
|
|||||||
dataIndex: "created_at",
|
dataIndex: "created_at",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
{records[record.id] ? (
|
{perRecords[record.id] ? (
|
||||||
<span>{dateFormat(records[record.id].created_at)}</span>
|
<span>{dateFormat(perRecords[record.id].created_at)}</span>
|
||||||
) : hourCount[record.id] ? (
|
) : hourCount[record.id] ? (
|
||||||
<span>{dateFormat(hourCount[record.id])}</span>
|
<span>{dateFormat(hourCount[record.id])}</span>
|
||||||
) : (
|
) : (
|
||||||
@ -150,7 +167,7 @@ const CourseUserPage = () => {
|
|||||||
dataIndex: "id",
|
dataIndex: "id",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
{records[record.id] ? (
|
{records[record.id] && records[record.id].finished_at ? (
|
||||||
<span>{dateFormat(String(records[record.id].finished_at))}</span>
|
<span>{dateFormat(String(records[record.id].finished_at))}</span>
|
||||||
) : (
|
) : (
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
@ -213,6 +230,7 @@ const CourseUserPage = () => {
|
|||||||
setList(res.data.data);
|
setList(res.data.data);
|
||||||
setHourCount(res.data.user_course_hour_user_first_at);
|
setHourCount(res.data.user_course_hour_user_first_at);
|
||||||
setRecords(res.data.user_course_records);
|
setRecords(res.data.user_course_records);
|
||||||
|
setPerRecords(res.data.per_user_earliest_records);
|
||||||
setCourse(res.data.course);
|
setCourse(res.data.course);
|
||||||
setDepartments(res.data.departments);
|
setDepartments(res.data.departments);
|
||||||
setUserDepIds(res.data.user_dep_ids);
|
setUserDepIds(res.data.user_dep_ids);
|
||||||
|
@ -558,7 +558,7 @@ const DashboardPage = () => {
|
|||||||
<div className={styles["usage-guide"]}>
|
<div className={styles["usage-guide"]}>
|
||||||
<img className={styles["banner"]} src={banner} alt="" />
|
<img className={styles["banner"]} src={banner} alt="" />
|
||||||
<Link
|
<Link
|
||||||
to="https://www.playedu.xyz/docs/docs/guide/"
|
to="https://www.playedu.xyz/book/opensource-handbook/article/wFymJ4SXcX"
|
||||||
target="blank"
|
target="blank"
|
||||||
className={styles["link"]}
|
className={styles["link"]}
|
||||||
>
|
>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useRef, useEffect } from "react";
|
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 styles from "./create.module.less";
|
||||||
import { department } from "../../../api/index";
|
import { department } from "../../../api/index";
|
||||||
|
|
||||||
@ -19,11 +19,13 @@ 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();
|
||||||
}
|
}
|
||||||
@ -54,6 +56,7 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
|
|||||||
});
|
});
|
||||||
setDepartments(new_arr);
|
setDepartments(new_arr);
|
||||||
}
|
}
|
||||||
|
setInit(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -125,7 +128,15 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
|
|||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
okButtonProps={{ loading: loading }}
|
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={form}
|
form={form}
|
||||||
name="basic"
|
name="basic"
|
||||||
|
@ -8,7 +8,8 @@ import type { DataNode, TreeProps } from "antd/es/tree";
|
|||||||
import { DepartmentCreate } from "./compenents/create";
|
import { DepartmentCreate } from "./compenents/create";
|
||||||
import { DepartmentUpdate } from "./compenents/update";
|
import { DepartmentUpdate } from "./compenents/update";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
|
import { saveDepartmentsAction } from "../../store/system/systemConfigSlice";
|
||||||
|
|
||||||
const { confirm } = Modal;
|
const { confirm } = Modal;
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ interface Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DepartmentPage = () => {
|
const DepartmentPage = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const permissions = useSelector(
|
const permissions = useSelector(
|
||||||
(state: any) => state.loginUser.value.permissions
|
(state: any) => state.loginUser.value.permissions
|
||||||
@ -32,6 +34,8 @@ const DepartmentPage = () => {
|
|||||||
const [updateVisible, setUpdateVisible] = useState(false);
|
const [updateVisible, setUpdateVisible] = useState(false);
|
||||||
const [did, setDid] = useState<number>(0);
|
const [did, setDid] = useState<number>(0);
|
||||||
const [modal, contextHolder] = Modal.useModal();
|
const [modal, contextHolder] = Modal.useModal();
|
||||||
|
|
||||||
|
// 是否启用LDAP
|
||||||
const ldapEnabled = useSelector(
|
const ldapEnabled = useSelector(
|
||||||
(state: any) => state.systemConfig.value["ldap-enabled"]
|
(state: any) => state.systemConfig.value["ldap-enabled"]
|
||||||
);
|
);
|
||||||
@ -55,6 +59,7 @@ const DepartmentPage = () => {
|
|||||||
const getData = () => {
|
const getData = () => {
|
||||||
department.departmentList().then((res: any) => {
|
department.departmentList().then((res: any) => {
|
||||||
const departments: DepartmentsBoxModel = res.data.departments;
|
const departments: DepartmentsBoxModel = res.data.departments;
|
||||||
|
dispatch(saveDepartmentsAction(res.data.departments));
|
||||||
if (JSON.stringify(departments) !== "{}") {
|
if (JSON.stringify(departments) !== "{}") {
|
||||||
const new_arr: Option[] = checkArr(departments, 0);
|
const new_arr: Option[] = checkArr(departments, 0);
|
||||||
setTreeData(new_arr);
|
setTreeData(new_arr);
|
||||||
@ -389,24 +394,49 @@ const DepartmentPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ldapSync = () => {
|
||||||
|
if (loading) {
|
||||||
|
message.warning("正在同步,请稍后...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
|
department.ldapSync().then(() => {
|
||||||
|
message.success("操作成功");
|
||||||
|
setLoading(false);
|
||||||
|
resetData();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!ldapEnabled && (
|
{
|
||||||
<div className="playedu-main-top mb-24">
|
<div className="playedu-main-top mb-24">
|
||||||
{contextHolder}
|
{contextHolder}
|
||||||
<div className="d-flex">
|
<div className="d-flex">
|
||||||
<PerButton
|
{ldapEnabled ? (
|
||||||
type="primary"
|
<PerButton
|
||||||
text="新建部门"
|
type="primary"
|
||||||
class="mr-16"
|
text="一键同步LDAP部门架构"
|
||||||
icon={<PlusOutlined />}
|
class="mr-16"
|
||||||
p="department-cud"
|
icon={null}
|
||||||
onClick={() => setCreateVisible(true)}
|
p="department-cud"
|
||||||
disabled={null}
|
onClick={() => ldapSync()}
|
||||||
/>
|
disabled={null}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<PerButton
|
||||||
|
type="primary"
|
||||||
|
text="新建部门"
|
||||||
|
class="mr-16"
|
||||||
|
icon={<PlusOutlined />}
|
||||||
|
p="department-cud"
|
||||||
|
onClick={() => setCreateVisible(true)}
|
||||||
|
disabled={null}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
}
|
||||||
<div className="playedu-main-body">
|
<div className="playedu-main-body">
|
||||||
{loading && (
|
{loading && (
|
||||||
<div className="float-left text-center mt-30">
|
<div className="float-left text-center mt-30">
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
SystemConfigStoreInterface,
|
SystemConfigStoreInterface,
|
||||||
saveConfigAction,
|
saveConfigAction,
|
||||||
} from "../../store/system/systemConfigSlice";
|
} from "../../store/system/systemConfigSlice";
|
||||||
|
import { UploadVideoFloatButton } from "../../compenents/upload-video-float-button";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
loginData?: any;
|
loginData?: any;
|
||||||
@ -27,6 +28,8 @@ const InitPage = (props: Props) => {
|
|||||||
systemH5Url: props.configData["system.h5_url"],
|
systemH5Url: props.configData["system.h5_url"],
|
||||||
memberDefaultAvatar: props.configData["member.default_avatar"],
|
memberDefaultAvatar: props.configData["member.default_avatar"],
|
||||||
courseDefaultThumbs: props.configData["default.course_thumbs"],
|
courseDefaultThumbs: props.configData["default.course_thumbs"],
|
||||||
|
departments: props.configData["departments"],
|
||||||
|
resourceCategories: props.configData["resource_categories"],
|
||||||
};
|
};
|
||||||
dispatch(saveConfigAction(config));
|
dispatch(saveConfigAction(config));
|
||||||
}
|
}
|
||||||
@ -34,6 +37,7 @@ const InitPage = (props: Props) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
|
<UploadVideoFloatButton></UploadVideoFloatButton>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,15 @@
|
|||||||
height: 640px;
|
height: 640px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.footer-box {
|
||||||
|
width: 880px;
|
||||||
|
height: auto;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -440px;
|
||||||
|
margin-top: 280px;
|
||||||
|
}
|
||||||
.login-box {
|
.login-box {
|
||||||
width: 880px;
|
width: 880px;
|
||||||
height: 560px;
|
height: 560px;
|
||||||
@ -30,9 +39,11 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 90px 10px 80px 30px;
|
padding: 90px 10px 80px 30px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.icon {
|
.icon {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 400px;
|
height: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.right-box {
|
.right-box {
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
SystemConfigStoreInterface,
|
SystemConfigStoreInterface,
|
||||||
saveConfigAction,
|
saveConfigAction,
|
||||||
} from "../../store/system/systemConfigSlice";
|
} from "../../store/system/systemConfigSlice";
|
||||||
|
import { Footer } from "../../compenents/footer";
|
||||||
|
|
||||||
const LoginPage = () => {
|
const LoginPage = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -67,6 +68,8 @@ const LoginPage = () => {
|
|||||||
systemH5Url: res.data["system.h5_url"],
|
systemH5Url: res.data["system.h5_url"],
|
||||||
memberDefaultAvatar: res.data["member.default_avatar"],
|
memberDefaultAvatar: res.data["member.default_avatar"],
|
||||||
courseDefaultThumbs: res.data["default.course_thumbs"],
|
courseDefaultThumbs: res.data["default.course_thumbs"],
|
||||||
|
departments: res.data["departments"],
|
||||||
|
resourceCategories: res.data["resource_categories"],
|
||||||
};
|
};
|
||||||
dispatch(saveConfigAction(data));
|
dispatch(saveConfigAction(data));
|
||||||
};
|
};
|
||||||
@ -124,6 +127,9 @@ const LoginPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className={styles["footer-box"]}>
|
||||||
|
<Footer type="none"></Footer>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
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 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,6 +24,7 @@ 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(
|
||||||
@ -32,6 +33,7 @@ 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();
|
||||||
}
|
}
|
||||||
@ -56,6 +58,7 @@ 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);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,10 +86,10 @@ export const MemberCreate: React.FC<PropInterface> = ({
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
// if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
||||||
message.error("请输入正确的身份证号!");
|
// message.error("请输入正确的身份证号!");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
user
|
user
|
||||||
.storeUser(
|
.storeUser(
|
||||||
@ -125,7 +128,15 @@ export const MemberCreate: React.FC<PropInterface> = ({
|
|||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
okButtonProps={{ loading: loading }}
|
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={form}
|
form={form}
|
||||||
name="create-basic"
|
name="create-basic"
|
||||||
@ -203,13 +214,6 @@ 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>
|
||||||
|
@ -59,7 +59,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
{
|
{
|
||||||
title: "课时标题",
|
title: "课时标题",
|
||||||
dataIndex: "title",
|
dataIndex: "title",
|
||||||
|
|
||||||
render: (title: string) => (
|
render: (title: string) => (
|
||||||
<>
|
<>
|
||||||
<span>{title}</span>
|
<span>{title}</span>
|
||||||
@ -68,7 +67,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "总时长",
|
title: "总时长",
|
||||||
width: 120,
|
|
||||||
dataIndex: "duration",
|
dataIndex: "duration",
|
||||||
render: (duration: number) => (
|
render: (duration: number) => (
|
||||||
<>
|
<>
|
||||||
@ -78,7 +76,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "已学习时长",
|
title: "已学习时长",
|
||||||
width: 120,
|
|
||||||
dataIndex: "finished_duration",
|
dataIndex: "finished_duration",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
@ -96,7 +93,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "是否学完",
|
title: "是否学完",
|
||||||
width: 100,
|
|
||||||
dataIndex: "is_finished",
|
dataIndex: "is_finished",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
@ -112,7 +108,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "开始时间",
|
title: "开始时间",
|
||||||
width: 150,
|
|
||||||
dataIndex: "created_at",
|
dataIndex: "created_at",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
@ -126,7 +121,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "学完时间",
|
title: "学完时间",
|
||||||
width: 150,
|
|
||||||
dataIndex: "finished_at",
|
dataIndex: "finished_at",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
@ -142,7 +136,6 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
title: "操作",
|
title: "操作",
|
||||||
key: "action",
|
key: "action",
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
width: 70,
|
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
{records && records[record.id] ? (
|
{records && records[record.id] ? (
|
||||||
@ -222,7 +215,7 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
footer={null}
|
footer={null}
|
||||||
>
|
>
|
||||||
<div className="d-flex mt-24">
|
<div className="mt-24">
|
||||||
<PerButton
|
<PerButton
|
||||||
type="primary"
|
type="primary"
|
||||||
text="重置学习记录"
|
text="重置学习记录"
|
||||||
@ -235,10 +228,7 @@ export const MemberLearnProgressDialog: React.FC<PropInterface> = ({
|
|||||||
disabled={null}
|
disabled={null}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div className="mt-24" style={{ maxHeight: 800, overflowY: "auto" }}>
|
||||||
className="d-flex mt-24"
|
|
||||||
style={{ maxHeight: 800, overflowY: "auto" }}
|
|
||||||
>
|
|
||||||
<Table
|
<Table
|
||||||
columns={column}
|
columns={column}
|
||||||
dataSource={list}
|
dataSource={list}
|
||||||
|
@ -108,10 +108,10 @@ export const MemberUpdate: React.FC<PropInterface> = ({
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
// if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
||||||
message.error("请输入正确的身份证号!");
|
// message.error("请输入正确的身份证号!");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
user
|
user
|
||||||
.updateUser(
|
.updateUser(
|
||||||
@ -239,13 +239,6 @@ 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>
|
||||||
|
@ -117,17 +117,17 @@ const MemberDepartmentProgressPage = () => {
|
|||||||
setSize(pageSize);
|
setSize(pageSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTotalHours = (params: any) => {
|
// const getTotalHours = (params: any) => {
|
||||||
if (params) {
|
// if (params) {
|
||||||
let value = 0;
|
// let value = 0;
|
||||||
for (let key in params) {
|
// for (let key in params) {
|
||||||
value += params[key].hour_count;
|
// value += params[key].hour_count;
|
||||||
}
|
// }
|
||||||
return value;
|
// return value;
|
||||||
} else {
|
// } else {
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
const getFinishedHours = (params: any) => {
|
const getFinishedHours = (params: any) => {
|
||||||
if (params) {
|
if (params) {
|
||||||
@ -164,7 +164,17 @@ const MemberDepartmentProgressPage = () => {
|
|||||||
let sheetName = "sheet1";
|
let sheetName = "sheet1";
|
||||||
let data = [];
|
let data = [];
|
||||||
let arr = ["学员"];
|
let arr = ["学员"];
|
||||||
courses.map((item: any) => {
|
let data2 = res.data.courses;
|
||||||
|
let arr2: any = [];
|
||||||
|
let value = 0;
|
||||||
|
for (let key in data2) {
|
||||||
|
arr2.push(data2[key]);
|
||||||
|
value += data2[key].class_hour;
|
||||||
|
}
|
||||||
|
let w_totalHour = value;
|
||||||
|
let w_courses = arr2;
|
||||||
|
let w_records = res.data.user_course_records;
|
||||||
|
w_courses.map((item: any) => {
|
||||||
arr.push(item.title);
|
arr.push(item.title);
|
||||||
});
|
});
|
||||||
arr.push("总计课时");
|
arr.push("总计课时");
|
||||||
@ -172,21 +182,23 @@ const MemberDepartmentProgressPage = () => {
|
|||||||
|
|
||||||
res.data.data.forEach((item: any) => {
|
res.data.data.forEach((item: any) => {
|
||||||
let arr = [item.name];
|
let arr = [item.name];
|
||||||
courses.map((it: any) => {
|
w_courses.map((it: any) => {
|
||||||
if (records && records[item.id] && records[item.id][it.id]) {
|
if (w_records && w_records[item.id] && w_records[item.id][it.id]) {
|
||||||
if (records && records[item.id][it.id].is_finished === 1) {
|
if (w_records && w_records[item.id][it.id].is_finished === 1) {
|
||||||
arr.push("已学完");
|
arr.push("已学完");
|
||||||
} else {
|
} else {
|
||||||
arr.push(
|
arr.push(
|
||||||
records &&
|
w_records &&
|
||||||
records[item.id][it.id].finished_count + " / " + it.class_hour
|
w_records[item.id][it.id].finished_count +
|
||||||
|
" / " +
|
||||||
|
it.class_hour
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
arr.push(0 + " / " + it.class_hour);
|
arr.push(0 + " / " + it.class_hour);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
arr.push(getFinishedHours(records[item.id]) + " / " + totalHour);
|
arr.push(getFinishedHours(w_records[item.id]) + " / " + w_totalHour);
|
||||||
data.push(arr);
|
data.push(arr);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { user } from "../../api/index";
|
import { user } from "../../api/index";
|
||||||
import { dateFormat } from "../../utils/index";
|
import { dateFormat } from "../../utils/index";
|
||||||
import { Link, Navigate, useLocation } from "react-router-dom";
|
import { Link, useLocation, useSearchParams } from "react-router-dom";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { TreeDepartment, PerButton } from "../../compenents";
|
import { TreeDepartment, PerButton } from "../../compenents";
|
||||||
import { MemberCreate } from "./compenents/create";
|
import { MemberCreate } from "./compenents/create";
|
||||||
@ -46,17 +46,34 @@ interface DataType {
|
|||||||
verify_at?: string;
|
verify_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface LocalSearchParamsInterface {
|
||||||
|
page?: number;
|
||||||
|
size?: number;
|
||||||
|
nickname?: string;
|
||||||
|
email?: string;
|
||||||
|
}
|
||||||
|
|
||||||
const MemberPage = () => {
|
const MemberPage = () => {
|
||||||
const result = new URLSearchParams(useLocation().search);
|
const result = new URLSearchParams(useLocation().search);
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
const [page, setPage] = useState(1);
|
const [searchParams, setSearchParams] = useSearchParams({
|
||||||
const [size, setSize] = useState(10);
|
page: "1",
|
||||||
|
size: "10",
|
||||||
|
nickname: "",
|
||||||
|
email: "",
|
||||||
|
});
|
||||||
|
const page = parseInt(searchParams.get("page") || "1");
|
||||||
|
const size = parseInt(searchParams.get("size") || "10");
|
||||||
|
const nickname = searchParams.get("nickname");
|
||||||
|
const email = searchParams.get("email");
|
||||||
|
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
const [list, setList] = useState<DataType[]>([]);
|
const [list, setList] = useState<DataType[]>([]);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
|
const [pureTotal, setPureTotal] = useState(0);
|
||||||
const [refresh, setRefresh] = useState(false);
|
const [refresh, setRefresh] = useState(false);
|
||||||
|
const [depUserCount, setDepUserCount] = useState<KeyNumberObject>();
|
||||||
|
|
||||||
const [nickname, setNickname] = useState("");
|
|
||||||
const [email, setEmail] = useState("");
|
|
||||||
const [dep_ids, setDepIds] = useState<number[]>([]);
|
const [dep_ids, setDepIds] = useState<number[]>([]);
|
||||||
const [selLabel, setLabel] = useState<string>(
|
const [selLabel, setLabel] = useState<string>(
|
||||||
result.get("label") ? String(result.get("label")) : "全部部门"
|
result.get("label") ? String(result.get("label")) : "全部部门"
|
||||||
@ -72,13 +89,13 @@ const MemberPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDid(Number(result.get("did")));
|
if (result.get("refresh")) {
|
||||||
if (Number(result.get("did"))) {
|
resetLocalSearchParams({
|
||||||
let arr = [];
|
page: 1,
|
||||||
arr.push(Number(result.get("did")));
|
});
|
||||||
setDepIds(arr);
|
setRefresh(!refresh);
|
||||||
}
|
}
|
||||||
}, [result.get("did")]);
|
}, [result.get("refresh")]);
|
||||||
|
|
||||||
const columns: ColumnsType<DataType> = [
|
const columns: ColumnsType<DataType> = [
|
||||||
{
|
{
|
||||||
@ -211,30 +228,45 @@ const MemberPage = () => {
|
|||||||
getData();
|
getData();
|
||||||
}, [refresh, page, size, dep_ids]);
|
}, [refresh, page, size, dep_ids]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handlePageBack = () => {
|
||||||
|
getData();
|
||||||
|
};
|
||||||
|
window.addEventListener("popstate", handlePageBack);
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("popstate", handlePageBack);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
const getData = () => {
|
const getData = () => {
|
||||||
let depIds = dep_ids.join(",");
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
user
|
user
|
||||||
.userList(page, size, {
|
.userList(page, size, {
|
||||||
name: nickname,
|
name: nickname,
|
||||||
email: email,
|
email: email,
|
||||||
id_card: "",
|
dep_ids: dep_ids.join(","),
|
||||||
dep_ids: depIds,
|
|
||||||
})
|
})
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
setList(res.data.data);
|
setList(res.data.data);
|
||||||
setDepartments(res.data.departments);
|
setDepartments(res.data.departments);
|
||||||
setUserDepIds(res.data.user_dep_ids);
|
setUserDepIds(res.data.user_dep_ids);
|
||||||
setTotal(res.data.total);
|
setTotal(res.data.total);
|
||||||
|
setPureTotal(res.data.pure_total);
|
||||||
|
setDepUserCount(res.data.dep_user_count);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetData = () => {
|
const resetData = () => {
|
||||||
setNickname("");
|
resetLocalSearchParams({
|
||||||
setEmail("");
|
page: 1,
|
||||||
setPage(1);
|
size: 10,
|
||||||
setSize(10);
|
nickname: "",
|
||||||
|
email: "",
|
||||||
|
});
|
||||||
setList([]);
|
setList([]);
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
@ -249,8 +281,31 @@ const MemberPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handlePageChange = (page: number, pageSize: number) => {
|
const handlePageChange = (page: number, pageSize: number) => {
|
||||||
setPage(page);
|
resetLocalSearchParams({
|
||||||
setSize(pageSize);
|
page: page,
|
||||||
|
size: pageSize,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetLocalSearchParams = (params: LocalSearchParamsInterface) => {
|
||||||
|
setSearchParams(
|
||||||
|
(prev) => {
|
||||||
|
if (typeof params.nickname !== "undefined") {
|
||||||
|
prev.set("nickname", params.nickname);
|
||||||
|
}
|
||||||
|
if (typeof params.email !== "undefined") {
|
||||||
|
prev.set("email", params.email);
|
||||||
|
}
|
||||||
|
if (typeof params.page !== "undefined") {
|
||||||
|
prev.set("page", params.page + "");
|
||||||
|
}
|
||||||
|
if (typeof params.size !== "undefined") {
|
||||||
|
prev.set("size", params.size + "");
|
||||||
|
}
|
||||||
|
return prev;
|
||||||
|
},
|
||||||
|
{ replace: true }
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const delUser = (id: number) => {
|
const delUser = (id: number) => {
|
||||||
@ -282,12 +337,14 @@ const MemberPage = () => {
|
|||||||
<div className="left-box">
|
<div className="left-box">
|
||||||
<TreeDepartment
|
<TreeDepartment
|
||||||
selected={dep_ids}
|
selected={dep_ids}
|
||||||
refresh={refresh}
|
|
||||||
showNum={true}
|
showNum={true}
|
||||||
type=""
|
userCount={pureTotal}
|
||||||
|
depUserCount={depUserCount}
|
||||||
text={"部门"}
|
text={"部门"}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
setPage(1);
|
resetLocalSearchParams({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
setDepIds(keys);
|
setDepIds(keys);
|
||||||
var index = title.indexOf("(");
|
var index = title.indexOf("(");
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
@ -324,7 +381,6 @@ const MemberPage = () => {
|
|||||||
class="mr-16"
|
class="mr-16"
|
||||||
icon={null}
|
icon={null}
|
||||||
p="user-store"
|
p="user-store"
|
||||||
onClick={() => null}
|
|
||||||
disabled={null}
|
disabled={null}
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
@ -340,9 +396,7 @@ const MemberPage = () => {
|
|||||||
type="default"
|
type="default"
|
||||||
text="部门学员进度"
|
text="部门学员进度"
|
||||||
class="mr-16"
|
class="mr-16"
|
||||||
icon={null}
|
|
||||||
p="department-user-learn"
|
p="department-user-learn"
|
||||||
onClick={() => null}
|
|
||||||
disabled={null}
|
disabled={null}
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
@ -352,9 +406,11 @@ const MemberPage = () => {
|
|||||||
<div className="d-flex mr-24">
|
<div className="d-flex mr-24">
|
||||||
<Typography.Text>姓名:</Typography.Text>
|
<Typography.Text>姓名:</Typography.Text>
|
||||||
<Input
|
<Input
|
||||||
value={nickname}
|
value={nickname || ""}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setNickname(e.target.value);
|
resetLocalSearchParams({
|
||||||
|
nickname: e.target.value,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
style={{ width: 160 }}
|
style={{ width: 160 }}
|
||||||
placeholder="请输入姓名关键字"
|
placeholder="请输入姓名关键字"
|
||||||
@ -364,9 +420,11 @@ const MemberPage = () => {
|
|||||||
<div className="d-flex mr-24">
|
<div className="d-flex mr-24">
|
||||||
<Typography.Text>邮箱:</Typography.Text>
|
<Typography.Text>邮箱:</Typography.Text>
|
||||||
<Input
|
<Input
|
||||||
value={email}
|
value={email || ""}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setEmail(e.target.value);
|
resetLocalSearchParams({
|
||||||
|
email: e.target.value,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
style={{ width: 160 }}
|
style={{ width: 160 }}
|
||||||
placeholder="请输入邮箱账号"
|
placeholder="请输入邮箱账号"
|
||||||
@ -380,7 +438,9 @@ const MemberPage = () => {
|
|||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPage(1);
|
resetLocalSearchParams({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -57,6 +57,22 @@ type DepartmentsListModel = {
|
|||||||
updated_at: string;
|
updated_at: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type PerCourseRecordsModel = {
|
||||||
|
[key: number]: {
|
||||||
|
course_id: number;
|
||||||
|
created_at: string;
|
||||||
|
finished_at: string;
|
||||||
|
finished_duration: number;
|
||||||
|
hour_id: number;
|
||||||
|
id: number;
|
||||||
|
is_finished: number;
|
||||||
|
real_duration: number;
|
||||||
|
total_duration: number;
|
||||||
|
updated_at: string;
|
||||||
|
user_id: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const MemberLearnPage = () => {
|
const MemberLearnPage = () => {
|
||||||
let chartRef = useRef(null);
|
let chartRef = useRef(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -69,6 +85,7 @@ const MemberLearnPage = () => {
|
|||||||
const [currentCourses, setCurrentCourses] = useState<DataType[]>([]);
|
const [currentCourses, setCurrentCourses] = useState<DataType[]>([]);
|
||||||
const [openCourses, setOpenCourses] = useState<CourseModel[]>([]);
|
const [openCourses, setOpenCourses] = useState<CourseModel[]>([]);
|
||||||
const [records, setRecords] = useState<UserCourseRecordsModel>({});
|
const [records, setRecords] = useState<UserCourseRecordsModel>({});
|
||||||
|
const [perRecords, setPerRecords] = useState<PerCourseRecordsModel>({});
|
||||||
const [hourCount, setHourCount] = useState<HourCountModel>({});
|
const [hourCount, setHourCount] = useState<HourCountModel>({});
|
||||||
const [total2, setTotal2] = useState(0);
|
const [total2, setTotal2] = useState(0);
|
||||||
const [refresh2, setRefresh2] = useState(false);
|
const [refresh2, setRefresh2] = useState(false);
|
||||||
@ -194,6 +211,7 @@ const MemberLearnPage = () => {
|
|||||||
setOpenCourses(res.data.open_courses);
|
setOpenCourses(res.data.open_courses);
|
||||||
setHourCount(res.data.user_course_hour_count);
|
setHourCount(res.data.user_course_hour_count);
|
||||||
setRecords(res.data.user_course_records);
|
setRecords(res.data.user_course_records);
|
||||||
|
setPerRecords(res.data.per_course_earliest_records);
|
||||||
if (res.data.departments.length > 0) {
|
if (res.data.departments.length > 0) {
|
||||||
let box: OptionModel[] = [];
|
let box: OptionModel[] = [];
|
||||||
res.data.departments.map((item: any) => {
|
res.data.departments.map((item: any) => {
|
||||||
@ -247,8 +265,8 @@ const MemberLearnPage = () => {
|
|||||||
dataIndex: "created_at",
|
dataIndex: "created_at",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
{records[record.id] ? (
|
{perRecords[record.id] ? (
|
||||||
<span>{dateFormat(records[record.id].created_at)}</span>
|
<span>{dateFormat(perRecords[record.id].created_at)}</span>
|
||||||
) : (
|
) : (
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
)}
|
)}
|
||||||
@ -260,7 +278,7 @@ const MemberLearnPage = () => {
|
|||||||
dataIndex: "finished_at",
|
dataIndex: "finished_at",
|
||||||
render: (_, record: any) => (
|
render: (_, record: any) => (
|
||||||
<>
|
<>
|
||||||
{records[record.id] ? (
|
{records[record.id] && records[record.id].finished_at ? (
|
||||||
<span>{dateFormat(String(records[record.id].finished_at))}</span>
|
<span>{dateFormat(String(records[record.id].finished_at))}</span>
|
||||||
) : (
|
) : (
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useRef, useEffect } from "react";
|
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 styles from "./create.module.less";
|
||||||
import { resourceCategory } from "../../../../api/index";
|
import { resourceCategory } from "../../../../api/index";
|
||||||
|
|
||||||
@ -19,11 +19,13 @@ 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();
|
||||||
}
|
}
|
||||||
@ -54,6 +56,7 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
|
|||||||
});
|
});
|
||||||
setCategories(new_arr);
|
setCategories(new_arr);
|
||||||
}
|
}
|
||||||
|
setInit(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -125,7 +128,15 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
|
|||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
okButtonProps={{ loading: loading }}
|
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={form}
|
form={form}
|
||||||
name="basic"
|
name="basic"
|
||||||
|
@ -8,7 +8,8 @@ import type { DataNode, TreeProps } from "antd/es/tree";
|
|||||||
import { ResourceCategoryCreate } from "./compenents/create";
|
import { ResourceCategoryCreate } from "./compenents/create";
|
||||||
import { ResourceCategoryUpdate } from "./compenents/update";
|
import { ResourceCategoryUpdate } from "./compenents/update";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
|
import { saveCategoriesAction } from "../../../store/system/systemConfigSlice";
|
||||||
|
|
||||||
const { confirm } = Modal;
|
const { confirm } = Modal;
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ interface Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ResourceCategoryPage = () => {
|
const ResourceCategoryPage = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const permissions = useSelector(
|
const permissions = useSelector(
|
||||||
(state: any) => state.loginUser.value.permissions
|
(state: any) => state.loginUser.value.permissions
|
||||||
@ -53,6 +55,7 @@ const ResourceCategoryPage = () => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
resourceCategory.resourceCategoryList().then((res: any) => {
|
resourceCategory.resourceCategoryList().then((res: any) => {
|
||||||
const categories: CategoriesBoxModel = res.data.categories;
|
const categories: CategoriesBoxModel = res.data.categories;
|
||||||
|
dispatch(saveCategoriesAction(res.data.categories));
|
||||||
if (JSON.stringify(categories) !== "{}") {
|
if (JSON.stringify(categories) !== "{}") {
|
||||||
const new_arr: Option[] = checkArr(categories, 0);
|
const new_arr: Option[] = checkArr(categories, 0);
|
||||||
setTreeData(new_arr);
|
setTreeData(new_arr);
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Modal, Table, message, Space, Dropdown, Button } from "antd";
|
import {
|
||||||
|
Modal,
|
||||||
|
Table,
|
||||||
|
message,
|
||||||
|
Space,
|
||||||
|
Dropdown,
|
||||||
|
Typography,
|
||||||
|
Input,
|
||||||
|
Button,
|
||||||
|
} from "antd";
|
||||||
import type { MenuProps } from "antd";
|
import type { MenuProps } from "antd";
|
||||||
import { resource } from "../../../api";
|
import { resource } from "../../../api";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
@ -63,6 +72,7 @@ const ResourceVideosPage = () => {
|
|||||||
const [multiConfig, setMultiConfig] = useState(false);
|
const [multiConfig, setMultiConfig] = useState(false);
|
||||||
const [updateId, setUpdateId] = useState(0);
|
const [updateId, setUpdateId] = useState(0);
|
||||||
const [playUrl, setPlayUrl] = useState("");
|
const [playUrl, setPlayUrl] = useState("");
|
||||||
|
const [title, setTitle] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCateId(Number(result.get("cid")));
|
setCateId(Number(result.get("cid")));
|
||||||
@ -231,7 +241,7 @@ const ResourceVideosPage = () => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
let categoryIds = category_ids.join(",");
|
let categoryIds = category_ids.join(",");
|
||||||
resource
|
resource
|
||||||
.resourceList(page, size, "", "", "", "VIDEO", categoryIds)
|
.resourceList(page, size, "", "", title, "VIDEO", categoryIds)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
setTotal(res.data.result.total);
|
setTotal(res.data.result.total);
|
||||||
setVideoList(res.data.result.data);
|
setVideoList(res.data.result.data);
|
||||||
@ -250,6 +260,7 @@ const ResourceVideosPage = () => {
|
|||||||
setSize(10);
|
setSize(10);
|
||||||
setVideoList([]);
|
setVideoList([]);
|
||||||
setSelectedRowKeys([]);
|
setSelectedRowKeys([]);
|
||||||
|
setTitle("");
|
||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -328,7 +339,34 @@ const ResourceVideosPage = () => {
|
|||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="d-flex"></div>
|
<div className="d-flex">
|
||||||
|
<div className="d-flex mr-24">
|
||||||
|
<Typography.Text>名称:</Typography.Text>
|
||||||
|
<Input
|
||||||
|
value={title}
|
||||||
|
onChange={(e) => {
|
||||||
|
setTitle(e.target.value);
|
||||||
|
}}
|
||||||
|
allowClear
|
||||||
|
style={{ width: 160 }}
|
||||||
|
placeholder="请输入名称关键字"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="d-flex">
|
||||||
|
<Button className="mr-16" onClick={resetVideoList}>
|
||||||
|
重 置
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
setPage(1);
|
||||||
|
setRefresh(!refresh);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查 询
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="float-left">
|
<div className="float-left">
|
||||||
{multiConfig ? (
|
{multiConfig ? (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
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 styles from "./create.module.less";
|
||||||
import { adminUser } from "../../../../api/index";
|
import { adminUser } from "../../../../api/index";
|
||||||
|
|
||||||
@ -22,10 +22,12 @@ 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();
|
||||||
}
|
}
|
||||||
@ -56,6 +58,7 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
setRoles(arr);
|
setRoles(arr);
|
||||||
|
setInit(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,7 +113,15 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
|||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
okButtonProps={{ loading: loading }}
|
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={form}
|
form={form}
|
||||||
name="basic"
|
name="basic"
|
||||||
@ -149,12 +160,12 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label="邮箱"
|
label="邮箱"
|
||||||
name="email"
|
name="email"
|
||||||
rules={[{ required: true, message: "请输入学员邮箱!" }]}
|
rules={[{ required: true, message: "请输入管理员邮箱!" }]}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
allowClear
|
allowClear
|
||||||
style={{ width: 200 }}
|
style={{ width: 200 }}
|
||||||
placeholder="请输入学员邮箱"
|
placeholder="请输入管理员邮箱"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
@ -111,7 +111,7 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
|||||||
<>
|
<>
|
||||||
{open ? (
|
{open ? (
|
||||||
<Modal
|
<Modal
|
||||||
title="编辑管理人员"
|
title="编辑管理员"
|
||||||
centered
|
centered
|
||||||
forceRender
|
forceRender
|
||||||
open={true}
|
open={true}
|
||||||
@ -168,12 +168,12 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label="邮箱"
|
label="邮箱"
|
||||||
name="email"
|
name="email"
|
||||||
rules={[{ required: true, message: "请输入学员邮箱!" }]}
|
rules={[{ required: true, message: "请输入管理员邮箱!" }]}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
allowClear
|
allowClear
|
||||||
style={{ width: 200 }}
|
style={{ width: 200 }}
|
||||||
placeholder="请输入学员邮箱"
|
placeholder="请输入管理员邮箱"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="密码" name="password">
|
<Form.Item label="密码" name="password">
|
||||||
|
@ -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_area",
|
dataIndex: "ip",
|
||||||
render: (ip_area: string) => <span>{ip_area}</span>,
|
render: (ip: string) => <span>{ip}</span>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "时间",
|
title: "时间",
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
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 styles from "./create.module.less";
|
||||||
import { adminRole } from "../../../../api/index";
|
import { adminRole } from "../../../../api/index";
|
||||||
|
|
||||||
@ -19,11 +28,13 @@ 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();
|
||||||
}
|
}
|
||||||
@ -39,89 +50,57 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
|
|
||||||
const getParams = () => {
|
const getParams = () => {
|
||||||
adminRole.createAdminRole().then((res: any) => {
|
adminRole.createAdminRole().then((res: any) => {
|
||||||
const arr: Option[] = [
|
const arr: any = [];
|
||||||
{
|
const arr2: any = [];
|
||||||
title: "学员",
|
|
||||||
value: "学员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员",
|
|
||||||
value: "管理员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const arr2: Option[] = [
|
|
||||||
{
|
|
||||||
title: "学员",
|
|
||||||
value: "学员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员",
|
|
||||||
value: "管理员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员日志",
|
|
||||||
value: "管理员日志-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员角色",
|
|
||||||
value: "管理员角色-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "线上课",
|
|
||||||
value: "线上课-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "资源分类",
|
|
||||||
value: "资源分类-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "部门",
|
|
||||||
value: "部门-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "系统配置",
|
|
||||||
value: "系统配置-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "其它",
|
|
||||||
value: "其它-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
let actions = res.data.perm_action.action;
|
let actions = res.data.perm_action.action;
|
||||||
let permissions = res.data.perm_action.data;
|
let permissions = res.data.perm_action.data;
|
||||||
for (let i = 0; i < permissions.length; i++) {
|
for (let i = 0; i < permissions.length; i++) {
|
||||||
arr.map((item: any) => {
|
const key = arr.findIndex(
|
||||||
if (item.title === permissions[i].group_name) {
|
(it: any) => it.title === permissions[i].group_name
|
||||||
item.children.push({
|
);
|
||||||
title: permissions[i].name,
|
if (key >= 0) {
|
||||||
value: permissions[i].id,
|
arr[key].children.push({
|
||||||
});
|
title: permissions[i].name,
|
||||||
}
|
value: permissions[i].id,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
arr.push({
|
||||||
|
title: permissions[i].group_name,
|
||||||
|
value: permissions[i].group_name + "-n",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: permissions[i].name,
|
||||||
|
value: permissions[i].id,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (let j = 0; j < actions.length; j++) {
|
for (let j = 0; j < actions.length; j++) {
|
||||||
arr2.map((item: any) => {
|
const key = arr2.findIndex(
|
||||||
if (item.title === actions[j].group_name) {
|
(it: any) => it.title === actions[j].group_name
|
||||||
item.children.push({
|
);
|
||||||
title: actions[j].name,
|
if (key >= 0) {
|
||||||
value: actions[j].id,
|
arr2[key].children.push({
|
||||||
});
|
title: actions[j].name,
|
||||||
}
|
value: actions[j].id,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
arr2.push({
|
||||||
|
title: actions[j].group_name,
|
||||||
|
value: actions[j].group_name + "-n",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: actions[j].name,
|
||||||
|
value: actions[j].id,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setPermissions(arr);
|
setPermissions(arr);
|
||||||
setActions(arr2);
|
setActions(arr2);
|
||||||
|
setInit(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -181,7 +160,15 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
}
|
}
|
||||||
width={634}
|
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={form}
|
form={form}
|
||||||
name="adminroles-create"
|
name="adminroles-create"
|
||||||
|
@ -53,86 +53,53 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
|||||||
|
|
||||||
const getParams = () => {
|
const getParams = () => {
|
||||||
adminRole.createAdminRole().then((res: any) => {
|
adminRole.createAdminRole().then((res: any) => {
|
||||||
const arr: Option[] = [
|
const arr: any = [];
|
||||||
{
|
const arr2: any = [];
|
||||||
title: "学员",
|
|
||||||
value: "学员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员",
|
|
||||||
value: "管理员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const arr2: Option[] = [
|
|
||||||
{
|
|
||||||
title: "学员",
|
|
||||||
value: "学员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员",
|
|
||||||
value: "管理员-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员日志",
|
|
||||||
value: "管理员日志-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "管理员角色",
|
|
||||||
value: "管理员角色-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "线上课",
|
|
||||||
value: "线上课-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "资源分类",
|
|
||||||
value: "资源分类-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "部门",
|
|
||||||
value: "部门-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "系统配置",
|
|
||||||
value: "系统配置-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "其它",
|
|
||||||
value: "其它-n",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
let actions = res.data.perm_action.action;
|
let actions = res.data.perm_action.action;
|
||||||
let permissions = res.data.perm_action.data;
|
let permissions = res.data.perm_action.data;
|
||||||
for (let i = 0; i < permissions.length; i++) {
|
for (let i = 0; i < permissions.length; i++) {
|
||||||
arr.map((item: any) => {
|
const key = arr.findIndex(
|
||||||
if (item.title === permissions[i].group_name) {
|
(it: any) => it.title === permissions[i].group_name
|
||||||
item.children.push({
|
);
|
||||||
title: permissions[i].name,
|
if (key >= 0) {
|
||||||
value: permissions[i].id,
|
arr[key].children.push({
|
||||||
});
|
title: permissions[i].name,
|
||||||
}
|
value: permissions[i].id,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
arr.push({
|
||||||
|
title: permissions[i].group_name,
|
||||||
|
value: permissions[i].group_name + "-n",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: permissions[i].name,
|
||||||
|
value: permissions[i].id,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (let j = 0; j < actions.length; j++) {
|
for (let j = 0; j < actions.length; j++) {
|
||||||
arr2.map((item: any) => {
|
const key = arr2.findIndex(
|
||||||
if (item.title === actions[j].group_name) {
|
(it: any) => it.title === actions[j].group_name
|
||||||
item.children.push({
|
);
|
||||||
title: actions[j].name,
|
if (key >= 0) {
|
||||||
value: actions[j].id,
|
arr2[key].children.push({
|
||||||
});
|
title: actions[j].name,
|
||||||
}
|
value: actions[j].id,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
arr2.push({
|
||||||
|
title: actions[j].group_name,
|
||||||
|
value: actions[j].group_name + "-n",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: actions[j].name,
|
||||||
|
value: actions[j].id,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setPermissions(arr);
|
setPermissions(arr);
|
||||||
setActions(arr2);
|
setActions(arr2);
|
||||||
|
@ -14,13 +14,14 @@ import {
|
|||||||
} from "antd";
|
} from "antd";
|
||||||
import { appConfig, system } from "../../../api/index";
|
import { appConfig, system } from "../../../api/index";
|
||||||
import { UploadImageButton } from "../../../compenents";
|
import { UploadImageButton } from "../../../compenents";
|
||||||
import { useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import type { TabsProps } from "antd";
|
import type { TabsProps } from "antd";
|
||||||
import type { CheckboxChangeEvent } from "antd/es/checkbox";
|
import type { CheckboxChangeEvent } from "antd/es/checkbox";
|
||||||
import {
|
import {
|
||||||
SystemConfigStoreInterface,
|
SystemConfigStoreInterface,
|
||||||
saveConfigAction,
|
saveConfigAction,
|
||||||
} from "../../../store/system/systemConfigSlice";
|
} from "../../../store/system/systemConfigSlice";
|
||||||
|
import logoIcon from "../../../assets/logo.png";
|
||||||
|
|
||||||
const SystemConfigPage = () => {
|
const SystemConfigPage = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -33,6 +34,9 @@ const SystemConfigPage = () => {
|
|||||||
const [nameChecked, setNameChecked] = useState(false);
|
const [nameChecked, setNameChecked] = useState(false);
|
||||||
const [emailChecked, setEmailChecked] = useState(false);
|
const [emailChecked, setEmailChecked] = useState(false);
|
||||||
const [idCardchecked, setIdCardChecked] = useState(false);
|
const [idCardchecked, setIdCardChecked] = useState(false);
|
||||||
|
const memberDefaultAvatar = useSelector(
|
||||||
|
(state: any) => state.systemConfig.value.memberDefaultAvatar
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDetail();
|
getDetail();
|
||||||
@ -52,6 +56,8 @@ const SystemConfigPage = () => {
|
|||||||
});
|
});
|
||||||
if (configData[i].key_value !== "") {
|
if (configData[i].key_value !== "") {
|
||||||
setLogo(configData[i].key_value);
|
setLogo(configData[i].key_value);
|
||||||
|
} else {
|
||||||
|
setLogo(logoIcon);
|
||||||
}
|
}
|
||||||
} else if (configData[i].key_name === "system.api_url") {
|
} else if (configData[i].key_name === "system.api_url") {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
@ -122,7 +128,11 @@ const SystemConfigPage = () => {
|
|||||||
"system.pc_index_footer_msg": configData[i].key_value,
|
"system.pc_index_footer_msg": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "member.default_avatar") {
|
} else if (configData[i].key_name === "member.default_avatar") {
|
||||||
setAvatar(configData[i].key_value);
|
if (configData[i].key_value !== "") {
|
||||||
|
setAvatar(configData[i].key_value);
|
||||||
|
} else {
|
||||||
|
setAvatar(memberDefaultAvatar);
|
||||||
|
}
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"member.default_avatar": configData[i].key_value,
|
"member.default_avatar": configData[i].key_value,
|
||||||
});
|
});
|
||||||
@ -170,10 +180,6 @@ const SystemConfigPage = () => {
|
|||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"ldap.base_dn": configData[i].key_value,
|
"ldap.base_dn": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "ldap.user_dn_prefix") {
|
|
||||||
form.setFieldsValue({
|
|
||||||
"ldap.user_dn_prefix": configData[i].key_value,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -259,6 +265,8 @@ const SystemConfigPage = () => {
|
|||||||
systemH5Url: res.data["system.h5_url"],
|
systemH5Url: res.data["system.h5_url"],
|
||||||
memberDefaultAvatar: res.data["member.default_avatar"],
|
memberDefaultAvatar: res.data["member.default_avatar"],
|
||||||
courseDefaultThumbs: res.data["default.course_thumbs"],
|
courseDefaultThumbs: res.data["default.course_thumbs"],
|
||||||
|
departments: res.data["departments"],
|
||||||
|
resourceCategories: res.data["resource_categories"],
|
||||||
};
|
};
|
||||||
dispatch(saveConfigAction(data));
|
dispatch(saveConfigAction(data));
|
||||||
});
|
});
|
||||||
@ -294,9 +302,9 @@ const SystemConfigPage = () => {
|
|||||||
{logo && (
|
{logo && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="网站Logo"
|
label="PC学员端Logo"
|
||||||
name="system.logo"
|
name="system.logo"
|
||||||
labelCol={{ style: { marginTop: 4, marginLeft: 54 } }}
|
labelCol={{ style: { marginTop: 4, marginLeft: 24 } }}
|
||||||
>
|
>
|
||||||
<div className="d-flex">
|
<div className="d-flex">
|
||||||
<Image preview={false} height={40} src={logo} />
|
<Image preview={false} height={40} src={logo} />
|
||||||
@ -318,7 +326,7 @@ const SystemConfigPage = () => {
|
|||||||
{!logo && (
|
{!logo && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="网站Logo"
|
label="PC学员端Logo"
|
||||||
name="system.logo"
|
name="system.logo"
|
||||||
>
|
>
|
||||||
<div className="d-flex">
|
<div className="d-flex">
|
||||||
@ -346,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
|
||||||
@ -459,13 +467,6 @@ const SystemConfigPage = () => {
|
|||||||
>
|
>
|
||||||
邮箱
|
邮箱
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox
|
|
||||||
checked={idCardchecked}
|
|
||||||
className="ml-24"
|
|
||||||
onChange={addIdCard}
|
|
||||||
>
|
|
||||||
身份证号
|
|
||||||
</Checkbox>
|
|
||||||
</Space>
|
</Space>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@ -729,7 +730,7 @@ const SystemConfigPage = () => {
|
|||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className="helper-text">
|
<div className="helper-text">
|
||||||
(LDAP的对外服务地址。例如:ldap.example.com)
|
(LDAP的对外服务地址。例如:ldap://ldap.example.com:389)
|
||||||
</div>
|
</div>
|
||||||
</Space>
|
</Space>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -763,21 +764,7 @@ const SystemConfigPage = () => {
|
|||||||
placeholder="请填写基本DN"
|
placeholder="请填写基本DN"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className="helper-text">(从LDAP根节点搜索用户)</div>
|
<div className="helper-text">(从此节点搜索用户)</div>
|
||||||
</Space>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item style={{ marginBottom: 30 }} label="附件用户DN">
|
|
||||||
<Space align="baseline" style={{ height: 32 }}>
|
|
||||||
<Form.Item name="ldap.user_dn_prefix">
|
|
||||||
<Input
|
|
||||||
style={{ width: 274 }}
|
|
||||||
allowClear
|
|
||||||
placeholder="请填写基本DN"
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<div className="helper-text">
|
|
||||||
(搜索用户时,基于基础DN的搜索范围限制)
|
|
||||||
</div>
|
|
||||||
</Space>
|
</Space>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
4
src/playedu.d.ts
vendored
4
src/playedu.d.ts
vendored
@ -1,4 +1,8 @@
|
|||||||
declare global {
|
declare global {
|
||||||
|
interface KeyNumberObject {
|
||||||
|
[key: number]: number;
|
||||||
|
}
|
||||||
|
|
||||||
interface FileItem {
|
interface FileItem {
|
||||||
id: string; //上传文件的唯一id
|
id: string; //上传文件的唯一id
|
||||||
file: File; //上传的文件资源
|
file: 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;
|
|
@ -9,21 +9,32 @@ type SystemConfigStoreInterface = {
|
|||||||
systemName?: string;
|
systemName?: string;
|
||||||
memberDefaultAvatar?: string;
|
memberDefaultAvatar?: string;
|
||||||
courseDefaultThumbs?: string[];
|
courseDefaultThumbs?: string[];
|
||||||
|
departments?: any;
|
||||||
|
resourceCategories?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let defaultValue: SystemConfigStoreInterface = {};
|
||||||
|
|
||||||
const systemConfigSlice = createSlice({
|
const systemConfigSlice = createSlice({
|
||||||
name: "systemConfig",
|
name: "systemConfig",
|
||||||
initialState: {
|
initialState: {
|
||||||
value: {},
|
value: defaultValue,
|
||||||
},
|
},
|
||||||
reducers: {
|
reducers: {
|
||||||
saveConfigAction(stage, e) {
|
saveConfigAction(stage, e) {
|
||||||
stage.value = e.payload;
|
stage.value = e.payload;
|
||||||
},
|
},
|
||||||
|
saveDepartmentsAction(stage, e) {
|
||||||
|
stage.value.departments = e.payload;
|
||||||
|
},
|
||||||
|
saveCategoriesAction(stage, e) {
|
||||||
|
stage.value.resourceCategories = e.payload;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default systemConfigSlice.reducer;
|
export default systemConfigSlice.reducer;
|
||||||
export const { saveConfigAction } = systemConfigSlice.actions;
|
export const { saveConfigAction, saveDepartmentsAction, saveCategoriesAction } =
|
||||||
|
systemConfigSlice.actions;
|
||||||
|
|
||||||
export type { SystemConfigStoreInterface };
|
export type { SystemConfigStoreInterface };
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createSlice } from "@reduxjs/toolkit";
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
import { message } from "antd";
|
||||||
|
|
||||||
type UserInterface = {
|
type UserInterface = {
|
||||||
id: number;
|
id: number;
|
||||||
@ -10,12 +11,16 @@ type UserStoreInterface = {
|
|||||||
user: UserInterface | null;
|
user: UserInterface | null;
|
||||||
isLogin: boolean;
|
isLogin: boolean;
|
||||||
permissions: string[];
|
permissions: string[];
|
||||||
|
uploadStatus: boolean;
|
||||||
|
uploadCateIds: number[];
|
||||||
};
|
};
|
||||||
|
|
||||||
let defaultValue: UserStoreInterface = {
|
let defaultValue: UserStoreInterface = {
|
||||||
user: null,
|
user: null,
|
||||||
isLogin: false,
|
isLogin: false,
|
||||||
permissions: [],
|
permissions: [],
|
||||||
|
uploadStatus: false,
|
||||||
|
uploadCateIds: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const loginUserSlice = createSlice({
|
const loginUserSlice = createSlice({
|
||||||
@ -33,10 +38,21 @@ const loginUserSlice = createSlice({
|
|||||||
stage.value.user = null;
|
stage.value.user = null;
|
||||||
stage.value.isLogin = false;
|
stage.value.isLogin = false;
|
||||||
},
|
},
|
||||||
|
uploadAction(stage, e) {
|
||||||
|
if (
|
||||||
|
stage.value.uploadStatus === true &&
|
||||||
|
e.payload.uploadStatus === true
|
||||||
|
) {
|
||||||
|
message.error("请点击右下角悬浮窗");
|
||||||
|
}
|
||||||
|
stage.value.uploadStatus = e.payload.uploadStatus;
|
||||||
|
stage.value.uploadCateIds = e.payload.uploadCateIds;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default loginUserSlice.reducer;
|
export default loginUserSlice.reducer;
|
||||||
export const { loginAction, logoutAction } = loginUserSlice.actions;
|
export const { loginAction, logoutAction, uploadAction } =
|
||||||
|
loginUserSlice.actions;
|
||||||
|
|
||||||
export type { UserStoreInterface };
|
export type { UserStoreInterface };
|
||||||
|
@ -24,22 +24,12 @@ export function timeFormat(dateStr: number) {
|
|||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
var d = moment.duration(dateStr, "seconds");
|
var d = moment.duration(dateStr, "seconds");
|
||||||
let value =
|
let value = d.hours() + "时" + d.minutes() + "分" + d.seconds() + "秒";
|
||||||
Math.floor(d.asDays()) +
|
|
||||||
"天" +
|
|
||||||
d.hours() +
|
|
||||||
"时" +
|
|
||||||
d.minutes() +
|
|
||||||
"分" +
|
|
||||||
d.seconds() +
|
|
||||||
"秒";
|
|
||||||
|
|
||||||
if (Math.floor(d.asDays()) === 0) {
|
if (d.hours() === 0) {
|
||||||
if (d.hours() === 0) {
|
value = d.minutes() + "分" + d.seconds() + "秒";
|
||||||
value = d.minutes() + "分" + d.seconds() + "秒";
|
} else {
|
||||||
} else {
|
value = d.hours() + "时" + d.minutes() + "分" + d.seconds() + "秒";
|
||||||
value = d.hours() + "时" + d.minutes() + "分" + d.seconds() + "秒";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user