Commit 4c0df188 authored by wuhao's avatar wuhao 🎯

asder

parent 7e294f1b
Pipeline #3506 passed with stages
in 5 minutes and 16 seconds
...@@ -31,6 +31,7 @@ export async function getInitialState() { ...@@ -31,6 +31,7 @@ export async function getInitialState() {
activeUserIdList: [], activeUserIdList: [],
vs: false, vs: false,
nav: 280, nav: 280,
menuNum:{},
message: { message: {
open: false, open: false,
snackbar: { snackbar: {
......
...@@ -3,8 +3,9 @@ import { useState } from "react"; ...@@ -3,8 +3,9 @@ import { useState } from "react";
import DraggableDialog from "../DraggableDialog"; import DraggableDialog from "../DraggableDialog";
import InitForm from "../InitForm"; import InitForm from "../InitForm";
function ImportExcel({importurl, downloadurl, refresh}) { function ImportExcel({ importurl, downloadurl, refresh }) {
const [dialogprops, setdialogprops] = useState(); const [dialogprops, setdialogprops] = useState();
const [errorList, seterrorList] = useState([]);
return ( return (
<> <>
...@@ -42,11 +43,21 @@ function ImportExcel({importurl, downloadurl, refresh}) { ...@@ -42,11 +43,21 @@ function ImportExcel({importurl, downloadurl, refresh}) {
colProps: { colProps: {
span: 24, span: 24,
}, },
fieldProps: {
showUploadList: false,
},
}, },
]} ]}
onValuesChange={(vals) => { onValuesChange={(vals) => {
if(Object.values(vals)?.[0]?.url){ seterrorList([]);
refresh?.() if (Object.values(vals)?.[0]?.length === 0) {
refresh?.();
setdialogprops((s) => ({
...s,
open: false,
}));
} else {
seterrorList(Object.values(vals)?.[0]);
} }
}} }}
></InitForm> ></InitForm>
...@@ -65,14 +76,25 @@ function ImportExcel({importurl, downloadurl, refresh}) { ...@@ -65,14 +76,25 @@ function ImportExcel({importurl, downloadurl, refresh}) {
<Button <Button
variant="text" variant="text"
onClick={() => { onClick={() => {
console.log(downloadurl);
window.open(DOWNLOAD_URL + downloadurl); window.open(DOWNLOAD_URL + downloadurl);
}} }}
> >
模板文件 模板文件
</Button> </Button>
</Stack> </Stack>
{errorList?.length > 0 && <b style={{ marginTop: 12 }}>错误信息</b>}
{errorList?.map?.((it) => {
return (
<Stack
direction={"row"}
style={{ color: "#ff4800", margin: "6px 0" }}
>
<span>{it?.name}</span>
<span style={{ flex: 1 }}>{it?.error}</span>
</Stack>
);
})}
</Stack> </Stack>
</DraggableDialog> </DraggableDialog>
</Stack> </Stack>
......
...@@ -19,6 +19,7 @@ function OnlineChat({ trainId }) { ...@@ -19,6 +19,7 @@ function OnlineChat({ trainId }) {
if (e.key === "Enter") { if (e.key === "Enter") {
if (e.ctrlKey) { if (e.ctrlKey) {
e.target.value += "\n"; e.target.value += "\n";
setvalue((s) => (s += "\n"));
} else { } else {
e.preventDefault(); e.preventDefault();
doFetch({ doFetch({
...@@ -82,7 +83,13 @@ function OnlineChat({ trainId }) { ...@@ -82,7 +83,13 @@ function OnlineChat({ trainId }) {
{difftime(dayjs(), dayjs(it?.createTime))} {difftime(dayjs(), dayjs(it?.createTime))}
</span> </span>
</Box> </Box>
<Box mt={0.8} p={2} bgcolor={"#c8facd"} borderRadius={2}> <Box
mt={0.8}
p={2}
bgcolor={"#c8facd"}
borderRadius={2}
whiteSpace={"pre-wrap"}
>
{it?.messageContent} {it?.messageContent}
</Box> </Box>
</Stack> </Stack>
...@@ -108,7 +115,13 @@ function OnlineChat({ trainId }) { ...@@ -108,7 +115,13 @@ function OnlineChat({ trainId }) {
{difftime(dayjs(), dayjs(it?.createTime))} {difftime(dayjs(), dayjs(it?.createTime))}
</span> </span>
</Box> </Box>
<Box mt={0.8} p={2} bgcolor={"#f4f6f7"} borderRadius={2}> <Box
mt={0.8}
p={2}
bgcolor={"#f4f6f7"}
borderRadius={2}
whiteSpace={"pre-wrap"}
>
{it?.messageContent} {it?.messageContent}
</Box> </Box>
</Stack> </Stack>
...@@ -119,7 +132,7 @@ function OnlineChat({ trainId }) { ...@@ -119,7 +132,7 @@ function OnlineChat({ trainId }) {
</Box> </Box>
<Box height={68} bgcolor={"#e0e0e0"} padding={1} borderRadius={2}> <Box height={68} bgcolor={"#e0e0e0"} padding={1} borderRadius={2}>
<Input.TextArea <Input.TextArea
placeholder="请输入" placeholder="请输入(按回车键发送,按ctrl+回车键换行)"
bordered={false} bordered={false}
style={{ height: "100%", resize: "none", margin: "0 -8px" }} style={{ height: "100%", resize: "none", margin: "0 -8px" }}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
......
This diff is collapsed.
import { Outlet } from "@umijs/max"; import { Outlet, useModel } from "@umijs/max";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
// @mui // @mui
import { styled } from "@mui/material/styles"; import { styled } from "@mui/material/styles";
...@@ -37,15 +37,21 @@ const Main = styled("div")(({ theme }) => ({ ...@@ -37,15 +37,21 @@ const Main = styled("div")(({ theme }) => ({
export default function DashboardLayout() { export default function DashboardLayout() {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const {
initialState: { menuNum },
setInitialState,
} = useModel("@@initialState");
useEffect(() => { useEffect(() => {
socket.connect(); socket.connect();
socket.on("message", (data) => { socket.on("message", (data) => {
console.log("===================================="); setInitialState((s) => ({
console.log(data); ...s,
console.log("===================================="); menuNum: {
if (data?.wsMsgModel === "") { ...s.menuNum,
} ...data?.param,
},
}));
}); });
return () => { return () => {
......
...@@ -74,6 +74,11 @@ const navConfig = [ ...@@ -74,6 +74,11 @@ const navConfig = [
path: "/work/organization", path: "/work/organization",
icon: icon("ic_org"), icon: icon("ic_org"),
}, },
{
title: "班级管理",
path: "/work/class",
icon: icon("ic_class"),
},
{ {
title: "教师管理", title: "教师管理",
path: "/work/teacher", path: "/work/teacher",
...@@ -86,11 +91,7 @@ const navConfig = [ ...@@ -86,11 +91,7 @@ const navConfig = [
icon: icon("ic_student"), icon: icon("ic_student"),
key:"MANAGE_STUDENT" key:"MANAGE_STUDENT"
}, },
{
title: "班级管理",
path: "/work/class",
icon: icon("ic_class"),
},
{ {
title: "课程管理", title: "课程管理",
path: "/work/lessons", path: "/work/lessons",
......
...@@ -28,7 +28,7 @@ export default function Nav({ openNav, onCloseNav }) { ...@@ -28,7 +28,7 @@ export default function Nav({ openNav, onCloseNav }) {
const [navConfigs, setNavConfigs] = useState(navConfig); const [navConfigs, setNavConfigs] = useState(navConfig);
const { const {
initialState: { nav, currentUser }, initialState: { nav, currentUser, menuNum},
setInitialState, setInitialState,
} = useModel("@@initialState"); } = useModel("@@initialState");
...@@ -58,7 +58,27 @@ export default function Nav({ openNav, onCloseNav }) { ...@@ -58,7 +58,27 @@ export default function Nav({ openNav, onCloseNav }) {
return { return {
...it, ...it,
children: it?.children?.map((item, i) => { children: it?.children?.map((item, i) => {
const info = data[item?.key ?? ""] const info = menuNum?.[item?.key ?? ""]?
{
info: (
<div
style={{
marginRight: 12,
backgroundColor: "#ff4800",
width: 20,
height: 20,
textAlign: "center",
lineHeight: "20px",
color: "#fff",
borderRadius: 12,
fontSize: 12,
}}
>
{menuNum[item?.key ?? ""]}
</div>
),
}
:data[item?.key ?? ""]
? { ? {
info: ( info: (
<div <div
...@@ -100,7 +120,7 @@ export default function Nav({ openNav, onCloseNav }) { ...@@ -100,7 +120,7 @@ export default function Nav({ openNav, onCloseNav }) {
}); });
} }
}); });
}, [data, currentUser?.type]); }, [data, currentUser?.type,menuNum]);
useEffect(() => { useEffect(() => {
if (openNav) { if (openNav) {
......
import DraggableDialog from "@/components/DraggableDialog"; import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton"; import PremButton from "@/components/PremButton";
import ShopProductLoadingCard from "@/components/ProductCard/loading"; import ShopProductLoadingCard from "@/components/ProductCard/loading";
...@@ -435,7 +434,6 @@ function Lessons() { ...@@ -435,7 +434,6 @@ function Lessons() {
})); }));
}} }}
></Input> ></Input>
<ImportExcel></ImportExcel>
<PremButton <PremButton
btn={{ btn={{
variant: "contained", variant: "contained",
......
import AutoTable from "@/components/AutoTable"; import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog"; import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton"; import PremButton from "@/components/PremButton";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
...@@ -150,7 +149,6 @@ function Class() { ...@@ -150,7 +149,6 @@ function Class() {
> >
<Typography variant="h5">班级管理</Typography> <Typography variant="h5">班级管理</Typography>
<Stack spacing={2} direction="row"> <Stack spacing={2} direction="row">
<ImportExcel></ImportExcel>
<PremButton <PremButton
btn={{ btn={{
variant: "contained", variant: "contained",
......
...@@ -292,11 +292,7 @@ function Dolessons() { ...@@ -292,11 +292,7 @@ function Dolessons() {
}, },
{ {
key: "2", key: "2",
label: ( label: '查看实验',
<Badge count={lessonDetail?.experimentNum} size="small" offset={[6, 0]}>
查看实验
</Badge>
),
children: ( children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable <AutoTable
......
...@@ -281,11 +281,7 @@ function Dolessons() { ...@@ -281,11 +281,7 @@ function Dolessons() {
}, },
{ {
key: "2", key: "2",
label: ( label: '查看实验',
<Badge count={lessonDetail?.experimentNum} size="small" offset={[6, 0]}>
查看实验
</Badge>
),
children: ( children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable <AutoTable
......
...@@ -2,22 +2,21 @@ import AutoTable from "@/components/AutoTable"; ...@@ -2,22 +2,21 @@ import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog"; import DraggableDialog from "@/components/DraggableDialog";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import Limit from "@/components/Limit"; import Limit from "@/components/Limit";
import OnlineChat from "@/components/OnlineChat";
import PremButton from "@/components/PremButton"; import PremButton from "@/components/PremButton";
import TreeRender from "@/components/TreeRender/sxtree"; import TreeRender from "@/components/TreeRender/sxtree";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import { Box, Container, Grid, Link, Stack, Typography } from "@mui/material"; import { Box, Container, Grid, Link, Stack, Typography } from "@mui/material";
import { useParams } from "@umijs/max"; import { useParams } from "@umijs/max";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { Badge, message, Tabs } from "antd"; import { message, Tabs } from "antd";
import { useEffect, useMemo, useRef, useState } from "react"; import { useEffect, useMemo, useRef, useState } from "react";
import { history } from "umi"; import { history } from "umi";
import OnlineChat from "@/components/OnlineChat";
import "./index.less"; import "./index.less";
function Dolessons() { function Dolessons() {
const params = useParams(); const params = useParams();
const formRef = useRef(), const cksyactionRef = useRef(),
cksyactionRef = useRef(),
cjwtactionRef = useRef(); cjwtactionRef = useRef();
const [lessonDetail, setlessonDetail] = useState(null), const [lessonDetail, setlessonDetail] = useState(null),
[courseContent, setCourseContent] = useState({}), [courseContent, setCourseContent] = useState({}),
...@@ -28,7 +27,7 @@ function Dolessons() { ...@@ -28,7 +27,7 @@ function Dolessons() {
const { runAsync, loading } = useRequest(doFetch, { const { runAsync, loading } = useRequest(doFetch, {
manual: true, manual: true,
onSuccess: (res, parames) => { onSuccess: (res) => {
if (res?.code == "0000") { if (res?.code == "0000") {
handleClose(); handleClose();
message.success("操作成功"); message.success("操作成功");
...@@ -67,7 +66,7 @@ function Dolessons() { ...@@ -67,7 +66,7 @@ function Dolessons() {
} }
}; };
const edit = (text, row, _, action) => { const edit = (text, row, _) => {
return ( return (
<PremButton <PremButton
btn={{ btn={{
...@@ -75,7 +74,7 @@ function Dolessons() { ...@@ -75,7 +74,7 @@ function Dolessons() {
disabled: ifs, disabled: ifs,
variant: "text", variant: "text",
onClick: () => { onClick: () => {
setDrawer((v) => ({ setDrawer(() => ({
open: true, open: true,
defaultFormValue: { ...row }, defaultFormValue: { ...row },
title: "编辑", title: "编辑",
...@@ -88,7 +87,7 @@ function Dolessons() { ...@@ -88,7 +87,7 @@ function Dolessons() {
); );
}; };
const remove = (text, row, _, action) => { const remove = (text, row, _) => {
return ( return (
<PremButton <PremButton
pop={{ pop={{
...@@ -113,31 +112,6 @@ function Dolessons() { ...@@ -113,31 +112,6 @@ function Dolessons() {
</PremButton> </PremButton>
); );
}; };
const removeq = (text, row, _, action) => {
return (
<PremButton
pop={{
disabled: ifs,
title: "是否删除该实验?",
okText: "确认",
cancelText: "取消",
onConfirm: async () => {
await runAsync({
url: "/busTrainQuestion/delete",
params: { id: row?.id },
});
},
}}
btn={{
size: "small",
color: "error",
disabled: ifs,
}}
>
删除
</PremButton>
);
};
const questionColumns = useMemo(() => { const questionColumns = useMemo(() => {
let col = [ let col = [
...@@ -247,7 +221,13 @@ function Dolessons() { ...@@ -247,7 +221,13 @@ function Dolessons() {
</Grid> </Grid>
<Grid item flex={1}> <Grid item flex={1}>
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2} padding={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2} padding={2}>
<Limit content={courseContent?.trainContent ?? '<span style="font-weight:bloder;color:#1890ff">-- 请选择左侧小节 </span>'}></Limit> <Limit
content={
courseContent?.parentId !== "0"
? courseContent?.trainContent
: '<span style="font-weight:bloder;color:#1890ff">-- 请选择左侧小节 </span>'
}
></Limit>
</Box> </Box>
</Grid> </Grid>
</Grid> </Grid>
...@@ -255,11 +235,7 @@ function Dolessons() { ...@@ -255,11 +235,7 @@ function Dolessons() {
}, },
{ {
key: "2", key: "2",
label: ( label: "查看实验",
<Badge count={lessonDetail?.experimentNum} size="small" offset={[6, 0]}>
查看实验
</Badge>
),
children: ( children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable <AutoTable
...@@ -293,9 +269,7 @@ function Dolessons() { ...@@ -293,9 +269,7 @@ function Dolessons() {
<AutoTable <AutoTable
rerendered={false} rerendered={false}
actionRef={cjwtactionRef} actionRef={cjwtactionRef}
columns={[ columns={[...questionColumns]}
...questionColumns,
]}
path="/studentTrain/questionPage" path="/studentTrain/questionPage"
extraparams={{ extraparams={{
id: params?.id, id: params?.id,
...@@ -311,17 +285,6 @@ function Dolessons() { ...@@ -311,17 +285,6 @@ function Dolessons() {
}, },
]; ];
const addHandel = (val) => {
if (active === "1") {
// 预览
} else if (active === "2") {
// 添加实验
setDrawer({ open: true, title: "添加实验" });
} else {
// 添加问题
setDrawer({ open: true, title: "添加问题" });
}
};
const handleClose = () => { const handleClose = () => {
setDrawer((s) => ({ setDrawer((s) => ({
...@@ -403,7 +366,7 @@ function Dolessons() { ...@@ -403,7 +366,7 @@ function Dolessons() {
}, },
}, },
]} ]}
onFinish={(val, extra) => { onFinish={(val) => {
let postdata; let postdata;
switch (drawer?.title) { switch (drawer?.title) {
case "添加实验": case "添加实验":
...@@ -456,7 +419,7 @@ function Dolessons() { ...@@ -456,7 +419,7 @@ function Dolessons() {
valueType: "textarea", valueType: "textarea",
}, },
]} ]}
onFinish={(val, extra) => { onFinish={(val) => {
let postdata; let postdata;
switch (drawer?.title) { switch (drawer?.title) {
case "添加问题": case "添加问题":
......
import DraggableDialog from "@/components/DraggableDialog"; import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton"; import PremButton from "@/components/PremButton";
import ShopProductCard from "@/components/ProductCard"; import ShopProductCard from "@/components/ProductCard";
import ShopProductLoadingCard from "@/components/ProductCard/loading"; import ShopProductLoadingCard from "@/components/ProductCard/loading";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import generateColor from "@/utils/pickColor";
import PRODUCTS from "@/_mock/products"; import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material"; import { Box, Container, Grid, Stack, Typography } from "@mui/material";
import Checkbox from "@mui/material/Checkbox"; import Checkbox from "@mui/material/Checkbox";
...@@ -325,7 +323,6 @@ function Lessons() { ...@@ -325,7 +323,6 @@ function Lessons() {
}} }}
></Input> ></Input>
<ImportExcel></ImportExcel>
<PremButton <PremButton
btn={{ btn={{
......
import AutoTable from "@/components/AutoTable"; import AutoTable from "@/components/AutoTable";
import ImportExcel from "@/components/ImportExcel"; import { Box, Container, Typography } from "@mui/material";
import PremButton from "@/components/PremButton";
import { Box, Container, Stack, Typography } from "@mui/material";
import * as Antd from "antd"; import * as Antd from "antd";
import { useMemo, useRef } from "react"; import { useMemo, useRef } from "react";
import "./index.less"; import "./index.less";
...@@ -53,25 +51,7 @@ function Class() { ...@@ -53,25 +51,7 @@ function Class() {
sx={{ mb: 2.5 }} sx={{ mb: 2.5 }}
mt={0} mt={0}
> >
<Typography variant="h5">模型管理</Typography> <Typography variant="h5">平台日志</Typography>
<Stack spacing={2} direction="row">
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
onClick: (e) => {
e.stopPropagation();
setdialogprops({
open: true,
defaultFormValue: {},
title: "新增模型",
});
},
}}
>
新增模型
</PremButton>
</Stack>
</Box> </Box>
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
......
import AutoTable from "@/components/AutoTable"; import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog"; import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton"; import PremButton from "@/components/PremButton";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
...@@ -153,7 +152,6 @@ function Class() { ...@@ -153,7 +152,6 @@ function Class() {
> >
<Typography variant="h5">模型管理</Typography> <Typography variant="h5">模型管理</Typography>
<Stack spacing={2} direction="row"> <Stack spacing={2} direction="row">
<ImportExcel></ImportExcel>
<PremButton <PremButton
btn={{ btn={{
variant: "contained", variant: "contained",
......
import DraggableDialog from "@/components/DraggableDialog"; import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import ShopProductLoadingCard from "@/components/ProductCard/loading"; import ShopProductLoadingCard from "@/components/ProductCard/loading";
import ShopProductCard from "@/components/ProductCard/stucard"; import ShopProductCard from "@/components/ProductCard/stucard";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
...@@ -368,22 +366,6 @@ function Lessons() { ...@@ -368,22 +366,6 @@ function Lessons() {
})); }));
}} }}
></Input> ></Input>
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
onClick: (e) => {
e.stopPropagation();
setdialogprops({
open: true,
defaultFormValue: {},
title: "新增实训",
});
},
}}
>
新增实训
</PremButton>
</Stack> </Stack>
</Box> </Box>
......
...@@ -123,7 +123,7 @@ const Head = ({ defaultImg, dofetchUserInfo }) => { ...@@ -123,7 +123,7 @@ const Head = ({ defaultImg, dofetchUserInfo }) => {
backgroundColor: "rgba(0,0,0,0.6)", backgroundColor: "rgba(0,0,0,0.6)",
}} }}
> >
<img src={src} alt="" style={{ borderRadius: 112,width:"100%",height:"100%" }} /> <img src={src} alt="" style={{ borderRadius: 112,width:"100%",height:"100%",objectFit:"cover" }} />
</div> </div>
)} )}
<div <div
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment