mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 01:14:50 +08:00
初始化项目
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import {
|
||||
FormOutlined,
|
||||
FieldTimeOutlined,
|
||||
DiffOutlined,
|
||||
SettingOutlined,
|
||||
CodeOutlined,
|
||||
FolderOutlined,
|
||||
LockOutlined,
|
||||
RadiusSettingOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import logo from '@/assets/logo.png';
|
||||
|
||||
export default {
|
||||
route: {
|
||||
routes: [
|
||||
{
|
||||
name: 'login',
|
||||
path: '/login',
|
||||
hideInMenu: true,
|
||||
component: '@/pages/login/index',
|
||||
},
|
||||
{
|
||||
path: '/cookie',
|
||||
name: 'Cookie管理',
|
||||
icon: <RadiusSettingOutlined />,
|
||||
component: '@/pages/cookie/index',
|
||||
},
|
||||
{
|
||||
path: '/config',
|
||||
name: '配置文件',
|
||||
icon: <SettingOutlined />,
|
||||
component: '@/pages/config/index',
|
||||
},
|
||||
{
|
||||
path: '/diy',
|
||||
name: '自定义脚本',
|
||||
icon: <FormOutlined />,
|
||||
component: '@/pages/diy/index',
|
||||
},
|
||||
{
|
||||
path: '/crontab',
|
||||
name: '定时任务',
|
||||
icon: <FieldTimeOutlined />,
|
||||
component: '@/pages/crontab/index',
|
||||
},
|
||||
{
|
||||
path: '/diff',
|
||||
name: '对比工具',
|
||||
icon: <DiffOutlined />,
|
||||
component: '@/pages/diff/index',
|
||||
},
|
||||
{
|
||||
path: '/code',
|
||||
name: '互助码',
|
||||
icon: <CodeOutlined />,
|
||||
component: '@/pages/code/index',
|
||||
},
|
||||
{
|
||||
path: '/log',
|
||||
name: '日志',
|
||||
icon: <FolderOutlined />,
|
||||
component: '@/pages/log/index',
|
||||
},
|
||||
{
|
||||
path: '/password',
|
||||
name: '修改密码',
|
||||
icon: <LockOutlined />,
|
||||
component: '@/pages/password/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
location: {
|
||||
pathname: '/',
|
||||
},
|
||||
fixSiderbar: true,
|
||||
navTheme: 'light',
|
||||
primaryColor: '#1890ff',
|
||||
contentWidth: 'Fixed',
|
||||
splitMenus: false,
|
||||
logo: logo,
|
||||
} as any;
|
||||
@@ -0,0 +1,23 @@
|
||||
body {
|
||||
height: 100%;
|
||||
overflow-y: hidden;
|
||||
background-color: rgb(248, 248, 248);
|
||||
}
|
||||
|
||||
@import '~codemirror/lib/codemirror.css';
|
||||
@import '~codemirror/theme/dracula.css';
|
||||
|
||||
.code-mirror-wrapper .CodeMirror {
|
||||
position: absolute;
|
||||
height: calc(100% - 24px);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ant-pro-grid-content.wide {
|
||||
max-width: unset;
|
||||
height: calc(100vh - 72px);
|
||||
overflow: auto;
|
||||
.ant-pro-page-container-children-content{
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Descriptions, Result, Avatar, Space, Statistic } from 'antd';
|
||||
import { LikeOutlined, UserOutlined } from '@ant-design/icons';
|
||||
import ProLayout, {
|
||||
PageContainer,
|
||||
PageLoading,
|
||||
SettingDrawer,
|
||||
} from '@ant-design/pro-layout';
|
||||
import defaultProps from './defaultProps';
|
||||
import { Link, history } from 'umi';
|
||||
import config from '@/utils/config';
|
||||
import 'codemirror/mode/shell/shell.js'
|
||||
import './index.less';
|
||||
|
||||
export default function (props: any) {
|
||||
useEffect(() => {
|
||||
const isAuth = localStorage.getItem(config.authKey);
|
||||
if (!isAuth) {
|
||||
history.push('/login');
|
||||
}
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if (props.location.pathname === '/') {
|
||||
history.push('/config');
|
||||
}
|
||||
}, [props.location.pathname]);
|
||||
if (props.location.pathname === '/login') {
|
||||
return props.children;
|
||||
}
|
||||
return (
|
||||
<ProLayout
|
||||
selectedKeys={[props.location.pathname]}
|
||||
title="控制面板"
|
||||
menuItemRender={(menuItemProps: any, defaultDom) => {
|
||||
if (
|
||||
menuItemProps.isUrl ||
|
||||
!menuItemProps.path ||
|
||||
location.pathname === menuItemProps.path
|
||||
) {
|
||||
return defaultDom;
|
||||
}
|
||||
return <Link to={menuItemProps.path}>{defaultDom}</Link>;
|
||||
}}
|
||||
// rightContentRender={() => (
|
||||
// <div>
|
||||
// <Avatar shape="square" size="small" icon={<UserOutlined />} />
|
||||
// </div>
|
||||
// )}
|
||||
{...defaultProps}
|
||||
>
|
||||
{props.children}
|
||||
</ProLayout>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user