Browse Source

some

master
yinweiwen 2 years ago
parent
commit
6e7425e22c
  1. 4
      code/web/client/src/app.js
  2. 49
      code/web/client/src/layout/containers/layout/index.js
  3. 2
      code/web/client/src/sections/auth/containers/login.js
  4. 7
      code/web/client/src/sections/search/actions/index.js
  5. 15
      code/web/client/src/sections/search/actions/search.js
  6. 5
      code/web/client/src/sections/search/containers/index.js
  7. 31
      code/web/client/src/sections/search/containers/search.js
  8. 16
      code/web/client/src/sections/search/containers/style.less
  9. 15
      code/web/client/src/sections/search/index.js
  10. 16
      code/web/client/src/sections/search/nav-item.js
  11. 5
      code/web/client/src/sections/search/reducers/index.js
  12. 12
      code/web/client/src/sections/search/routes.js
  13. 3
      code/web/client/src/sections/search/style.less

4
code/web/client/src/app.js

@ -3,7 +3,7 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import Layout from './layout'; import Layout from './layout';
import Auth from './sections/auth'; import Auth from './sections/auth';
import Example from './sections/example'; import Search from './sections/search';
const App = props => { const App = props => {
const { projectName } = props const { projectName } = props
@ -15,7 +15,7 @@ const App = props => {
return ( return (
<Layout <Layout
title={projectName} title={projectName}
sections={[Auth, Example]} sections={[Auth, Search]}
/> />
) )
} }

49
code/web/client/src/layout/containers/layout/index.js

@ -24,7 +24,7 @@ NProgress.configure({
</div> </div>
` `
}); });
const headerHeight = 64 const headerHeight = 32
const footerHeight = 0 const footerHeight = 0
let scrollbar let scrollbar
@ -32,7 +32,7 @@ const LayoutContainer = props => {
const { dispatch, msg, user, copyright, children, sections, clientWidth, clientHeight, const { dispatch, msg, user, copyright, children, sections, clientWidth, clientHeight,
location, match, routes, history } = props location, match, routes, history } = props
const [themeName, setThemeName] = useState(localStorage.getItem("theme-name") || 'light') const [themeName, setThemeName] = useState(localStorage.getItem("theme-name") || 'light')
const [collapsed, setCollapsed] = useState(false) const [collapsed, setCollapsed] = useState(true)
NProgress.start(); NProgress.start();
@ -77,9 +77,9 @@ const LayoutContainer = props => {
let contentStyle = { let contentStyle = {
position: 'relative', position: 'relative',
margin: '12px 12px 0px', margin: '1px 1px 0px',
padding: '8px', padding: '1px',
height: clientHeight - 16 + 68, height: clientHeight + 68,
} }
if (themeName == 'light') { if (themeName == 'light') {
contentStyle.background = '#fff'; contentStyle.background = '#fff';
@ -91,10 +91,10 @@ const LayoutContainer = props => {
<Header <Header
user={user} user={user}
pathname={location.pathname} pathname={location.pathname}
toggleCollapsed={() => { // toggleCollapsed={() => {
setCollapsed(!collapsed); // setCollapsed(!collapsed);
resize(!collapsed) // resize(!collapsed)
}} // }}
changeTheme={(themeName) => { changeTheme={(themeName) => {
setThemeName(themeName) setThemeName(themeName)
}} }}
@ -103,29 +103,30 @@ const LayoutContainer = props => {
/> />
</Layout.Header> </Layout.Header>
<Layout> <Layout>
<Layout.Sider trigger={null} collapsible collapsed={collapsed} theme={themeName}> {
{/* <div style={{ false ? (
<Layout.Sider trigger={null} collapsible collapsed={collapsed} theme={themeName}>
{/* <div style={{
height: headerHeight, height: headerHeight,
textAlign: 'center', textAlign: 'center',
lineHeight: headerHeight + 'px' lineHeight: headerHeight + 'px'
}}> }}>
LOGO LOGO
</div> */} </div> */}
<Sider <Sider
sections={sections} sections={sections}
dispatch={dispatch} dispatch={dispatch}
user={user} user={user}
pathname={location.pathname} pathname={location.pathname}
collapsed={collapsed} collapsed={collapsed}
themeName={themeName} themeName={themeName}
/> />
</Layout.Sider> </Layout.Sider>
) : null
}
<Layout.Content id="page-content" style={contentStyle}> <Layout.Content id="page-content" style={contentStyle}>
<div style={{ minWidth: 520 }}> <div style={{ minWidth: 520 }}>
<div style={{ padding: '0px 16px 4px', borderBottom: '1px solid #e8e8e8' }}> <div style={{ paddingTop: 6 }}>
<Breadcrumbs routes={routes} />
</div>
<div style={{ paddingTop: 12 }}>
{children} {children}
</div> </div>
</div> </div>

2
code/web/client/src/sections/auth/containers/login.js

@ -27,7 +27,7 @@ const Login = props => {
useEffect(() => { useEffect(() => {
if (user && user.authorized) { if (user && user.authorized) {
dispatch(push('/workflow/application')); dispatch(push('/search'));
} }
}, [user]) }, [user])

7
code/web/client/src/sections/search/actions/index.js

@ -0,0 +1,7 @@
'use strict';
import * as search from './search'
export default {
...search
}

15
code/web/client/src/sections/search/actions/search.js

@ -0,0 +1,15 @@
'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function getMembersW(orgId) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_MEMBERS',
url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`,
msg: { error: '获取用户列表失败' },
reducer: { name: 'members' }
});
}

5
code/web/client/src/sections/search/containers/index.js

@ -0,0 +1,5 @@
'use strict';
import Search from './search';
export { Search };

31
code/web/client/src/sections/search/containers/search.js

@ -0,0 +1,31 @@
import React, { useEffect } from 'react';
import { connect } from 'react-redux';
import { Spin, Card, Input } from 'antd';
import '../style.less';
import './style.less';
const Search = (props) => {
const { dispatch, actions, user, loading } = props
useEffect(() => {
// dispatch(actions.search.getMembersW(user.orgId))
}, [])
return (
<div className="parent">
<Input className="search" type="text" placeholder=" "></Input>
</div>
)
}
function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
members: members.data
};
}
export default connect(mapStateToProps)(Search);

16
code/web/client/src/sections/search/containers/style.less

@ -0,0 +1,16 @@
.search {
width: 200px;
height: 30px;
font: 16px arial,sans-serif;
// margin:auto;
}
.search:hover, .search:focus {
outline: none;
box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.parent{
display:flex;
justify-content: center;
align-items: center;
}

15
code/web/client/src/sections/search/index.js

@ -0,0 +1,15 @@
'use strict';
import reducers from './reducers';
import routes from './routes';
import actions from './actions';
import { getNavItem } from './nav-item';
export default {
key: 'search',
name: '搜索',
reducers: reducers,
routes: routes,
actions: actions,
getNavItem: getNavItem
};

16
code/web/client/src/sections/search/nav-item.js

@ -0,0 +1,16 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { SettingOutlined } from '@ant-design/icons';
const SubMenu = Menu.SubMenu;
export function getNavItem(user, dispatch) {
return (
<SubMenu key="search" icon={<SettingOutlined />} title={'举个栗子'}>
<Menu.Item key="e1">
<Link to="/search/e1">举个棒子</Link>
</Menu.Item>
</SubMenu>
);
}

5
code/web/client/src/sections/search/reducers/index.js

@ -0,0 +1,5 @@
'use strict';
export default {
}

12
code/web/client/src/sections/search/routes.js

@ -0,0 +1,12 @@
'use strict';
import { Search, } from './containers';
export default [{
type: 'inner',
route: {
path: '/search',
key: 'search',
breadcrumb: '搜索引擎',
component: Search
}
}];

3
code/web/client/src/sections/search/style.less

@ -0,0 +1,3 @@
#example:hover {
font-size: larger;
}
Loading…
Cancel
Save