董国庆
2025-02-25 d69d4b99f1245bf7c9040bd15f8bf617c2d6a5d5
management/src/app.tsx
@@ -7,6 +7,7 @@
import { errorConfig } from './requestErrorConfig';
const loginPath = '/login';
import '../public/font.css'
import { useEffect, useState } from 'react';
/**
@@ -39,8 +40,21 @@
// ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => {
  const [title, setTitle] = useState('');
  useEffect(() => {
    const updateTitle = () => {
      const now = new Date();
      const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
      const formattedDate = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()} ${now.getHours()}:${now.getMinutes()} ${days[now.getDay()]}`;
      setTitle(formattedDate);
    };
    updateTitle();
    const interval = setInterval(updateTitle, 1000); // 每分钟更新一次
    return () => clearInterval(interval); // 清除定时器
  }, []);
  return {
    title,
    logo: false,
    avatarProps: {
      title: <AvatarName />,