yh-client 2.0.11 → 2.0.13

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/index.es.js CHANGED
@@ -117,16 +117,16 @@ class Le {
117
117
  }
118
118
  }
119
119
  const U = new Le();
120
- function Ox(B, d) {
120
+ function Ux(B, d) {
121
121
  return U.get(B, d);
122
122
  }
123
- function Wx(B, d) {
123
+ function Nx(B, d) {
124
124
  U.set(B, d);
125
125
  }
126
- function Lx(B) {
126
+ function Kx(B) {
127
127
  U.merge(B);
128
128
  }
129
- function Ux(B) {
129
+ function jx(B) {
130
130
  U.init(B);
131
131
  }
132
132
  var I = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
@@ -5142,10 +5142,10 @@ function Cx() {
5142
5142
  });
5143
5143
  })(ve);
5144
5144
  var Ex = ve.exports;
5145
- async function Nx(B) {
5145
+ async function Mx(B) {
5146
5146
  return Ex.MD5(B).toString();
5147
5147
  }
5148
- function Kx(B) {
5148
+ function Xx(B) {
5149
5149
  let d = 0;
5150
5150
  for (let t = 0; t < B.length; t++) {
5151
5151
  const r = B.charCodeAt(t);
@@ -5153,9 +5153,9 @@ function Kx(B) {
5153
5153
  }
5154
5154
  return Math.abs(d).toString(36);
5155
5155
  }
5156
- const jx = (B) => B.replace(/\_(\w)/g, function(d, t) {
5156
+ const Gx = (B) => B.replace(/\_(\w)/g, function(d, t) {
5157
5157
  return t.toUpperCase();
5158
- }), Mx = () => {
5158
+ }), $x = () => {
5159
5159
  const B = (/* @__PURE__ */ new Date()).getTime();
5160
5160
  return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function(t) {
5161
5161
  const r = (B + Math.random() * 16) % 16 | 0;
@@ -5170,7 +5170,7 @@ function px(B, d, t = window) {
5170
5170
  const r = (a) => d(a.detail);
5171
5171
  return t.addEventListener(B, r), () => t.removeEventListener(B, r);
5172
5172
  }
5173
- function Xx(B, d, t = window) {
5173
+ function Zx(B, d, t = window) {
5174
5174
  const r = px(
5175
5175
  B,
5176
5176
  (a) => {
@@ -5180,11 +5180,11 @@ function Xx(B, d, t = window) {
5180
5180
  );
5181
5181
  return r;
5182
5182
  }
5183
- function Gx(B, d, t = window) {
5183
+ function Yx(B, d, t = window) {
5184
5184
  const r = (a) => d(a.detail);
5185
5185
  t.removeEventListener(B, r);
5186
5186
  }
5187
- const $x = He, Zx = Se, Yx = Re;
5187
+ const Qx = He, Vx = Se, Jx = Re;
5188
5188
  class Ax {
5189
5189
  constructor(d = "") {
5190
5190
  this.timeout = 12e4, this.baseUrl = d, this.queue = {};
@@ -5425,7 +5425,7 @@ const D0 = new Ax(), g0 = "SATOKEN", _0 = "login-token";
5425
5425
  function fe(B) {
5426
5426
  return /^[\x20-\x7E]*$/.test(B);
5427
5427
  }
5428
- function Qx() {
5428
+ function rt() {
5429
5429
  const B = E0(_0);
5430
5430
  B && fe(B) ? U.token = B : (U.token = "", fr(_0));
5431
5431
  const d = E0(g0);
@@ -5434,69 +5434,30 @@ function Qx() {
5434
5434
  function Fx(B) {
5435
5435
  ur(_0, B), U.token = B;
5436
5436
  }
5437
- function Vx() {
5437
+ function Dx() {
5438
5438
  if (U.token !== void 0)
5439
5439
  return U.token;
5440
5440
  const B = E0(_0);
5441
5441
  return U.token = B || "", U.token;
5442
5442
  }
5443
- function Dx(B) {
5443
+ function gx(B) {
5444
5444
  ur(g0, B), U.saToken = B;
5445
5445
  }
5446
- function Jx() {
5446
+ function _x() {
5447
5447
  if (U.saToken !== void 0)
5448
5448
  return U.saToken;
5449
5449
  const B = E0(g0);
5450
5450
  return U.saToken = B || "", U.saToken;
5451
5451
  }
5452
- function gx() {
5452
+ function bx() {
5453
5453
  U.token = "", U.saToken = "", We();
5454
5454
  }
5455
- function _x() {
5456
- gx();
5455
+ function yx() {
5456
+ bx();
5457
5457
  }
5458
- const rt = ze("clientStore", () => {
5459
- const B = s0(""), d = s0(""), t = s0(""), r = s0(""), a = s0(!!U.token || !!U.saToken), h = s0(!!U.saToken);
5460
- return {
5461
- // 用户信息
5462
- userId: B,
5463
- userName: d,
5464
- avatar: r,
5465
- // 计算属性
5466
- isLoggedIn: a,
5467
- isAdmin: h,
5468
- // 方法
5469
- login: async (l) => {
5470
- var s;
5471
- const x = await D0.post(
5472
- "loginController/login",
5473
- l,
5474
- "json"
5475
- );
5476
- return (s = x.data) != null && s.token && (Fx(x.data.token), a.value = !0, h.value = !1), x;
5477
- },
5478
- logout: async () => {
5479
- _x(), a.value = !1, h.value = !1, B.value = "", d.value = "", r.value = "";
5480
- },
5481
- getUserInfo: async () => {
5482
- const l = await D0.post("loginController/getUserInfo", {}, "json"), x = l.data;
5483
- return x && (B.value = x.userId || "", d.value = x.userName || "", t.value = x.name || "", r.value = "", x.defaultLanguage && U.set("defaultLanguage", x.defaultLanguage), x.homePath && U.set("homePath", x.homePath)), l;
5484
- },
5485
- saLogin: async (l) => {
5486
- var s;
5487
- const x = await D0.post("admin/login", l, "json");
5488
- return (s = x.data) != null && s.token && (Dx(x.data.token), a.value = !0, h.value = !0), x;
5489
- },
5490
- getSaUserInfo: async () => {
5491
- var s;
5492
- const l = await D0.post("admin/getSaUserInfo", {}, "json"), x = (s = l.data) == null ? void 0 : s.saUser;
5493
- return x && (B.value = x.id || "", d.value = x.username || "", t.value = x.name || "", r.value = "", x.language && U.set("defaultLanguage", x.language), x.mainPage && U.set("homePath", x.mainPage)), l;
5494
- }
5495
- };
5496
- });
5497
- var bx = x0();
5498
- const yx = /* @__PURE__ */ Ue(bx);
5499
- function kx(B) {
5458
+ var kx = x0();
5459
+ const wx = /* @__PURE__ */ Ue(kx);
5460
+ function mx(B) {
5500
5461
  const d = [], t = {}, r = {};
5501
5462
  return B = JSON.parse(JSON.stringify(B)), B.forEach(function(a) {
5502
5463
  a.parentId && a.parentId !== "0" && (r[a.parentId] || (r[a.parentId] = []), r[a.parentId].push(a)), a.children && a.children.length > 0 && a.children.forEach((h) => {
@@ -5509,7 +5470,7 @@ function kx(B) {
5509
5470
  }), d;
5510
5471
  }
5511
5472
  function et(B, d = !1) {
5512
- const t = kx(B);
5473
+ const t = mx(B);
5513
5474
  function r(a) {
5514
5475
  if (["SUBPAGE", "JOIN", "APP"].includes(a.menuType || ""))
5515
5476
  return !1;
@@ -5526,7 +5487,7 @@ function et(B, d = !1) {
5526
5487
  h.id = `/sys/window/${a.windowId || a.id}`;
5527
5488
  else if (a.url.indexOf("http") > -1) {
5528
5489
  const y = "";
5529
- h.id = `/iframe/${yx(a.url)}?url=${encodeURIComponent(a.url)}&title=${a.name}&_keepAlive=${y}`;
5490
+ h.id = `/iframe/${wx(a.url)}?url=${encodeURIComponent(a.url)}&title=${a.name}&_keepAlive=${y}`;
5530
5491
  } else
5531
5492
  a.url.indexOf("/") !== 0 && (a.url = `/${a.url}`), h.id = a.url;
5532
5493
  return a.children && (h.hasChildren = !0, h.children = a.children.map(r).filter((y) => !!y)), h;
@@ -5545,67 +5506,107 @@ function xt(B, d) {
5545
5506
  }
5546
5507
  const hr = "yh-menu-cache";
5547
5508
  let C0 = null;
5548
- function wx() {
5509
+ function Hx() {
5549
5510
  if (C0)
5550
5511
  return C0;
5551
5512
  const B = E0(hr);
5552
5513
  return B ? (C0 = B, B) : null;
5553
5514
  }
5554
- function mx(B) {
5515
+ function Sx(B) {
5555
5516
  C0 = B, ur(hr, B);
5556
5517
  }
5557
- function Hx() {
5518
+ function Rx() {
5558
5519
  C0 = null, fr(hr);
5559
5520
  }
5560
5521
  async function tt(B = !1) {
5561
- const d = wx();
5522
+ const d = Hx();
5562
5523
  if (d)
5563
5524
  return d;
5564
5525
  const r = (await Pe.post(
5565
5526
  B ? "loginController/getPdaMenus" : "loginController/getMenus",
5566
5527
  {}
5567
5528
  )).data.data;
5568
- return mx(r), r;
5529
+ return Sx(r), r;
5569
5530
  }
5570
- function nt() {
5571
- Hx();
5531
+ function zx() {
5532
+ Rx();
5572
5533
  }
5534
+ const nt = ze("clientStore", () => {
5535
+ Dx(), _x();
5536
+ const B = s0(""), d = s0(""), t = s0(""), r = s0(""), a = s0(!!U.token || !!U.saToken), h = s0(!!U.saToken);
5537
+ return {
5538
+ // 用户信息
5539
+ userId: B,
5540
+ userName: d,
5541
+ avatar: r,
5542
+ // 计算属性
5543
+ isLoggedIn: a,
5544
+ isAdmin: h,
5545
+ // 方法
5546
+ login: async (l) => {
5547
+ var s;
5548
+ const x = await D0.post(
5549
+ "loginController/login",
5550
+ l,
5551
+ "json"
5552
+ );
5553
+ return (s = x.data) != null && s.token && (Fx(x.data.token), a.value = !0, h.value = !1), x;
5554
+ },
5555
+ logout: async () => {
5556
+ yx(), zx(), a.value = !1, h.value = !1, B.value = "", d.value = "", r.value = "";
5557
+ },
5558
+ getUserInfo: async () => {
5559
+ const l = await D0.post("loginController/getUserInfo", {}, "json"), x = l.data;
5560
+ return x && (B.value = x.userId || "", d.value = x.userName || "", t.value = x.name || "", r.value = "", x.defaultLanguage && U.set("defaultLanguage", x.defaultLanguage), x.homePath && U.set("homePath", x.homePath)), l;
5561
+ },
5562
+ saLogin: async (l) => {
5563
+ var s;
5564
+ const x = await D0.post("admin/login", l, "json");
5565
+ return (s = x.data) != null && s.token && (gx(x.data.token), a.value = !0, h.value = !0), x;
5566
+ },
5567
+ getSaUserInfo: async () => {
5568
+ var s;
5569
+ const l = await D0.post("admin/getSaUserInfo", {}, "json"), x = (s = l.data) == null ? void 0 : s.saUser;
5570
+ return x && (B.value = x.id || "", d.value = x.username || "", t.value = x.name || "", r.value = "", x.language && U.set("defaultLanguage", x.language), x.mainPage && U.set("homePath", x.mainPage)), l;
5571
+ }
5572
+ };
5573
+ });
5573
5574
  export {
5574
5575
  U as Config,
5575
5576
  Ax as HttpRequest,
5576
5577
  g0 as SA_TOKEN,
5577
5578
  _0 as TOKEN_KEY,
5578
- _x as clearAllTokens,
5579
- nt as clearMenu,
5579
+ yx as clearAllTokens,
5580
+ zx as clearMenu,
5580
5581
  We as clearStorage,
5581
- gx as clearTokens,
5582
- $x as deepClone,
5582
+ bx as clearTokens,
5583
+ Qx as deepClone,
5583
5584
  fr as delStorage,
5584
- Mx as generateId,
5585
- Nx as generateMd5Hash,
5586
- Kx as generateSimpleHash,
5587
- Ox as getConfig,
5585
+ $x as generateId,
5586
+ Mx as generateMd5Hash,
5587
+ Xx as generateSimpleHash,
5588
+ Ux as getConfig,
5588
5589
  tt as getMenus,
5589
5590
  xt as getRoutes,
5590
- Jx as getSaToken,
5591
+ _x as getSaToken,
5591
5592
  E0 as getStorage,
5592
- Vx as getToken,
5593
+ Dx as getToken,
5593
5594
  D0 as httpRequest,
5594
- Ux as initConfig,
5595
- Qx as initTokens,
5596
- Zx as isEqual,
5595
+ jx as initConfig,
5596
+ rt as initTokens,
5597
+ Vx as isEqual,
5597
5598
  et as menusToAside,
5598
- Lx as mergeConfig,
5599
- Gx as off,
5599
+ Kx as mergeConfig,
5600
+ Yx as off,
5600
5601
  px as on,
5601
- Xx as once,
5602
- Yx as overwriteObj,
5603
- Wx as setConfig,
5604
- Dx as setSaToken,
5602
+ Zx as once,
5603
+ Jx as overwriteObj,
5604
+ Nx as setConfig,
5605
+ gx as setSaToken,
5605
5606
  ur as setStorage,
5606
5607
  Fx as setToken,
5607
- jx as toHump,
5608
+ Gx as toHump,
5608
5609
  ce as trigger,
5609
- rt as useClientStore
5610
+ nt as useClientStore
5610
5611
  };
5611
5612
  //# sourceMappingURL=index.es.js.map