mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-18 15:20:25 +08:00
fix: 修复版本提醒功能bug和默认在新版本开启了版本提醒功能
This commit is contained in:
parent
ccaa32a507
commit
6dab1df55e
@ -69,7 +69,8 @@ plugin.emitHook('app_route', AppRoute);
|
||||
@connect(
|
||||
state => {
|
||||
return {
|
||||
loginState: state.user.loginState
|
||||
loginState: state.user.loginState,
|
||||
curUserRole: state.user.role
|
||||
};
|
||||
},
|
||||
{
|
||||
@ -86,7 +87,8 @@ export default class App extends Component {
|
||||
|
||||
static propTypes = {
|
||||
checkLoginState: PropTypes.func,
|
||||
loginState: PropTypes.number
|
||||
loginState: PropTypes.number,
|
||||
curUserRole: PropTypes.string
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@ -110,7 +112,7 @@ export default class App extends Component {
|
||||
<Router getUserConfirmation={this.showConfirm}>
|
||||
<div className="g-main">
|
||||
<div className="router-main">
|
||||
{process.env.versionNotify && <Notify />}
|
||||
{this.props.curUserRole === 'admin' && <Notify />}
|
||||
{alertContent()}
|
||||
{this.props.loginState !== 1 ? <Header /> : null}
|
||||
<div className="router-container">
|
||||
|
@ -7,14 +7,14 @@ export default class Notify extends Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
newVersion: process.env.version,
|
||||
version: process.env.version
|
||||
version: 'v1.0'
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
axios.get('http://yapi.demo.qunar.com/publicapi/versions').then(req => {
|
||||
axios.get('https://www.easy-mock.com/mock/5c2851e3d84c733cb500c3b9/yapi/versions').then(req => {
|
||||
if (req.status === 200) {
|
||||
this.setState({ newVersion: req.data[0].version });
|
||||
this.setState({ newVersion: req.data.data[0] });
|
||||
} else {
|
||||
message.error('无法获取新版本信息!');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user