From ffd42fca334407b8a9b38055a1cc3a04875450ed Mon Sep 17 00:00:00 2001 From: liufumingren Date: Fri, 25 Sep 2026 01:42:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(error-report):=20=E6=8E=A5=E5=85=A5=20inde?= =?UTF-8?q?x.uploadClientErrorLog=20-=20=E8=BF=90=E8=A1=8C=E6=97=B6?= =?UTF-8?q?=E5=BC=82=E5=B8=B8/=E6=89=AB=E7=A0=81=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E8=87=AA=E5=8A=A8=E6=89=B9=E9=87=8F=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5(=E5=B9=82=E7=AD=89+=E9=99=90=E6=B5=81+=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=E9=98=9F=E5=88=97+=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E4=B8=8A=E6=8A=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 3 + src/api/index.ts | 20 ++ src/components/scan-diag-panel.vue | 14 + src/core/error-report.js | 515 +++++++++++++++++++++++++++++ src/core/scan-diag.js | 44 +++ src/main.js | 3 + 6 files changed, 599 insertions(+) create mode 100644 src/core/error-report.js diff --git a/src/App.vue b/src/App.vue index 0f19ddd..0f2fcce 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,6 @@ diff --git a/src/api/index.ts b/src/api/index.ts index c96e105..60427e8 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -19,6 +19,26 @@ export function getLoginWechatCode( }) } +/** + * 上报客户端错误日志(免登录、免权限、免鉴权,服务端写 wms_client_error_log) + * - 入参支持单条对象/数组/{logs:[...]} 三种形态,单次最多 50 条;这里统一用 { logs } 包裹 + * - error_message 与 error_stack 至少一项有值;report_uuid 幂等去重(重复上报静默成功) + */ +export function uploadClientErrorLog( + logs: Record[] | Record, + options?: RequestOptions +) { + const list = Array.isArray(logs) ? logs : [logs] + return request( + 'index.uploadClientErrorLog', + { logs: list }, + { + skipAuth: true, + ...options, + } + ) +} + /** * 工作台登录:获取工作台绑定码 / 绑定状态(免登录、免鉴权) * - 不传 clientCode:分配新客户端编码并立即返回绑定码 diff --git a/src/components/scan-diag-panel.vue b/src/components/scan-diag-panel.vue index aaf4c36..e814a15 100644 --- a/src/components/scan-diag-panel.vue +++ b/src/components/scan-diag-panel.vue @@ -5,6 +5,7 @@ 扫码诊断 刷新 + 上报 复制 清空 × @@ -22,6 +23,7 @@