@utogether/utils 3.0.0-beta.33 → 3.0.0-beta.34

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.
@@ -17,6 +17,7 @@ declare class SuHttp {
17
17
  private static retryOriginalRequest;
18
18
  private httpInterceptorsRequest;
19
19
  private setToken;
20
+ private routeToLogin;
20
21
  private httpInterceptorsResponse;
21
22
  private transformConfigByMethod;
22
23
  request<T>(method: RequestMethods, url: string, param?: AxiosRequestConfig, axiosConfig?: SuHttpRequestConfig): Promise<T>;
@@ -26,8 +26,9 @@ declare class localforageProxy implements ProxyStorage {
26
26
  removeItem(key: string): void;
27
27
  clear(): void;
28
28
  }
29
+ /** 文档开头 */
30
+ /** 文档结束 */
29
31
  export declare const storageSession: sessionStorageProxy;
30
32
  export declare const storageLocal: localStorageProxy;
31
- /** 文档结束 */
32
33
  export declare const dbstorage: localforageProxy;
33
34
  export {};
package/dist/utils.es.js CHANGED
@@ -69,12 +69,7 @@ class localforageProxy {
69
69
  this.storage.clear();
70
70
  }
71
71
  }
72
- let window$1;
73
- window$1 || (window$1 = {
74
- sessionStorage: {},
75
- localStorage: {}
76
- });
77
- const storageSession = new sessionStorageProxy(window$1 == null ? void 0 : window$1.sessionStorage), storageLocal = new localStorageProxy(window$1 == null ? void 0 : window$1.localStorage), dbstorage = new localforageProxy();
72
+ const storageSession = new sessionStorageProxy(sessionStorage), storageLocal = new localStorageProxy(localStorage), dbstorage = new localforageProxy();
78
73
  /*! typescript-cookie v1.0.6 | MIT */
79
74
  const encodeName = (a) => encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), encodeValue = (a) => encodeURIComponent(a).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent), decodeName = decodeURIComponent, decodeValue = (a) => (a[0] === '"' && (a = a.slice(1, -1)), a.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent));
80
75
  function stringifyAttributes(a) {
@@ -1232,7 +1227,7 @@ const useRender = () => {
1232
1227
  placeholder: null
1233
1228
  }, L, S;
1234
1229
  isObject(c) ? (C = Object.assign(C, c), L = c.defaultValue, S = c == null ? void 0 : c.code) : S = c;
1235
- const I = (N = storageLocal.getItem("kLov")[S]) == null ? void 0 : N.children, D = I ? I.filter((T) => T.enabled === "1") : [];
1230
+ const I = (N = storageLocal.getItem("kLov")[S]) == null ? void 0 : N.children, D = I ? I.filter((R) => R.enabled === "1") : [];
1236
1231
  return {
1237
1232
  name: "#select",
1238
1233
  optionProps: a,
@@ -1361,14 +1356,14 @@ const useRender = () => {
1361
1356
  const u = w(H), C = "yyyy-MM-dd HH:mm:ss", L = c == null ? void 0 : c.defaultValue;
1362
1357
  return { name: "VxeDatePicker", props: Object.assign({ type: "date", valueFormat: C, clearable: !0 }, c || {}), defaultValue: L, events: u };
1363
1358
  }, m = (c, H) => {
1364
- const u = w(H), C = "yyyy-MM-dd HH:mm:ss", L = c == null ? void 0 : c.startValue, S = c == null ? void 0 : c.endValue, I = c == null ? void 0 : c.startField, D = c == null ? void 0 : c.endField, T = Object.assign({ type: "date", valueFormat: C, clearable: !0 }, c || {});
1359
+ const u = w(H), C = "yyyy-MM-dd HH:mm:ss", L = c == null ? void 0 : c.startValue, S = c == null ? void 0 : c.endValue, I = c == null ? void 0 : c.startField, D = c == null ? void 0 : c.endField, R = Object.assign({ type: "date", valueFormat: C, clearable: !0 }, c || {});
1365
1360
  return {
1366
1361
  name: "VxeDateRangePicker",
1367
1362
  startField: I,
1368
1363
  endField: D,
1369
1364
  startValue: L,
1370
1365
  endValue: S,
1371
- props: T,
1366
+ props: R,
1372
1367
  events: u
1373
1368
  };
1374
1369
  }, s = (c, H) => {
@@ -1410,7 +1405,7 @@ const useRender = () => {
1410
1405
  !isFunction(c) && isObject(c) && Object.assign(u, c);
1411
1406
  const C = isFunction(c) ? c : H;
1412
1407
  return p(u, C);
1413
- }, k = () => ({ name: "#iconSelect" }), V = (c = [], H = {}, u) => ({ name: "#treeSelect", sourceData: c, props: H, events: u }), R = (c, H) => {
1408
+ }, k = () => ({ name: "#iconSelect" }), V = (c = [], H = {}, u) => ({ name: "#treeSelect", sourceData: c, props: H, events: u }), E = (c, H) => {
1414
1409
  const u = w(H);
1415
1410
  return {
1416
1411
  name: "#area",
@@ -1430,7 +1425,7 @@ const useRender = () => {
1430
1425
  prefixClick: c == null ? void 0 : c.prefixClick,
1431
1426
  filterMethod: c == null ? void 0 : c.filterMethod
1432
1427
  } : c && (H = { change: c }), H;
1433
- }, E = (c, H) => {
1428
+ }, T = (c, H) => {
1434
1429
  c = c || { fieldType: "string", mode: "image" };
1435
1430
  const { singleMode: u, mode: C } = c;
1436
1431
  return u && Object.assign(c, {
@@ -1462,8 +1457,8 @@ const useRender = () => {
1462
1457
  renderEnabled: A,
1463
1458
  renderIconSelect: k,
1464
1459
  renderTreeSelect: V,
1465
- renderArea: R,
1466
- renderUpload: E
1460
+ renderArea: E,
1461
+ renderUpload: T
1467
1462
  };
1468
1463
  }, useGlobal = () => {
1469
1464
  const a = getCurrentInstance();
@@ -1723,7 +1718,9 @@ const kTOKENKEY = "authorized-token", defaultConfig = {
1723
1718
  e.expires - i <= 0 ? (g.isRefreshing || (g.isRefreshing = !0, this.get(this.baseUrl + "/uath/refreshToken", {
1724
1719
  refreshToken: e.refreshToken
1725
1720
  }).then((v) => {
1726
- this.setToken(v), l.headers.Authorization = "Bearer " + v.access_token, g.requests.forEach((Z) => Z(v.access_token)), g.requests = [];
1721
+ v != null && v.access_token ? (this.setToken(v), l.headers.Authorization = "Bearer " + v.access_token, g.requests.forEach((Z) => Z(v.access_token)), g.requests = []) : this.routeToLogin();
1722
+ }).catch(() => {
1723
+ this.routeToLogin();
1727
1724
  }).finally(() => {
1728
1725
  g.isRefreshing = !1;
1729
1726
  })), h(g.retryOriginalRequest(l))) : (l.headers.Authorization = "Bearer " + e.accessToken, h(l));
@@ -1743,6 +1740,9 @@ const kTOKENKEY = "authorized-token", defaultConfig = {
1743
1740
  };
1744
1741
  cookies.set(kTOKENKEY, JSON.stringify(e));
1745
1742
  }
1743
+ routeToLogin() {
1744
+ g.requests = [], cookies.remove("kCookies_token"), cookies.remove("authorized-token"), cookies.remove("loginer"), this.router.push({ name: "login" });
1745
+ }
1746
1746
  // 响应拦截
1747
1747
  httpInterceptorsResponse() {
1748
1748
  g.axiosInstance.interceptors.response.use(
@@ -2644,11 +2644,11 @@ const http = new SuHttp(), lunarCalendar = {
2644
2644
  for (t = 1; t < 13 && d > 0; t++)
2645
2645
  v > 0 && t === v + 1 && M === !1 ? (--t, M = !0, Z = this.leapDays(s)) : Z = this.monthDays(s, t), M === !0 && t === v + 1 && (M = !1), d -= Z;
2646
2646
  d === 0 && v > 0 && t === v + 1 && (M ? M = !1 : (M = !0, --t)), d < 0 && (d += Z, --t);
2647
- const p = t, y = d + 1, A = r - 1, k = this.toGanZhiYear(s), V = this.getTerm(h, r * 2 - 1), R = this.getTerm(h, r * 2);
2647
+ const p = t, y = d + 1, A = r - 1, k = this.toGanZhiYear(s), V = this.getTerm(h, r * 2 - 1), E = this.getTerm(h, r * 2);
2648
2648
  let w = this.toGanZhi((h - 1900) * 12 + r + 11);
2649
2649
  e >= V && (w = this.toGanZhi((h - 1900) * 12 + r + 12));
2650
- let E = !1, F;
2651
- V === e && (E = !0, F = this.solarTerm[r * 2 - 2]), R === e && (E = !0, F = this.solarTerm[r * 2 - 1]);
2650
+ let T = !1, F;
2651
+ V === e && (T = !0, F = this.solarTerm[r * 2 - 2]), E === e && (T = !0, F = this.solarTerm[r * 2 - 1]);
2652
2652
  const c = Date.UTC(h, A, 1, 0, 0, 0, 0) / 864e5 + 25567 + 10, H = this.toGanZhi(c + e - 1), u = this.toAstro(r, e), C = h + "-" + r + "-" + e, L = s + "-" + p + "-" + y, S = this.festival, I = this.lFestival, D = r + "-" + e;
2653
2653
  let N = p + "-" + y;
2654
2654
  return p === 12 && y === 29 && this.monthDays(s, p) === 29 && (N = "12-30"), {
@@ -2672,7 +2672,7 @@ const http = new SuHttp(), lunarCalendar = {
2672
2672
  isLeap: M,
2673
2673
  nWeek: b,
2674
2674
  ncWeek: "星期" + m,
2675
- isTerm: E,
2675
+ isTerm: T,
2676
2676
  Term: F,
2677
2677
  astro: u
2678
2678
  };