| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import React, {Component} from 'react'
- import {withRouter, Route, Switch} from 'react-router-dom'
- import Shop from './shop'
- import Goods from './goods'
- import Orders from './orders'
- import Admin from './admin'
- class Manage extends Component {
- constructor(props) {
- super(props)
- this.state = {
- page: ''
- }
- }
- componentWillMount() {
- let {location} = this.props
- if (location && location.state) {
- this.props.history.replace({
- pathname: '/my/manage/' + location.state.page,
- state: {}
- })
- }
- }
- render() {
- return (
- <div className='manage-wrap'>
- <Switch>
- <Route exact path="/my/manage" component={Orders}/>
- <Route path="/my/manage/shop" component={Shop}/>
- <Route path="/my/manage/goods" component={Goods}/>
- <Route path="/my/manage/orders" component={Orders}/>
- <Route path="/my/manage/admin" component={Admin}/>
- <Route path="/my/manage/*" component={Orders}/>
- </Switch>
- </div>
- )
- }
- }
- export default withRouter(Manage)
|