@moluoxixi/ajax-package 0.0.23 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/BaseHttpClient.d.ts +0 -111
- package/es/SystemErrorDialog.d.ts +0 -4
- package/es/_types/api.d.ts +1 -74
- package/es/_types/emits.d.ts +0 -7
- package/es/_types/props.d.ts +0 -14
- package/es/_utils/messageWrapper.d.ts +0 -4
- package/es/_utils/notificationWrapper.d.ts +0 -4
- package/es/_utils/systemErrorInfo.d.ts +0 -21
- package/es/class.d.ts +18 -185
- package/es/index.mjs +166 -411
- package/es/netseriver.d.ts +0 -14
- package/package.json +1 -1
package/es/index.mjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
try {
|
|
4
4
|
if (typeof document !== "undefined") {
|
|
5
|
-
if (!document.getElementById("
|
|
5
|
+
if (!document.getElementById("2bc22f5b-4ebf-4d8d-82c3-7863ef59645c")) {
|
|
6
6
|
var elementStyle = document.createElement("style");
|
|
7
|
-
elementStyle.id = "
|
|
7
|
+
elementStyle.id = "2bc22f5b-4ebf-4d8d-82c3-7863ef59645c";
|
|
8
8
|
elementStyle.appendChild(document.createTextNode("._root_11p33_1 .el-dialog__header {\n padding: 0 12px 12px;\n}\n\n._root_11p33_1 .el-dialog__body {\n border-top: 1px solid #e5e7eb;\n border-bottom: 1px solid #e5e7eb;\n padding: 0 12px;\n}\n\n._root_11p33_1 .el-dialog__footer {\n padding: 0 12px;\n}"));
|
|
9
9
|
document.head.appendChild(elementStyle);
|
|
10
10
|
}
|
|
@@ -12049,9 +12049,9 @@ notify.closeAll = closeAll;
|
|
|
12049
12049
|
notify.updateOffsets = updateOffsets;
|
|
12050
12050
|
notify._context = null;
|
|
12051
12051
|
const ElNotification = withInstallFunction(notify, "$notify");
|
|
12052
|
-
const hasDocument$
|
|
12052
|
+
const hasDocument$1 = typeof document !== "undefined";
|
|
12053
12053
|
function createMessageWrapper() {
|
|
12054
|
-
if (hasDocument$
|
|
12054
|
+
if (hasDocument$1) {
|
|
12055
12055
|
return ElMessage;
|
|
12056
12056
|
}
|
|
12057
12057
|
return {
|
|
@@ -12071,9 +12071,9 @@ function createMessageWrapper() {
|
|
|
12071
12071
|
}
|
|
12072
12072
|
};
|
|
12073
12073
|
}
|
|
12074
|
-
const hasDocument
|
|
12074
|
+
const hasDocument = typeof document !== "undefined";
|
|
12075
12075
|
function createNotificationWrapper() {
|
|
12076
|
-
if (hasDocument
|
|
12076
|
+
if (hasDocument) {
|
|
12077
12077
|
return ElNotification;
|
|
12078
12078
|
}
|
|
12079
12079
|
const consoleNotification = (options, level = "info") => {
|
|
@@ -12183,10 +12183,6 @@ function defaultGetToken() {
|
|
|
12183
12183
|
return typeof localStorage !== "undefined" ? localStorage.getItem("token") || "" : "";
|
|
12184
12184
|
}
|
|
12185
12185
|
class BaseHttpClient {
|
|
12186
|
-
/**
|
|
12187
|
-
* 创建 BaseHttpClient 实例
|
|
12188
|
-
* @param config - HTTP 客户端配置对象
|
|
12189
|
-
*/
|
|
12190
12186
|
constructor(config) {
|
|
12191
12187
|
__publicField(this, "baseURL", "");
|
|
12192
12188
|
__publicField(this, "timeout", 5e3);
|
|
@@ -12216,86 +12212,42 @@ class BaseHttpClient {
|
|
|
12216
12212
|
baseURL: this.baseURL,
|
|
12217
12213
|
timeout: this.timeout,
|
|
12218
12214
|
...axiosConfig
|
|
12219
|
-
// 将所有剩余参数传给axios.create
|
|
12220
12215
|
});
|
|
12221
12216
|
this.setupInterceptors();
|
|
12222
12217
|
}
|
|
12223
|
-
/**
|
|
12224
|
-
* 处理请求配置,子类可重写此方法自定义请求配置
|
|
12225
|
-
* @param config - 请求配置对象
|
|
12226
|
-
* @returns 处理后的请求配置
|
|
12227
|
-
*/
|
|
12228
12218
|
processRequestConfig(config) {
|
|
12229
12219
|
return config;
|
|
12230
12220
|
}
|
|
12231
|
-
/**
|
|
12232
|
-
* 处理响应配置,子类可重写此方法自定义响应处理
|
|
12233
|
-
* 按照标准 HTTP 结构处理响应
|
|
12234
|
-
* @param response - Axios 响应对象
|
|
12235
|
-
* @returns 解析后的响应数据
|
|
12236
|
-
*/
|
|
12237
12221
|
processResponseConfig(response) {
|
|
12238
12222
|
this.handleHttpStatus(response);
|
|
12239
12223
|
return this.handleSuccessResponse(response);
|
|
12240
12224
|
}
|
|
12241
|
-
/**
|
|
12242
|
-
* 处理 HTTP 状态码
|
|
12243
|
-
* 子类可重写此方法来自定义 HTTP 状态码处理逻辑
|
|
12244
|
-
* @param response - Axios 响应对象
|
|
12245
|
-
*/
|
|
12246
12225
|
handleHttpStatus(response) {
|
|
12247
12226
|
var _a2;
|
|
12248
12227
|
if (response.status !== 200) {
|
|
12249
12228
|
throw new Error(((_a2 = response.data) == null ? void 0 : _a2.message) || `HTTP Error: ${response.status}`);
|
|
12250
12229
|
}
|
|
12251
12230
|
}
|
|
12252
|
-
/**
|
|
12253
|
-
* 处理成功响应
|
|
12254
|
-
* 子类可重写此方法来自定义成功响应的处理逻辑
|
|
12255
|
-
* @param response - Axios 响应对象
|
|
12256
|
-
* @returns 解析后的响应数据
|
|
12257
|
-
*/
|
|
12258
12231
|
handleSuccessResponse(response) {
|
|
12259
12232
|
return response.data;
|
|
12260
12233
|
}
|
|
12261
|
-
/**
|
|
12262
|
-
* 处理响应错误,子类可重写此方法自定义错误处理
|
|
12263
|
-
* 按照标准 HTTP 错误结构处理错误
|
|
12264
|
-
* @param error - Axios 错误对象
|
|
12265
|
-
* @returns 处理后的错误对象
|
|
12266
|
-
*/
|
|
12267
12234
|
async processResponseError(error) {
|
|
12268
12235
|
this.handleAuthenticationError(error);
|
|
12269
12236
|
this.handleTimeoutError(error);
|
|
12270
12237
|
this.handleNetworkError(error);
|
|
12271
12238
|
return error;
|
|
12272
12239
|
}
|
|
12273
|
-
/**
|
|
12274
|
-
* 处理认证错误(401 - 未授权/登录失效)
|
|
12275
|
-
* 子类可重写此方法来自定义认证错误处理逻辑
|
|
12276
|
-
* @param error - Axios 错误对象
|
|
12277
|
-
*/
|
|
12278
12240
|
handleAuthenticationError(error) {
|
|
12279
12241
|
var _a2, _b;
|
|
12280
12242
|
if (((_a2 = error.response) == null ? void 0 : _a2.status) === 401) {
|
|
12281
12243
|
(_b = this.onLoginRequired) == null ? void 0 : _b.call(this, this.messageInstance);
|
|
12282
12244
|
}
|
|
12283
12245
|
}
|
|
12284
|
-
/**
|
|
12285
|
-
* 处理超时错误
|
|
12286
|
-
* 子类可重写此方法来自定义超时错误处理逻辑
|
|
12287
|
-
* @param error - Axios 错误对象
|
|
12288
|
-
*/
|
|
12289
12246
|
handleTimeoutError(error) {
|
|
12290
12247
|
if (error.code === "ECONNABORTED" && error.message.includes("timeout")) {
|
|
12291
12248
|
this.onTimeout(this.messageInstance);
|
|
12292
12249
|
}
|
|
12293
12250
|
}
|
|
12294
|
-
/**
|
|
12295
|
-
* 处理网络错误(其他错误)
|
|
12296
|
-
* 子类可重写此方法来自定义网络错误处理逻辑
|
|
12297
|
-
* @param error - Axios 错误对象
|
|
12298
|
-
*/
|
|
12299
12251
|
handleNetworkError(error) {
|
|
12300
12252
|
var _a2, _b, _c;
|
|
12301
12253
|
if (((_a2 = error.response) == null ? void 0 : _a2.status) !== 401 && error.code !== "ECONNABORTED") {
|
|
@@ -12306,11 +12258,6 @@ class BaseHttpClient {
|
|
|
12306
12258
|
});
|
|
12307
12259
|
}
|
|
12308
12260
|
}
|
|
12309
|
-
/**
|
|
12310
|
-
* 设置请求和响应拦截器
|
|
12311
|
-
* 请求拦截器:自动添加 Token
|
|
12312
|
-
* 响应拦截器:处理成功响应和错误响应(401、超时等)
|
|
12313
|
-
*/
|
|
12314
12261
|
setupInterceptors() {
|
|
12315
12262
|
this.instance.interceptors.request.use(
|
|
12316
12263
|
(config) => {
|
|
@@ -12337,59 +12284,21 @@ class BaseHttpClient {
|
|
|
12337
12284
|
}
|
|
12338
12285
|
);
|
|
12339
12286
|
}
|
|
12340
|
-
/**
|
|
12341
|
-
* 发送 HTTP 请求,所有 HTTP 方法最终都调用此方法
|
|
12342
|
-
* @param config - Axios 请求配置对象
|
|
12343
|
-
* @returns 解析后的响应数据
|
|
12344
|
-
*/
|
|
12345
12287
|
async request(config) {
|
|
12346
12288
|
return this.instance.request(config);
|
|
12347
12289
|
}
|
|
12348
|
-
/**
|
|
12349
|
-
* 发送 GET 请求
|
|
12350
|
-
* @param url - 请求 URL 路径
|
|
12351
|
-
* @param params - 查询参数对象
|
|
12352
|
-
* @param config - 额外的请求配置
|
|
12353
|
-
* @returns 解析后的响应数据
|
|
12354
|
-
*/
|
|
12355
12290
|
async get(url, params, config) {
|
|
12356
12291
|
return this.request({ ...config, url, method: "get", params });
|
|
12357
12292
|
}
|
|
12358
|
-
/**
|
|
12359
|
-
* 发送 POST 请求
|
|
12360
|
-
* @param url - 请求 URL 路径
|
|
12361
|
-
* @param data - 请求体数据
|
|
12362
|
-
* @param config - 额外的请求配置
|
|
12363
|
-
* @returns 解析后的响应数据
|
|
12364
|
-
*/
|
|
12365
12293
|
async post(url, data, config) {
|
|
12366
12294
|
return this.request({ ...config, url, method: "post", data });
|
|
12367
12295
|
}
|
|
12368
|
-
/**
|
|
12369
|
-
* 发送 DELETE 请求
|
|
12370
|
-
* @param url - 请求 URL 路径
|
|
12371
|
-
* @param params - 查询参数对象
|
|
12372
|
-
* @param config - 额外的请求配置
|
|
12373
|
-
* @returns 解析后的响应数据
|
|
12374
|
-
*/
|
|
12375
12296
|
async delete(url, params, config) {
|
|
12376
12297
|
return this.request({ ...config, url, method: "delete", params });
|
|
12377
12298
|
}
|
|
12378
|
-
/**
|
|
12379
|
-
* 发送 PUT 请求
|
|
12380
|
-
* @param url - 请求 URL 路径
|
|
12381
|
-
* @param data - 请求体数据
|
|
12382
|
-
* @param config - 额外的请求配置
|
|
12383
|
-
* @returns 解析后的响应数据
|
|
12384
|
-
*/
|
|
12385
12299
|
async put(url, data, config) {
|
|
12386
12300
|
return this.request({ ...config, url, method: "put", data });
|
|
12387
12301
|
}
|
|
12388
|
-
/**
|
|
12389
|
-
* 批量请求,并发发送多个请求
|
|
12390
|
-
* @param requests - 请求配置数组或已发起的请求 Promise 数组
|
|
12391
|
-
* @returns 所有请求的响应数据数组
|
|
12392
|
-
*/
|
|
12393
12302
|
async all(requests) {
|
|
12394
12303
|
if (!requests.length)
|
|
12395
12304
|
return [];
|
|
@@ -12402,13 +12311,6 @@ class BaseHttpClient {
|
|
|
12402
12311
|
const promises = requests.map((config) => this.request(config));
|
|
12403
12312
|
return await Promise.all(promises);
|
|
12404
12313
|
}
|
|
12405
|
-
/**
|
|
12406
|
-
* 文件上传,将文件包装为 FormData 发送
|
|
12407
|
-
* @param url - 上传地址
|
|
12408
|
-
* @param file - 文件对象
|
|
12409
|
-
* @param config - 额外的请求配置
|
|
12410
|
-
* @returns 解析后的响应数据
|
|
12411
|
-
*/
|
|
12412
12314
|
async uploadFile(url, file, config) {
|
|
12413
12315
|
const formData = new FormData();
|
|
12414
12316
|
formData.append("file", file);
|
|
@@ -12420,11 +12322,6 @@ class BaseHttpClient {
|
|
|
12420
12322
|
}
|
|
12421
12323
|
});
|
|
12422
12324
|
}
|
|
12423
|
-
/**
|
|
12424
|
-
* 下载文件,将 Blob 对象下载到本地
|
|
12425
|
-
* @param blob - Blob 对象
|
|
12426
|
-
* @param filename - 文件名,如果不提供则使用时间戳
|
|
12427
|
-
*/
|
|
12428
12325
|
downloadFile(blob, filename) {
|
|
12429
12326
|
if (typeof window === "undefined") {
|
|
12430
12327
|
console.warn("downloadFile: 非浏览器环境,无法下载文件");
|
|
@@ -12440,22 +12337,18 @@ class BaseHttpClient {
|
|
|
12440
12337
|
window.URL.revokeObjectURL(url);
|
|
12441
12338
|
}
|
|
12442
12339
|
}
|
|
12443
|
-
async function dynamicImport(modulePromise, exportName = "default") {
|
|
12444
|
-
const module = await modulePromise;
|
|
12445
|
-
if (exportName === "default") {
|
|
12446
|
-
return module.default ?? module;
|
|
12447
|
-
}
|
|
12448
|
-
if (!(exportName in module)) {
|
|
12449
|
-
throw new Error(`模块中不存在导出 "${exportName}"`);
|
|
12450
|
-
}
|
|
12451
|
-
return module[exportName];
|
|
12452
|
-
}
|
|
12453
12340
|
async function dynamicImports(modulePromise, exportNames) {
|
|
12341
|
+
const module = await modulePromise;
|
|
12454
12342
|
const result = {};
|
|
12455
|
-
for (const
|
|
12456
|
-
const
|
|
12457
|
-
if (
|
|
12458
|
-
result[name] =
|
|
12343
|
+
for (const _name of exportNames) {
|
|
12344
|
+
const name = _name || "default";
|
|
12345
|
+
if (name === "default") {
|
|
12346
|
+
result[name] = module.default ?? module;
|
|
12347
|
+
} else {
|
|
12348
|
+
if (!(name in module)) {
|
|
12349
|
+
throw new Error(`模块中不存在导出 "${name}"`);
|
|
12350
|
+
}
|
|
12351
|
+
result[name] = module[name];
|
|
12459
12352
|
}
|
|
12460
12353
|
}
|
|
12461
12354
|
return result;
|
|
@@ -12544,12 +12437,10 @@ function createApiDialog(DialogComponent) {
|
|
|
12544
12437
|
cleanup();
|
|
12545
12438
|
}
|
|
12546
12439
|
},
|
|
12547
|
-
// 监听关闭事件
|
|
12548
12440
|
onClose: () => {
|
|
12549
12441
|
reject(new Error("对话框已关闭"));
|
|
12550
12442
|
cleanup();
|
|
12551
12443
|
},
|
|
12552
|
-
// 监听确认事件(如有)
|
|
12553
12444
|
onConfirm: (data) => {
|
|
12554
12445
|
resolve(data);
|
|
12555
12446
|
cleanup();
|
|
@@ -12597,22 +12488,20 @@ function createApiDialog(DialogComponent) {
|
|
|
12597
12488
|
close: close2
|
|
12598
12489
|
};
|
|
12599
12490
|
}
|
|
12600
|
-
const
|
|
12601
|
-
let systemErrorDialogInstance = null;
|
|
12602
|
-
class BaseApi extends BaseHttpClient {
|
|
12603
|
-
/**
|
|
12604
|
-
* 创建 BaseApi 实例
|
|
12605
|
-
* @param config - API 配置对象
|
|
12606
|
-
*/
|
|
12491
|
+
const _BaseApi = class _BaseApi extends BaseHttpClient {
|
|
12607
12492
|
constructor(config) {
|
|
12608
12493
|
const {
|
|
12609
12494
|
responseFields,
|
|
12610
12495
|
enableSystemErrorDialog = true,
|
|
12496
|
+
systemErrorMessage = "系统错误",
|
|
12611
12497
|
...baseConfig
|
|
12612
12498
|
} = config;
|
|
12613
12499
|
super(baseConfig);
|
|
12614
12500
|
__publicField(this, "responseFields");
|
|
12615
12501
|
__publicField(this, "enableSystemErrorDialog");
|
|
12502
|
+
__publicField(this, "systemErrorMessage");
|
|
12503
|
+
__publicField(this, "systemErrorDialogInstance", null);
|
|
12504
|
+
__publicField(this, "systemErrorDialogInitPromise", null);
|
|
12616
12505
|
this.responseFields = {
|
|
12617
12506
|
code: "Code",
|
|
12618
12507
|
message: "Message",
|
|
@@ -12622,75 +12511,83 @@ class BaseApi extends BaseHttpClient {
|
|
|
12622
12511
|
...responseFields
|
|
12623
12512
|
};
|
|
12624
12513
|
this.enableSystemErrorDialog = enableSystemErrorDialog;
|
|
12514
|
+
this.systemErrorMessage = systemErrorMessage;
|
|
12515
|
+
if (this.enableSystemErrorDialog && this.hasDocument) {
|
|
12516
|
+
this.systemErrorDialogInitPromise = this.initSystemErrorDialog();
|
|
12517
|
+
}
|
|
12625
12518
|
}
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
* 显式声明以确保类型一致性,避免打包后的类型不兼容问题
|
|
12629
|
-
* @param config - 请求配置对象
|
|
12630
|
-
* @returns 处理后的请求配置
|
|
12631
|
-
*/
|
|
12632
|
-
processRequestConfig(config) {
|
|
12633
|
-
return super.processRequestConfig(config);
|
|
12634
|
-
}
|
|
12635
|
-
/**
|
|
12636
|
-
* 处理响应配置,子类可重写此方法自定义响应处理
|
|
12637
|
-
* 显式声明以确保类型一致性,避免打包后的类型不兼容问题
|
|
12638
|
-
* @param response - Axios 响应对象
|
|
12639
|
-
* @returns 解析后的响应数据
|
|
12640
|
-
*/
|
|
12641
|
-
processResponseConfig(response) {
|
|
12642
|
-
return super.processResponseConfig(response);
|
|
12643
|
-
}
|
|
12644
|
-
/**
|
|
12645
|
-
* 处理响应错误,子类可重写此方法自定义错误处理
|
|
12646
|
-
* 显式声明以确保类型一致性,避免打包后的类型不兼容问题
|
|
12647
|
-
* @param error - Axios 错误对象
|
|
12648
|
-
* @returns 处理后的错误对象
|
|
12649
|
-
*/
|
|
12650
|
-
async processResponseError(error) {
|
|
12651
|
-
return super.processResponseError(error);
|
|
12519
|
+
get hasDocument() {
|
|
12520
|
+
return _BaseApi.hasDocument;
|
|
12652
12521
|
}
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
* 重写父类方法,确保子类可以重写此方法
|
|
12656
|
-
* @param response - Axios 响应对象
|
|
12657
|
-
*/
|
|
12658
|
-
handleHttpStatus(response) {
|
|
12659
|
-
return super.handleHttpStatus(response);
|
|
12522
|
+
get systemErrorInfoMap() {
|
|
12523
|
+
return _BaseApi.systemErrorInfoMap;
|
|
12660
12524
|
}
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
* 重写父类方法,处理 HTTP 401 错误
|
|
12664
|
-
* 子类可重写此方法来自定义 HTTP 认证错误处理逻辑
|
|
12665
|
-
* @param error - Axios 错误对象
|
|
12666
|
-
*/
|
|
12667
|
-
handleAuthenticationError(error) {
|
|
12668
|
-
super.handleAuthenticationError(error);
|
|
12525
|
+
generateErrorId() {
|
|
12526
|
+
return `system_error_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
12669
12527
|
}
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12528
|
+
async openSystemErrorDialog(errorId) {
|
|
12529
|
+
const errorInfo = this.systemErrorInfoMap.get(errorId);
|
|
12530
|
+
if (!errorInfo) {
|
|
12531
|
+
console.warn("未找到错误信息,ID:", errorId);
|
|
12532
|
+
return;
|
|
12533
|
+
}
|
|
12534
|
+
this.systemErrorInfoMap.delete(errorId);
|
|
12535
|
+
try {
|
|
12536
|
+
if (!this.systemErrorDialogInstance) {
|
|
12537
|
+
if (this.systemErrorDialogInitPromise) {
|
|
12538
|
+
try {
|
|
12539
|
+
await this.systemErrorDialogInitPromise;
|
|
12540
|
+
} catch {
|
|
12541
|
+
console.error("系统异常信息:", errorInfo.responseData);
|
|
12542
|
+
return;
|
|
12543
|
+
}
|
|
12544
|
+
} else {
|
|
12545
|
+
try {
|
|
12546
|
+
await this.initSystemErrorDialog();
|
|
12547
|
+
} catch {
|
|
12548
|
+
console.error("系统异常信息:", errorInfo.responseData);
|
|
12549
|
+
return;
|
|
12550
|
+
}
|
|
12551
|
+
}
|
|
12552
|
+
if (!this.systemErrorDialogInstance) {
|
|
12553
|
+
console.error("系统异常信息:", errorInfo.responseData);
|
|
12554
|
+
return;
|
|
12555
|
+
}
|
|
12556
|
+
}
|
|
12557
|
+
const errorInfoData = extractSystemErrorInfo(
|
|
12558
|
+
errorInfo.response,
|
|
12559
|
+
errorInfo.code,
|
|
12560
|
+
errorInfo.message
|
|
12561
|
+
);
|
|
12562
|
+
this.systemErrorDialogInstance.show({
|
|
12563
|
+
props: {
|
|
12564
|
+
title: "系统异常信息",
|
|
12565
|
+
width: 600,
|
|
12566
|
+
...errorInfoData
|
|
12567
|
+
}
|
|
12568
|
+
}).then((result) => {
|
|
12569
|
+
if (result == null ? void 0 : result.reported) {
|
|
12570
|
+
/* @__PURE__ */ console.log("系统异常已上报:", result);
|
|
12571
|
+
} else {
|
|
12572
|
+
/* @__PURE__ */ console.log("系统异常对话框已确认");
|
|
12573
|
+
}
|
|
12574
|
+
}).catch((e) => {
|
|
12575
|
+
/* @__PURE__ */ console.log("系统异常对话框已关闭", e);
|
|
12576
|
+
});
|
|
12577
|
+
} catch (error) {
|
|
12578
|
+
console.error("显示系统异常对话框失败:", error);
|
|
12579
|
+
console.error("系统异常信息:", errorInfo.responseData);
|
|
12580
|
+
}
|
|
12677
12581
|
}
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12582
|
+
async initSystemErrorDialog() {
|
|
12583
|
+
try {
|
|
12584
|
+
const { default: SystemErrorDialog2 } = await dynamicImports(Promise.resolve().then(() => SystemErrorDialog$1), ["default"]);
|
|
12585
|
+
this.systemErrorDialogInstance = createApiDialog(SystemErrorDialog2);
|
|
12586
|
+
} catch (error) {
|
|
12587
|
+
console.warn("Failed to load SystemErrorDialog:", error);
|
|
12588
|
+
throw error;
|
|
12589
|
+
}
|
|
12685
12590
|
}
|
|
12686
|
-
/**
|
|
12687
|
-
* 处理成功响应
|
|
12688
|
-
* 重写父类方法,在标准 HTTP 成功响应基础上,处理业务特定的响应结构
|
|
12689
|
-
* 支持嵌套路径解析,自动处理业务层的登录失效、系统异常等错误
|
|
12690
|
-
* 注意:HTTP 层的错误(如 HTTP 401、超时等)由父类 BaseHttpClient 处理
|
|
12691
|
-
* @param response - Axios 响应对象
|
|
12692
|
-
* @returns 解析后的响应数据
|
|
12693
|
-
*/
|
|
12694
12591
|
handleSuccessResponse(response) {
|
|
12695
12592
|
const httpData = super.handleSuccessResponse(response);
|
|
12696
12593
|
const parsedFields = this.parseResponseFields(httpData);
|
|
@@ -12705,12 +12602,6 @@ class BaseApi extends BaseHttpClient {
|
|
|
12705
12602
|
}
|
|
12706
12603
|
return responseData;
|
|
12707
12604
|
}
|
|
12708
|
-
/**
|
|
12709
|
-
* 支持路径解析的辅助函数
|
|
12710
|
-
* @param obj
|
|
12711
|
-
* @param path
|
|
12712
|
-
* @protected
|
|
12713
|
-
*/
|
|
12714
12605
|
getValueByPath(obj, path) {
|
|
12715
12606
|
if (!path)
|
|
12716
12607
|
return obj;
|
|
@@ -12725,12 +12616,6 @@ class BaseApi extends BaseHttpClient {
|
|
|
12725
12616
|
}
|
|
12726
12617
|
return result;
|
|
12727
12618
|
}
|
|
12728
|
-
/**
|
|
12729
|
-
* 解析响应字段,支持嵌套路径解析
|
|
12730
|
-
* 子类可重写此方法来自定义字段解析逻辑
|
|
12731
|
-
* @param data - 响应数据对象
|
|
12732
|
-
* @returns 解析后的字段值对象
|
|
12733
|
-
*/
|
|
12734
12619
|
parseResponseFields(data) {
|
|
12735
12620
|
var _a2, _b, _c;
|
|
12736
12621
|
const code = this.getValueByPath(data, (_a2 = this.responseFields) == null ? void 0 : _a2.code);
|
|
@@ -12738,30 +12623,72 @@ class BaseApi extends BaseHttpClient {
|
|
|
12738
12623
|
const responseData = this.getValueByPath(data, (_c = this.responseFields) == null ? void 0 : _c.data);
|
|
12739
12624
|
return { code, message: message2, responseData };
|
|
12740
12625
|
}
|
|
12741
|
-
/**
|
|
12742
|
-
* 处理系统异常错误(-1 - 系统异常)
|
|
12743
|
-
* 子类可重写此方法来自定义系统异常处理逻辑
|
|
12744
|
-
* @param response - Axios 响应对象
|
|
12745
|
-
* @param code - 响应状态码
|
|
12746
|
-
* @param message - 错误消息
|
|
12747
|
-
* @param responseData - 响应数据
|
|
12748
|
-
*/
|
|
12749
12626
|
handleSystemError(response, code, message2, responseData) {
|
|
12750
12627
|
if (code === -1) {
|
|
12751
12628
|
if (this.enableSystemErrorDialog) {
|
|
12752
|
-
this.
|
|
12753
|
-
console.error("显示系统异常对话框失败:", error);
|
|
12754
|
-
});
|
|
12629
|
+
this.showSystemErrorMessage(response, responseData, code, message2);
|
|
12755
12630
|
}
|
|
12756
12631
|
throw new Error(message2 || "系统异常");
|
|
12757
12632
|
}
|
|
12758
12633
|
}
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12634
|
+
showSystemErrorMessage(response, responseData, code, message2) {
|
|
12635
|
+
var _a2;
|
|
12636
|
+
if (!this.hasDocument) {
|
|
12637
|
+
console.error("系统异常信息:", responseData);
|
|
12638
|
+
return;
|
|
12639
|
+
}
|
|
12640
|
+
const errorId = this.generateErrorId();
|
|
12641
|
+
this.systemErrorInfoMap.set(errorId, {
|
|
12642
|
+
response,
|
|
12643
|
+
responseData,
|
|
12644
|
+
code,
|
|
12645
|
+
message: message2
|
|
12646
|
+
});
|
|
12647
|
+
setTimeout(() => {
|
|
12648
|
+
this.systemErrorInfoMap.delete(errorId);
|
|
12649
|
+
}, 5 * 60 * 1e3);
|
|
12650
|
+
const handleIconClick = () => {
|
|
12651
|
+
this.openSystemErrorDialog(errorId).catch((error) => {
|
|
12652
|
+
console.error("打开系统错误对话框失败:", error);
|
|
12653
|
+
});
|
|
12654
|
+
};
|
|
12655
|
+
const messageVNode = h("div", {
|
|
12656
|
+
style: {
|
|
12657
|
+
display: "flex",
|
|
12658
|
+
alignItems: "center",
|
|
12659
|
+
gap: "8px",
|
|
12660
|
+
maxWidth: "100%"
|
|
12661
|
+
}
|
|
12662
|
+
}, [
|
|
12663
|
+
h("div", {
|
|
12664
|
+
style: {
|
|
12665
|
+
color: "var(--el-message-text-color)",
|
|
12666
|
+
lineHeight: "24px"
|
|
12667
|
+
}
|
|
12668
|
+
}, message2 || this.systemErrorMessage),
|
|
12669
|
+
h("svg", {
|
|
12670
|
+
onClick: handleIconClick,
|
|
12671
|
+
style: {
|
|
12672
|
+
cursor: "pointer",
|
|
12673
|
+
color: "#F56C6C",
|
|
12674
|
+
width: "16px",
|
|
12675
|
+
height: "16px",
|
|
12676
|
+
flexShrink: 0
|
|
12677
|
+
},
|
|
12678
|
+
viewBox: "0 0 1024 1024",
|
|
12679
|
+
fill: "currentColor",
|
|
12680
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
12681
|
+
}, [
|
|
12682
|
+
h("path", {
|
|
12683
|
+
d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z"
|
|
12684
|
+
})
|
|
12685
|
+
])
|
|
12686
|
+
]);
|
|
12687
|
+
(_a2 = this.messageInstance) == null ? void 0 : _a2.error({
|
|
12688
|
+
message: messageVNode,
|
|
12689
|
+
duration: 5 * 1e3
|
|
12690
|
+
});
|
|
12691
|
+
}
|
|
12765
12692
|
handleBusinessError(code, message2) {
|
|
12766
12693
|
var _a2;
|
|
12767
12694
|
if (code && code !== 200) {
|
|
@@ -12772,12 +12699,6 @@ class BaseApi extends BaseHttpClient {
|
|
|
12772
12699
|
throw new Error(message2 || "请求失败");
|
|
12773
12700
|
}
|
|
12774
12701
|
}
|
|
12775
|
-
/**
|
|
12776
|
-
* 处理错误数组 errors(如果有配置)
|
|
12777
|
-
* 子类可重写此方法来自定义错误数组处理逻辑
|
|
12778
|
-
* @param httpData
|
|
12779
|
-
* @param response
|
|
12780
|
-
*/
|
|
12781
12702
|
handleErrorArray(httpData, response) {
|
|
12782
12703
|
var _a2;
|
|
12783
12704
|
const errorsField = (_a2 = this.responseFields) == null ? void 0 : _a2.errors;
|
|
@@ -12791,20 +12712,14 @@ class BaseApi extends BaseHttpClient {
|
|
|
12791
12712
|
}
|
|
12792
12713
|
}
|
|
12793
12714
|
}
|
|
12794
|
-
|
|
12795
|
-
* 显示错误数组通知
|
|
12796
|
-
* 子类可重写此方法来自定义错误数组通知显示方式
|
|
12797
|
-
* @param errors - 错误数组
|
|
12798
|
-
* @param notificationOptions
|
|
12799
|
-
*/
|
|
12800
|
-
showErrorArrayNotification(errors, notificationOptions) {
|
|
12715
|
+
showNotification(items, type, color, notificationOptions) {
|
|
12801
12716
|
var _a2, _b;
|
|
12802
|
-
const html = errors.map((item) => `<div style="font-size: 14px;color:red">${item.code}:${item.message}</div>`).join("");
|
|
12803
12717
|
const defaultOptions = {
|
|
12804
12718
|
title: "提示",
|
|
12805
|
-
type
|
|
12719
|
+
type
|
|
12806
12720
|
};
|
|
12807
|
-
if (hasDocument) {
|
|
12721
|
+
if (this.hasDocument) {
|
|
12722
|
+
const html = items.map((item) => `<div style="font-size: 14px;color:${color}">${item.code}:${item.message}</div>`).join("");
|
|
12808
12723
|
const finalOptions = {
|
|
12809
12724
|
...defaultOptions,
|
|
12810
12725
|
...notificationOptions,
|
|
@@ -12812,21 +12727,18 @@ class BaseApi extends BaseHttpClient {
|
|
|
12812
12727
|
};
|
|
12813
12728
|
(_a2 = this.notificationInstance) == null ? void 0 : _a2.call(this, finalOptions);
|
|
12814
12729
|
} else {
|
|
12815
|
-
const
|
|
12730
|
+
const messages = items.map((item) => `${item.code}:${item.message}`).join("\n");
|
|
12816
12731
|
const finalOptions = {
|
|
12817
12732
|
...defaultOptions,
|
|
12818
12733
|
...notificationOptions,
|
|
12819
|
-
message:
|
|
12734
|
+
message: messages
|
|
12820
12735
|
};
|
|
12821
12736
|
(_b = this.notificationInstance) == null ? void 0 : _b.call(this, finalOptions);
|
|
12822
12737
|
}
|
|
12823
12738
|
}
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
* @param httpData
|
|
12828
|
-
* @param response
|
|
12829
|
-
*/
|
|
12739
|
+
showErrorArrayNotification(errors, notificationOptions) {
|
|
12740
|
+
this.showNotification(errors, "error", "red", notificationOptions);
|
|
12741
|
+
}
|
|
12830
12742
|
handleTips(httpData, response) {
|
|
12831
12743
|
var _a2;
|
|
12832
12744
|
const tipsField = (_a2 = this.responseFields) == null ? void 0 : _a2.tips;
|
|
@@ -12839,194 +12751,41 @@ class BaseApi extends BaseHttpClient {
|
|
|
12839
12751
|
}
|
|
12840
12752
|
}
|
|
12841
12753
|
}
|
|
12842
|
-
/**
|
|
12843
|
-
* 显示提示信息通知
|
|
12844
|
-
* 子类可重写此方法来自定义提示信息通知显示方式
|
|
12845
|
-
* @param tips - 提示信息数组
|
|
12846
|
-
* @param notificationOptions
|
|
12847
|
-
*/
|
|
12848
12754
|
showTipsNotification(tips, notificationOptions) {
|
|
12849
|
-
|
|
12850
|
-
const html = tips.map((item) => `<div style="font-size: 14px;color:#E6A23C">${item.code}:${item.message}</div>`).join("");
|
|
12851
|
-
const defaultOptions = {
|
|
12852
|
-
title: "提示",
|
|
12853
|
-
type: "warning"
|
|
12854
|
-
};
|
|
12855
|
-
if (hasDocument) {
|
|
12856
|
-
const finalOptions = {
|
|
12857
|
-
...defaultOptions,
|
|
12858
|
-
...notificationOptions,
|
|
12859
|
-
message: html
|
|
12860
|
-
};
|
|
12861
|
-
(_a2 = this.notificationInstance) == null ? void 0 : _a2.call(this, finalOptions);
|
|
12862
|
-
} else {
|
|
12863
|
-
const tipMessages = tips.map((item) => `${item.code}:${item.message}`).join("\n");
|
|
12864
|
-
const finalOptions = {
|
|
12865
|
-
...defaultOptions,
|
|
12866
|
-
...notificationOptions,
|
|
12867
|
-
message: tipMessages
|
|
12868
|
-
};
|
|
12869
|
-
(_b = this.notificationInstance) == null ? void 0 : _b.call(this, finalOptions);
|
|
12870
|
-
}
|
|
12871
|
-
}
|
|
12872
|
-
/**
|
|
12873
|
-
* 显示系统异常对话框,当响应状态码为 -1 时调用
|
|
12874
|
-
* @param response - Axios 响应对象
|
|
12875
|
-
* @param responseData - 响应数据
|
|
12876
|
-
* @param code - 错误状态码
|
|
12877
|
-
* @param message - 错误消息
|
|
12878
|
-
*/
|
|
12879
|
-
async showSystemExceptionDialog(response, responseData, code, message2) {
|
|
12880
|
-
if (!hasDocument) {
|
|
12881
|
-
console.error("系统异常信息:", responseData);
|
|
12882
|
-
return;
|
|
12883
|
-
}
|
|
12884
|
-
try {
|
|
12885
|
-
if (!systemErrorDialogInstance) {
|
|
12886
|
-
try {
|
|
12887
|
-
const { default: SystemErrorDialog2 } = await dynamicImports(Promise.resolve().then(() => SystemErrorDialog$1), ["default"]);
|
|
12888
|
-
systemErrorDialogInstance = createApiDialog(SystemErrorDialog2);
|
|
12889
|
-
} catch (error) {
|
|
12890
|
-
console.warn("Failed to load SystemErrorDialog:", error);
|
|
12891
|
-
console.error("系统异常信息:", responseData);
|
|
12892
|
-
return;
|
|
12893
|
-
}
|
|
12894
|
-
}
|
|
12895
|
-
const errorInfo = extractSystemErrorInfo(response, code, message2);
|
|
12896
|
-
systemErrorDialogInstance.show({
|
|
12897
|
-
props: {
|
|
12898
|
-
title: "系统异常信息",
|
|
12899
|
-
width: 600,
|
|
12900
|
-
...errorInfo
|
|
12901
|
-
}
|
|
12902
|
-
}).then((result) => {
|
|
12903
|
-
if (result == null ? void 0 : result.reported) {
|
|
12904
|
-
/* @__PURE__ */ console.log("系统异常已上报:", result);
|
|
12905
|
-
this.reportError(result.errorInfo);
|
|
12906
|
-
} else {
|
|
12907
|
-
/* @__PURE__ */ console.log("系统异常对话框已确认");
|
|
12908
|
-
}
|
|
12909
|
-
}).catch((e) => {
|
|
12910
|
-
/* @__PURE__ */ console.log("系统异常对话框已关闭", e);
|
|
12911
|
-
});
|
|
12912
|
-
} catch (error) {
|
|
12913
|
-
console.error("显示系统异常对话框失败:", error);
|
|
12914
|
-
console.error("系统异常信息:", responseData);
|
|
12915
|
-
}
|
|
12755
|
+
this.showNotification(tips, "warning", "#E6A23C", notificationOptions);
|
|
12916
12756
|
}
|
|
12917
|
-
/**
|
|
12918
|
-
* 上报错误信息到服务器,默认实现仅显示提示,子类可重写实现真实上报
|
|
12919
|
-
* @param errorInfo - 错误信息对象
|
|
12920
|
-
*/
|
|
12921
|
-
async reportError(errorInfo) {
|
|
12922
|
-
var _a2, _b;
|
|
12923
|
-
try {
|
|
12924
|
-
/* @__PURE__ */ console.log("🚀 开始上报错误信息:", errorInfo);
|
|
12925
|
-
/* @__PURE__ */ console.log("✅ 错误信息上报成功");
|
|
12926
|
-
(_a2 = this.messageInstance) == null ? void 0 : _a2.success({
|
|
12927
|
-
message: "错误信息已成功上报",
|
|
12928
|
-
duration: 3 * 1e3
|
|
12929
|
-
});
|
|
12930
|
-
} catch (error) {
|
|
12931
|
-
console.error("❌ 错误信息上报失败:", error);
|
|
12932
|
-
(_b = this.messageInstance) == null ? void 0 : _b.error({
|
|
12933
|
-
message: "错误信息上报失败,请稍后重试",
|
|
12934
|
-
duration: 5 * 1e3
|
|
12935
|
-
});
|
|
12936
|
-
}
|
|
12937
|
-
}
|
|
12938
|
-
/**
|
|
12939
|
-
* 发送 HTTP 请求,所有 HTTP 方法最终都调用此方法
|
|
12940
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
12941
|
-
* @param config - Axios 请求配置对象
|
|
12942
|
-
* @returns 解析后的响应数据
|
|
12943
|
-
*/
|
|
12944
12757
|
async request(config) {
|
|
12945
12758
|
return super.request(config);
|
|
12946
12759
|
}
|
|
12947
|
-
/**
|
|
12948
|
-
* 发送 GET 请求
|
|
12949
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
12950
|
-
* @param url - 请求 URL 路径
|
|
12951
|
-
* @param params - 查询参数对象
|
|
12952
|
-
* @param config - 额外的请求配置
|
|
12953
|
-
* @returns 解析后的响应数据
|
|
12954
|
-
*/
|
|
12955
12760
|
async get(url, params, config) {
|
|
12956
12761
|
return super.get(url, params, config);
|
|
12957
12762
|
}
|
|
12958
|
-
/**
|
|
12959
|
-
* 发送 POST 请求
|
|
12960
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
12961
|
-
* @param url - 请求 URL 路径
|
|
12962
|
-
* @param data - 请求体数据
|
|
12963
|
-
* @param config - 额外的请求配置
|
|
12964
|
-
* @returns 解析后的响应数据
|
|
12965
|
-
*/
|
|
12966
12763
|
async post(url, data, config) {
|
|
12967
12764
|
return super.post(url, data, config);
|
|
12968
12765
|
}
|
|
12969
|
-
/**
|
|
12970
|
-
* 发送 DELETE 请求
|
|
12971
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
12972
|
-
* @param url - 请求 URL 路径
|
|
12973
|
-
* @param params - 查询参数对象
|
|
12974
|
-
* @param config - 额外的请求配置
|
|
12975
|
-
* @returns 解析后的响应数据
|
|
12976
|
-
*/
|
|
12977
12766
|
async delete(url, params, config) {
|
|
12978
12767
|
return super.delete(url, params, config);
|
|
12979
12768
|
}
|
|
12980
|
-
/**
|
|
12981
|
-
* 发送 PUT 请求
|
|
12982
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
12983
|
-
* @param url - 请求 URL 路径
|
|
12984
|
-
* @param data - 请求体数据
|
|
12985
|
-
* @param config - 额外的请求配置
|
|
12986
|
-
* @returns 解析后的响应数据
|
|
12987
|
-
*/
|
|
12988
12769
|
async put(url, data, config) {
|
|
12989
12770
|
return super.put(url, data, config);
|
|
12990
12771
|
}
|
|
12991
|
-
/**
|
|
12992
|
-
* 批量请求,并发发送多个请求
|
|
12993
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
12994
|
-
* @param requests - 请求配置数组或已发起的请求 Promise 数组
|
|
12995
|
-
* @returns 所有请求的响应数据数组
|
|
12996
|
-
*/
|
|
12997
12772
|
async all(requests) {
|
|
12998
12773
|
return super.all(requests);
|
|
12999
12774
|
}
|
|
13000
|
-
/**
|
|
13001
|
-
* 文件上传,将文件包装为 FormData 发送
|
|
13002
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
13003
|
-
* @param url - 上传地址
|
|
13004
|
-
* @param file - 文件对象
|
|
13005
|
-
* @param config - 额外的请求配置
|
|
13006
|
-
* @returns 解析后的响应数据
|
|
13007
|
-
*/
|
|
13008
12775
|
async uploadFile(url, file, config) {
|
|
13009
12776
|
return super.uploadFile(url, file, config);
|
|
13010
12777
|
}
|
|
13011
|
-
/**
|
|
13012
|
-
* 下载文件,将 Blob 对象下载到本地
|
|
13013
|
-
* 显式声明以确保类型一致性,子类可重写此方法
|
|
13014
|
-
* @param blob - Blob 对象
|
|
13015
|
-
* @param filename - 文件名,如果不提供则使用时间戳
|
|
13016
|
-
*/
|
|
13017
12778
|
downloadFile(blob, filename) {
|
|
13018
12779
|
return super.downloadFile(blob, filename);
|
|
13019
12780
|
}
|
|
13020
|
-
}
|
|
12781
|
+
};
|
|
12782
|
+
__publicField(_BaseApi, "hasDocument", typeof document !== "undefined");
|
|
12783
|
+
__publicField(_BaseApi, "systemErrorInfoMap", /* @__PURE__ */ new Map());
|
|
12784
|
+
let BaseApi = _BaseApi;
|
|
13021
12785
|
function createHttpService(options = {}) {
|
|
13022
12786
|
return new BaseApi(options);
|
|
13023
12787
|
}
|
|
13024
12788
|
const VueAxiosPlugin = {
|
|
13025
|
-
/**
|
|
13026
|
-
* 安装插件
|
|
13027
|
-
* @param app - Vue 应用实例
|
|
13028
|
-
* @param options - 插件配置选项
|
|
13029
|
-
*/
|
|
13030
12789
|
install(app, options = {}) {
|
|
13031
12790
|
const httpService = createHttpService(options.default ?? {});
|
|
13032
12791
|
app.config.globalProperties.$http = httpService;
|
|
@@ -13116,7 +12875,6 @@ const SystemErrorDialog = defineComponent({
|
|
|
13116
12875
|
const localUserInfo = getUserInfoFromLocalStorage();
|
|
13117
12876
|
return {
|
|
13118
12877
|
userName: localUserInfo.username ?? props.userName,
|
|
13119
|
-
// userId: localUserInfo.id ?? props.userId,
|
|
13120
12878
|
userId: localUserInfo.usercode ?? props.userId,
|
|
13121
12879
|
deptName: localUserInfo.workDeptName ?? props.deptName,
|
|
13122
12880
|
deptId: localUserInfo.workDeptId ?? props.deptId,
|
|
@@ -13199,6 +12957,7 @@ const SystemErrorDialog = defineComponent({
|
|
|
13199
12957
|
"showClose": true,
|
|
13200
12958
|
"closeOnClickModal": false,
|
|
13201
12959
|
"closeOnPressEscape": false,
|
|
12960
|
+
"zIndex": 99999999,
|
|
13202
12961
|
"style": { padding: "16px 0" },
|
|
13203
12962
|
"onUpdate:modelValue": handleModelValueChange
|
|
13204
12963
|
},
|
|
@@ -13208,12 +12967,10 @@ const SystemErrorDialog = defineComponent({
|
|
|
13208
12967
|
h("span", { style: { fontWeight: "bold", fontSize: "16px" } }, props.title || "系统异常信息")
|
|
13209
12968
|
]),
|
|
13210
12969
|
default: () => h("div", { style: { padding: 0, maxHeight: "500px", overflowY: "auto" } }, [
|
|
13211
|
-
// 第一块:无法完成您的请求
|
|
13212
12970
|
h("div", { style: { padding: "20px", borderBottom: "1px solid #ebeef5" } }, [
|
|
13213
12971
|
h("h3", { style: { margin: "0 0 12px 0", fontSize: "16px", fontWeight: "bold", color: "#303133" } }, "无法完成您的请求"),
|
|
13214
12972
|
h("p", { style: { margin: 0, color: "#606266", lineHeight: 1.5 } }, "系统在处理您的请求时遇到了问题,可能是由于服务暂时不可用。")
|
|
13215
12973
|
]),
|
|
13216
|
-
// 第二块:技术摘要(可展开)
|
|
13217
12974
|
h("div", { style: { borderBottom: "1px solid #ebeef5" } }, [
|
|
13218
12975
|
h(
|
|
13219
12976
|
"div",
|
|
@@ -13275,7 +13032,6 @@ const SystemErrorDialog = defineComponent({
|
|
|
13275
13032
|
)
|
|
13276
13033
|
) : null
|
|
13277
13034
|
]),
|
|
13278
|
-
// SkyWalking 按钮
|
|
13279
13035
|
h("div", { style: { padding: "16px 20px", borderBottom: "1px solid #ebeef5" } }, [
|
|
13280
13036
|
h(
|
|
13281
13037
|
ElButton,
|
|
@@ -13287,7 +13043,6 @@ const SystemErrorDialog = defineComponent({
|
|
|
13287
13043
|
{ default: () => "📊 在SkyWalking中查看详情" }
|
|
13288
13044
|
)
|
|
13289
13045
|
]),
|
|
13290
|
-
// 黑色错误信息区域
|
|
13291
13046
|
h("div", { style: { backgroundColor: "#2c3e50", color: "#fff", padding: "16px 20px", fontFamily: 'Monaco, Consolas, "Courier New", monospace', fontSize: "12px", lineHeight: 1.5, maxHeight: "200px", overflowY: "auto" } }, [
|
|
13292
13047
|
h("div", { style: { marginBottom: "8px", color: "#ecf0f1" } }, `Trace ID: ${props.traceId || "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8"}`),
|
|
13293
13048
|
h("div", { style: { color: "#e74c3c", fontWeight: "bold", whiteSpace: "pre-wrap" } }, `Error: ${props.errorMessage || "Connection timeout after 5000ms"}`)
|