import React, {Component} from 'react';

import {Layout, Menu} from 'antd';

import WechatConfig from "./wechatConfig/WechatConfig";
import Deploy from "../common/deploy/Deploy";
import WechatManage from "./wechatManage/WechatManage";

const { Content } = Layout;

class WechatService extends Component {
    constructor() {
        super();
        this.state = {
            menuLevel3: "wechat-config",
        }
    }

    switchMenu = (menuName, e) => {
        // console.log('menuName', menuName, 'e', e);
        this.setState({
            [menuName]: e.key,
        });
    };

    render() {
        return (
            <div>
                <Menu
                    mode="horizontal"
                    defaultSelectedKeys={['wechat-config']}
                    style={{padding: '0 24px', position: 'fixed', width: '100%', zIndex: '1',lineHeight:'50px',fontWeight:600}}
                    onClick={(e) => this.switchMenu('menuLevel3', e)}
                    selectedKeys={[this.state.menuLevel3]}
                >
                    <Menu.Item key="wechat-config">config settings</Menu.Item>
                    <Menu.Item key="wechat-deploy">deploy settings</Menu.Item>
                    <Menu.Item key="wechat-manage">manage</Menu.Item>
                </Menu>

                <Layout style={{ padding: '24px', zIndex: '0'}}>
                    <Content style={{ padding: '24px', minHeight: 280, background: '#fff',marginTop: '48px'  }}>
                        {(() => {
                            switch (this.state.menuLevel3) {
                                case 'wechat-config':
                                    return <WechatConfig />;
                                case 'wechat-deploy':
                                    return <Deploy />;
                                case 'wechat-manage':
                                    return <WechatManage />;
                                default:
                                    return <WechatConfig />
                            }
                        })()}
                    </Content>
                </Layout>
            </div>
        )
    }
}

export default WechatService;