From d720795ec4826b06c45e03a584123985983fbd6e Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 30 Dec 2025 16:08:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=89=8D=E7=AB=AF):=20`@haina/utils-p?= =?UTF-8?q?agespy`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +++ src/components/LogUploader.jsx | 3 ++- src/utils/pagespy.js | 11 ++++++++++- src/views/AuthApp.jsx | 5 +++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 36a12e2..dc6403e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/LogUploader.jsx b/src/components/LogUploader.jsx index cd35f83..c767be1 100644 --- a/src/components/LogUploader.jsx +++ b/src/components/LogUploader.jsx @@ -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); diff --git a/src/utils/pagespy.js b/src/utils/pagespy.js index 200cbae..f1a1c5e 100644 --- a/src/utils/pagespy.js +++ b/src/utils/pagespy.js @@ -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') } - } \ No newline at end of file + } diff --git a/src/views/AuthApp.jsx b/src/views/AuthApp.jsx index 0ebd155..225971f 100644 --- a/src/views/AuthApp.jsx +++ b/src/views/AuthApp.jsx @@ -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)