first commit

This commit is contained in:
wang_yp 2025-03-16 14:16:31 +08:00
parent a583668f29
commit 0cc80eec5c
6 changed files with 83 additions and 73 deletions

View File

@ -3,7 +3,7 @@ import "./layout.less";
import { inject, observer } from "mobx-react";
import { Store } from "antd/es/form/interface";
import { useEffect, useState } from "react";
import { Avatar, Breadcrumb, Layout, Menu, theme } from "antd";
import { Avatar, Breadcrumb, Layout, Menu, MenuProps, theme } from "antd";
import { UserOutlined } from "@ant-design/icons";
import Sider from "antd/es/layout/Sider";
import { items } from "./layout_config";
@ -12,6 +12,7 @@ import { Outlet, useNavigate } from "react-router";
const LayOut = (props: Store) => {
const { usrStore } = props;
const [collapsed, setCollapsed] = useState(false);
const nav = useNavigate();
const {
token: { colorBgContainer, borderRadiusLG },
@ -62,6 +63,7 @@ const LayOut = (props: Store) => {
theme="dark"
defaultSelectedKeys={["1"]}
defaultOpenKeys={["sub1"]}
style={{ height: "100%", borderRight: 0 }}
items={items}
onClick={(e) => {

View File

@ -1,62 +0,0 @@
import { ItemType, MenuItemType } from 'antd/es/menu/interface';
export const items:ItemType<MenuItemType>[] = [
{
key: "/",
label: `首页看板`,
},
{
key: "/user",
label: `用户管理`,
children: [
{ key: "/user/list", label: `用户管理` },
],
},
{
key: "/sku",
label: `商品管理`,
children: [
{ key: "/sku/list", label: `商品列表` },
{ key: "/sku/cat", label: `商品分类` },
{ key: "/sku/spec", label: `商品规格` },
{ key: "/sku/brand", label: `商品品牌` },
],
},
{
key: "/order",
label: `订单管理`,
children: [
{ key: "/order/list", label: `订单列表` },
],
},
{
key: "/rbac",
label: `权限管理`,
children: [
{ label: `角色管理`, key: "/rbac/role" },
{ label: `菜单管理`, key: "/rbac/menu" },
{ label: `部门管理`, key: "/rbac/dep" },
{ label: `机构管理`, key: "/rbac/org" },
{ label: `员工管理`, key: "/rbac/staff" },
],
},
{
key: "/city",
label: `区域管理`,
children: [
{ label: `区域列表`, key: "/city/list" },
],
},
{
key: "/sys",
label: `系统管理`,
children: [
{ label: `部门管理`, key: "/sys/dep" },
{ label: `数据字典`, key: "/sys/keywod" },
{ label: `版本管理`, key: "/sys/version" },
{ label: `捐赠管理`, key: "/sys/don" },
{ label: `通告管理`, key: "/sys/notic" },
],
},
];

View File

@ -0,0 +1,70 @@
import { ItemType, MenuItemType } from "antd/es/menu/interface";
import {
UserOutlined,
NotificationOutlined,
PaperClipOutlined,
FileSyncOutlined,
DashboardOutlined
} from "@ant-design/icons";
export const items: ItemType<MenuItemType>[] = [
{
key: "/",
label: `首页看板`,
icon:<DashboardOutlined />,
},
{
key: "/user",
label: `用户管理`,
icon: <UserOutlined />,
children: [{ key: "/user/list", label: `用户管理` }],
},
{
key: "/sku",
label: `商品管理`,
icon: <NotificationOutlined />,
children: [
{ key: "/sku/list", label: `商品列表` },
{ key: "/sku/cat", label: `商品分类` },
{ key: "/sku/spec", label: `商品规格` },
{ key: "/sku/brand", label: `商品品牌` },
],
},
{
key: "/order",
label: `订单管理`,
icon: <NotificationOutlined />,
children: [{ key: "/order/list", label: `订单列表` }],
},
{
key: "/rbac",
label: `权限管理`,
icon: <PaperClipOutlined />,
children: [
{ label: `角色管理`, key: "/rbac/role" },
{ label: `菜单管理`, key: "/rbac/menu" },
{ label: `部门管理`, key: "/rbac/dep" },
{ label: `机构管理`, key: "/rbac/org" },
{ label: `员工管理`, key: "/rbac/staff" },
],
},
{
icon:<FileSyncOutlined />,
key: "/city",
label: `区域管理`,
children: [{ label: `区域列表`, key: "/city/list" }],
},
{
key: "/sys",
label: `系统管理`,
icon:<FileSyncOutlined />,
children: [
{ label: `部门管理`, key: "/sys/dep" },
{ label: `数据字典`, key: "/sys/keywod" },
{ label: `版本管理`, key: "/sys/version" },
{ label: `捐赠管理`, key: "/sys/don" },
{ label: `通告管理`, key: "/sys/notic" },
],
},
];

View File

@ -10,10 +10,10 @@ const Login = (props) => {
const navigate = useNavigate();
const onFinish = async (values: any) => {
navigate("/", { replace: true });
return;
let status = await usrStore.login({
userName: values.account,
passWord: values.password,
genre:1
});
if (status) {
usrStore.closeLoginDilog();

View File

@ -18,16 +18,16 @@ axios.interceptors.request.use((config) => {
// 添加响应拦截器
axios.interceptors.response.use((res: AxiosResponse) => {
if (res.data?.status === 401) {
// store.usrStore.openLoginDilog()
// store.usrStore.logOut()
// window.location.href = '#/login'
store.usrStore.openLoginDilog()
store.usrStore.logOut()
window.location.href = '#/login'
}
return res;
}, (err) => {
if (err.status === 401) {
// store.usrStore.openLoginDilog()
// store.usrStore.logOut()
// window.location.href = '#/login'
store.usrStore.openLoginDilog()
store.usrStore.logOut()
window.location.href = '#/login'
}
return Promise.reject(err);
});

View File

@ -44,7 +44,7 @@ class UserStore extends BaseStore<UserDataType> {
}
try {
let data = await base.post(UserConfig.LOGINURI, param)
if (data.code !== 0) {
if (data.code !== 200) {
message.error(data.msg)
return false
}