@utogether/utils 3.0.0-beta.32 → 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,6 +26,8 @@ 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
33
  export declare const dbstorage: localforageProxy;
package/dist/utils.es.js CHANGED
@@ -1227,7 +1227,7 @@ const useRender = () => {
1227
1227
  placeholder: null
1228
1228
  }, L, S;
1229
1229
  isObject(c) ? (C = Object.assign(C, c), L = c.defaultValue, S = c == null ? void 0 : c.code) : S = c;
1230
- 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") : [];
1231
1231
  return {
1232
1232
  name: "#select",
1233
1233
  optionProps: a,
@@ -1356,14 +1356,14 @@ const useRender = () => {
1356
1356
  const u = w(H), C = "yyyy-MM-dd HH:mm:ss", L = c == null ? void 0 : c.defaultValue;
1357
1357
  return { name: "VxeDatePicker", props: Object.assign({ type: "date", valueFormat: C, clearable: !0 }, c || {}), defaultValue: L, events: u };
1358
1358
  }, m = (c, H) => {
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, 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 || {});
1360
1360
  return {
1361
1361
  name: "VxeDateRangePicker",
1362
1362
  startField: I,
1363
1363
  endField: D,
1364
1364
  startValue: L,
1365
1365
  endValue: S,
1366
- props: T,
1366
+ props: R,
1367
1367
  events: u
1368
1368
  };
1369
1369
  }, s = (c, H) => {
@@ -1405,7 +1405,7 @@ const useRender = () => {
1405
1405
  !isFunction(c) && isObject(c) && Object.assign(u, c);
1406
1406
  const C = isFunction(c) ? c : H;
1407
1407
  return p(u, C);
1408
- }, 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) => {
1409
1409
  const u = w(H);
1410
1410
  return {
1411
1411
  name: "#area",
@@ -1425,7 +1425,7 @@ const useRender = () => {
1425
1425
  prefixClick: c == null ? void 0 : c.prefixClick,
1426
1426
  filterMethod: c == null ? void 0 : c.filterMethod
1427
1427
  } : c && (H = { change: c }), H;
1428
- }, E = (c, H) => {
1428
+ }, T = (c, H) => {
1429
1429
  c = c || { fieldType: "string", mode: "image" };
1430
1430
  const { singleMode: u, mode: C } = c;
1431
1431
  return u && Object.assign(c, {
@@ -1457,8 +1457,8 @@ const useRender = () => {
1457
1457
  renderEnabled: A,
1458
1458
  renderIconSelect: k,
1459
1459
  renderTreeSelect: V,
1460
- renderArea: R,
1461
- renderUpload: E
1460
+ renderArea: E,
1461
+ renderUpload: T
1462
1462
  };
1463
1463
  }, useGlobal = () => {
1464
1464
  const a = getCurrentInstance();
@@ -1718,7 +1718,9 @@ const kTOKENKEY = "authorized-token", defaultConfig = {
1718
1718
  e.expires - i <= 0 ? (g.isRefreshing || (g.isRefreshing = !0, this.get(this.baseUrl + "/uath/refreshToken", {
1719
1719
  refreshToken: e.refreshToken
1720
1720
  }).then((v) => {
1721
- 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();
1722
1724
  }).finally(() => {
1723
1725
  g.isRefreshing = !1;
1724
1726
  })), h(g.retryOriginalRequest(l))) : (l.headers.Authorization = "Bearer " + e.accessToken, h(l));
@@ -1738,6 +1740,9 @@ const kTOKENKEY = "authorized-token", defaultConfig = {
1738
1740
  };
1739
1741
  cookies.set(kTOKENKEY, JSON.stringify(e));
1740
1742
  }
1743
+ routeToLogin() {
1744
+ g.requests = [], cookies.remove("kCookies_token"), cookies.remove("authorized-token"), cookies.remove("loginer"), this.router.push({ name: "login" });
1745
+ }
1741
1746
  // 响应拦截
1742
1747
  httpInterceptorsResponse() {
1743
1748
  g.axiosInstance.interceptors.response.use(
@@ -2639,11 +2644,11 @@ const http = new SuHttp(), lunarCalendar = {
2639
2644
  for (t = 1; t < 13 && d > 0; t++)
2640
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;
2641
2646
  d === 0 && v > 0 && t === v + 1 && (M ? M = !1 : (M = !0, --t)), d < 0 && (d += Z, --t);
2642
- 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);
2643
2648
  let w = this.toGanZhi((h - 1900) * 12 + r + 11);
2644
2649
  e >= V && (w = this.toGanZhi((h - 1900) * 12 + r + 12));
2645
- let E = !1, F;
2646
- 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]);
2647
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;
2648
2653
  let N = p + "-" + y;
2649
2654
  return p === 12 && y === 29 && this.monthDays(s, p) === 29 && (N = "12-30"), {
@@ -2667,7 +2672,7 @@ const http = new SuHttp(), lunarCalendar = {
2667
2672
  isLeap: M,
2668
2673
  nWeek: b,
2669
2674
  ncWeek: "星期" + m,
2670
- isTerm: E,
2675
+ isTerm: T,
2671
2676
  Term: F,
2672
2677
  astro: u
2673
2678
  };