mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
move the function of switching desktop/mobile page to frontend
This commit is contained in:
+5
-1
@@ -5,7 +5,11 @@
|
||||
<script>
|
||||
export default {
|
||||
created() {
|
||||
location.href = '../mobile/'
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
window.location.replace('../mobile/');
|
||||
} else {
|
||||
window.location.replace('../mobile.html');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import uaParser from 'ua-parser-js';
|
||||
|
||||
function isMobileDevice() {
|
||||
if (!navigator.userAgent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uaParseRet = uaParser(navigator.userAgent);
|
||||
|
||||
if (!uaParseRet || !uaParseRet.device) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const device = uaParseRet.device;
|
||||
|
||||
if (device.type === 'mobile' || device.type === 'tablet' || device.type === 'wearable' || device.type === 'embedded') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function navigate(type) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
window.location.replace(`${type}/`);
|
||||
} else {
|
||||
window.location.replace(`${type}.html`);
|
||||
}
|
||||
}
|
||||
|
||||
if (isMobileDevice()) {
|
||||
navigate('mobile');
|
||||
} else {
|
||||
navigate('desktop');
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
<meta name="apple-mobile-web-app-title" content="ezBookkeeping"/>
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default"/>
|
||||
<meta name="theme-color" content="#c67e48">
|
||||
<meta name="format-detection" content="telephone=no"/>
|
||||
<meta name="description" content="ezBookkeeping is a lightweight personal bookkeeping app hosted by yourself.">
|
||||
<title>ezBookkeeping</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="apple-touch-icon" href="touchicon.png">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but ezBookkeeping doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user