fix: 修复group路由问题

This commit is contained in:
qitmac000249 2017-07-25 15:53:55 +08:00
parent fc5abce8d8
commit 901c80846c
4 changed files with 23 additions and 4 deletions

View File

@ -45,7 +45,9 @@ export default class App extends Component {
<div className="router-main">
<Header />
<Route path="/" component={Home} exact />
<Route path="/group/:groupName" component={requireAuthentication(ProjectGroups)} />
<Route path="/group" component={ ProjectGroups } >
<Route exact={false} path="/group/:groupName" component={ ProjectGroups } />
</Route>
<Route path="/Interface" component={requireAuthentication(Interface)} />
<Route path="/user" component={requireAuthentication(User)} />
<Route path="/News" component={requireAuthentication(News)} />

View File

@ -68,6 +68,8 @@ export default class GroupList extends Component {
this.props.history.replace(`${currGroup.group_name}`);
}
}
}else if(!groupName && this.props.groupList.length){
this.props.history.replace(`group/${this.props.groupList[0].group_name}`);
}
console.log(currGroup);
this.setState({groupList: this.props.groupList});

View File

@ -2,9 +2,18 @@ import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { Row, Col, Menu, AutoComplete, Input, Icon } from 'antd'
import axios from 'axios'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
const Option = AutoComplete.Option;
@connect(
state => {
console.log(state);
return {
curUid: state.user.curUid
}
}
)
class LeftMenu extends Component {
constructor(props) {
super(props)
@ -16,6 +25,9 @@ class LeftMenu extends Component {
this.interval = null;
}
static propTypes = {
curUid: PropTypes.string
}
//延迟搜索
handleSearch = (value) => {
@ -51,7 +63,7 @@ class LeftMenu extends Component {
render() {
const menus = [{
title: '个人资料',
path: "/user/profile/" + 107
path: `/user/profile/${this.props.curUid}`
}, {
title: '用户管理',
path: '/user/list'

View File

@ -9,7 +9,10 @@ export default () => {
<div className="router-main">
<Header/>
<Route path="/" component={ Home } exact />
<Route path="/group/:groupName" component={ ProjectGroups } />
<Route path="/group" component={ ProjectGroups } >
<Route exact={false} path="/group/:groupName" component={ ProjectGroups } />
</Route>
<Route path="/Interface" component={ Interface } />
<Route path="/user" component={User} />
<Route path="/News" component={ News } />