WxTrialCase.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import React, {Component} from 'react';
  2. import {Layout, Menu} from 'antd';
  3. import WxConfig from "./wxConfig/WxConfig";
  4. import WxDeploy from "../common/deploy/Deploy";
  5. import WxResult from './wxResult/WxResult';
  6. import {FormattedMessage} from 'react-intl';
  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.history.location.state ? this.props.history.location.state.configID : "ecommerce_wxConfigID";
  23. let appName = this.props.history.location.state ? this.props.history.location.state.appName : "ecommerce";
  24. return (
  25. <div>
  26. <Menu
  27. mode="horizontal"
  28. defaultSelectedKeys={['wechat-config']}
  29. style={{
  30. padding: '0 24px',
  31. position: 'fixed',
  32. width: '100%',
  33. zIndex: '1',
  34. lineHeight: '50px',
  35. fontWeight: 600
  36. }}
  37. onClick={(e) => this.switchMenu('menuLevel3', e)}
  38. selectedKeys={[this.state.menuLevel3]}
  39. >
  40. <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
  41. <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
  42. <Menu.Item key="wechat-result"><FormattedMessage id="result"/></Menu.Item>
  43. </Menu>
  44. <Layout style={{padding: '24px', zIndex: '0'}}>
  45. <Content style={{padding: '24px', minHeight: 280, background: '#fff', marginTop: '48px'}}>
  46. {(() => {
  47. switch (this.state.menuLevel3) {
  48. case 'wechat-config':
  49. return <WxConfig defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} trialcase={true} history={this.props.history} location={this.props.location}/>;
  50. case 'wechat-deploy':
  51. return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
  52. case 'wechat-result':
  53. return <WxResult/>;
  54. default:
  55. return <WxConfig/>
  56. }
  57. })()}
  58. </Content>
  59. </Layout>
  60. </div>
  61. )
  62. }
  63. }
  64. export default WxTrialCase;