@huyooo/ui 0.5.14 → 0.5.15

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.
@@ -1,20 +1,20 @@
1
- import { ref as r } from "vue";
2
- import { api as t } from "@huyooo/api";
3
- import { g as i } from "./globalConfig-C1YOJcxa.js";
4
- function s(a) {
5
- return t({
6
- url: `${i.authPrefixUrl}/restfulApi/apps/findOne`,
1
+ import { ref as l } from "vue";
2
+ import { api as u } from "@huyooo/api";
3
+ import { g as p } from "./globalConfig-C1YOJcxa.js";
4
+ function g(t) {
5
+ return u({
6
+ url: `${p.authPrefixUrl}/restfulApi/apps/findOne`,
7
7
  method: "post",
8
- data: a
8
+ data: t
9
9
  });
10
10
  }
11
- function l() {
12
- return t({
13
- url: `${i.authPrefixUrl}/restfulApi/apps/authPageInfo`,
11
+ function r() {
12
+ return u({
13
+ url: `${p.authPrefixUrl}/restfulApi/apps/authPageInfo`,
14
14
  method: "post"
15
15
  });
16
16
  }
17
- const o = r({
17
+ const o = l({
18
18
  id: "",
19
19
  appKey: "",
20
20
  name: "",
@@ -86,23 +86,25 @@ const o = r({
86
86
  backgroundImageUrl: "",
87
87
  backgroundImage: "/66a0d5b35203890887f0e1a4/6714e2458fe86895bf3da8ae/1ef8ed72-1731-6e00-93d1-fa24165f1a3e.webp"
88
88
  }
89
- });
90
- function f() {
91
- function a(n) {
92
- l().then(({
89
+ }), a = l(!1), n = l(!1);
90
+ function h() {
91
+ function t(i) {
92
+ a.value = !0, n.value = !1, r().then(({
93
93
  data: e
94
94
  }) => {
95
- o.value.id = e.id, o.value.appKey = e.appKey, o.value.name = e.name, o.value.description = e.description, o.value.homePageUrl = e.homePageUrl, o.value.applicationLogo = e.applicationLogo, o.value.applicationLogoUrl = e.applicationLogoUrl, o.value.publicRoutes = e.publicRoutes || [], o.value.oauth = e.oauth, o.value.authorizationCallback = e.authorizationCallback, o.value.aboutUs = e.aboutUs, o.value.brand = e.brand, n && n();
95
+ a.value = !1, n.value = !0, o.value.id = e.id, o.value.appKey = e.appKey, o.value.name = e.name, o.value.description = e.description, o.value.homePageUrl = e.homePageUrl, o.value.applicationLogo = e.applicationLogo, o.value.applicationLogoUrl = e.applicationLogoUrl, o.value.publicRoutes = e.publicRoutes || [], o.value.oauth = e.oauth, o.value.authorizationCallback = e.authorizationCallback, o.value.aboutUs = e.aboutUs, o.value.brand = e.brand, i && i();
96
96
  }).catch((e) => {
97
- console.error("获取应用认证页面信息失败:", e);
97
+ a.value = !1, n.value = !1, console.error("获取应用认证页面信息失败:", e);
98
98
  });
99
99
  }
100
100
  return {
101
101
  appsData: o,
102
- appsAuthPageInfoApi: a
102
+ appsAuthPageInfoApi: t,
103
+ appsAuthPageInfoLoading: a,
104
+ appsAuthPageInfoSuccess: n
103
105
  };
104
106
  }
105
107
  export {
106
- s as a,
107
- f as u
108
+ g as a,
109
+ h as u
108
110
  };
@@ -1,36 +1,36 @@
1
- import { ref as l, readonly as S, computed as A } from "vue";
2
- import { api as o } from "@huyooo/api";
3
- import { g as n } from "./globalConfig-C1YOJcxa.js";
4
- function T(e) {
5
- return o({
6
- url: `${n.authPrefixUrl}/restfulApi/auth/signIn`,
1
+ import { ref as u, readonly as A, computed as T } from "vue";
2
+ import { api as a } from "@huyooo/api";
3
+ import { g as o } from "./globalConfig-C1YOJcxa.js";
4
+ function b(e) {
5
+ return a({
6
+ url: `${o.authPrefixUrl}/restfulApi/auth/signIn`,
7
7
  method: "post",
8
8
  data: e
9
9
  });
10
10
  }
11
- function b(e) {
12
- return o({
13
- url: `${n.authPrefixUrl}/restfulApi/auth/resetPassword`,
11
+ function x(e) {
12
+ return a({
13
+ url: `${o.authPrefixUrl}/restfulApi/auth/resetPassword`,
14
14
  method: "post",
15
15
  data: e
16
16
  });
17
17
  }
18
- function x(e) {
19
- return o({
20
- url: `${n.authPrefixUrl}/restfulApi/auth/signUp`,
18
+ function y(e) {
19
+ return a({
20
+ url: `${o.authPrefixUrl}/restfulApi/auth/signUp`,
21
21
  method: "post",
22
22
  data: e
23
23
  });
24
24
  }
25
- function G(e) {
26
- return o({
27
- url: `${n.authPrefixUrl}/restfulApi/oauth2/authorize`,
25
+ function H(e) {
26
+ return a({
27
+ url: `${o.authPrefixUrl}/restfulApi/oauth2/authorize`,
28
28
  method: "post",
29
29
  data: e
30
30
  });
31
31
  }
32
- function H(e) {
33
- return o({
32
+ function J(e) {
33
+ return a({
34
34
  url: "/restfulApi/auth/refresh",
35
35
  method: "post",
36
36
  data: {
@@ -38,8 +38,8 @@ function H(e) {
38
38
  }
39
39
  });
40
40
  }
41
- const c = l("signIn"), g = [], m = [], w = [], i = l(null);
42
- function y() {
41
+ const c = u("signIn"), m = [], v = [], w = [], i = u(null);
42
+ function $() {
43
43
  try {
44
44
  const e = localStorage.getItem("jwtToken");
45
45
  if (e)
@@ -49,7 +49,7 @@ function y() {
49
49
  }
50
50
  return !1;
51
51
  }
52
- function $() {
52
+ function C() {
53
53
  if (i.value)
54
54
  return i.value;
55
55
  try {
@@ -59,7 +59,7 @@ function $() {
59
59
  return console.warn("Failed to access localStorage:", e), null;
60
60
  }
61
61
  }
62
- function p(e) {
62
+ function g(e) {
63
63
  i.value = e;
64
64
  try {
65
65
  localStorage.setItem("jwtToken", e);
@@ -67,7 +67,7 @@ function p(e) {
67
67
  console.warn("Failed to save token to localStorage:", s);
68
68
  }
69
69
  }
70
- function C() {
70
+ function j() {
71
71
  i.value = null;
72
72
  try {
73
73
  localStorage.removeItem("jwtToken");
@@ -75,44 +75,44 @@ function C() {
75
75
  console.warn("Failed to clear localStorage:", e);
76
76
  }
77
77
  }
78
- function j(e) {
79
- g.push(e);
80
- }
81
78
  function E(e) {
82
79
  m.push(e);
83
80
  }
84
81
  function V(e) {
82
+ v.push(e);
83
+ }
84
+ function F(e) {
85
85
  w.push(e);
86
86
  }
87
- function F() {
88
- const e = l(!1), s = l(!1), f = l(!1);
89
- function h(r) {
90
- e.value = !0, T({
87
+ function L() {
88
+ const e = u(!1), s = u(!1), f = u(!1);
89
+ function d(r) {
90
+ e.value = !0, b({
91
91
  email: r.email,
92
92
  password: r.password
93
93
  }).then(({
94
94
  data: t
95
95
  }) => {
96
- e.value = !1, p(t.jwtToken), g.forEach((I) => I(t));
96
+ e.value = !1, g(t.jwtToken), m.forEach((S) => S(t));
97
97
  }).catch((t) => {
98
98
  e.value = !1, console.error("登录失败:", t);
99
99
  });
100
100
  }
101
- function a(r) {
102
- s.value = !0, x({
101
+ function n(r) {
102
+ s.value = !0, y({
103
103
  email: r.email,
104
104
  userToken: r.userToken,
105
105
  emailVerifyId: r.emailVerifyId,
106
106
  password: r.password,
107
107
  referrerId: r.referrerId
108
108
  }).then(() => {
109
- s.value = !1, c.value = "signIn", m.forEach((t) => t());
109
+ s.value = !1, c.value = "signIn", v.forEach((t) => t());
110
110
  }).catch((t) => {
111
111
  s.value = !1, console.error("注册失败:", t);
112
112
  });
113
113
  }
114
- function v(r) {
115
- f.value = !0, b({
114
+ function k(r) {
115
+ f.value = !0, x({
116
116
  email: r.email,
117
117
  userToken: r.userToken,
118
118
  emailVerifyId: r.emailVerifyId,
@@ -123,116 +123,115 @@ function F() {
123
123
  f.value = !1, console.error("重置密码失败:", t);
124
124
  });
125
125
  }
126
- function k() {
126
+ function P() {
127
127
  c.value = "signUp";
128
128
  }
129
129
  function U() {
130
130
  c.value = "resetPassword";
131
131
  }
132
- function P() {
132
+ function I() {
133
133
  c.value = "signIn";
134
134
  }
135
135
  return {
136
- signInSubmit: h,
137
- signUpSubmit: a,
138
- resetPasswordSubmit: v,
136
+ signInSubmit: d,
137
+ signUpSubmit: n,
138
+ resetPasswordSubmit: k,
139
139
  currentView: c,
140
140
  authSignInLoading: e,
141
141
  authSignUpLoading: s,
142
142
  resetPasswordLoading: f,
143
- switchSignUp: k,
143
+ switchSignUp: P,
144
144
  switchResetPassword: U,
145
- switchSignIn: P,
146
- addSignInCallback: j,
147
- addSignUpCallback: E,
148
- addResetPasswordCallback: V,
145
+ switchSignIn: I,
146
+ addSignInCallback: E,
147
+ addSignUpCallback: V,
148
+ addResetPasswordCallback: F,
149
149
  // 简化的token管理
150
- jwtToken: S(i),
151
- getToken: $,
152
- setToken: p,
153
- initializeAuth: y,
154
- clearAuth: C
150
+ jwtToken: A(i),
151
+ getToken: C,
152
+ setToken: g,
153
+ initializeAuth: $,
154
+ clearAuth: j
155
155
  };
156
156
  }
157
- function L(e) {
158
- return console.log(n.authPrefixUrl, "globalConfig.authPrefixUrl"), o({
159
- url: `${n.authPrefixUrl}/restfulApi/users/profile`,
157
+ function z(e) {
158
+ return console.log(o.authPrefixUrl, "globalConfig.authPrefixUrl"), a({
159
+ url: `${o.authPrefixUrl}/restfulApi/users/profile`,
160
160
  method: "post",
161
161
  data: e
162
162
  });
163
163
  }
164
- function J(e) {
165
- return o({
166
- url: `${n.authPrefixUrl}/restfulApi/users/update/baseInfo`,
164
+ function K(e) {
165
+ return a({
166
+ url: `${o.authPrefixUrl}/restfulApi/users/update/baseInfo`,
167
167
  method: "post",
168
168
  data: e
169
169
  });
170
170
  }
171
- function K(e) {
172
- return o({
173
- url: `${n.authPrefixUrl}/restfulApi/users/update/email`,
171
+ function M(e) {
172
+ return a({
173
+ url: `${o.authPrefixUrl}/restfulApi/users/update/email`,
174
174
  method: "post",
175
175
  data: e
176
176
  });
177
177
  }
178
- function M(e) {
179
- return o({
180
- url: `${n.authPrefixUrl}/restfulApi/users/update/password`,
178
+ function O(e) {
179
+ return a({
180
+ url: `${o.authPrefixUrl}/restfulApi/users/update/password`,
181
181
  method: "post",
182
182
  data: e
183
183
  });
184
184
  }
185
- function O() {
186
- return o({
187
- url: `${n.authPrefixUrl}/restfulApi/users//unbind/email`,
185
+ function Q() {
186
+ return a({
187
+ url: `${o.authPrefixUrl}/restfulApi/users//unbind/email`,
188
188
  method: "post"
189
189
  });
190
190
  }
191
- const u = l(null), d = l(!1), z = A(() => !!u.value);
192
- async function R() {
193
- var h;
191
+ const l = u(null), p = u(!1), h = u(!1), R = T(() => !!l.value);
192
+ async function B() {
193
+ var d;
194
194
  const {
195
195
  getToken: e,
196
196
  clearAuth: s
197
- } = F();
197
+ } = L();
198
198
  if (!e()) {
199
- console.warn("No authentication token found"), u.value = null;
199
+ console.warn("No authentication token found"), l.value = null;
200
200
  return;
201
201
  }
202
- d.value = !0;
202
+ p.value = !0, h.value = !1;
203
203
  try {
204
204
  const {
205
- data: a
206
- } = await L();
207
- a ? u.value = a : (console.warn("获取用户资料返回空数据"), u.value = null);
208
- } catch (a) {
209
- console.error("获取用户资料失败:", a), ((h = a == null ? void 0 : a.response) == null ? void 0 : h.status) === 401 && (console.warn("认证已过期,清除认证状态"), s()), u.value = null;
210
- } finally {
211
- d.value = !1;
205
+ data: n
206
+ } = await z();
207
+ p.value = !1, n ? (l.value = n, h.value = !0) : (console.warn("获取用户资料返回空数据"), l.value = null, h.value = !1);
208
+ } catch (n) {
209
+ p.value = !1, h.value = !1, console.error("获取用户资料失败:", n), ((d = n == null ? void 0 : n.response) == null ? void 0 : d.status) === 401 && (console.warn("认证已过期,清除认证状态"), s()), l.value = null;
212
210
  }
213
211
  }
214
- function B() {
215
- u.value = null;
212
+ function N() {
213
+ l.value = null;
216
214
  }
217
- function Q() {
215
+ function W() {
218
216
  return {
219
- userProfile: u,
220
- loading: d,
221
- isLoggedIn: z,
217
+ userProfile: l,
218
+ loading: p,
219
+ usersProfileSuccess: h,
220
+ isLoggedIn: R,
222
221
  // 新增:基于userProfile的登录状态
223
- fetchUserProfile: R,
224
- clearUserProfile: B
222
+ fetchUserProfile: B,
223
+ clearUserProfile: N
225
224
  // 新增:清除用户信息的方法
226
225
  };
227
226
  }
228
227
  export {
229
- Q as a,
230
- L as b,
231
- J as c,
232
- M as d,
233
- K as e,
234
- O as f,
235
- G as o,
236
- H as r,
237
- F as u
228
+ W as a,
229
+ z as b,
230
+ K as c,
231
+ O as d,
232
+ M as e,
233
+ Q as f,
234
+ H as o,
235
+ J as r,
236
+ L as u
238
237
  };
@@ -9,10 +9,10 @@ import "@arco-design/web-vue";
9
9
  import "./useUploadCos-D5k1YLb7.js";
10
10
  import "@huyooo/api";
11
11
  import "./AuthkitAuthModal.vue_vue_type_style_index_1_lang-BpOmabWi.js";
12
- import { a as E } from "./useAuthkitUsersProfile-C0ZRUQ3T.js";
12
+ import { a as E } from "./useAuthkitUsersProfile-zbKT0W_h.js";
13
13
  import "@iconify/vue";
14
14
  /* empty css */
15
- import { u as O } from "./useAuthkitAppsAuthPageInfo-Dfj4byB5.js";
15
+ import { u as O } from "./useAuthkitAppsAuthPageInfo-BifS1KOG.js";
16
16
  /* empty css */
17
17
  /* empty css */
18
18
  /* empty css */
package/dist/user.js CHANGED
@@ -1,5 +1,5 @@
1
- import { U as r, a as e, b as o, c as n, S as t } from "./UserPanel-DzSB8_xh.js";
2
- import { U as c } from "./UserAccountMenu-CjajHECj.js";
1
+ import { U as r, a as e, b as o, c as n, S as t } from "./UserPanel-hGYAeWcj.js";
2
+ import { U as c } from "./UserAccountMenu-DHozw36C.js";
3
3
  export {
4
4
  c as UserAccountMenu,
5
5
  r as UserAvatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [