feat: 增加上传PageSpy离线日志

main
Jimmy Liow 10 months ago
parent ff8c072e07
commit 4671179614

@ -1,6 +1,6 @@
import { Outlet, Link, useHref, useNavigate, NavLink } from 'react-router-dom'
import { useEffect, useState } from 'react'
import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, App as AntApp } from 'antd'
import { Layout, Menu, ConfigProvider, theme, Dropdown, FloatButton, Space, Row, Col, Badge, App as AntApp } from 'antd'
import { DownOutlined } from '@ant-design/icons'
import 'antd/dist/reset.css'
import AppLogo from '@/assets/logo-gh.png'
@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next'
import zhLocale from 'antd/locale/zh_CN'
import enLocale from 'antd/locale/en_US'
import 'dayjs/locale/zh-cn'
import { BugOutlined } from "@ant-design/icons"
import ErrorBoundary from '@/components/ErrorBoundary'
import { BUILD_VERSION, } from '@/config'
import useNoticeStore from '@/stores/Notice'
@ -33,6 +34,8 @@ function App() {
const { loginToken } = usingStorage()
const { message, notification } = AntApp.useApp()
const noticeUnRead = useNoticeStore((state) => state.noticeUnRead)
const href = useHref()
const navigate = useNavigate()
@ -59,6 +62,15 @@ function App() {
appendRequestParams('lgc', language)
}, [i18n.language])
const uploadLog = () => {
if (window.$pageSpy) {
window.$pageSpy.triggerPlugins('onOfflineLog', 'upload')
alert('Success.')
} else {
alert('Failure.')
}
}
return (
<ConfigProvider locale={antdLng}
theme={{
@ -70,6 +82,7 @@ function App() {
algorithm: theme.defaultAlgorithm,
}}>
<AntApp>
<FloatButton icon={<BugOutlined />} onClick={() => uploadLog()} />
<ErrorBoundary>
<Layout className='min-h-screen'>
<Header className='sticky top-0 z-10 w-full'>

Loading…
Cancel
Save