import React from 'react';
import { Menu, Icon } from 'antd';
import './leftTab.less';
const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup;
import { getMenu } from './publicMenu.js'
const LeftTab = React.createClass({
getInitialState() {
return {
current: '',
subKey: '',
};
},
handleClick(e) {
this.props.handlekey(e.key);
this.setState({
current: e.key,
});
},
componentWillMount() {
let me_ = this;
var ids = window.location.href.indexOf('rid=')
var idk = window.location.href.substr(ids + 4)
var rid = idk.split('#')
var menu = getMenu(rid);
let cur, sub, sut;
if (rid.length > 1) {
for (var h = 0; h < menu.length; h++) {
if (menu[h].subMenus.length) {
menu[h].subMenus.map(function (atem) {
let urls = atem.url.split('#')
if (rid[1] == urls[1]) {
sut = menu[h].url;
return false
}
})
}
}
};
if (menu[0].subMenus.length) {
cur = menu[0].subMenus[0].url.split('#');
sub = menu[0].url;
} else {
cur = menu[0].url.split('#');
sub = ''
};
this.setState({
current: rid.length > 1 ? rid[1] : cur[1],
subKey: rid.length > 1 ? sut : sub
});
var htmlMenu = [];
for (var j = 0; j < menu.length; j++) {
if (menu[j].subMenus.length) {
htmlMenu.push(