refactor(前端): `@haina/utils-pagespy`

main
Lei OT 4 months ago
parent 2bb45fb16a
commit d720795ec4

@ -12,6 +12,9 @@
"dependencies": {
"@ant-design/icons": "^6.0.0",
"@dckj/react-better-modal": "^0.1.2",
"@haina/utils-commons": "http://202.103.68.93:9000/npm/utils-commons-0.1.0.tgz",
"@haina/utils-pagespy": "http://202.103.68.93:9000/npm/utils-pagespy-0.1.1.tgz",
"@haina/utils-request": "http://202.103.68.93:9000/npm/utils-request-0.1.0.tgz",
"@lexical/code": "^0.34.0",
"@lexical/hashtag": "^0.34.0",
"@lexical/html": "^0.34.0",

@ -2,7 +2,8 @@ import { useState } from "react";
import { Popover, message, FloatButton, Button, Form, Input } from "antd";
import { BugOutlined } from "@ant-design/icons";
import useAuthStore from '@/stores/AuthStore'
import { uploadPageSpyLog, sendNotify } from "@/utils/pagespy";
import { sendNotify } from "@/utils/pagespy";
import { uploadPageSpyLog } from "@haina/utils-pagespy";
function LogUploader() {
const [open, setOpen] = useState(false);

@ -3,6 +3,9 @@ import { fetchJSON } from '@/utils/request'
import { readWebsocketLog } from '@/utils/indexedDB'
import { BUILD_VERSION, BUILD_DATE } from '@/config'
/**
* @deprecated
*/
export const loadPageSpy = (title) => {
if (import.meta.env.DEV || window.$pageSpy) return
@ -46,6 +49,9 @@ export const loadPageSpy = (title) => {
})
}
/**
* @deprecated
*/
export const uploadPageSpyLog = async () => {
// window.$pageSpy.triggerPlugins('onOfflineLog', 'upload');
// if (window.$pageSpy) {
@ -92,6 +98,9 @@ export const sendNotify = async (message) => {
});
};
/**
* @deprecated
*/
const uploadLog = async () => {
await readWebsocketLog()
if (window.$pageSpy) {
@ -113,4 +122,4 @@ export const sendNotify = async (message) => {
} else {
messageApi.error('Failure')
}
}
}

@ -15,7 +15,7 @@ import 'dayjs/locale/zh-cn'
import { useEffect } from 'react'
import { Outlet, useHref, useNavigate } from 'react-router-dom'
import { appendRequestHeader } from '@/utils/request'
import { loadPageSpy } from '@/utils/pagespy'
import { loadPageSpy } from '@haina/utils-pagespy'
import AppLogo from '@/assets/highlights_travel_300_300.png'
import '@/assets/App.css'
@ -26,6 +26,7 @@ import { useGlobalNotify } from '@/hooks/useGlobalNotify'
import GeneratePaymentDrawer from './Conversations/Online/Components/GeneratePaymentDrawer'
import GenerateAutoDocDrawer from './Conversations/Online/Components/GenerateAutoDocDrawer'
import LogUploader from '@/components/LogUploader'
import { BUILD_VERSION } from '@/config'
const fetchEmailWorker = new Worker(FetchEmailWorker, { type: 'module' });
@ -55,7 +56,7 @@ function AuthApp() {
let _fetchEmailWorker;
if (loginUser.userId > 0) {
appendRequestHeader('X-User-Id', loginUser.userId)
loadPageSpy(loginUser.username)
loadPageSpy(loginUser.username + '(v' + BUILD_VERSION + ')', 'Sales CRM', true)
connectWebsocket(loginUser.userId)
fetchInitialData(loginUser)

Loading…
Cancel
Save