mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
feat: 添加chrome浏览器的判断
This commit is contained in:
parent
19059bb526
commit
b2f5f89aa5
@ -4,6 +4,8 @@ import { connect } from 'react-redux';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Route, BrowserRouter as Router } from 'react-router-dom';
|
import { Route, BrowserRouter as Router } from 'react-router-dom';
|
||||||
import { Home, Group, Project, Follows, AddProject, Login } from './containers/index';
|
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 User from './containers/User/User.js';
|
||||||
import Header from './components/Header/Header';
|
import Header from './components/Header/Header';
|
||||||
import Footer from './components/Footer/Footer';
|
import Footer from './components/Footer/Footer';
|
||||||
@ -14,6 +16,14 @@ import { requireAuthentication } from './components/AuthenticatedComponent';
|
|||||||
|
|
||||||
const LOADING_STATUS = 0;
|
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(
|
@connect(
|
||||||
state => {
|
state => {
|
||||||
return {
|
return {
|
||||||
@ -59,6 +69,7 @@ export default class App extends Component {
|
|||||||
}}>
|
}}>
|
||||||
<div className="g-main">
|
<div className="g-main">
|
||||||
<div className="router-main">
|
<div className="router-main">
|
||||||
|
{alertContent()}
|
||||||
{this.props.loginState !== 1 ? <Header /> : null}
|
{this.props.loginState !== 1 ? <Header /> : null}
|
||||||
<div className="router-container">
|
<div className="router-container">
|
||||||
<Route exact path="/" component={Home} />
|
<Route exact path="/" component={Home} />
|
||||||
|
Loading…
Reference in New Issue
Block a user