|
@@ -1,9 +1,18 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
|
import { routes } from './routes'
|
|
|
-import { Layout, Menu } from 'antd'
|
|
|
+import {
|
|
|
+ Layout,
|
|
|
+ Menu,
|
|
|
+ Select,
|
|
|
+ Divider,
|
|
|
+ Space,
|
|
|
+ Button,
|
|
|
+ Modal,
|
|
|
+ Input,
|
|
|
+} from 'antd'
|
|
|
import { Routes, Route, Link, Navigate, useLocation } from 'react-router-dom'
|
|
|
import styled from 'styled-components'
|
|
|
-import { SettingFilled } from '@ant-design/icons'
|
|
|
+import { SettingFilled, PlusOutlined, ProjectOutlined } from '@ant-design/icons'
|
|
|
const { Content, Sider, Header } = Layout
|
|
|
|
|
|
const SidebarDiv = styled.div`
|
|
@@ -28,6 +37,17 @@ const SidebarDiv = styled.div`
|
|
|
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;
|
|
@@ -43,10 +63,18 @@ 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)
|
|
|
+
|
|
|
const menus = routes.map(item => {
|
|
|
return {
|
|
|
key: item.path,
|
|
@@ -82,11 +110,68 @@ 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">
|
|
|
- {/* <SettingFilled className="setting" /> */}
|
|
|
</Header>
|
|
|
<Layout hasSider style={{ marginTop: '54px' }}>
|
|
|
<Sider className="sidebar">
|
|
@@ -114,6 +199,8 @@ const Main = () => {
|
|
|
</Content>
|
|
|
</Layout>
|
|
|
</Layout>
|
|
|
+ {addProjectModal}
|
|
|
+ {projectSettingModal}
|
|
|
</SidebarDiv>
|
|
|
)
|
|
|
}
|