mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
fix: 修复group路由问题
This commit is contained in:
parent
fc5abce8d8
commit
901c80846c
@ -45,7 +45,9 @@ export default class App extends Component {
|
|||||||
<div className="router-main">
|
<div className="router-main">
|
||||||
<Header />
|
<Header />
|
||||||
<Route path="/" component={Home} exact />
|
<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="/Interface" component={requireAuthentication(Interface)} />
|
||||||
<Route path="/user" component={requireAuthentication(User)} />
|
<Route path="/user" component={requireAuthentication(User)} />
|
||||||
<Route path="/News" component={requireAuthentication(News)} />
|
<Route path="/News" component={requireAuthentication(News)} />
|
||||||
|
@ -68,6 +68,8 @@ export default class GroupList extends Component {
|
|||||||
this.props.history.replace(`${currGroup.group_name}`);
|
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);
|
console.log(currGroup);
|
||||||
this.setState({groupList: this.props.groupList});
|
this.setState({groupList: this.props.groupList});
|
||||||
|
@ -2,9 +2,18 @@ import React, { Component } from 'react'
|
|||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { Row, Col, Menu, AutoComplete, Input, Icon } from 'antd'
|
import { Row, Col, Menu, AutoComplete, Input, Icon } from 'antd'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { connect } from 'react-redux'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
const Option = AutoComplete.Option;
|
const Option = AutoComplete.Option;
|
||||||
|
@connect(
|
||||||
|
state => {
|
||||||
|
console.log(state);
|
||||||
|
return {
|
||||||
|
curUid: state.user.curUid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
class LeftMenu extends Component {
|
class LeftMenu extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
@ -16,6 +25,9 @@ class LeftMenu extends Component {
|
|||||||
this.interval = null;
|
this.interval = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
curUid: PropTypes.string
|
||||||
|
}
|
||||||
|
|
||||||
//延迟搜索
|
//延迟搜索
|
||||||
handleSearch = (value) => {
|
handleSearch = (value) => {
|
||||||
@ -51,7 +63,7 @@ class LeftMenu extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const menus = [{
|
const menus = [{
|
||||||
title: '个人资料',
|
title: '个人资料',
|
||||||
path: "/user/profile/" + 107
|
path: `/user/profile/${this.props.curUid}`
|
||||||
}, {
|
}, {
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
path: '/user/list'
|
path: '/user/list'
|
||||||
|
@ -9,7 +9,10 @@ export default () => {
|
|||||||
<div className="router-main">
|
<div className="router-main">
|
||||||
<Header/>
|
<Header/>
|
||||||
<Route path="/" component={ Home } exact />
|
<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="/Interface" component={ Interface } />
|
||||||
<Route path="/user" component={User} />
|
<Route path="/user" component={User} />
|
||||||
<Route path="/News" component={ News } />
|
<Route path="/News" component={ News } />
|
||||||
|
Loading…
Reference in New Issue
Block a user