WxTrialCase.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import React, {Component} from 'react';
  2. import {Layout, Menu} from 'antd';
  3. import {FormattedMessage} from 'react-intl';
  4. import WxConfig from "./wxConfig/WxConfig";
  5. import WxDeploy from "../common/deploy/Deploy";
  6. import Manage from '../common/manage/Manage';
  7. const {Content} = Layout;
  8. class WxTrialCase extends Component {
  9. constructor() {
  10. super();
  11. this.state = {
  12. menuLevel3: "wechat-config",
  13. userID: 'ioobot'
  14. }
  15. }
  16. switchMenu = (menuName, e) => {
  17. this.setState({
  18. [menuName]: e.key,
  19. });
  20. };
  21. render() {
  22. let configID = this.props.location.state ? this.props.location.state.configID : "ecommerce_wxConfigID";
  23. let appName = this.props.location.state ? this.props.location.state.appName : "ecommerce";
  24. let projectID = this.props.location.state ? this.props.location.state.projectID : "";
  25. return (
  26. <div>
  27. <Menu
  28. mode="horizontal"
  29. defaultSelectedKeys={['wechat-config']}
  30. style={{
  31. padding: '0 24px',
  32. position: 'fixed',
  33. width: '100%',
  34. zIndex: '1',
  35. lineHeight: '50px',
  36. fontWeight: 600
  37. }}
  38. onClick={(e) => this.switchMenu('menuLevel3', e)}
  39. selectedKeys={[this.state.menuLevel3]}
  40. >
  41. <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
  42. <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
  43. <Menu.Item key="wechat-manage"><FormattedMessage id="manage"/></Menu.Item>
  44. </Menu>
  45. <Layout style={{padding: '24px', zIndex: '0'}}>
  46. <Content style={{padding: '24px', minHeight: 280, background: '#fff', marginTop: '48px'}}>
  47. {(() => {
  48. switch (this.state.menuLevel3) {
  49. case 'wechat-config':
  50. return <WxConfig projectID={projectID} defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} trialcase={true} history={this.props.history} location={this.props.location}/>;
  51. case 'wechat-deploy':
  52. return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
  53. case 'wechat-manage':
  54. return <Manage trialcase={true} userID={this.state.userID} configID={configID} switchMenu={this.switchMenu}/>;
  55. default:
  56. return <WxConfig/>
  57. }
  58. })()}
  59. </Content>
  60. </Layout>
  61. </div>
  62. )
  63. }
  64. }
  65. export default WxTrialCase;