@moluoxixi/ajax-package 0.0.28 → 0.0.30

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.
@@ -6,6 +6,8 @@ export interface SystemErrorDialogPropsType {
6
6
  deptName?: string;
7
7
  deptId?: string;
8
8
  clientIp?: string;
9
+ isStart?: boolean;
10
+ menuName?: string;
9
11
  requestUrl?: string;
10
12
  traceId?: string;
11
13
  errorMessage?: string;
@@ -3,4 +3,5 @@ import { SystemErrorDialogPropsType } from '../_types/index.ts';
3
3
  export declare function normalizePayload(payload: any): Record<string, any>;
4
4
  export declare function resolveTraceId(headers: AxiosResponse['headers'] | undefined): string;
5
5
  export declare function getUserInfoFromLocalStorage(): Record<string, any>;
6
+ export declare function getCurrentMenuLocalStorage(): Record<string, any>;
6
7
  export declare function extractSystemErrorInfo(response: AxiosResponse, code: number, message: string): Omit<SystemErrorDialogPropsType, 'title' | 'width'>;
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("164b41d1-677b-4c78-84fd-e1396b9efac6")) {
5
+ if (!document.getElementById("53e0d8c6-e714-459c-b36d-af44a2fd903c")) {
6
6
  var elementStyle = document.createElement("style");
7
- elementStyle.id = "164b41d1-677b-4c78-84fd-e1396b9efac6";
7
+ elementStyle.id = "53e0d8c6-e714-459c-b36d-af44a2fd903c";
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
  }
@@ -7364,6 +7364,20 @@ function getUserInfoFromLocalStorage() {
7364
7364
  return {};
7365
7365
  }
7366
7366
  }
7367
+ function getCurrentMenuLocalStorage() {
7368
+ if (typeof window === "undefined" || typeof localStorage === "undefined")
7369
+ return {};
7370
+ try {
7371
+ const userInfoStr = localStorage.getItem("currentMenu");
7372
+ if (!userInfoStr)
7373
+ return {};
7374
+ const currentMenu = JSON.parse(userInfoStr);
7375
+ return currentMenu || {};
7376
+ } catch (error) {
7377
+ console.warn("Failed to parse currentMenu from localStorage:", error);
7378
+ return {};
7379
+ }
7380
+ }
7367
7381
  function extractSystemErrorInfo(response, code, message2) {
7368
7382
  var _a2, _b;
7369
7383
  const mergedRequestPayload = {
@@ -7380,12 +7394,15 @@ function extractSystemErrorInfo(response, code, message2) {
7380
7394
  return baseURL.endsWith("/") && url.startsWith("/") ? baseURL + url.slice(1) : baseURL.endsWith("/") || url.startsWith("/") || !url ? baseURL + url : `${baseURL}/${url}`;
7381
7395
  }
7382
7396
  const userInfo = getUserInfoFromLocalStorage();
7397
+ const currentMenu = getCurrentMenuLocalStorage();
7383
7398
  return {
7384
7399
  userName: userInfo.username ?? mergedRequestPayload.userName ?? mergedRequestPayload.username,
7385
7400
  userId: userInfo.id ?? mergedRequestPayload.userId ?? mergedRequestPayload.userid,
7386
7401
  deptName: userInfo.workDeptName ?? mergedRequestPayload.deptName ?? mergedRequestPayload.departmentName,
7387
7402
  deptId: userInfo.workDeptId ?? mergedRequestPayload.deptId ?? mergedRequestPayload.departmentId,
7388
7403
  clientIp: userInfo.loginip ?? mergedRequestPayload.clientIp ?? mergedRequestPayload.ip,
7404
+ isStart: userInfo.isStart ?? mergedRequestPayload.isStart,
7405
+ menuName: currentMenu.title ?? mergedRequestPayload.menuName,
7389
7406
  requestUrl: getFullRequestUrl(),
7390
7407
  traceId: resolveTraceId(response.headers),
7391
7408
  errorCode: code,
@@ -7929,7 +7946,7 @@ const _BaseApi = class _BaseApi extends BaseHttpClient {
7929
7946
  }
7930
7947
  styleElement.textContent = `
7931
7948
  .system-error-message {
7932
- z-index: 999999 !important;
7949
+ z-index: 99999998 !important;
7933
7950
  }
7934
7951
  `;
7935
7952
  }
@@ -7968,6 +7985,7 @@ const _BaseApi = class _BaseApi extends BaseHttpClient {
7968
7985
  const finalOptions = {
7969
7986
  ...defaultOptions,
7970
7987
  ...notificationOptions,
7988
+ dangerouslyUseHTMLString: true,
7971
7989
  message: html
7972
7990
  };
7973
7991
  (_a2 = this.notificationInstance) == null ? void 0 : _a2.call(this, finalOptions);
@@ -8118,12 +8136,15 @@ const SystemErrorDialog = defineComponent({
8118
8136
  const isMobile = typeof window !== "undefined" && window.innerWidth <= 768;
8119
8137
  const userInfo = computed(() => {
8120
8138
  const localUserInfo = getUserInfoFromLocalStorage();
8139
+ const currentMenu = getCurrentMenuLocalStorage();
8121
8140
  return {
8122
8141
  userName: localUserInfo.username ?? props.userName,
8123
8142
  userId: localUserInfo.usercode ?? props.userId,
8143
+ isStart: localUserInfo.isStart ?? false,
8144
+ menuName: (currentMenu == null ? void 0 : currentMenu.title) ?? "",
8124
8145
  deptName: localUserInfo.workDeptName ?? props.deptName,
8125
8146
  deptId: localUserInfo.workDeptId ?? props.deptId,
8126
- clientIp: localUserInfo.loginip ?? props.clientIp
8147
+ clientIp: localUserInfo.isStart ? localUserInfo.loginip ?? props.clientIp : ""
8127
8148
  };
8128
8149
  });
8129
8150
  const techSummaryItems = computed(() => [
@@ -8132,7 +8153,8 @@ const SystemErrorDialog = defineComponent({
8132
8153
  { label: "科室名称", value: userInfo.value.deptName },
8133
8154
  { label: "科室ID", value: userInfo.value.deptId },
8134
8155
  { label: "客户端IP", value: userInfo.value.clientIp },
8135
- { label: "菜单名称", value: currentUrl },
8156
+ { label: "菜单URL", value: currentUrl },
8157
+ { label: "菜单名称", value: userInfo.value.menuName },
8136
8158
  { label: "请求URL路径", value: props.requestUrl },
8137
8159
  { label: "链路ID", value: props.traceId }
8138
8160
  ]);
@@ -8161,7 +8183,8 @@ const SystemErrorDialog = defineComponent({
8161
8183
  clientIp: userInfo.value.clientIp,
8162
8184
  requestPath: props.requestUrl,
8163
8185
  traceId: props.traceId,
8164
- menuName: currentUrl,
8186
+ menuName: userInfo.value.menuName,
8187
+ menuUrl: currentUrl,
8165
8188
  errorMessage: props.errorMessage
8166
8189
  });
8167
8190
  ElMessage.success("上报成功");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moluoxixi/ajax-package",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "AjaxPackage 组件",
5
5
  "sideEffects": [
6
6
  "*.css",