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 {
border: none !important;
}
.ant-tabs-ink-bar-animated {
display: none !important;
//display: none !important;
}
.ant-tabs-tab-btn {
font-weight: bolder !important;
......
function Welcome() {
return <div className="center" style={{height:260,fontSize:26}}>欢迎使用</div>;
}
import { useModel,history } from "@umijs/max";
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";
import { doFetch } from "@/utils/doFetch";
import PRODUCTS from "@/_mock/products";
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 { Empty, Input, message } from "antd";
import { Empty, Input, message, Tabs } from "antd";
import { useMemo, useState } from "react";
import "./index.less";
......@@ -21,7 +18,7 @@ function Lessons() {
const [params, setparams] = useState({
trainName: "",
status: null,
typeList: ["1", "2", "3", "4", "5"],
type: null,
});
const handleClose = () => {
......@@ -330,92 +327,41 @@ function Lessons() {
>
<Typography variant="h5">实训管理</Typography>
<Stack spacing={2} direction="row">
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.length === 5}
indeterminate={
params?.typeList?.length > 0 && params?.typeList?.length < 5
}
/>
}
label="全部"
onChange={(e) => {
setparams((s) => {
let news = [];
if (e.target.checked) {
news = ["1", "2", "3", "4", "5"];
}
return {
...s,
typeList: news,
};
});
}}
/>
<FormGroup
row
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];
}
return {
...s,
typeList: news,
};
});
<Tabs
items={[
{
key: null,
label: `全部`,
},
{
key: "1",
label: `待发布`,
},
{
key: "2",
label: `已发布`,
},
{
key: "3",
label: `已发布(暂停)`,
},
{
key: "4",
label: `已结束`,
},
]}
activeKey={params?.type}
onChange={(val) => {
setparams((s) => ({
...s,
type: val,
}));
}}
>
<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>
></Tabs>
<Input
placeholder="请输入课程名称"
style={{ width: 200 }}
style={{ width: 200, marginLeft: 24 }}
value={params?.trainName}
onChange={(e) => {
setparams((s) => ({
......
......@@ -10,7 +10,7 @@ import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup";
import { useRequest } from "ahooks";
import { Empty, Input, message } from "antd";
import { Empty, Input, message,Tabs } from "antd";
import { useMemo, useState } from "react";
import "./index.less";
......@@ -247,84 +247,38 @@ function Lessons() {
>
<Typography variant="h5">课程管理</Typography>
<Stack spacing={2} direction="row" flex={1} justifyContent={"flex-end"}>
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.length === 3}
indeterminate={
params?.typeList?.length > 0 && params?.typeList?.length < 3
}
/>
}
label="全部"
onChange={(e) => {
setparams((s) => {
let news = [];
if (e.target.checked) {
news = ["1", "2", "3"];
}
return {
...s,
typeList: news,
};
});
}}
/>
<FormGroup
row
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
items={[
{
key: null,
label: `全部`,
},
{
key: "1",
label: `待发布`,
},
{
key: "2",
label: `已发布`,
},
{
key: "3",
label: `已结束`,
},
]}
activeKey={params?.type}
onChange={(val) => {
setparams((s) => ({
...s,
type: val,
}));
}}
>
<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>
></Tabs>
<Input
placeholder="请输入课程名称"
style={{ width: 200 }}
style={{ width: 200, marginLeft: 24 }}
value={params?.courseName}
onChange={(e) => {
setparams((s) => ({
......
......@@ -9,11 +9,10 @@ import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup";
import { useRequest } from "ahooks";
import { Empty, Input, message } from "antd";
import { Empty, Input, message,Tabs } from "antd";
import { useMemo, useState } from "react";
import "./index.less";
function Lessons() {
const [dialogprops, setdialogprops] = useState({
open: false,
......@@ -44,7 +43,6 @@ function Lessons() {
const datalist = useRequest(
async () => {
let res = await doFetch({ url: "/studentTrain/queryTrainList", params });
return res?.data?.dataList;
},
......@@ -55,7 +53,6 @@ function Lessons() {
);
const edit = (row) => {
setdialogprops({
open: true,
defaultFormValue: { ...row },
......@@ -262,92 +259,41 @@ function Lessons() {
>
<Typography variant="h5">我的实训</Typography>
<Stack spacing={2} direction="row">
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.length === 5}
indeterminate={
params?.typeList?.length > 0 && params?.typeList?.length < 5
}
/>
}
label="全部"
onChange={(e) => {
setparams((s) => {
let news = [];
if (e.target.checked) {
news = ["1", "2", "3", "4", "5"];
}
return {
...s,
typeList: news,
};
});
}}
/>
<FormGroup
row
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];
}
return {
...s,
typeList: news,
};
});
<Tabs
items={[
{
key: null,
label: `全部`,
},
{
key: "1",
label: `待提交`,
},
{
key: "2",
label: `已提交`,
},
{
key: "3",
label: `暂停中`,
},
{
key: "4",
label: `已结束`,
},
]}
activeKey={params?.type}
onChange={(val) => {
setparams((s) => ({
...s,
type: val,
}));
}}
>
<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>
></Tabs>
<Input
placeholder="请输入课程名称"
style={{ width: 200 }}
style={{ width: 200, marginLeft: 24 }}
value={params?.trainName}
onChange={(e) => {
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