Browse Source

退出

release_0.0.1
巴林闲侠 3 years ago
parent
commit
85ab237dfb
  1. 8
      api/app/lib/controllers/overview/conserve.js
  2. 2
      web/client/src/index.js
  3. 81
      web/client/src/layout/components/header/index.js
  4. 2
      web/client/src/layout/components/sider/index.js

8
api/app/lib/controllers/overview/conserve.js

@ -22,10 +22,18 @@ async function statistic (ctx) {
} }
const reportRes = await await models.Report.findAll(findOption) const reportRes = await await models.Report.findAll(findOption)
const reportCount = await models.Report.count({
attributes: ['projectType'],
group: ['projectType'],
where: {
reportType: 'conserve',
},
})
ctx.status = 200 ctx.status = 200
ctx.body = { ctx.body = {
processed: reportRes.length, processed: reportRes.length,
reportCount: reportCount,
reportList: reportRes, reportList: reportRes,
} }
} catch (error) { } catch (error) {

2
web/client/src/index.js

@ -4,4 +4,4 @@ import React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import App from './app'; import App from './app';
render((<App projectName="智慧应急" />), document.getElementById('App')); render((<App projectName="四好公路" />), document.getElementById('App'));

81
web/client/src/layout/components/header/index.js

@ -18,30 +18,15 @@ const themeMap = {
} }
const Header = props => { const Header = props => {
const { dispatch, changeTheme, history, user, pathname, toggleCollapsed, collapsed, actions } = props const { dispatch, history, user, pathname, toggleCollapsed, collapsed, actions } = props
const changeTheme_ = (themeKey) => {
localStorage.setItem("theme-name", themeKey);
window.less.modifyVars(themeMap[themeKey]).catch(error => {
message.error(`Failed to reset theme`);
});
changeTheme(themeKey)
}
const handelClick = item => { const handelClick = item => {
if (item.key == 'logout') { if (item.key == 'logout') {
dispatch(actions.auth.logout(user)); dispatch(actions.auth.logout(user));
history.push(`/signin`); history.push(`/signin`);
} else if (item.key == 'themeLight') {
changeTheme_('light')
} else if (item.key == 'themeDark') {
changeTheme_('dark')
} else if (item.key == 'themeExample') {
changeTheme_('example')
} }
} }
let current = pathname; let current = pathname;
console.log(pathname); console.log(pathname);
if (pathname == '/' || pathname == '') { if (pathname == '/' || pathname == '') {
@ -56,56 +41,46 @@ const Header = props => {
return ( return (
<div className={styles.header}> <div className={styles.header}>
{/* <div className={styles['header-fold']}> <div className={styles['header-fold']}>
<span onClick={toggleCollapsed} style={{ marginRight: 20 }}> <span onClick={toggleCollapsed} style={{ marginRight: 20 }}>
{collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />} {collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
</span> </span>
<div className={styles['header-title']} style={{}}> <div className={styles['header-title']} style={{}}>
智慧应急 */} 四好公路
{/* <span>{user.orgName}</span> */} </div>
{/* </div>
</div> </div>
<div id="nav" className={styles['header-nav']}> */} <div id="nav" className={styles['header-nav']}>
{/* <Menu <Menu
mode='horizontal' mode='horizontal'
selectedKeys={[current]} style={{ border: 0 }} selectedKeys={[current]} style={{ border: 0 }}
onClick={handelClick} onClick={handelClick}
> */} >
{/* <Menu.SubMenu key="theme" title={<div style={{ margin: '0 8px' }}></div>} > <Menu.SubMenu key="user" title={
<Menu.Item key="themeLight" > <div style={{
<span>亮色风格</span> margin: '0 8px'
}}>
<div
className={styles['header-nav-user-img-wrapper']}
>
<UserOutlined />
</div>
<div style={{ display: 'inline-block' }}>{user.name}</div>
</div>}
>
{/* <Menu.Item key="profile" icon={<UserOutlined />}>
<Link to="/profile">个人设置</Link>
</Menu.Item> */}
<Menu.Item key="logout" icon={<LogoutOutlined />}>
<span>退出</span>
</Menu.Item> </Menu.Item>
<Menu.Item key="themeDark" > </Menu.SubMenu>
<span>暗色风格</span> </Menu>
</Menu.Item> </div>
<Menu.Item key="themeExample" >
<span>示例风格</span>
</Menu.Item>
</Menu.SubMenu> */}
{/* <Menu.SubMenu key="user" title={
<div style={{
margin: '0 8px'
}}>
<div className={styles['header-nav-user-img-wrapper']}>
<UserOutlined />
</div>
<div style={{ display: 'inline-block' }}>{user.name}</div>
</div>}
> */}
{/* <Menu.Item key="profile" icon={<UserOutlined />}>
<Link to="/profile">个人设置</Link>
</Menu.Item> */}
{/* <Menu.Item key="logout" icon={<LogoutOutlined />}>
<span>退出</span>
</Menu.Item>
</Menu.SubMenu> */}
{/* </Menu> */}
{/* </div> */}
</div> </div>
); );
}; };
function mapStateToProps(state) { function mapStateToProps (state) {
const { global, auth } = state; const { global, auth } = state;
return { return {
actions: global.actions, actions: global.actions,

2
web/client/src/layout/components/sider/index.js

@ -54,7 +54,7 @@ const Sider = props => {
return ( return (
<Menu id="sider" mode="inline" <Menu id="sider" mode="inline"
theme={themeName || 'dark'} // theme={themeName || 'dark'}
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
openKeys={openKeys} openKeys={openKeys}
onSelect={(e) => { onSelect={(e) => {

Loading…
Cancel
Save