移除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 { useBasicStore } from '@/store/basic'
import { useConfigStore } from '@/store/config'
import { useErrorLog } from '@/hooks/use-error-log'
//reshow default setting
import { toggleHtmlClass } from '@/theme/utils'
@ -24,10 +23,6 @@ onBeforeMount(() => {
//set tmp token when setting isNeedLogin false
if (!settings.value.isNeedLogin) useBasicStore().setToken(settings.value.tmpToken)
})
onMounted(() => {
//lanch the errorLog collection
useErrorLog()
})
const route = useRoute()
onMounted(() => {
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
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const buttonCodes: typeof import('../src/directives/button-codes')['default']
const casHandleChange: typeof import('../src/hooks/use-element')['casHandleChange']
const clickoutside: typeof import('../src/directives/example/clickoutside.js')['default']
const cloneDeep: typeof import('../src/hooks/use-common')['cloneDeep']
const closeElLoading: typeof import('../src/hooks/use-element')['closeElLoading']
const codesPermission: typeof import('../src/directives/codes-permission')['default']
const computed: typeof import('vue')['computed']
const copy: typeof import('../src/directives/example/copy.js')['default']
const copyValueToClipboard: typeof import('../src/hooks/use-common')['copyValueToClipboard']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const debounce: typeof import('../src/directives/example/debounce.js')['default']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const directives: typeof import('../src/directives/index')['default']
const effectScope: typeof import('vue')['effectScope']
const elConfirm: typeof import('../src/hooks/use-element')['elConfirm']
const elConfirmNoCancelBtn: typeof import('../src/hooks/use-element')['elConfirmNoCancelBtn']
const elLoading: typeof import('../src/hooks/use-element')['elLoading']
const elMessage: typeof import('../src/hooks/use-element')['elMessage']
const elNotify: typeof import('../src/hooks/use-element')['elNotify']
const freshRouter: typeof import('../src/hooks/use-permission')['freshRouter']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const getLangInstance: typeof import('../src/hooks/use-common')['getLangInstance']
const getQueryParam: typeof import('../src/hooks/use-self-router')['getQueryParam']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isExternal: typeof import('../src/hooks/use-layout')['isExternal']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const lang: typeof import('../src/directives/lang')['default']
const langTitle: typeof import('../src/hooks/use-common')['langTitle']
const longpress: typeof import('../src/directives/example/longpress.js')['default']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const progressClose: typeof import('../src/hooks/use-permission')['progressClose']
const progressStart: typeof import('../src/hooks/use-permission')['progressStart']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resetRouter: typeof import('../src/hooks/use-permission')['resetRouter']
const resetState: typeof import('../src/hooks/use-permission')['resetState']
const resizeHandler: typeof import('../src/hooks/use-layout')['resizeHandler']
const resolveComponent: typeof import('vue')['resolveComponent']
const resolveDirective: typeof import('vue')['resolveDirective']
const rolesPermission: typeof import('../src/directives/roles-permission')['default']
const routeInfo: typeof import('../src/hooks/use-self-router')['routeInfo']
const routerBack: typeof import('../src/hooks/use-self-router')['routerBack']
const routerPush: typeof import('../src/hooks/use-self-router')['routerPush']
const routerReplace: typeof import('../src/hooks/use-self-router')['routerReplace']
const setRouterFromDatabase: typeof import('../src/hooks/use-permission')['setRouterFromDatabase']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const sleepTimeout: typeof import('../src/hooks/use-common')['sleepTimeout']
const storeToRefs: typeof import('pinia/dist/pinia')['storeToRefs']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useBasicStore: typeof import('../src/store/basic')['useBasicStore']
const useConfigStore: typeof import('../src/store/config')['useConfigStore']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useDebuggerStore: typeof import('../src/store/debuger')['useDebuggerStore']
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 useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const useSystemStore: typeof import('../src/store/system')['useSystemStore']
const useTable: typeof import('../src/hooks/use-table')['useTable']
const useTagsViewStore: typeof import('../src/store/tags-view')['useTagsViewStore']
const userRouteStore: typeof import('../src/store/routes')['userRouteStore']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
const watermark: typeof import('../src/directives/example/watermark.js')['default']
const waves: typeof import('../src/directives/example/waves.js')['default']
const EffectScope: (typeof import('vue'))['EffectScope']
const buttonCodes: (typeof import('../src/directives/button-codes'))['default']
const casHandleChange: (typeof import('../src/hooks/use-element'))['casHandleChange']
const clickoutside: (typeof import('../src/directives/example/clickoutside.js'))['default']
const cloneDeep: (typeof import('../src/hooks/use-common'))['cloneDeep']
const closeElLoading: (typeof import('../src/hooks/use-element'))['closeElLoading']
const codesPermission: (typeof import('../src/directives/codes-permission'))['default']
const computed: (typeof import('vue'))['computed']
const copy: (typeof import('../src/directives/example/copy.js'))['default']
const copyValueToClipboard: (typeof import('../src/hooks/use-common'))['copyValueToClipboard']
const createApp: (typeof import('vue'))['createApp']
const customRef: (typeof import('vue'))['customRef']
const debounce: (typeof import('../src/directives/example/debounce.js'))['default']
const defineAsyncComponent: (typeof import('vue'))['defineAsyncComponent']
const defineComponent: (typeof import('vue'))['defineComponent']
const directives: (typeof import('../src/directives/index'))['default']
const effectScope: (typeof import('vue'))['effectScope']
const elConfirm: (typeof import('../src/hooks/use-element'))['elConfirm']
const elConfirmNoCancelBtn: (typeof import('../src/hooks/use-element'))['elConfirmNoCancelBtn']
const elLoading: (typeof import('../src/hooks/use-element'))['elLoading']
const elMessage: (typeof import('../src/hooks/use-element'))['elMessage']
const elNotify: (typeof import('../src/hooks/use-element'))['elNotify']
const freshRouter: (typeof import('../src/hooks/use-permission'))['freshRouter']
const getCurrentInstance: (typeof import('vue'))['getCurrentInstance']
const getCurrentScope: (typeof import('vue'))['getCurrentScope']
const getLangInstance: (typeof import('../src/hooks/use-common'))['getLangInstance']
const getQueryParam: (typeof import('../src/hooks/use-self-router'))['getQueryParam']
const h: (typeof import('vue'))['h']
const inject: (typeof import('vue'))['inject']
const isExternal: (typeof import('../src/hooks/use-layout'))['isExternal']
const isProxy: (typeof import('vue'))['isProxy']
const isReactive: (typeof import('vue'))['isReactive']
const isReadonly: (typeof import('vue'))['isReadonly']
const isRef: (typeof import('vue'))['isRef']
const lang: (typeof import('../src/directives/lang'))['default']
const langTitle: (typeof import('../src/hooks/use-common'))['langTitle']
const longpress: (typeof import('../src/directives/example/longpress.js'))['default']
const markRaw: (typeof import('vue'))['markRaw']
const nextTick: (typeof import('vue'))['nextTick']
const onActivated: (typeof import('vue'))['onActivated']
const onBeforeMount: (typeof import('vue'))['onBeforeMount']
const onBeforeRouteLeave: (typeof import('vue-router'))['onBeforeRouteLeave']
const onBeforeRouteUpdate: (typeof import('vue-router'))['onBeforeRouteUpdate']
const onBeforeUnmount: (typeof import('vue'))['onBeforeUnmount']
const onBeforeUpdate: (typeof import('vue'))['onBeforeUpdate']
const onDeactivated: (typeof import('vue'))['onDeactivated']
const onErrorCaptured: (typeof import('vue'))['onErrorCaptured']
const onMounted: (typeof import('vue'))['onMounted']
const onRenderTracked: (typeof import('vue'))['onRenderTracked']
const onRenderTriggered: (typeof import('vue'))['onRenderTriggered']
const onScopeDispose: (typeof import('vue'))['onScopeDispose']
const onServerPrefetch: (typeof import('vue'))['onServerPrefetch']
const onUnmounted: (typeof import('vue'))['onUnmounted']
const onUpdated: (typeof import('vue'))['onUpdated']
const progressClose: (typeof import('../src/hooks/use-permission'))['progressClose']
const progressStart: (typeof import('../src/hooks/use-permission'))['progressStart']
const provide: (typeof import('vue'))['provide']
const reactive: (typeof import('vue'))['reactive']
const readonly: (typeof import('vue'))['readonly']
const ref: (typeof import('vue'))['ref']
const resetRouter: (typeof import('../src/hooks/use-permission'))['resetRouter']
const resetState: (typeof import('../src/hooks/use-permission'))['resetState']
const resizeHandler: (typeof import('../src/hooks/use-layout'))['resizeHandler']
const resolveComponent: (typeof import('vue'))['resolveComponent']
const resolveDirective: (typeof import('vue'))['resolveDirective']
const rolesPermission: (typeof import('../src/directives/roles-permission'))['default']
const routeInfo: (typeof import('../src/hooks/use-self-router'))['routeInfo']
const routerBack: (typeof import('../src/hooks/use-self-router'))['routerBack']
const routerPush: (typeof import('../src/hooks/use-self-router'))['routerPush']
const routerReplace: (typeof import('../src/hooks/use-self-router'))['routerReplace']
const setRouterFromDatabase: (typeof import('../src/hooks/use-permission'))['setRouterFromDatabase']
const shallowReactive: (typeof import('vue'))['shallowReactive']
const shallowReadonly: (typeof import('vue'))['shallowReadonly']
const shallowRef: (typeof import('vue'))['shallowRef']
const sleepTimeout: (typeof import('../src/hooks/use-common'))['sleepTimeout']
const storeToRefs: (typeof import('pinia/dist/pinia'))['storeToRefs']
const toRaw: (typeof import('vue'))['toRaw']
const toRef: (typeof import('vue'))['toRef']
const toRefs: (typeof import('vue'))['toRefs']
const toValue: (typeof import('vue'))['toValue']
const triggerRef: (typeof import('vue'))['triggerRef']
const unref: (typeof import('vue'))['unref']
const useAttrs: (typeof import('vue'))['useAttrs']
const useBasicStore: (typeof import('../src/store/basic'))['useBasicStore']
const useConfigStore: (typeof import('../src/store/config'))['useConfigStore']
const useCssModule: (typeof import('vue'))['useCssModule']
const useCssVars: (typeof import('vue'))['useCssVars']
const useDebuggerStore: (typeof import('../src/store/debuger'))['useDebuggerStore']
const useElement: (typeof import('../src/hooks/use-element'))['useElement']
const useLink: (typeof import('vue-router'))['useLink']
const useRoute: (typeof import('vue-router'))['useRoute']
const useRouter: (typeof import('vue-router'))['useRouter']
const useSlots: (typeof import('vue'))['useSlots']
const useSystemStore: (typeof import('../src/store/system'))['useSystemStore']
const useTable: (typeof import('../src/hooks/use-table'))['useTable']
const useTagsViewStore: (typeof import('../src/store/tags-view'))['useTagsViewStore']
const userRouteStore: (typeof import('../src/store/routes'))['userRouteStore']
const watch: (typeof import('vue'))['watch']
const watchEffect: (typeof import('vue'))['watchEffect']
const watchPostEffect: (typeof import('vue'))['watchPostEffect']
const watchSyncEffect: (typeof import('vue'))['watchSyncEffect']
const watermark: (typeof import('../src/directives/example/watermark.js'))['default']
const waves: (typeof import('../src/directives/example/waves.js'))['default']
}
// for type re-export
declare global {
// @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')
}