feat: 添加chrome浏览器的判断

This commit is contained in:
wenbo.dong 2017-10-12 17:01:58 +08:00
parent 19059bb526
commit b2f5f89aa5

View File

@ -4,6 +4,8 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { Route, BrowserRouter as Router } from 'react-router-dom';
import { Home, Group, Project, Follows, AddProject, Login } from './containers/index';
import { Alert } from 'antd';
import { Link } from 'react-router-dom'
import User from './containers/User/User.js';
import Header from './components/Header/Header';
import Footer from './components/Footer/Footer';
@ -14,6 +16,14 @@ import { requireAuthentication } from './components/AuthenticatedComponent';
const LOADING_STATUS = 0;
const alertContent = () => {
const ua = window.navigator.userAgent,
isChrome = ua.indexOf("Chrome") && window.chrome;
if (!isChrome) {
return <Alert style={{zIndex: 99}} message={'YApi 的插件、接口测试等功能仅支持 Chrome 浏览器,请使用 Chrome 浏览器获得完整功能。'} banner closable />
}
}
@connect(
state => {
return {
@ -59,6 +69,7 @@ export default class App extends Component {
}}>
<div className="g-main">
<div className="router-main">
{alertContent()}
{this.props.loginState !== 1 ? <Header /> : null}
<div className="router-container">
<Route exact path="/" component={Home} />