You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Global-sales/src/utils/pagespy.js

26 lines
1.0 KiB
JavaScript

import { loadScript } from '@/utils/commons';
import { BUILD_VERSION, BUILD_DATE } from '@/config'
export const loadPageSpy = (title) => {
if (import.meta.env.DEV || window.$pageSpy) return
const PageSpySrc = [
'https://page-spy.mycht.cn/page-spy/index.min.js', // +`?${BUILD_DATE}`,
'https://page-spy.mycht.cn/plugin/data-harbor/index.min.js', // +`?${BUILD_DATE}`,
'https://page-spy.mycht.cn/plugin/rrweb/index.min.js', // +`?${BUILD_DATE}`,
];
Promise.all(PageSpySrc.map((src) => loadScript(src))).then(() => {
// 注册插件
// window.$harbor = new DataHarborPlugin({ maximum: 0.2 * 1024 * 1024 });
// PageSpy.registerPlugin(window.$harbor);
PageSpy.registerPlugin(new DataHarborPlugin());
PageSpy.registerPlugin(new RRWebPlugin());
// 实例化 PageSpy
window.$pageSpy = new PageSpy({ api: 'page-spy.mycht.cn', project: 'Sales CRM', title: title + '(v' + BUILD_VERSION + ')', autoRender: false, offline: true, });
console.log('[PageSpy]', window.$pageSpy.version);
});
};