Commit 9861674e authored by wuhao's avatar wuhao 🎯

asder

parent 4e33978b
Pipeline #4207 passed with stages
in 11 minutes and 58 seconds
...@@ -545,7 +545,7 @@ h4 { ...@@ -545,7 +545,7 @@ h4 {
border: none !important; border: none !important;
} }
.ant-tabs-ink-bar-animated { .ant-tabs-ink-bar-animated {
display: none !important; //display: none !important;
} }
.ant-tabs-tab-btn { .ant-tabs-tab-btn {
font-weight: bolder !important; font-weight: bolder !important;
......
function Welcome() { import { useModel,history } from "@umijs/max";
return <div className="center" style={{height:260,fontSize:26}}>欢迎使用</div>; import { useEffect, useState } from "react";
} // @mui
import { Box, ListItemIcon, Typography } from "@mui/material";
// mock
import { styled } from "@mui/material/styles";
// components
import navConfig from "@/layouts/dashboard/nav/config";
import { doFetch } from "@/utils/doFetch";
import { useRequest } from "ahooks";
import { Badge, Card, Divider } from "antd";
const StyledNavItemIcon = styled(ListItemIcon)({
width: 48,
height: 48,
color: "inherit",
display: "flex",
alignItems: "center",
justifyContent: "center",
color:"#448ee2"
});
export default function Welcome() {
const [navConfigs, setNavConfigs] = useState(navConfig);
const {
initialState: { nav, currentUser, menuNum },
setInitialState,
} = useModel("@@initialState");
export default Welcome; const { data } = useRequest(async () => {
let res = await doFetch({ url: "/system/message", params: {} });
let result = {};
res?.data?.dataList?.map((it) => {
result[it?.menu] = it?.count;
});
return result;
});
useEffect(() => {
if (!data) {
return;
}
setNavConfigs(() => {
let news = navConfig?.map((it) => {
return {
...it,
children: it?.children?.map((item) => {
const info =
menuNum?.[item?.key ?? ""] === 0
? {}
: 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
style={{
marginRight: 12,
backgroundColor: "#ff4800",
width: 20,
height: 20,
textAlign: "center",
lineHeight: "20px",
color: "#fff",
borderRadius: 12,
fontSize: 12,
}}
>
{data[item?.key]}
</div>
),
}
: {};
return {
...item,
...info,
};
}),
};
});
if (currentUser?.type == 1) {
return news?.filter((it) => {
return it?.title === "管理中心";
});
} else if (currentUser?.type == 2) {
return news?.filter((it) => {
return it?.title === "教学中心";
});
} else {
return news?.filter((it) => {
return it?.title === "学习中心";
});
}
});
}, [data, currentUser?.type, menuNum]);
console.log(navConfigs, currentUser);
return (
<Box p={2}>
<Typography component={"h1"} align="center" fontSize={24}>
你好<b style={{ fontSize: 24, padding: 8 }}>{currentUser?.name}</b>{" "}
欢迎使用
</Typography>
<Divider style={{marginTop:48}}></Divider>
<div style={{ display: "flex", gap: 16, justifyContent: "center",marginTop:60,flexWrap:"wrap" }}>
{navConfigs?.[0]?.children?.map?.((it) => {
return (
<Badge>
<Card hoverable className="center" style={{width:240}} onClick={()=>{
history.push(it?.path)
}}>
<div className="center" style={{ padding: "20px 0",gap:12 }}>
<StyledNavItemIcon>{it?.icon}</StyledNavItemIcon>
<Typography align="center" fontSize={18}>{it?.title}</Typography>
<div style={{ width: 20, height: 20}}>{it?.info}</div>
</div>
</Card>
</Badge>
);
})}
</div>
</Box>
);
}
...@@ -6,11 +6,8 @@ import ShopProductCard from "@/components/ProductCard/sxcard"; ...@@ -6,11 +6,8 @@ import ShopProductCard from "@/components/ProductCard/sxcard";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
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 FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { Empty, Input, message } from "antd"; import { Empty, Input, message, Tabs } from "antd";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
import "./index.less"; import "./index.less";
...@@ -21,7 +18,7 @@ function Lessons() { ...@@ -21,7 +18,7 @@ function Lessons() {
const [params, setparams] = useState({ const [params, setparams] = useState({
trainName: "", trainName: "",
status: null, status: null,
typeList: ["1", "2", "3", "4", "5"], type: null,
}); });
const handleClose = () => { const handleClose = () => {
...@@ -330,92 +327,41 @@ function Lessons() { ...@@ -330,92 +327,41 @@ function Lessons() {
> >
<Typography variant="h5">实训管理</Typography> <Typography variant="h5">实训管理</Typography>
<Stack spacing={2} direction="row"> <Stack spacing={2} direction="row">
<FormControlLabel <Tabs
control={ items={[
<Checkbox {
checked={params?.typeList?.length === 5} key: null,
indeterminate={ label: `全部`,
params?.typeList?.length > 0 && params?.typeList?.length < 5 },
} {
/> key: "1",
} label: `待发布`,
label="全部" },
onChange={(e) => { {
setparams((s) => { key: "2",
let news = []; label: `已发布`,
if (e.target.checked) { },
news = ["1", "2", "3", "4", "5"]; {
} key: "3",
return { label: `已发布(暂停)`,
...s, },
typeList: news, {
}; key: "4",
}); label: `已结束`,
}} },
/> ]}
<FormGroup activeKey={params?.type}
row onChange={(val) => {
value={params?.typeList ?? []} setparams((s) => ({
onChange={(e) => { ...s,
let val = e.target.value; type: val,
setparams((s) => { }));
let news = [...s?.typeList];
if (news.includes(val)) {
news = news.filter((it) => it !== val);
} else {
news = [...news, val];
}
return {
...s,
typeList: news,
};
});
}} }}
> ></Tabs>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("1")}
color={"warning"}
/>
}
label="待发布"
value={1}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("2")}
color={"info"}
/>
}
label="已发布"
value={2}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("3")}
color={"default"}
/>
}
label="已发布(暂停)"
value={3}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("4")}
color={"default"}
/>
}
label="已结束"
value={4}
/>
</FormGroup>
<Input <Input
placeholder="请输入课程名称" placeholder="请输入课程名称"
style={{ width: 200 }} style={{ width: 200, marginLeft: 24 }}
value={params?.trainName} value={params?.trainName}
onChange={(e) => { onChange={(e) => {
setparams((s) => ({ setparams((s) => ({
......
...@@ -10,7 +10,7 @@ import Checkbox from "@mui/material/Checkbox"; ...@@ -10,7 +10,7 @@ import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup"; import FormGroup from "@mui/material/FormGroup";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { Empty, Input, message } from "antd"; import { Empty, Input, message,Tabs } from "antd";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
import "./index.less"; import "./index.less";
...@@ -247,84 +247,38 @@ function Lessons() { ...@@ -247,84 +247,38 @@ function Lessons() {
> >
<Typography variant="h5">课程管理</Typography> <Typography variant="h5">课程管理</Typography>
<Stack spacing={2} direction="row" flex={1} justifyContent={"flex-end"}> <Stack spacing={2} direction="row" flex={1} justifyContent={"flex-end"}>
<FormControlLabel
control={ <Tabs
<Checkbox items={[
checked={params?.typeList?.length === 3} {
indeterminate={ key: null,
params?.typeList?.length > 0 && params?.typeList?.length < 3 label: `全部`,
} },
/> {
} key: "1",
label="全部" label: `待发布`,
onChange={(e) => { },
setparams((s) => { {
let news = []; key: "2",
if (e.target.checked) { label: `已发布`,
news = ["1", "2", "3"]; },
} {
return { key: "3",
...s, label: `已结束`,
typeList: news, },
}; ]}
}); activeKey={params?.type}
}} onChange={(val) => {
/> setparams((s) => ({
<FormGroup ...s,
row type: val,
value={params?.typeList ?? []} }));
onChange={(e) => {
let val = e.target.value;
setparams((s) => {
let news = [...s?.typeList];
if (news.includes(val)) {
news = news.filter((it) => it !== val);
} else {
news = [...news, val];
}
console.log(news);
return {
...s,
typeList: news,
};
});
}} }}
> ></Tabs>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("1")}
color={"warning"}
/>
}
label="待发布"
value={1}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("2")}
color={"info"}
/>
}
label="已发布"
value={2}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("3")}
color={"default"}
/>
}
label="已结束"
value={3}
/>
</FormGroup>
<Input <Input
placeholder="请输入课程名称" placeholder="请输入课程名称"
style={{ width: 200 }} style={{ width: 200, marginLeft: 24 }}
value={params?.courseName} value={params?.courseName}
onChange={(e) => { onChange={(e) => {
setparams((s) => ({ setparams((s) => ({
......
...@@ -9,11 +9,10 @@ import Checkbox from "@mui/material/Checkbox"; ...@@ -9,11 +9,10 @@ import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup"; import FormGroup from "@mui/material/FormGroup";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { Empty, Input, message } from "antd"; import { Empty, Input, message,Tabs } from "antd";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
import "./index.less"; import "./index.less";
function Lessons() { function Lessons() {
const [dialogprops, setdialogprops] = useState({ const [dialogprops, setdialogprops] = useState({
open: false, open: false,
...@@ -44,7 +43,6 @@ function Lessons() { ...@@ -44,7 +43,6 @@ function Lessons() {
const datalist = useRequest( const datalist = useRequest(
async () => { async () => {
let res = await doFetch({ url: "/studentTrain/queryTrainList", params }); let res = await doFetch({ url: "/studentTrain/queryTrainList", params });
return res?.data?.dataList; return res?.data?.dataList;
}, },
...@@ -55,7 +53,6 @@ function Lessons() { ...@@ -55,7 +53,6 @@ function Lessons() {
); );
const edit = (row) => { const edit = (row) => {
setdialogprops({ setdialogprops({
open: true, open: true,
defaultFormValue: { ...row }, defaultFormValue: { ...row },
...@@ -262,92 +259,41 @@ function Lessons() { ...@@ -262,92 +259,41 @@ function Lessons() {
> >
<Typography variant="h5">我的实训</Typography> <Typography variant="h5">我的实训</Typography>
<Stack spacing={2} direction="row"> <Stack spacing={2} direction="row">
<FormControlLabel <Tabs
control={ items={[
<Checkbox {
checked={params?.typeList?.length === 5} key: null,
indeterminate={ label: `全部`,
params?.typeList?.length > 0 && params?.typeList?.length < 5 },
} {
/> key: "1",
} label: `待提交`,
label="全部" },
onChange={(e) => { {
setparams((s) => { key: "2",
let news = []; label: `已提交`,
if (e.target.checked) { },
news = ["1", "2", "3", "4", "5"]; {
} key: "3",
return { label: `暂停中`,
...s, },
typeList: news, {
}; key: "4",
}); label: `已结束`,
}} },
/> ]}
<FormGroup activeKey={params?.type}
row onChange={(val) => {
value={params?.typeList ?? []} setparams((s) => ({
onChange={(e) => { ...s,
let val = e.target.value; type: val,
setparams((s) => { }));
let news = [...s?.typeList];
if (news.includes(val)) {
news = news.filter((it) => it !== val);
} else {
news = [...news, val];
}
return {
...s,
typeList: news,
};
});
}} }}
> ></Tabs>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("1")}
color={"warning"}
/>
}
label="待提交"
value={1}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("2")}
color={"info"}
/>
}
label="已提交"
value={2}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("3")}
color={"default"}
/>
}
label="暂停中"
value={3}
/>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("4")}
color={"default"}
/>
}
label="已结束"
value={4}
/>
</FormGroup>
<Input <Input
placeholder="请输入课程名称" placeholder="请输入课程名称"
style={{ width: 200 }} style={{ width: 200, marginLeft: 24 }}
value={params?.trainName} value={params?.trainName}
onChange={(e) => { onChange={(e) => {
setparams((s) => ({ setparams((s) => ({
......
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