移除use-error-log

This commit is contained in:
洛洛希雅 2024-04-25 08:41:05 +08:00
parent 32afd40532
commit cdcf846e58
3 changed files with 116 additions and 142 deletions

View File

@ -12,7 +12,6 @@ import { storeToRefs } from 'pinia/dist/pinia'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useBasicStore } from '@/store/basic' import { useBasicStore } from '@/store/basic'
import { useConfigStore } from '@/store/config' import { useConfigStore } from '@/store/config'
import { useErrorLog } from '@/hooks/use-error-log'
//reshow default setting //reshow default setting
import { toggleHtmlClass } from '@/theme/utils' import { toggleHtmlClass } from '@/theme/utils'
@ -24,10 +23,6 @@ onBeforeMount(() => {
//set tmp token when setting isNeedLogin false //set tmp token when setting isNeedLogin false
if (!settings.value.isNeedLogin) useBasicStore().setToken(settings.value.tmpToken) if (!settings.value.isNeedLogin) useBasicStore().setToken(settings.value.tmpToken)
}) })
onMounted(() => {
//lanch the errorLog collection
useErrorLog()
})
const route = useRoute() const route = useRoute()
onMounted(() => { onMounted(() => {
const { setTheme, theme, setSize, size, setLanguage, language } = useConfigStore() const { setTheme, theme, setSize, size, setLanguage, language } = useConfigStore()

View File

@ -1,32 +0,0 @@
/*js 错误日志收集*/
import { jsErrorCollection } from 'js-error-collection'
import pack from '../../package.json'
import settings from '@/settings'
import bus from '@/utils/bus'
import request from '@/utils/request'
const reqUrl = '/integration-front/errorCollection/insert'
const errorLogReq = (errLog: string) => {
request({
url: reqUrl,
data: {
pageUrl: window.location.href,
errorLog: errLog,
browserType: navigator.userAgent,
version: pack.version
},
method: 'post'
}).then(() => {
//通知错误列表页面更新数据
bus.emit('reloadErrorPage', {})
})
}
export const useErrorLog = () => {
//判断该环境是否需要收集错误日志,由settings配置决定
if (settings.errorLog?.includes(import.meta.env.VITE_APP_ENV)) {
jsErrorCollection({ runtimeError: true, rejectError: true, consoleError: true }, (errLog) => {
//判断是否是reqUrl错误避免死循环
if (!errLog.includes(reqUrl)) errorLogReq(errLog)
})
}
}

View File

@ -5,114 +5,125 @@
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
const EffectScope: typeof import('vue')['EffectScope'] const EffectScope: (typeof import('vue'))['EffectScope']
const buttonCodes: typeof import('../src/directives/button-codes')['default'] const buttonCodes: (typeof import('../src/directives/button-codes'))['default']
const casHandleChange: typeof import('../src/hooks/use-element')['casHandleChange'] const casHandleChange: (typeof import('../src/hooks/use-element'))['casHandleChange']
const clickoutside: typeof import('../src/directives/example/clickoutside.js')['default'] const clickoutside: (typeof import('../src/directives/example/clickoutside.js'))['default']
const cloneDeep: typeof import('../src/hooks/use-common')['cloneDeep'] const cloneDeep: (typeof import('../src/hooks/use-common'))['cloneDeep']
const closeElLoading: typeof import('../src/hooks/use-element')['closeElLoading'] const closeElLoading: (typeof import('../src/hooks/use-element'))['closeElLoading']
const codesPermission: typeof import('../src/directives/codes-permission')['default'] const codesPermission: (typeof import('../src/directives/codes-permission'))['default']
const computed: typeof import('vue')['computed'] const computed: (typeof import('vue'))['computed']
const copy: typeof import('../src/directives/example/copy.js')['default'] const copy: (typeof import('../src/directives/example/copy.js'))['default']
const copyValueToClipboard: typeof import('../src/hooks/use-common')['copyValueToClipboard'] const copyValueToClipboard: (typeof import('../src/hooks/use-common'))['copyValueToClipboard']
const createApp: typeof import('vue')['createApp'] const createApp: (typeof import('vue'))['createApp']
const customRef: typeof import('vue')['customRef'] const customRef: (typeof import('vue'))['customRef']
const debounce: typeof import('../src/directives/example/debounce.js')['default'] const debounce: (typeof import('../src/directives/example/debounce.js'))['default']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] const defineAsyncComponent: (typeof import('vue'))['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent'] const defineComponent: (typeof import('vue'))['defineComponent']
const directives: typeof import('../src/directives/index')['default'] const directives: (typeof import('../src/directives/index'))['default']
const effectScope: typeof import('vue')['effectScope'] const effectScope: (typeof import('vue'))['effectScope']
const elConfirm: typeof import('../src/hooks/use-element')['elConfirm'] const elConfirm: (typeof import('../src/hooks/use-element'))['elConfirm']
const elConfirmNoCancelBtn: typeof import('../src/hooks/use-element')['elConfirmNoCancelBtn'] const elConfirmNoCancelBtn: (typeof import('../src/hooks/use-element'))['elConfirmNoCancelBtn']
const elLoading: typeof import('../src/hooks/use-element')['elLoading'] const elLoading: (typeof import('../src/hooks/use-element'))['elLoading']
const elMessage: typeof import('../src/hooks/use-element')['elMessage'] const elMessage: (typeof import('../src/hooks/use-element'))['elMessage']
const elNotify: typeof import('../src/hooks/use-element')['elNotify'] const elNotify: (typeof import('../src/hooks/use-element'))['elNotify']
const freshRouter: typeof import('../src/hooks/use-permission')['freshRouter'] const freshRouter: (typeof import('../src/hooks/use-permission'))['freshRouter']
const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentInstance: (typeof import('vue'))['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope'] const getCurrentScope: (typeof import('vue'))['getCurrentScope']
const getLangInstance: typeof import('../src/hooks/use-common')['getLangInstance'] const getLangInstance: (typeof import('../src/hooks/use-common'))['getLangInstance']
const getQueryParam: typeof import('../src/hooks/use-self-router')['getQueryParam'] const getQueryParam: (typeof import('../src/hooks/use-self-router'))['getQueryParam']
const h: typeof import('vue')['h'] const h: (typeof import('vue'))['h']
const inject: typeof import('vue')['inject'] const inject: (typeof import('vue'))['inject']
const isExternal: typeof import('../src/hooks/use-layout')['isExternal'] const isExternal: (typeof import('../src/hooks/use-layout'))['isExternal']
const isProxy: typeof import('vue')['isProxy'] const isProxy: (typeof import('vue'))['isProxy']
const isReactive: typeof import('vue')['isReactive'] const isReactive: (typeof import('vue'))['isReactive']
const isReadonly: typeof import('vue')['isReadonly'] const isReadonly: (typeof import('vue'))['isReadonly']
const isRef: typeof import('vue')['isRef'] const isRef: (typeof import('vue'))['isRef']
const lang: typeof import('../src/directives/lang')['default'] const lang: (typeof import('../src/directives/lang'))['default']
const langTitle: typeof import('../src/hooks/use-common')['langTitle'] const langTitle: (typeof import('../src/hooks/use-common'))['langTitle']
const longpress: typeof import('../src/directives/example/longpress.js')['default'] const longpress: (typeof import('../src/directives/example/longpress.js'))['default']
const markRaw: typeof import('vue')['markRaw'] const markRaw: (typeof import('vue'))['markRaw']
const nextTick: typeof import('vue')['nextTick'] const nextTick: (typeof import('vue'))['nextTick']
const onActivated: typeof import('vue')['onActivated'] const onActivated: (typeof import('vue'))['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount'] const onBeforeMount: (typeof import('vue'))['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave'] const onBeforeRouteLeave: (typeof import('vue-router'))['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate'] const onBeforeRouteUpdate: (typeof import('vue-router'))['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] const onBeforeUnmount: (typeof import('vue'))['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] const onBeforeUpdate: (typeof import('vue'))['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated'] const onDeactivated: (typeof import('vue'))['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured'] const onErrorCaptured: (typeof import('vue'))['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted'] const onMounted: (typeof import('vue'))['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked'] const onRenderTracked: (typeof import('vue'))['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered'] const onRenderTriggered: (typeof import('vue'))['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose'] const onScopeDispose: (typeof import('vue'))['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch'] const onServerPrefetch: (typeof import('vue'))['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted'] const onUnmounted: (typeof import('vue'))['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated'] const onUpdated: (typeof import('vue'))['onUpdated']
const progressClose: typeof import('../src/hooks/use-permission')['progressClose'] const progressClose: (typeof import('../src/hooks/use-permission'))['progressClose']
const progressStart: typeof import('../src/hooks/use-permission')['progressStart'] const progressStart: (typeof import('../src/hooks/use-permission'))['progressStart']
const provide: typeof import('vue')['provide'] const provide: (typeof import('vue'))['provide']
const reactive: typeof import('vue')['reactive'] const reactive: (typeof import('vue'))['reactive']
const readonly: typeof import('vue')['readonly'] const readonly: (typeof import('vue'))['readonly']
const ref: typeof import('vue')['ref'] const ref: (typeof import('vue'))['ref']
const resetRouter: typeof import('../src/hooks/use-permission')['resetRouter'] const resetRouter: (typeof import('../src/hooks/use-permission'))['resetRouter']
const resetState: typeof import('../src/hooks/use-permission')['resetState'] const resetState: (typeof import('../src/hooks/use-permission'))['resetState']
const resizeHandler: typeof import('../src/hooks/use-layout')['resizeHandler'] const resizeHandler: (typeof import('../src/hooks/use-layout'))['resizeHandler']
const resolveComponent: typeof import('vue')['resolveComponent'] const resolveComponent: (typeof import('vue'))['resolveComponent']
const resolveDirective: typeof import('vue')['resolveDirective'] const resolveDirective: (typeof import('vue'))['resolveDirective']
const rolesPermission: typeof import('../src/directives/roles-permission')['default'] const rolesPermission: (typeof import('../src/directives/roles-permission'))['default']
const routeInfo: typeof import('../src/hooks/use-self-router')['routeInfo'] const routeInfo: (typeof import('../src/hooks/use-self-router'))['routeInfo']
const routerBack: typeof import('../src/hooks/use-self-router')['routerBack'] const routerBack: (typeof import('../src/hooks/use-self-router'))['routerBack']
const routerPush: typeof import('../src/hooks/use-self-router')['routerPush'] const routerPush: (typeof import('../src/hooks/use-self-router'))['routerPush']
const routerReplace: typeof import('../src/hooks/use-self-router')['routerReplace'] const routerReplace: (typeof import('../src/hooks/use-self-router'))['routerReplace']
const setRouterFromDatabase: typeof import('../src/hooks/use-permission')['setRouterFromDatabase'] const setRouterFromDatabase: (typeof import('../src/hooks/use-permission'))['setRouterFromDatabase']
const shallowReactive: typeof import('vue')['shallowReactive'] const shallowReactive: (typeof import('vue'))['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowReadonly: (typeof import('vue'))['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef'] const shallowRef: (typeof import('vue'))['shallowRef']
const sleepTimeout: typeof import('../src/hooks/use-common')['sleepTimeout'] const sleepTimeout: (typeof import('../src/hooks/use-common'))['sleepTimeout']
const storeToRefs: typeof import('pinia/dist/pinia')['storeToRefs'] const storeToRefs: (typeof import('pinia/dist/pinia'))['storeToRefs']
const toRaw: typeof import('vue')['toRaw'] const toRaw: (typeof import('vue'))['toRaw']
const toRef: typeof import('vue')['toRef'] const toRef: (typeof import('vue'))['toRef']
const toRefs: typeof import('vue')['toRefs'] const toRefs: (typeof import('vue'))['toRefs']
const toValue: typeof import('vue')['toValue'] const toValue: (typeof import('vue'))['toValue']
const triggerRef: typeof import('vue')['triggerRef'] const triggerRef: (typeof import('vue'))['triggerRef']
const unref: typeof import('vue')['unref'] const unref: (typeof import('vue'))['unref']
const useAttrs: typeof import('vue')['useAttrs'] const useAttrs: (typeof import('vue'))['useAttrs']
const useBasicStore: typeof import('../src/store/basic')['useBasicStore'] const useBasicStore: (typeof import('../src/store/basic'))['useBasicStore']
const useConfigStore: typeof import('../src/store/config')['useConfigStore'] const useConfigStore: (typeof import('../src/store/config'))['useConfigStore']
const useCssModule: typeof import('vue')['useCssModule'] const useCssModule: (typeof import('vue'))['useCssModule']
const useCssVars: typeof import('vue')['useCssVars'] const useCssVars: (typeof import('vue'))['useCssVars']
const useDebuggerStore: typeof import('../src/store/debuger')['useDebuggerStore'] const useDebuggerStore: (typeof import('../src/store/debuger'))['useDebuggerStore']
const useElement: typeof import('../src/hooks/use-element')['useElement'] const useElement: (typeof import('../src/hooks/use-element'))['useElement']
const useErrorLog: typeof import('../src/hooks/use-error-log')['useErrorLog'] const useLink: (typeof import('vue-router'))['useLink']
const useLink: typeof import('vue-router')['useLink'] const useRoute: (typeof import('vue-router'))['useRoute']
const useRoute: typeof import('vue-router')['useRoute'] const useRouter: (typeof import('vue-router'))['useRouter']
const useRouter: typeof import('vue-router')['useRouter'] const useSlots: (typeof import('vue'))['useSlots']
const useSlots: typeof import('vue')['useSlots'] const useSystemStore: (typeof import('../src/store/system'))['useSystemStore']
const useSystemStore: typeof import('../src/store/system')['useSystemStore'] const useTable: (typeof import('../src/hooks/use-table'))['useTable']
const useTable: typeof import('../src/hooks/use-table')['useTable'] const useTagsViewStore: (typeof import('../src/store/tags-view'))['useTagsViewStore']
const useTagsViewStore: typeof import('../src/store/tags-view')['useTagsViewStore'] const userRouteStore: (typeof import('../src/store/routes'))['userRouteStore']
const userRouteStore: typeof import('../src/store/routes')['userRouteStore'] const watch: (typeof import('vue'))['watch']
const watch: typeof import('vue')['watch'] const watchEffect: (typeof import('vue'))['watchEffect']
const watchEffect: typeof import('vue')['watchEffect'] const watchPostEffect: (typeof import('vue'))['watchPostEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect'] const watchSyncEffect: (typeof import('vue'))['watchSyncEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect'] const watermark: (typeof import('../src/directives/example/watermark.js'))['default']
const watermark: typeof import('../src/directives/example/watermark.js')['default'] const waves: (typeof import('../src/directives/example/waves.js'))['default']
const waves: typeof import('../src/directives/example/waves.js')['default']
} }
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' export type {
Component,
ComponentPublicInstance,
ComputedRef,
ExtractDefaultPropTypes,
ExtractPropTypes,
ExtractPublicPropTypes,
InjectionKey,
PropType,
Ref,
VNode,
WritableComputedRef
} from 'vue'
import('vue') import('vue')
} }