diff --git a/src/App.tsx b/src/App.tsx index 75c80ad..c7d3821 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,7 +5,7 @@ import ParentView from './ParentView' import Loading from './Loading' import currentRouter from './router' import RouteInterception from './router/RouteInterception' -import { useDispatch, useSelector } from 'react-redux' +import { useSelector } from 'react-redux' import { Suspense, lazy, useEffect, useState } from 'react' const Views = import.meta.glob('./view/**/*.tsx') const transferReactNode = (comp: string) => { diff --git a/src/Loading.tsx b/src/Loading.tsx index ac32caf..7ed2278 100644 --- a/src/Loading.tsx +++ b/src/Loading.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import NProgress from './mynprogress' import { Spin } from "antd"; diff --git a/src/Login.tsx b/src/Login.tsx index 7932d0e..0ea9bab 100644 --- a/src/Login.tsx +++ b/src/Login.tsx @@ -1,5 +1,5 @@ import { Button, Form, Input, Image, message } from "antd"; -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import './assets/styles/login.scss' import { getCaptchaApi, loginApi } from "./api/login"; import { useNavigate } from "react-router-dom"; diff --git a/src/Notfound.tsx b/src/Notfound.tsx index 655d105..e6ad00a 100644 --- a/src/Notfound.tsx +++ b/src/Notfound.tsx @@ -1,4 +1,4 @@ -import React from 'react' + export default function Notfound() { return
404
diff --git a/src/ParentView.tsx b/src/ParentView.tsx index 9c7397b..8df70ef 100644 --- a/src/ParentView.tsx +++ b/src/ParentView.tsx @@ -1,4 +1,4 @@ -import React from 'react' + import { Outlet } from 'react-router-dom' export default function ParentView() { diff --git a/src/components/Authenticationbtn.tsx b/src/components/Authenticationbtn.tsx index 47ff3c9..37e3228 100644 --- a/src/components/Authenticationbtn.tsx +++ b/src/components/Authenticationbtn.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; /** * @author {温华} diff --git a/src/components/ConfirmModel.tsx b/src/components/ConfirmModel.tsx index 5ae7504..7c19156 100644 --- a/src/components/ConfirmModel.tsx +++ b/src/components/ConfirmModel.tsx @@ -1,5 +1,5 @@ -import React from "react"; +// import React from "react"; -export default function ConfirmModel() { +// export default function ConfirmModel() { -} \ No newline at end of file +// } \ No newline at end of file diff --git a/src/hooks/useDemo.ts b/src/hooks/useDemo.ts index 3a8ff78..aeb5c32 100644 --- a/src/hooks/useDemo.ts +++ b/src/hooks/useDemo.ts @@ -1,5 +1,5 @@ -import { useState, useEffect } from "react"; +// import { useState, useEffect } from "react"; -export default function useDemo() { +// export default function useDemo() { -} \ No newline at end of file +// } \ No newline at end of file diff --git a/src/layout/appmain/index.tsx b/src/layout/appmain/index.tsx index 1bbf204..adce09a 100644 --- a/src/layout/appmain/index.tsx +++ b/src/layout/appmain/index.tsx @@ -1,4 +1,3 @@ -import React from "react"; import '../../assets/styles/appmain.scss' import { Outlet } from "react-router-dom"; diff --git a/src/layout/index.tsx b/src/layout/index.tsx index 073a1c7..7c0e853 100644 --- a/src/layout/index.tsx +++ b/src/layout/index.tsx @@ -1,4 +1,3 @@ -import React, { useEffect } from "react"; import { Layout } from 'antd' import { useSelector } from 'react-redux' import SideBar from "./sidebar"; diff --git a/src/layout/navbar/index.tsx b/src/layout/navbar/index.tsx index 80705fb..ffdb8b4 100644 --- a/src/layout/navbar/index.tsx +++ b/src/layout/navbar/index.tsx @@ -3,7 +3,7 @@ import { MenuFoldOutlined, MenuUnfoldOutlined, } from '@ant-design/icons'; -import React from 'react' + import { useSelector, useDispatch } from 'react-redux' import { setCollapsed } from '../../stores/sidebar'; diff --git a/src/layout/sidebar/index.tsx b/src/layout/sidebar/index.tsx index b28ca06..7b342bf 100644 --- a/src/layout/sidebar/index.tsx +++ b/src/layout/sidebar/index.tsx @@ -1,6 +1,6 @@ import { Menu } from 'antd' -import React, {Fragment, useEffect, useState} from 'react' -import { useDispatch, useSelector } from 'react-redux'; +import {Fragment, useEffect, useState} from 'react' +import { useSelector } from 'react-redux'; import { generateMenu } from '../../permission'; import { useLocation, useNavigate } from 'react-router-dom'; @@ -8,7 +8,7 @@ export default function SideBar() { const navigate = useNavigate() const location = useLocation() const routes: [] = useSelector((store: any)=>store.permission) - const dispatch = useDispatch() + // const dispatch = useDispatch() const [menuItem, setMenuItem] = useState>([{ key: '/', label: '首页', diff --git a/src/router/RouteInterception.tsx b/src/router/RouteInterception.tsx index 49b17e1..4742d8b 100644 --- a/src/router/RouteInterception.tsx +++ b/src/router/RouteInterception.tsx @@ -1,5 +1,4 @@ import { Navigate } from "react-router-dom" -import Notfound from "../Notfound" import { getToken } from "../utils/auth" import { useDispatch, useSelector } from "react-redux" import { addRoutes, getAsyncRouters } from "../stores/permission" diff --git a/src/router/index.tsx b/src/router/index.tsx index b7ecb3b..7319266 100644 --- a/src/router/index.tsx +++ b/src/router/index.tsx @@ -1,13 +1,12 @@ -import { getToken } from '../utils/auth' import LayOut from '../layout/index' import { Suspense, lazy } from 'react' import Loading from '../Loading' import RouteInterception from './RouteInterception' import Notfound from '../Notfound' -interface Meta { - title: string, - redirect?: boolean -} +// interface Meta { +// title: string, +// redirect?: boolean +// } type route = { path: string, diff --git a/src/stores/auth.ts b/src/stores/auth.ts index c224dcd..83d64c4 100644 --- a/src/stores/auth.ts +++ b/src/stores/auth.ts @@ -34,12 +34,16 @@ export const authInfoSlice = createSlice({ extraReducers(builder) { builder .addCase(getAuthInfo.pending, (state) => { + console.log(state); + console.log('正在请求登录用户信息') }) .addCase(getAuthInfo.fulfilled, (state, {payload}) => { + console.log(state); return payload }) .addCase(getAuthInfo.rejected, (state, err) => { + console.log(state); console.log(err, 'rejected') }) } diff --git a/src/stores/cache.ts b/src/stores/cache.ts index 284a5bf..d64accd 100644 --- a/src/stores/cache.ts +++ b/src/stores/cache.ts @@ -1,10 +1,10 @@ import { createSlice } from '@reduxjs/toolkit' -type CacheKey = string +// type CacheKey = string -type CacheVal = any +// type CacheVal = any -const initCache = new Map([]) +// const initCache = new Map([]) // 创建一个slice export const cacheSlice = createSlice({ diff --git a/src/stores/permission.ts b/src/stores/permission.ts index ee902bd..562d77b 100644 --- a/src/stores/permission.ts +++ b/src/stores/permission.ts @@ -46,13 +46,16 @@ export const permissionSlice = createSlice({ extraReducers(builder) { builder .addCase(getAsyncRouters.pending, (state) => { + console.log(state); console.log('正在请求路由'); }) .addCase(getAsyncRouters.fulfilled, (state, { payload }) => { + console.log(state); // 请求成功后处理路由 return payload }) .addCase(getAsyncRouters.rejected, (state, err) => { + console.log(state); console.log(err,'rejected'); }) diff --git a/src/type/index.ts b/src/type/index.ts index 35ba61b..c0c7622 100644 --- a/src/type/index.ts +++ b/src/type/index.ts @@ -6,13 +6,13 @@ export interface IResponse { } // 定义请求方式枚举 -enum EMethod { - GET = 'get', - POST = 'post', - PUT = 'put', - DELETE = 'delete', - PATCH = 'patch' -} +// enum EMethod { +// GET = 'get', +// POST = 'post', +// PUT = 'put', +// DELETE = 'delete', +// PATCH = 'patch' +// } // 用户token类型定义 export type IToken = string diff --git a/src/utils/request.ts b/src/utils/request.ts index 4fade71..9fa03de 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,6 +1,5 @@ import { IResponse, IToken } from "@/type"; import axios, { InternalAxiosRequestConfig, AxiosInstance, AxiosRequestConfig } from "axios"; -import Cookie from 'js-cookie' import { getToken, removeToken } from "./auth"; import { message } from "antd"; diff --git a/src/view/home/index.tsx b/src/view/home/index.tsx index 6865f54..3099b57 100644 --- a/src/view/home/index.tsx +++ b/src/view/home/index.tsx @@ -1,5 +1,3 @@ -import React from 'react' - export default function Home() { return(
home
diff --git a/src/view/system/dept/index.tsx b/src/view/system/dept/index.tsx index 3012326..f8515f9 100644 --- a/src/view/system/dept/index.tsx +++ b/src/view/system/dept/index.tsx @@ -1,5 +1,3 @@ -import React from "react"; - export default function Dept() { return(
dept
diff --git a/src/view/system/user/index.tsx b/src/view/system/user/index.tsx index 34c1c31..b47f70a 100644 --- a/src/view/system/user/index.tsx +++ b/src/view/system/user/index.tsx @@ -1,4 +1,4 @@ -import React from 'react' + export default function User() { return(