|
@@ -59,7 +59,7 @@ export default function useErrorLog() {
|
|
|
}
|
|
|
|
|
|
const _uploadErrorLog = async (event: any) => {
|
|
|
- console.log('onerror message -----------------')
|
|
|
+ console.log('onerror message -----------------', event)
|
|
|
try {
|
|
|
/*
|
|
|
日志上报:1.手机号、应用端 iOS|安卓 App类型(老师端|学生端|web)、App版本、系统信息(系统版本|web userAgent)、错误信息(什么位置出现,错误内容) 错误时间 上报类型(错误、埋点)
|
|
@@ -72,17 +72,17 @@ export default function useErrorLog() {
|
|
|
(item: string) => href.indexOf(item) !== -1
|
|
|
);
|
|
|
|
|
|
- const whiteIp = ['online.lexiaoya.cn', 'test.lexiaoya.cn', 'dev.lexiaoya.cn']
|
|
|
- console.log(window.location.host, index, 'errorLog')
|
|
|
- if (!whiteIp.includes(window.location.host)) {
|
|
|
- return
|
|
|
- }
|
|
|
+ // const whiteIp = ['online.lexiaoya.cn', 'test.lexiaoya.cn', 'dev.lexiaoya.cn']
|
|
|
+ // console.log(window.location.host, index, 'errorLog')
|
|
|
+ // if (!whiteIp.includes(window.location.host)) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
if (!(window.location.hash === '#/' || index !== -1)) {
|
|
|
return
|
|
|
}
|
|
|
// 错误信息
|
|
|
// 资源加载失败,可以在这里处理错误
|
|
|
- const contentError = `Error message: ${event.target.tagName || ''};${event.target.src || event.target.href || ''
|
|
|
+ const contentError = `Error message: ${event.target.tagName || ''};${event.data ? JSON.stringify(event.data) : ''};${event.target.src || event.target.href || ''
|
|
|
};lineno: ${event.lineno || ''};message: ${event.message || ''
|
|
|
};filename: ${event.filename || ''};fileUrl: ${window.location.href
|
|
|
}`;
|
|
@@ -97,15 +97,16 @@ export default function useErrorLog() {
|
|
|
exceptionTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
}
|
|
|
];
|
|
|
- // console.log(params)
|
|
|
+ console.log(params, state.user.status)
|
|
|
// 如果不是登录则存在缓存里面
|
|
|
if (state.user.status !== "login") {
|
|
|
operationErrorLog('set', params)
|
|
|
return
|
|
|
}
|
|
|
await api_sysExceptionLogSave(params);
|
|
|
- } catch {
|
|
|
+ } catch (e) {
|
|
|
//
|
|
|
+ console.log(e)
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -161,6 +162,10 @@ export default function useErrorLog() {
|
|
|
tempRouteSchool.push(child.path)
|
|
|
}
|
|
|
});
|
|
|
+ } else {
|
|
|
+ if (route.meta?.errorLog) {
|
|
|
+ tempRouteSchool.push(route.path)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -175,6 +180,10 @@ export default function useErrorLog() {
|
|
|
tempRouteSchool.push(child.path)
|
|
|
}
|
|
|
});
|
|
|
+ }else {
|
|
|
+ if (route.meta?.errorLog) {
|
|
|
+ tempRouteSchool.push(route.path)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -189,6 +198,10 @@ export default function useErrorLog() {
|
|
|
tempRouteSchool.push(child.path)
|
|
|
}
|
|
|
});
|
|
|
+ }else {
|
|
|
+ if (route.meta?.errorLog) {
|
|
|
+ tempRouteSchool.push(route.path)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -201,6 +214,7 @@ export default function useErrorLog() {
|
|
|
|
|
|
return {
|
|
|
startListenErrorLog,
|
|
|
- stopListenErrorLog
|
|
|
+ stopListenErrorLog,
|
|
|
+ _uploadErrorLog
|
|
|
};
|
|
|
}
|