chore: PageSpy

feature/hotel-cruise
Lei OT 1 year ago
parent a7280a79b9
commit 00f0c1a7b1

@ -25,10 +25,20 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Hainatravel Dashboard</title>
<script crossorigin="anonymous" src="https://page-spy.mycht.cn/page-spy/index.min.js"></script>
<script crossorigin="anonymous" src="https://page-spy.mycht.cn/plugin/data-harbor/index.min.js"></script>
<script crossorigin="anonymous" src="https://page-spy.mycht.cn/plugin/rrweb/index.min.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script defer>
window.initPageSpy = function () {
PageSpy.registerPlugin(new DataHarborPlugin());
window.$pageSpy = new PageSpy({ api: 'page-spy.mycht.cn', project: 'Dashboard', title: window.__spytitle, autoRender: false, });
// console.log(window.$pageSpy.address.substring(0, 4)); // device ID
}
</script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

@ -16,7 +16,7 @@ import {
BarChartOutlined,
CoffeeOutlined,
} from '@ant-design/icons';
import { Layout, Menu, Image, Badge, } from 'antd';
import { Layout, Menu, Image, Badge, Button } from 'antd';
import { BrowserRouter, Route, Routes, NavLink } from 'react-router-dom';
import Home from './views/Home';
import Dashboard from './views/Dashboard';
@ -154,8 +154,11 @@ const App = () => {
];
const callDebug = () => {
const vConsole = new window.VConsole({ theme: 'dark' });
auth_store.get_auth();
// const vConsole = new window.VConsole({ theme: 'dark' });
// auth_store.get_auth();
// window.$pageSpy.render();
window.$pageSpy.triggerPlugins('onOfflineLog', 'upload');
window.$pageSpy.triggerPlugins('onOfflineLog', 'download');
};
return (
<BrowserRouter>
@ -250,7 +253,8 @@ const App = () => {
<span>
v<span>{APP_VERSION}</span>{' '}
</span>{' '}
©2022 <span onClick={callDebug}> Created by IT</span>
©2022 <span > Created by IT</span>
<Button type='link' onClick={callDebug}>上传/下载debug日志</Button>
</Footer>
</Layout>
</Layout>

@ -9,6 +9,7 @@ class AuthStore {
makeAutoObservable(this);
if (process.env.NODE_ENV === 'production') {
this.get_auth(); // 放到钉钉环境才能开启
window.initPageSpy();
}
}
@ -43,6 +44,7 @@ class AuthStore {
runInAction(() => {
_this.user = json.result;
_this.auth = json.result.authlist;
window.__spytitle = json.result.name;
});
})
.catch((error) => {

Loading…
Cancel
Save