@huyooo/ui 0.5.60 → 0.5.62

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/dist/user.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as r, U as e, a as n, b as o, c as t, S as U } from "./UserAccountMenu-DgvdmbWH.js";
1
+ import { d as r, U as e, a as n, b as o, c as t, S as U } from "./UserAccountMenu-DqwouFOD.js";
2
2
  export {
3
3
  r as UserAccountMenu,
4
4
  e as UserAvatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "0.5.60",
3
+ "version": "0.5.62",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -1,330 +0,0 @@
1
- import { defineComponent as A, computed as P, createElementBlock as f, openBlock as m, normalizeStyle as C, createElementVNode as e, createCommentVNode as T, renderSlot as O, ref as _, toDisplayString as y, createVNode as i, unref as s, withCtx as d, createTextVNode as L, onMounted as B } from "vue";
2
- import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- /* empty css */
4
- /* empty css */
5
- /* empty css */
6
- /* empty css */
7
- /* empty css */
8
- /* empty css */
9
- /* empty css */
10
- import { List as N, ListItem as w, ListItemMeta as S, Avatar as I, Button as V } from "@arco-design/web-vue";
11
- import { a as M } from "./useAuthkitAppsAuthPageInfo-CzZmhPMm.js";
12
- import { o as D } from "./auth-bwwc2iT8.js";
13
- import { u as E, a as F } from "./useAuthkitUsersProfile-hZ9L3rYe.js";
14
- const H = {
15
- class: "header"
16
- }, j = ["href"], K = {
17
- class: "container"
18
- }, G = /* @__PURE__ */ A({
19
- __name: "AuthkitAuthContainer",
20
- props: {
21
- applicationLogoUrl: {
22
- type: String,
23
- required: !0,
24
- default: () => ""
25
- },
26
- name: {
27
- type: String,
28
- required: !0,
29
- default: () => ""
30
- },
31
- description: {
32
- type: String,
33
- required: !0,
34
- default: () => ""
35
- },
36
- appHomePage: {
37
- type: String,
38
- required: !0,
39
- default: () => ""
40
- },
41
- backgroundImage: {
42
- type: String,
43
- required: !0,
44
- default: () => ""
45
- },
46
- backgroundColor: {
47
- type: String,
48
- required: !0,
49
- default: () => ""
50
- },
51
- linkColor: {
52
- type: String,
53
- default: "rgb(22, 93, 255)"
54
- },
55
- backgroundType: {
56
- type: String,
57
- default: "color"
58
- }
59
- },
60
- setup(g) {
61
- const r = g, t = P(() => r.backgroundType === "color" ? {
62
- backgroundColor: r.backgroundColor
63
- } : {
64
- backgroundImage: `url(${r.backgroundImage})`
65
- });
66
- return (o, p) => (m(), f("div", {
67
- class: "auth",
68
- style: C(t.value)
69
- }, [e("div", H, [r.name ? (m(), f("a", {
70
- key: 0,
71
- href: r.appHomePage,
72
- target: "_self",
73
- class: "link",
74
- style: C({
75
- color: r.linkColor
76
- })
77
- }, " 返回主页 ", 12, j)) : T("", !0)]), e("div", K, [O(o.$slots, "default", {}, void 0, !0)])], 4));
78
- }
79
- }), _e = /* @__PURE__ */ q(G, [["__scopeId", "data-v-203946ff"]]), J = {
80
- class: "box"
81
- }, Q = {
82
- class: "title"
83
- }, W = {
84
- class: "content"
85
- }, X = {
86
- class: "redirect"
87
- }, Y = {
88
- style: {
89
- "font-weight": "bold",
90
- "font-size": "12px"
91
- }
92
- }, Z = /* @__PURE__ */ A({
93
- __name: "AuthkitAuthorize",
94
- props: {
95
- size: {
96
- type: String,
97
- required: !0
98
- },
99
- title: {
100
- type: String,
101
- required: !0,
102
- default: () => "授权登录"
103
- },
104
- logo: {
105
- type: String,
106
- required: !0,
107
- default: () => ""
108
- },
109
- clientId: {
110
- type: String,
111
- required: !0,
112
- default: () => ""
113
- },
114
- responseType: {
115
- type: String,
116
- required: !0,
117
- default: () => ""
118
- },
119
- scope: {
120
- type: String,
121
- required: !0,
122
- default: () => ""
123
- },
124
- state: {
125
- type: String,
126
- required: !0,
127
- default: () => ""
128
- },
129
- redirectUri: {
130
- type: String,
131
- required: !0,
132
- default: () => ""
133
- },
134
- userInfo: {
135
- type: Object,
136
- required: !0,
137
- default: () => ""
138
- }
139
- },
140
- setup(g) {
141
- const r = _(!1), t = g, o = _({
142
- appKey: "",
143
- name: "",
144
- homePageUrl: "",
145
- createAt: "",
146
- authorizationCallback: ""
147
- });
148
- function p() {
149
- M({
150
- id: t.clientId
151
- }).then(({
152
- data: l
153
- }) => {
154
- o.value = l;
155
- }).catch((l) => {
156
- console.error("获取应用信息失败:", l);
157
- });
158
- }
159
- p();
160
- function n() {
161
- r.value = !0, D({
162
- client_id: t.clientId,
163
- response_type: t.responseType,
164
- scope: t.scope,
165
- state: t.state,
166
- redirect_uri: t.redirectUri
167
- }).then(({
168
- data: l
169
- }) => {
170
- r.value = !1, window.location = l.authorizeUrl;
171
- }).catch((l) => {
172
- r.value = !1, console.error("授权失败:", l);
173
- });
174
- }
175
- return (l, u) => (m(), f("div", J, [e("div", Q, y(`授权 ${o.value.name}`), 1), e("div", W, [i(s(N), null, {
176
- default: d(() => [i(s(w), null, {
177
- default: d(() => {
178
- var h;
179
- return [i(s(S), {
180
- title: o.value.name,
181
- description: `想要使用您的${(h = t.userInfo) == null ? void 0 : h.nickname}账户`
182
- }, {
183
- avatar: d(() => {
184
- var v;
185
- return [i(s(I), {
186
- shape: "square",
187
- "image-url": (v = t.userInfo) == null ? void 0 : v.avatar
188
- }, null, 8, ["image-url"])];
189
- }),
190
- _: 1
191
- }, 8, ["title", "description"])];
192
- }),
193
- _: 1
194
- }), i(s(w), null, {
195
- default: d(() => [i(s(S), {
196
- title: "公开信息",
197
- description: "头像、昵称"
198
- }, {
199
- avatar: d(() => [i(s(I), {
200
- shape: "square"
201
- }, {
202
- default: d(() => [...u[0] || (u[0] = [e("img", {
203
- alt: "avatar",
204
- src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
205
- }, null, -1)])]),
206
- _: 1
207
- })]),
208
- _: 1
209
- })]),
210
- _: 1
211
- }), i(s(w), null, {
212
- default: d(() => [i(s(S), {
213
- title: "个人用户数据",
214
- description: "电子邮件地址"
215
- }, {
216
- avatar: d(() => [i(s(I), {
217
- shape: "square"
218
- }, {
219
- default: d(() => [...u[1] || (u[1] = [e("img", {
220
- alt: "avatar",
221
- src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
222
- }, null, -1)])]),
223
- _: 1
224
- })]),
225
- _: 1
226
- })]),
227
- _: 1
228
- })]),
229
- _: 1
230
- }), i(s(V), {
231
- type: "primary",
232
- size: t.size,
233
- loading: r.value,
234
- onClick: n
235
- }, {
236
- default: d(() => [...u[2] || (u[2] = [L(" 授权 ", -1)])]),
237
- _: 1
238
- }, 8, ["size", "loading"]), e("div", X, [u[3] || (u[3] = e("div", {
239
- style: {
240
- color: "#888",
241
- "font-size": "12px"
242
- }
243
- }, "授权后将跳转至", -1)), e("div", Y, y(o.value.authorizationCallback), 1)])])]));
244
- }
245
- }), ye = /* @__PURE__ */ q(Z, [["__scopeId", "data-v-cc821ddc"]]), ee = {
246
- class: "oauth-callback"
247
- }, te = {
248
- key: 0,
249
- class: "callback-loading"
250
- }, re = {
251
- key: 1,
252
- class: "callback-error"
253
- }, ae = {
254
- key: 2,
255
- class: "callback-success"
256
- }, oe = /* @__PURE__ */ A({
257
- __name: "AuthkitOauthCallback",
258
- props: {
259
- defaultRedirect: {},
260
- loadingText: {}
261
- },
262
- emits: ["success", "error"],
263
- setup(g, {
264
- emit: r
265
- }) {
266
- const t = g, o = r, p = _(!0), n = _(""), {
267
- setToken: l,
268
- initializeAuth: u
269
- } = E(), {
270
- fetchUserProfile: h
271
- } = F();
272
- async function v() {
273
- const c = new URLSearchParams(window.location.search), a = c.get("error");
274
- if (a) {
275
- n.value = decodeURIComponent(a), p.value = !1, o("error", n.value);
276
- return;
277
- }
278
- const k = c.get("token"), $ = c.get("userId"), x = c.get("appId");
279
- if (!k) {
280
- n.value = "登录失败:未收到认证令牌", p.value = !1, o("error", n.value);
281
- return;
282
- }
283
- try {
284
- l(k), await h();
285
- const b = window.location.pathname;
286
- window.history.replaceState({}, "", b), o("success", {
287
- token: k,
288
- userId: $ || "",
289
- appId: x || ""
290
- });
291
- const R = sessionStorage.getItem("auth_redirect");
292
- sessionStorage.removeItem("auth_redirect");
293
- const U = R || t.defaultRedirect || "/";
294
- p.value = !1, setTimeout(() => {
295
- window.location.href = U;
296
- }, 500);
297
- } catch (b) {
298
- console.error("OAuth 回调处理失败:", b), n.value = "登录处理失败,请重试", p.value = !1, o("error", n.value);
299
- }
300
- }
301
- function z() {
302
- const c = sessionStorage.getItem("auth_redirect");
303
- sessionStorage.removeItem("auth_redirect"), window.location.href = c || t.defaultRedirect || "/";
304
- }
305
- return B(() => {
306
- const c = new URLSearchParams(window.location.search);
307
- if (c.has("token") || c.has("error"))
308
- v();
309
- else if (u()) {
310
- const a = sessionStorage.getItem("auth_redirect");
311
- sessionStorage.removeItem("auth_redirect"), window.location.href = a || t.defaultRedirect || "/";
312
- } else
313
- n.value = "无效的访问", p.value = !1;
314
- }), (c, a) => (m(), f("div", ee, [p.value ? (m(), f("div", te, [a[0] || (a[0] = e("div", {
315
- class: "spinner"
316
- }, null, -1)), e("p", null, y(g.loadingText), 1)])) : n.value ? (m(), f("div", re, [a[1] || (a[1] = e("div", {
317
- class: "error-icon"
318
- }, "✕", -1)), a[2] || (a[2] = e("h2", null, "登录失败", -1)), e("p", null, y(n.value), 1), e("button", {
319
- class: "retry-btn",
320
- onClick: z
321
- }, "返回重试")])) : (m(), f("div", ae, [...a[3] || (a[3] = [e("div", {
322
- class: "success-icon"
323
- }, "✓", -1), e("p", null, "登录成功,正在跳转...", -1)])]))]));
324
- }
325
- }), ke = /* @__PURE__ */ q(oe, [["__scopeId", "data-v-fa89973e"]]);
326
- export {
327
- _e as A,
328
- ye as a,
329
- ke as b
330
- };