smart-admin-web 10.25.0 → 10.26.0

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.
@@ -1482,7 +1482,7 @@ export interface paths {
1482
1482
  path?: never;
1483
1483
  cookie?: never;
1484
1484
  };
1485
- /** 当前用户未读通知数(顶栏角标) */
1485
+ /** 当前用户未读通知数(顶栏角标);带 Types 时只数这几种类型(铃铛页签角标) */
1486
1486
  get: operations["Notice_UnreadCount"];
1487
1487
  put?: never;
1488
1488
  post?: never;
@@ -1517,7 +1517,7 @@ export interface paths {
1517
1517
  cookie?: never;
1518
1518
  };
1519
1519
  get?: never;
1520
- /** 标记全部通知为已读 */
1520
+ /** 标记全部通知为已读;带 Types 时只标这几种类型(铃铛当前页签) */
1521
1521
  put: operations["Notice_ReadAll"];
1522
1522
  post?: never;
1523
1523
  delete?: never;
@@ -10344,6 +10344,8 @@ export interface operations {
10344
10344
  Title?: string;
10345
10345
  /** @description 类型(精确匹配,可选) */
10346
10346
  Type?: components["schemas"]["NoticeType"];
10347
+ /** @description 类型(多选,命中任一即可;可选,与 Type 同时给时两条都要满足) */
10348
+ Types?: components["schemas"]["NoticeType"][];
10347
10349
  /** @description 仅未读(用户端"未读"页签用;管理端列表忽略) */
10348
10350
  OnlyUnread?: boolean;
10349
10351
  Current?: number | string;
@@ -10401,6 +10403,8 @@ export interface operations {
10401
10403
  Title?: string;
10402
10404
  /** @description 类型(精确匹配,可选) */
10403
10405
  Type?: components["schemas"]["NoticeType"];
10406
+ /** @description 类型(多选,命中任一即可;可选,与 Type 同时给时两条都要满足) */
10407
+ Types?: components["schemas"]["NoticeType"][];
10404
10408
  /** @description 仅未读(用户端"未读"页签用;管理端列表忽略) */
10405
10409
  OnlyUnread?: boolean;
10406
10410
  Current?: number | string;
@@ -10429,7 +10433,9 @@ export interface operations {
10429
10433
  };
10430
10434
  Notice_UnreadCount: {
10431
10435
  parameters: {
10432
- query?: never;
10436
+ query?: {
10437
+ Types?: components["schemas"]["NoticeType"][];
10438
+ };
10433
10439
  header?: never;
10434
10440
  path?: never;
10435
10441
  cookie?: never;
@@ -10475,7 +10481,9 @@ export interface operations {
10475
10481
  };
10476
10482
  Notice_ReadAll: {
10477
10483
  parameters: {
10478
- query?: never;
10484
+ query?: {
10485
+ Types?: components["schemas"]["NoticeType"][];
10486
+ };
10479
10487
  header?: never;
10480
10488
  path?: never;
10481
10489
  cookie?: never;
@@ -1,8 +1,8 @@
1
1
  import o from "./NoticeBell2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-3d522858"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4cd418d9"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };
8
8
  //# sourceMappingURL=NoticeBell.vue.js.map
@@ -1,117 +1,146 @@
1
- import { defineComponent as W, ref as u, openBlock as l, createElementBlock as d, Fragment as R, createVNode as n, unref as e, withCtx as o, createElementVNode as f, toDisplayString as c, createTextVNode as p, renderList as I, normalizeClass as L, createCommentVNode as T, createBlock as S, createSlots as X } from "vue";
2
- import { useRouter as Y } from "vue-router";
3
- import { useMessage as Z, NPopover as ee, NButton as k, NSpin as te, NScrollbar as ae, NEmpty as oe, NTag as ne, NEllipsis as ie, NText as U, NBadge as le, NModal as se, NSpace as ce } from "naive-ui";
4
- import { Icon as N } from "@iconify/vue";
5
- import { useIntervalFn as re } from "@vueuse/core";
6
- import { useI18n as ue } from "vue-i18n";
7
- import { noticeApi as b } from "../api/index.js";
8
- import { noticeBus as de } from "../composables/useRealtime.js";
9
- import { useNoticeAction as pe } from "../composables/useNoticeAction.js";
10
- import { NoticeType as x } from "../types/api.js";
11
- import fe from "../components/MarkdownEditor/MarkdownView.vue.js";
12
- import { translateError as D } from "../utils/error.js";
13
- import { fmtDateTime as me } from "../utils/format.js";
14
- const he = { class: "notice-panel" }, ve = { class: "notice-head" }, ye = { class: "notice-title" }, _e = {
1
+ import { defineComponent as se, ref as d, reactive as ie, computed as q, openBlock as s, createElementBlock as p, Fragment as R, createVNode as o, unref as t, withCtx as l, createElementVNode as h, toDisplayString as r, createTextVNode as f, renderList as V, normalizeClass as O, createCommentVNode as x, createBlock as S, createSlots as ce } from "vue";
2
+ import { useRouter as re } from "vue-router";
3
+ import { useMessage as ue, NPopover as de, NButton as z, NTabs as pe, NTab as fe, NBadge as G, NSpin as me, NScrollbar as ye, NEmpty as ve, NTag as he, NEllipsis as ge, NText as H, NModal as _e, NSpace as we } from "naive-ui";
4
+ import { Icon as B } from "@iconify/vue";
5
+ import { useIntervalFn as ke } from "@vueuse/core";
6
+ import { useI18n as be } from "vue-i18n";
7
+ import { noticeApi as N } from "../api/index.js";
8
+ import { noticeBus as Ne } from "../composables/useRealtime.js";
9
+ import { useNoticeAction as Te } from "../composables/useNoticeAction.js";
10
+ import { NoticeType as y } from "../types/api.js";
11
+ import Ae from "../components/MarkdownEditor/MarkdownView.vue.js";
12
+ import { translateError as J } from "../utils/error.js";
13
+ import { fmtDateTime as Ce } from "../utils/format.js";
14
+ const Re = { class: "notice-panel" }, xe = { class: "notice-head" }, Se = { class: "notice-title" }, ze = {
15
15
  key: 0,
16
16
  class: "notice-empty"
17
- }, we = {
17
+ }, Be = {
18
18
  key: 1,
19
19
  class: "notice-list"
20
- }, ge = ["onClick"], ke = {
20
+ }, Me = ["onClick"], Ee = {
21
21
  key: 0,
22
22
  class: "dot"
23
- }, Ne = { class: "notice-body" }, be = { class: "line1" }, xe = { class: "notice-foot" }, De = /* @__PURE__ */ W({
23
+ }, Ue = { class: "notice-body" }, Ve = { class: "line1" }, $e = { class: "notice-foot" }, Xe = /* @__PURE__ */ se({
24
24
  __name: "NoticeBell",
25
- setup(Ae) {
26
- const { t: s } = ue(), F = Y(), z = Z(), A = pe(), y = u(0), _ = u([]), C = u(!1), w = u(!1);
27
- async function m() {
25
+ setup(Ie) {
26
+ const { t: i } = be(), K = re(), $ = ue(), M = Te(), u = [
27
+ {
28
+ key: "message",
29
+ types: [y.Message],
30
+ label: "app.notice.tabMessage",
31
+ empty: "app.notice.emptyMessage"
32
+ },
33
+ {
34
+ key: "notice",
35
+ types: [y.Notice, y.Announcement],
36
+ label: "app.notice.tabNotice",
37
+ empty: "app.notice.empty"
38
+ }
39
+ ], I = (e) => [...u.find((n) => n.key === e).types], E = d(0), c = d(u[0].key), g = ie({ message: 0, notice: 0 }), L = q(() => u.find((e) => e.key === c.value)), T = d([]), A = d(!1), _ = d(!1);
40
+ async function P() {
41
+ const e = await Promise.all(u.map((n) => N.unreadCount([...n.types])));
42
+ u.forEach((n, v) => g[n.key] = e[v]);
43
+ }
44
+ async function w() {
28
45
  try {
29
- y.value = await b.unreadCount();
46
+ E.value = await N.unreadCount(), _.value && await P();
30
47
  } catch {
31
48
  }
32
49
  }
33
- async function B() {
34
- C.value = !0;
50
+ async function U() {
51
+ const e = c.value;
52
+ A.value = !0;
35
53
  try {
36
- const { items: t } = await b.mine({ page: 1, pageSize: 10 });
37
- _.value = t;
54
+ const { items: n } = await N.mine({ page: 1, pageSize: 10, types: I(e) });
55
+ e === c.value && (T.value = n);
38
56
  } catch {
39
- _.value = [];
57
+ e === c.value && (T.value = []);
40
58
  } finally {
41
- C.value = !1;
59
+ e === c.value && (A.value = !1);
42
60
  }
43
61
  }
44
- function P(t) {
45
- t && B();
62
+ async function Q(e) {
63
+ var n;
64
+ if (e) {
65
+ A.value = !0;
66
+ try {
67
+ await P();
68
+ } catch {
69
+ }
70
+ c.value = ((n = u.find((v) => g[v.key] > 0)) == null ? void 0 : n.key) ?? u[0].key, U();
71
+ }
72
+ }
73
+ function W(e) {
74
+ c.value = e, U();
46
75
  }
47
- const g = u(!1), h = u(null);
48
- async function j(t) {
49
- if (!t.isRead)
76
+ const C = d(!1), k = d(null);
77
+ async function X(e) {
78
+ if (!e.isRead)
50
79
  try {
51
- await b.markRead(t.id), t.isRead = !0, await m();
52
- } catch (i) {
53
- z.error(D(i));
80
+ await N.markRead(e.id), e.isRead = !0, await w();
81
+ } catch (n) {
82
+ $.error(J(n));
54
83
  }
55
84
  }
56
- async function q(t) {
57
- h.value = t, g.value = !0, await j(t);
85
+ async function Y(e) {
86
+ k.value = e, C.value = !0, await X(e);
58
87
  }
59
- const v = u(null);
60
- async function G(t, i) {
61
- v.value = i;
88
+ const b = d(null);
89
+ async function Z(e, n) {
90
+ b.value = n;
62
91
  try {
63
- await A.run(t) && (g.value = !1, w.value = !1);
92
+ await M.run(e) && (C.value = !1, _.value = !1);
64
93
  } finally {
65
- v.value = null;
94
+ b.value = null;
66
95
  }
67
96
  }
68
- async function H() {
97
+ async function ee() {
69
98
  try {
70
- await b.markAllRead(), await Promise.all([m(), B()]);
71
- } catch (t) {
72
- z.error(D(t));
99
+ await N.markAllRead(I(c.value)), await Promise.all([w(), U()]);
100
+ } catch (e) {
101
+ $.error(J(e));
73
102
  }
74
103
  }
75
- function J() {
76
- w.value = !1, F.push("/personal/notice");
104
+ function te() {
105
+ _.value = !1, K.push("/personal/notice");
77
106
  }
78
- const K = (t) => t === x.Announcement ? "warning" : t === x.Message ? "success" : "info", O = (t) => t === x.Announcement ? s("notice.typeAnnouncement") : t === x.Message ? s("notice.typeMessage") : s("notice.typeNotice");
79
- function E(t) {
80
- if (!t) return "";
81
- const i = t.replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/[#>*_`~-]/g, "").replace(/\s+/g, " ").trim();
82
- return i.length > 60 ? i.slice(0, 60) + "…" : i;
107
+ const ae = (e) => e === y.Announcement ? "warning" : e === y.Message ? "success" : "info", ne = (e) => e === y.Announcement ? i("notice.typeAnnouncement") : e === y.Message ? i("notice.typeMessage") : i("notice.typeNotice"), le = q(() => L.value.types.length > 1);
108
+ function D(e) {
109
+ if (!e) return "";
110
+ const n = e.replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/[#>*_`~-]/g, "").replace(/\s+/g, " ").trim();
111
+ return n.length > 60 ? n.slice(0, 60) + "…" : n;
83
112
  }
84
- return de.on(() => {
85
- m();
86
- }), re(m, 3e4), m(), (t, i) => {
87
- var M, V, $;
88
- return l(), d(R, null, [
89
- n(e(ee), {
90
- show: w.value,
113
+ return Ne.on(() => {
114
+ w();
115
+ }), ke(w, 3e4), w(), (e, n) => {
116
+ var v, F, j;
117
+ return s(), p(R, null, [
118
+ o(t(de), {
119
+ show: _.value,
91
120
  "onUpdate:show": [
92
- i[0] || (i[0] = (a) => w.value = a),
93
- P
121
+ n[0] || (n[0] = (a) => _.value = a),
122
+ Q
94
123
  ],
95
124
  trigger: "click",
96
125
  placement: "bottom-end",
97
126
  "show-arrow": !1,
98
127
  style: { padding: "0" }
99
128
  }, {
100
- trigger: o(() => [
101
- n(e(le), {
102
- value: y.value,
129
+ trigger: l(() => [
130
+ o(t(G), {
131
+ value: E.value,
103
132
  max: 99,
104
- show: y.value > 0,
133
+ show: E.value > 0,
105
134
  offset: [0, 5]
106
135
  }, {
107
- default: o(() => [
108
- n(e(k), {
136
+ default: l(() => [
137
+ o(t(z), {
109
138
  quaternary: "",
110
139
  circle: "",
111
- "aria-label": e(s)("app.notice.title")
140
+ "aria-label": t(i)("app.notice.title")
112
141
  }, {
113
- default: o(() => [
114
- n(e(N), {
142
+ default: l(() => [
143
+ o(t(B), {
115
144
  icon: "ph:bell",
116
145
  width: 19
117
146
  })
@@ -122,95 +151,123 @@ const he = { class: "notice-panel" }, ve = { class: "notice-head" }, ye = { clas
122
151
  _: 1
123
152
  }, 8, ["value", "show"])
124
153
  ]),
125
- default: o(() => [
126
- f("div", he, [
127
- f("div", ve, [
128
- f("span", ye, c(e(s)("app.notice.title")), 1),
129
- n(e(k), {
154
+ default: l(() => [
155
+ h("div", Re, [
156
+ h("div", xe, [
157
+ h("span", Se, r(t(i)("app.notice.title")), 1),
158
+ o(t(z), {
130
159
  text: "",
131
160
  size: "tiny",
132
- disabled: y.value === 0,
133
- onClick: H
161
+ disabled: g[c.value] === 0,
162
+ onClick: ee
134
163
  }, {
135
- icon: o(() => [
136
- n(e(N), {
164
+ icon: l(() => [
165
+ o(t(B), {
137
166
  icon: "ph:checks",
138
167
  width: 15
139
168
  })
140
169
  ]),
141
- default: o(() => [
142
- p(" " + c(e(s)("app.notice.markAllRead")), 1)
170
+ default: l(() => [
171
+ f(" " + r(t(i)("app.notice.markAllRead")), 1)
143
172
  ]),
144
173
  _: 1
145
174
  }, 8, ["disabled"])
146
175
  ]),
147
- n(e(te), { show: C.value }, {
148
- default: o(() => [
149
- n(e(ae), { style: { "max-height": "360px" } }, {
150
- default: o(() => [
151
- _.value.length === 0 ? (l(), d("div", _e, [
152
- n(e(oe), {
153
- description: e(s)("app.notice.empty"),
176
+ o(t(pe), {
177
+ value: c.value,
178
+ type: "line",
179
+ size: "small",
180
+ "tabs-padding": 16,
181
+ class: "notice-tabs",
182
+ "onUpdate:value": W
183
+ }, {
184
+ default: l(() => [
185
+ (s(), p(R, null, V(u, (a) => o(t(fe), {
186
+ key: a.key,
187
+ name: a.key
188
+ }, {
189
+ default: l(() => [
190
+ f(r(t(i)(a.label)) + " ", 1),
191
+ o(t(G), {
192
+ value: g[a.key],
193
+ max: 99,
194
+ show: g[a.key] > 0,
195
+ class: "tab-badge"
196
+ }, null, 8, ["value", "show"])
197
+ ]),
198
+ _: 2
199
+ }, 1032, ["name"])), 64))
200
+ ]),
201
+ _: 1
202
+ }, 8, ["value"]),
203
+ o(t(me), { show: A.value }, {
204
+ default: l(() => [
205
+ o(t(ye), { style: { "max-height": "360px" } }, {
206
+ default: l(() => [
207
+ T.value.length === 0 ? (s(), p("div", ze, [
208
+ o(t(ve), {
209
+ description: t(i)(L.value.empty),
154
210
  size: "small"
155
211
  }, null, 8, ["description"])
156
- ])) : (l(), d("ul", we, [
157
- (l(!0), d(R, null, I(_.value, (a) => {
158
- var r;
159
- return l(), d("li", {
212
+ ])) : (s(), p("ul", Be, [
213
+ (s(!0), p(R, null, V(T.value, (a) => {
214
+ var m;
215
+ return s(), p("li", {
160
216
  key: a.id,
161
- class: L(["notice-item", a.isRead ? "read" : "unread"]),
162
- onClick: (Q) => q(a)
217
+ class: O(["notice-item", a.isRead ? "read" : "unread"]),
218
+ onClick: (oe) => Y(a)
163
219
  }, [
164
- a.isRead ? T("", !0) : (l(), d("span", ke)),
165
- f("div", Ne, [
166
- f("div", be, [
167
- n(e(ne), {
168
- type: K(a.type),
220
+ a.isRead ? x("", !0) : (s(), p("span", Ee)),
221
+ h("div", Ue, [
222
+ h("div", Ve, [
223
+ le.value ? (s(), S(t(he), {
224
+ key: 0,
225
+ type: ae(a.type),
169
226
  size: "tiny",
170
227
  bordered: !1,
171
228
  round: ""
172
229
  }, {
173
- default: o(() => [
174
- p(c(O(a.type)), 1)
230
+ default: l(() => [
231
+ f(r(ne(a.type)), 1)
175
232
  ]),
176
233
  _: 2
177
- }, 1032, ["type"]),
178
- n(e(ie), {
179
- class: L(["item-title", { unread: !a.isRead }])
234
+ }, 1032, ["type"])) : x("", !0),
235
+ o(t(ge), {
236
+ class: O(["item-title", { unread: !a.isRead }])
180
237
  }, {
181
- default: o(() => [
182
- p(c(a.title), 1)
238
+ default: l(() => [
239
+ f(r(a.title), 1)
183
240
  ]),
184
241
  _: 2
185
242
  }, 1032, ["class"]),
186
- (r = a.actions) != null && r.length ? (l(), S(e(N), {
187
- key: 0,
243
+ (m = a.actions) != null && m.length ? (s(), S(t(B), {
244
+ key: 1,
188
245
  icon: "ph:lightning",
189
246
  width: 13,
190
247
  class: "item-actions-mark"
191
- })) : T("", !0)
248
+ })) : x("", !0)
192
249
  ]),
193
- E(a.content) ? (l(), S(e(U), {
250
+ D(a.content) ? (s(), S(t(H), {
194
251
  key: 0,
195
252
  depth: "3",
196
253
  class: "item-snippet"
197
254
  }, {
198
- default: o(() => [
199
- p(c(E(a.content)), 1)
255
+ default: l(() => [
256
+ f(r(D(a.content)), 1)
200
257
  ]),
201
258
  _: 2
202
- }, 1024)) : T("", !0),
203
- n(e(U), {
259
+ }, 1024)) : x("", !0),
260
+ o(t(H), {
204
261
  depth: "3",
205
262
  class: "item-time"
206
263
  }, {
207
- default: o(() => [
208
- p(c(e(me)(a.publishTime, { seconds: !1 })), 1)
264
+ default: l(() => [
265
+ f(r(t(Ce)(a.publishTime, { seconds: !1 })), 1)
209
266
  ]),
210
267
  _: 2
211
268
  }, 1024)
212
269
  ])
213
- ], 10, ge);
270
+ ], 10, Me);
214
271
  }), 128))
215
272
  ]))
216
273
  ]),
@@ -219,20 +276,20 @@ const he = { class: "notice-panel" }, ve = { class: "notice-head" }, ye = { clas
219
276
  ]),
220
277
  _: 1
221
278
  }, 8, ["show"]),
222
- f("div", xe, [
223
- n(e(k), {
279
+ h("div", $e, [
280
+ o(t(z), {
224
281
  text: "",
225
282
  size: "small",
226
- onClick: J
283
+ onClick: te
227
284
  }, {
228
- icon: o(() => [
229
- n(e(N), {
285
+ icon: l(() => [
286
+ o(t(B), {
230
287
  icon: "ph:arrow-right",
231
288
  width: 14
232
289
  })
233
290
  ]),
234
- default: o(() => [
235
- p(c(e(s)("app.notice.viewAll")) + " ", 1)
291
+ default: l(() => [
292
+ f(r(t(i)("app.notice.viewAll")) + " ", 1)
236
293
  ]),
237
294
  _: 1
238
295
  })
@@ -241,38 +298,38 @@ const he = { class: "notice-panel" }, ve = { class: "notice-head" }, ye = { clas
241
298
  ]),
242
299
  _: 1
243
300
  }, 8, ["show"]),
244
- n(e(se), {
245
- show: g.value,
246
- "onUpdate:show": i[1] || (i[1] = (a) => g.value = a),
301
+ o(t(_e), {
302
+ show: C.value,
303
+ "onUpdate:show": n[1] || (n[1] = (a) => C.value = a),
247
304
  preset: "card",
248
- title: ((M = h.value) == null ? void 0 : M.title) || e(s)("notice.detailTitle"),
305
+ title: ((v = k.value) == null ? void 0 : v.title) || t(i)("notice.detailTitle"),
249
306
  style: { width: "640px", "max-width": "92vw" }
250
- }, X({
251
- default: o(() => {
307
+ }, ce({
308
+ default: l(() => {
252
309
  var a;
253
310
  return [
254
- n(fe, {
255
- value: (a = h.value) == null ? void 0 : a.content
311
+ o(Ae, {
312
+ value: (a = k.value) == null ? void 0 : a.content
256
313
  }, null, 8, ["value"])
257
314
  ];
258
315
  }),
259
316
  _: 2
260
317
  }, [
261
- ($ = (V = h.value) == null ? void 0 : V.actions) != null && $.length ? {
318
+ (j = (F = k.value) == null ? void 0 : F.actions) != null && j.length ? {
262
319
  name: "footer",
263
- fn: o(() => [
264
- n(e(ce), { justify: "end" }, {
265
- default: o(() => [
266
- (l(!0), d(R, null, I(h.value.actions, (a, r) => (l(), S(e(k), {
267
- key: r,
320
+ fn: l(() => [
321
+ o(t(we), { justify: "end" }, {
322
+ default: l(() => [
323
+ (s(!0), p(R, null, V(k.value.actions, (a, m) => (s(), S(t(z), {
324
+ key: m,
268
325
  size: "small",
269
- type: e(A).buttonType(a),
270
- loading: v.value === r,
271
- disabled: v.value !== null && v.value !== r,
272
- onClick: (Q) => G(a, r)
326
+ type: t(M).buttonType(a),
327
+ loading: b.value === m,
328
+ disabled: b.value !== null && b.value !== m,
329
+ onClick: (oe) => Z(a, m)
273
330
  }, {
274
- default: o(() => [
275
- p(c(e(A).label(a)), 1)
331
+ default: l(() => [
332
+ f(r(t(M).label(a)), 1)
276
333
  ]),
277
334
  _: 2
278
335
  }, 1032, ["type", "loading", "disabled", "onClick"]))), 128))
@@ -288,6 +345,6 @@ const he = { class: "notice-panel" }, ve = { class: "notice-head" }, ye = { clas
288
345
  }
289
346
  });
290
347
  export {
291
- De as default
348
+ Xe as default
292
349
  };
293
350
  //# sourceMappingURL=NoticeBell2.vue.js.map