|
@@ -1,18 +1,8 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
|
import { routes } from './routes'
|
|
|
-import {
|
|
|
- Layout,
|
|
|
- Menu,
|
|
|
- Select,
|
|
|
- Divider,
|
|
|
- Space,
|
|
|
- Button,
|
|
|
- Modal,
|
|
|
- Input,
|
|
|
-} from 'antd'
|
|
|
+import { Layout, Menu, Select, Space, Button, Modal, Input } from 'antd'
|
|
|
import { Routes, Route, Link, Navigate, useLocation } from 'react-router-dom'
|
|
|
import styled from 'styled-components'
|
|
|
-import { SettingFilled, PlusOutlined, ProjectOutlined } from '@ant-design/icons'
|
|
|
const { Content, Sider, Header } = Layout
|
|
|
|
|
|
const SidebarDiv = styled.div`
|
|
@@ -21,39 +11,12 @@ const SidebarDiv = styled.div`
|
|
|
height: 100vh;
|
|
|
position: fixed;
|
|
|
left: 0;
|
|
|
- top: 54px;
|
|
|
bottom: 0;
|
|
|
}
|
|
|
.content {
|
|
|
overflow: initial;
|
|
|
margin-left: 200px;
|
|
|
}
|
|
|
- .header {
|
|
|
- position: fixed;
|
|
|
- z-index: 1;
|
|
|
- width: 100%;
|
|
|
- height: 54px;
|
|
|
- background: #102337;
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
- align-items: center;
|
|
|
- .projects {
|
|
|
- color: #fff;
|
|
|
- .ant-select-arrow {
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
- }
|
|
|
- .line {
|
|
|
- height: 24px;
|
|
|
- margin: 0 15px;
|
|
|
- border-left: 1px solid #454545;
|
|
|
- }
|
|
|
- .setting {
|
|
|
- color: #fff;
|
|
|
- font-size: 20px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- }
|
|
|
.headerLogo {
|
|
|
height: 32px;
|
|
|
margin: 16px;
|
|
@@ -63,14 +26,10 @@ const SidebarDiv = styled.div`
|
|
|
line-height: 32px;
|
|
|
}
|
|
|
`
|
|
|
-const { Option } = Select
|
|
|
-
|
|
|
-const projects = ['项目1', '项目2', '项目3']
|
|
|
|
|
|
const Main = () => {
|
|
|
const { pathname } = useLocation()
|
|
|
const [currentSide, setCurrentSide] = useState('1')
|
|
|
- const [projectsList, setProjectsList] = useState(projects)
|
|
|
const [isAddProject, setIsAddProject] = useState(false)
|
|
|
const [projectSetting, setProjectSetting] = useState(false)
|
|
|
const [projectName, setProjectName] = useState(null)
|
|
@@ -110,70 +69,10 @@ const Main = () => {
|
|
|
setCurrentSide(val.key)
|
|
|
}
|
|
|
|
|
|
- const addProject = () => {
|
|
|
- setProjectsList([...projectsList, `项目${projectsList.length + 1}`])
|
|
|
- setIsAddProject(false)
|
|
|
- setProjectName(null)
|
|
|
- }
|
|
|
-
|
|
|
- const handleProjcet = () => {
|
|
|
- setIsAddProject(false)
|
|
|
- setProjectName(null)
|
|
|
- }
|
|
|
-
|
|
|
- const editProject = () => {
|
|
|
- setProjectSetting(false)
|
|
|
- }
|
|
|
-
|
|
|
- const addProjectModal = (
|
|
|
- <Modal
|
|
|
- title="新建项目"
|
|
|
- visible={isAddProject}
|
|
|
- onOk={addProject}
|
|
|
- okText="确认添加"
|
|
|
- onCancel={handleProjcet}
|
|
|
- cancelText="取消">
|
|
|
- <Space style={{ padding: '10px 20px 30px' }}>
|
|
|
- <span>项目名称:</span>
|
|
|
- <Input
|
|
|
- value={projectName}
|
|
|
- onChange={e => {
|
|
|
- setProjectName(e.target.value)
|
|
|
- }}
|
|
|
- style={{ width: '350px' }}
|
|
|
- />
|
|
|
- </Space>
|
|
|
- </Modal>
|
|
|
- )
|
|
|
-
|
|
|
- const projectSettingModal = (
|
|
|
- <Modal
|
|
|
- title="项目设置"
|
|
|
- visible={projectSetting}
|
|
|
- width={'60%'}
|
|
|
- onOk={editProject}
|
|
|
- okText="确认"
|
|
|
- onCancel={() => {
|
|
|
- setProjectSetting(false)
|
|
|
- }}
|
|
|
- cancelText="取消">
|
|
|
- <Space style={{ padding: '10px 20px 30px', display: 'flex' }}>
|
|
|
- <span>项目名称:</span>
|
|
|
- <Input style={{ width: '350px' }} />
|
|
|
- </Space>
|
|
|
- <Space style={{ padding: '10px 20px 30px', display: 'flex' }}>
|
|
|
- <span>项目成员管理:</span>
|
|
|
- <Button type="link">添加成员</Button>
|
|
|
- </Space>
|
|
|
- </Modal>
|
|
|
- )
|
|
|
-
|
|
|
return (
|
|
|
<SidebarDiv>
|
|
|
<Layout>
|
|
|
- <Header className="header">
|
|
|
- </Header>
|
|
|
- <Layout hasSider style={{ marginTop: '54px' }}>
|
|
|
+ <Layout hasSider>
|
|
|
<Sider className="sidebar">
|
|
|
<div className="headerLogo">AI平台</div>
|
|
|
<Menu
|
|
@@ -199,8 +98,6 @@ const Main = () => {
|
|
|
</Content>
|
|
|
</Layout>
|
|
|
</Layout>
|
|
|
- {addProjectModal}
|
|
|
- {projectSettingModal}
|
|
|
</SidebarDiv>
|
|
|
)
|
|
|
}
|