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() {
activeUserIdList: [],
vs: false,
nav: 280,
menuNum:{},
message: {
open: false,
snackbar: {
......
......@@ -3,8 +3,9 @@ import { useState } from "react";
import DraggableDialog from "../DraggableDialog";
import InitForm from "../InitForm";
function ImportExcel({importurl, downloadurl, refresh}) {
function ImportExcel({ importurl, downloadurl, refresh }) {
const [dialogprops, setdialogprops] = useState();
const [errorList, seterrorList] = useState([]);
return (
<>
......@@ -42,11 +43,21 @@ function ImportExcel({importurl, downloadurl, refresh}) {
colProps: {
span: 24,
},
fieldProps: {
showUploadList: false,
},
},
]}
onValuesChange={(vals) => {
if(Object.values(vals)?.[0]?.url){
refresh?.()
seterrorList([]);
if (Object.values(vals)?.[0]?.length === 0) {
refresh?.();
setdialogprops((s) => ({
...s,
open: false,
}));
} else {
seterrorList(Object.values(vals)?.[0]);
}
}}
></InitForm>
......@@ -65,14 +76,25 @@ function ImportExcel({importurl, downloadurl, refresh}) {
<Button
variant="text"
onClick={() => {
console.log(downloadurl);
window.open(DOWNLOAD_URL + downloadurl);
}}
>
模板文件
</Button>
</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>
</DraggableDialog>
</Stack>
......
......@@ -19,6 +19,7 @@ function OnlineChat({ trainId }) {
if (e.key === "Enter") {
if (e.ctrlKey) {
e.target.value += "\n";
setvalue((s) => (s += "\n"));
} else {
e.preventDefault();
doFetch({
......@@ -82,7 +83,13 @@ function OnlineChat({ trainId }) {
{difftime(dayjs(), dayjs(it?.createTime))}
</span>
</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}
</Box>
</Stack>
......@@ -108,7 +115,13 @@ function OnlineChat({ trainId }) {
{difftime(dayjs(), dayjs(it?.createTime))}
</span>
</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}
</Box>
</Stack>
......@@ -119,7 +132,7 @@ function OnlineChat({ trainId }) {
</Box>
<Box height={68} bgcolor={"#e0e0e0"} padding={1} borderRadius={2}>
<Input.TextArea
placeholder="请输入"
placeholder="请输入(按回车键发送,按ctrl+回车键换行)"
bordered={false}
style={{ height: "100%", resize: "none", margin: "0 -8px" }}
onKeyDown={handleKeyDown}
......
This diff is collapsed.
import { Outlet } from "@umijs/max";
import { Outlet, useModel } from "@umijs/max";
import { useEffect, useState } from "react";
// @mui
import { styled } from "@mui/material/styles";
......@@ -37,15 +37,21 @@ const Main = styled("div")(({ theme }) => ({
export default function DashboardLayout() {
const [open, setOpen] = useState(false);
const {
initialState: { menuNum },
setInitialState,
} = useModel("@@initialState");
useEffect(() => {
socket.connect();
socket.on("message", (data) => {
console.log("====================================");
console.log(data);
console.log("====================================");
if (data?.wsMsgModel === "") {
}
setInitialState((s) => ({
...s,
menuNum: {
...s.menuNum,
...data?.param,
},
}));
});
return () => {
......
......@@ -74,6 +74,11 @@ const navConfig = [
path: "/work/organization",
icon: icon("ic_org"),
},
{
title: "班级管理",
path: "/work/class",
icon: icon("ic_class"),
},
{
title: "教师管理",
path: "/work/teacher",
......@@ -86,11 +91,7 @@ const navConfig = [
icon: icon("ic_student"),
key:"MANAGE_STUDENT"
},
{
title: "班级管理",
path: "/work/class",
icon: icon("ic_class"),
},
{
title: "课程管理",
path: "/work/lessons",
......
......@@ -28,7 +28,7 @@ export default function Nav({ openNav, onCloseNav }) {
const [navConfigs, setNavConfigs] = useState(navConfig);
const {
initialState: { nav, currentUser },
initialState: { nav, currentUser, menuNum},
setInitialState,
} = useModel("@@initialState");
......@@ -58,7 +58,27 @@ export default function Nav({ openNav, onCloseNav }) {
return {
...it,
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: (
<div
......@@ -100,7 +120,7 @@ export default function Nav({ openNav, onCloseNav }) {
});
}
});
}, [data, currentUser?.type]);
}, [data, currentUser?.type,menuNum]);
useEffect(() => {
if (openNav) {
......
import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import ShopProductLoadingCard from "@/components/ProductCard/loading";
......@@ -435,7 +434,6 @@ function Lessons() {
}));
}}
></Input>
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
......
import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import { doFetch } from "@/utils/doFetch";
......@@ -150,7 +149,6 @@ function Class() {
>
<Typography variant="h5">班级管理</Typography>
<Stack spacing={2} direction="row">
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
......
......@@ -292,11 +292,7 @@ function Dolessons() {
},
{
key: "2",
label: (
<Badge count={lessonDetail?.experimentNum} size="small" offset={[6, 0]}>
查看实验
</Badge>
),
label: '查看实验',
children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable
......
......@@ -281,11 +281,7 @@ function Dolessons() {
},
{
key: "2",
label: (
<Badge count={lessonDetail?.experimentNum} size="small" offset={[6, 0]}>
查看实验
</Badge>
),
label: '查看实验',
children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable
......
......@@ -2,22 +2,21 @@ import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog";
import InitForm from "@/components/InitForm";
import Limit from "@/components/Limit";
import OnlineChat from "@/components/OnlineChat";
import PremButton from "@/components/PremButton";
import TreeRender from "@/components/TreeRender/sxtree";
import { doFetch } from "@/utils/doFetch";
import { Box, Container, Grid, Link, Stack, Typography } from "@mui/material";
import { useParams } from "@umijs/max";
import { useRequest } from "ahooks";
import { Badge, message, Tabs } from "antd";
import { message, Tabs } from "antd";
import { useEffect, useMemo, useRef, useState } from "react";
import { history } from "umi";
import OnlineChat from "@/components/OnlineChat";
import "./index.less";
function Dolessons() {
const params = useParams();
const formRef = useRef(),
cksyactionRef = useRef(),
const cksyactionRef = useRef(),
cjwtactionRef = useRef();
const [lessonDetail, setlessonDetail] = useState(null),
[courseContent, setCourseContent] = useState({}),
......@@ -28,7 +27,7 @@ function Dolessons() {
const { runAsync, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, parames) => {
onSuccess: (res) => {
if (res?.code == "0000") {
handleClose();
message.success("操作成功");
......@@ -67,7 +66,7 @@ function Dolessons() {
}
};
const edit = (text, row, _, action) => {
const edit = (text, row, _) => {
return (
<PremButton
btn={{
......@@ -75,7 +74,7 @@ function Dolessons() {
disabled: ifs,
variant: "text",
onClick: () => {
setDrawer((v) => ({
setDrawer(() => ({
open: true,
defaultFormValue: { ...row },
title: "编辑",
......@@ -88,7 +87,7 @@ function Dolessons() {
);
};
const remove = (text, row, _, action) => {
const remove = (text, row, _) => {
return (
<PremButton
pop={{
......@@ -113,31 +112,6 @@ function Dolessons() {
</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(() => {
let col = [
......@@ -247,7 +221,13 @@ function Dolessons() {
</Grid>
<Grid item flex={1}>
<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>
</Grid>
</Grid>
......@@ -255,11 +235,7 @@ function Dolessons() {
},
{
key: "2",
label: (
<Badge count={lessonDetail?.experimentNum} size="small" offset={[6, 0]}>
查看实验
</Badge>
),
label: "查看实验",
children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable
......@@ -293,9 +269,7 @@ function Dolessons() {
<AutoTable
rerendered={false}
actionRef={cjwtactionRef}
columns={[
...questionColumns,
]}
columns={[...questionColumns]}
path="/studentTrain/questionPage"
extraparams={{
id: params?.id,
......@@ -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 = () => {
setDrawer((s) => ({
......@@ -403,7 +366,7 @@ function Dolessons() {
},
},
]}
onFinish={(val, extra) => {
onFinish={(val) => {
let postdata;
switch (drawer?.title) {
case "添加实验":
......@@ -456,7 +419,7 @@ function Dolessons() {
valueType: "textarea",
},
]}
onFinish={(val, extra) => {
onFinish={(val) => {
let postdata;
switch (drawer?.title) {
case "添加问题":
......
import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import ShopProductCard from "@/components/ProductCard";
import ShopProductLoadingCard from "@/components/ProductCard/loading";
import { doFetch } from "@/utils/doFetch";
import generateColor from "@/utils/pickColor";
import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material";
import Checkbox from "@mui/material/Checkbox";
......@@ -325,7 +323,6 @@ function Lessons() {
}}
></Input>
<ImportExcel></ImportExcel>
<PremButton
btn={{
......
import AutoTable from "@/components/AutoTable";
import ImportExcel from "@/components/ImportExcel";
import PremButton from "@/components/PremButton";
import { Box, Container, Stack, Typography } from "@mui/material";
import { Box, Container, Typography } from "@mui/material";
import * as Antd from "antd";
import { useMemo, useRef } from "react";
import "./index.less";
......@@ -53,25 +51,7 @@ function Class() {
sx={{ mb: 2.5 }}
mt={0}
>
<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>
<Typography variant="h5">平台日志</Typography>
</Box>
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
......
import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import { doFetch } from "@/utils/doFetch";
......@@ -153,7 +152,6 @@ function Class() {
>
<Typography variant="h5">模型管理</Typography>
<Stack spacing={2} direction="row">
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
......
import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import ShopProductLoadingCard from "@/components/ProductCard/loading";
import ShopProductCard from "@/components/ProductCard/stucard";
import { doFetch } from "@/utils/doFetch";
......@@ -368,22 +366,6 @@ function Lessons() {
}));
}}
></Input>
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
onClick: (e) => {
e.stopPropagation();
setdialogprops({
open: true,
defaultFormValue: {},
title: "新增实训",
});
},
}}
>
新增实训
</PremButton>
</Stack>
</Box>
......
......@@ -123,7 +123,7 @@ const Head = ({ defaultImg, dofetchUserInfo }) => {
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
......
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