调整
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { useUserStore } from '@/stores';
|
||||
|
||||
// 如果即将去往的是 /login 页面并且有 token 情况就自动重定向到 /home,否则就跳转
|
||||
// 如果即将去往的是 /login 页面并且有 token 情况就自动重定向到 /,否则就跳转
|
||||
const useAuthRedirect = () => {
|
||||
const store = useUserStore();
|
||||
const navigate = useNavigate();
|
||||
@@ -12,7 +12,7 @@ const useAuthRedirect = () => {
|
||||
const token = store.token;
|
||||
const isGoingToLogin = location.pathname === '/login';
|
||||
|
||||
if (isGoingToLogin && token) navigate('/home');
|
||||
if (isGoingToLogin && token) navigate('/');
|
||||
}, [location, navigate, store.token]);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { MessageOutlined } from '@ant-design/icons';
|
||||
import { Avatar, Card, List, Space, Spin } from 'antd';
|
||||
import Title from '@/components/Title';
|
||||
import { getRssListAPI } from '@/api/Rss';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { notification, Divider, Input, Alert, Button, Spin } from 'antd';
|
||||
import { PictureOutlined, LoadingOutlined } from '@ant-design/icons';
|
||||
import { editLayoutDataAPI, getLayoutDataAPI } from '@/api/System';
|
||||
import { Layout } from '@/types/system';
|
||||
import { editLayoutDataAPI, getLayoutDataAPI } from '@/api/Project';
|
||||
import { Layout } from '@/types/project';
|
||||
|
||||
const LayoutPage = () => {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Form, Input, Button, message } from 'antd';
|
||||
import { getWebDataAPI, editWebDataAPI } from '@/api/System';
|
||||
import { getWebDataAPI, editWebDataAPI } from '@/api/Project';
|
||||
import { Web } from '@/types/project'
|
||||
|
||||
const WebPage = () => {
|
||||
|
||||
28
src/types/project.d.ts
vendored
28
src/types/project.d.ts
vendored
@@ -1,28 +1,10 @@
|
||||
// 磁盘
|
||||
export interface Disk {
|
||||
diskFree: number;
|
||||
diskPercent: number;
|
||||
diskTotal: number;
|
||||
diskUsed: number;
|
||||
}
|
||||
|
||||
// 内存
|
||||
export interface Memory {
|
||||
memoryAvailable: number;
|
||||
memoryPercent: number;
|
||||
memoryTotal: number;
|
||||
memoryUsed: number;
|
||||
}
|
||||
|
||||
// 系统信息
|
||||
export interface System {
|
||||
boot_time: string;
|
||||
cpu: number;
|
||||
disk: Disk;
|
||||
memory: Memory;
|
||||
name: string;
|
||||
run: number;
|
||||
ip: number
|
||||
osName: string,
|
||||
osVersion: string,
|
||||
totalMemory: number,
|
||||
availableMemory: number,
|
||||
memoryUsage: number
|
||||
}
|
||||
|
||||
// 网站信息
|
||||
|
||||
Reference in New Issue
Block a user