69 lines
2.7 KiB
HTML
69 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<link rel="icon" type="image/svg+xml" href="/src/assets/logo.png" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>OPS-首页</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="app"></div>
|
|
<script type="module" src="/src/main.js"></script>
|
|
<script>
|
|
let companyId = localStorage.getItem('companyId')
|
|
if (companyId) {
|
|
function offline ()
|
|
{ //#铭品测试环境
|
|
// http://login.ops.f2b211.com/api/
|
|
//#铭品正式环境
|
|
// https://api.mingpin.f2b211.com/api/v1/Public/get/offline
|
|
//#正式代理
|
|
const pathurl = `https://proxy.ops.f2b211.com/api/v1/Public/get/offline?c=${companyId}`
|
|
//#测试代理
|
|
// const pathurl = `https://dev.proxy.ops.f2b211.com/api/v1/Public/get/offline?c=${companyId}`
|
|
|
|
// const pathrul = `https://login.ops.f2b211.com/api/v1/Public/get/offline?c=${companyId}`
|
|
fetch(pathurl,
|
|
{
|
|
method: 'GET',
|
|
credentials: 'include',
|
|
keepalive: true,
|
|
headers: {
|
|
Authorization: window.localStorage.getItem('userToken')
|
|
}
|
|
})
|
|
}
|
|
var ua = window.navigator.userAgent.toLowerCase();
|
|
var rkn = /\b(opera|chrome|webkit|safari|msie|firefox|gecko|qqbrowser|edg)\b(\s*(version|rv:|\/)*(\d+(\.\d+)*))?/g;
|
|
window.addEventListener('mouseover', function ()
|
|
{
|
|
window.removeEventListener('beforeunload', offline, true)
|
|
ua.replace(rkn, function (match, type, all, rv, version)
|
|
{
|
|
if (type == 'chrome' && parseInt(version) <= 86) {
|
|
window.removeEventListener('unload', offline, true)
|
|
}
|
|
})
|
|
})
|
|
window.addEventListener('mouseout', function ()
|
|
{
|
|
window.addEventListener('beforeunload', offline, true);
|
|
ua.replace(rkn, function (match, type, all, rv, version)
|
|
{
|
|
if (type == 'qqbrowser' || type == 'edg' || (type == 'chrome' && parseInt(version) <= 86)) {
|
|
window.addEventListener('unload', offline, true);
|
|
}
|
|
})
|
|
})
|
|
if (window.location.pathnam !== '/login') {
|
|
window.removeEventListener('beforeunload', offline)
|
|
window.removeEventListener('unload', offline)
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |