import Router from 'react-router/lib/Router'; import Link from 'react-router/lib/Link'; import browserHistory from 'react-router/lib/browserHistory'; import '../../less/prolibrary/prolibrary.less'; import eventProxy from '../../../plugin/reactcommon/myreflux'; import { Layout, Menu, Breadcrumb, Icon } from 'antd'; const { Header, Content, Footer, Sider } = Layout; const SubMenu = Menu.SubMenu; var domain = "//www."+window.supervar.domain; var apiUrl="//www."+window.supervar.domain+"/product-admin/"; let moduleName = ['prolibrary','promotion','shop']; /* your logic code */ class MyContent extends React.Component{ constructor(props){ super(props); var childlist=[]; this.state={ childlist:childlist, index:0, userName:'', collapsed: false, mode: 'inline', target:'' } } componentWillMount(){ let target = ''; for(let m=0;m res.json()).then(data=>{ if(data.state==0){ eventProxy.trigger('getUserInfo',{userName:data.username}); for(let i=0;i console.log("menu is loading failed",ex)); } onCollapse = (collapsed) => { this.setState({ collapsed, mode: collapsed ? 'vertical' : 'inline', }); } logoutHandle(){ fetch(`${apiUrl}pub/auth/logout`,{ method:'GET', credentials: "include", }).then(res=> {return res.json();}).then(data=> { if(data.state==0){ window.location.href=`${domain}/newadmin/login/`; //alert('登录成功') }else{ alert('退出失败:'+data.msg); } }) } render(){ var self=this; return(
Superbuy商品管理系统
退出
{!this.state.childlist.length || this.state.childlist[Number(this.state.index)].childs.map(function (data,index) { return( data.childs&&data.childs.length>0? {data.name}} > {data.childs.map(function (data2,index2) { return ({data2.name}); })} : {data.name} ) })} 欢迎:{this.state.userName}
{this.props.children}
Superbuy Design @2017. Powered By Ant. Created by CodeLai Derek NeroZhang Rex Roy Selina Simon WillLi.
) } } var routes = { path: '/newadmin/<%= myrouter %>/', component: MyContent, childRoutes: [ <% for(var i=0;i{ path: "<%= link %>", getComponent: (nextState, cb) => { require.ensure([], (require) => { cb(null, require("<%= req %>")); },"<%= file %>") } },<% } } }else{ link=childlist[i].link; req=childlist[i].req; file=childlist[i].file; if(req){ %>{ path: "<%= link %>", getComponent: (nextState, cb) => { require.ensure([], (require) => { cb(null, require("<%= req %>")); },"<%= file %>") } },<% } } }%> ] } class Myrouter extends React.Component{ componentWillMount(){ document.getElementById("container").style.opacity=1; } render(){ return( ) } } ReactDOM.render( , document.getElementById("container") );