mirror of https://github.com/openspug/spug
U 优化移动设备访问体验
parent
f91060ddaf
commit
01cc1ca8c7
|
@ -9,7 +9,7 @@
|
||||||
name="description"
|
name="description"
|
||||||
content="Web site created using create-react-app"
|
content="Web site created using create-react-app"
|
||||||
/>
|
/>
|
||||||
<link rel="apple-touch-icon" href="logo192.png" />
|
<link rel="apple-touch-icon" href="logo.png" />
|
||||||
<!--
|
<!--
|
||||||
manifest.json provides metadata used when your web app is installed on a
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
work correctly both with client-side routing and a non-root public URL.
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
<title>Spug O & M management system</title>
|
<title>Spug</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
|
@ -5,13 +5,13 @@
|
||||||
*/
|
*/
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Switch, Route } from 'react-router-dom';
|
import { Switch, Route } from 'react-router-dom';
|
||||||
import { Layout } from 'antd';
|
import { Layout, message } from 'antd';
|
||||||
import { NotFound } from 'components';
|
import { NotFound } from 'components';
|
||||||
import Sider from './Sider';
|
import Sider from './Sider';
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
import Footer from './Footer'
|
import Footer from './Footer'
|
||||||
import routes from '../routes';
|
import routes from '../routes';
|
||||||
import { hasPermission } from 'libs';
|
import { hasPermission, isMobile } from 'libs';
|
||||||
import styles from './layout.module.less';
|
import styles from './layout.module.less';
|
||||||
|
|
||||||
function initRoutes(Routes, routes) {
|
function initRoutes(Routes, routes) {
|
||||||
|
@ -31,6 +31,10 @@ export default function () {
|
||||||
const [Routes, setRoutes] = useState([]);
|
const [Routes, setRoutes] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (isMobile) {
|
||||||
|
setCollapsed(true);
|
||||||
|
message.warn('检测到您在移动设备上访问,请使用横屏模式。', 5)
|
||||||
|
}
|
||||||
const Routes = [];
|
const Routes = [];
|
||||||
initRoutes(Routes, routes);
|
initRoutes(Routes, routes);
|
||||||
setRoutes(Routes)
|
setRoutes(Routes)
|
||||||
|
|
|
@ -10,6 +10,7 @@ let Permission = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export let X_TOKEN;
|
export let X_TOKEN;
|
||||||
|
export const isMobile = /Android|iPhone/i.test(navigator.userAgent)
|
||||||
|
|
||||||
export function updatePermissions() {
|
export function updatePermissions() {
|
||||||
X_TOKEN = localStorage.getItem('token');
|
X_TOKEN = localStorage.getItem('token');
|
||||||
|
|
Loading…
Reference in New Issue