MonitorNotify.jsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React, {Component} from 'react';
  2. import {Layout, Menu} from 'antd';
  3. import CaseNotification from "../common/caseNotification/CaseNotification";
  4. import Notification from "./notification/Notification";
  5. import GraphqlTrigger from "./graphqlTrigger/GraphqlTrigger";
  6. import StockSignal from "./stockSignal/StockSignal";
  7. const { Content } = Layout;
  8. class MonitorNotify extends Component {
  9. constructor() {
  10. super();
  11. this.state = {
  12. menuLevel2: "notification",
  13. }
  14. }
  15. switchMenu = (menuName, e) => {
  16. console.log('menuName', menuName, 'e', e);
  17. this.setState({
  18. [menuName]: e.key,
  19. });
  20. };
  21. render() {
  22. return (
  23. <div>
  24. <Menu
  25. mode="horizontal"
  26. defaultSelectedKeys={['notification']}
  27. style={{padding: '0 24px', position: 'fixed', width: '100%', zIndex: '1'}}
  28. onClick={(e) => this.switchMenu('menuLevel2', e)}
  29. selectedKeys={[this.state.menuLevel2]}
  30. >
  31. <Menu.Item key="notification">notification</Menu.Item>
  32. <Menu.Item key="graphql-trigger">graphql trigger</Menu.Item>
  33. <Menu.Item key="stock-signal">stock signal</Menu.Item>
  34. </Menu>
  35. <Layout style={{ padding: '24px', zIndex: '0'}}>
  36. <Content style={{ padding: '24px', minHeight: 280, background: '#fff',marginTop: '48px' }}>
  37. {(() => {
  38. switch (this.state.menuLevel2) {
  39. case 'notification':
  40. return <Notification />;
  41. case 'graphql-trigger':
  42. return <GraphqlTrigger />;
  43. case 'stock-signal':
  44. return <StockSignal />;
  45. default:
  46. return <Notification />
  47. }
  48. })()}
  49. </Content>
  50. </Layout>
  51. </div>
  52. )
  53. }
  54. }
  55. export default MonitorNotify;