@pangu-backend-ui/apputil-core 0.0.1

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.js ADDED
@@ -0,0 +1,540 @@
1
+ import { defineComponent as W, ref as g, inject as j, resolveComponent as u, openBlock as i, createBlock as _, withCtx as l, createVNode as e, createTextVNode as f, createElementBlock as S, Fragment as D, renderList as I, onBeforeMount as J, createCommentVNode as V, toDisplayString as B, unref as M } from "vue";
2
+ const z = [], K = /* @__PURE__ */ W({
3
+ __name: "BannerDialog",
4
+ emits: ["success"],
5
+ setup(P, { expose: r, emit: d }) {
6
+ const m = g(!1), n = g({
7
+ sceneCode: null,
8
+ image: null,
9
+ targetPath: null,
10
+ targetPathType: null,
11
+ params: null,
12
+ shelfTimeArr: []
13
+ }), F = g({
14
+ sceneCode: [{ required: !0, message: "请输入场景代码" }],
15
+ image: [{ required: !0, message: "请上传图片" }],
16
+ targetPath: [{ required: !0, message: "请输入目标地址" }],
17
+ targetPathType: [{ required: !0, message: "请选择目标地址类型" }]
18
+ }), C = g(!1), b = j("http"), k = g();
19
+ function x() {
20
+ var y;
21
+ (y = k.value) == null || y.validate((t) => {
22
+ if (t) {
23
+ C.value = !0;
24
+ let o = `/api/banner/${w ?? ""}/${w ? "update" : "create"}`, p = { ...n.value };
25
+ n.value.shelfTimeArr.length && (p.shelfTime = n.value.shelfTimeArr[0], p.offShelfTime = n.value.shelfTimeArr[1]), b == null || b.post(o, p).then((h) => {
26
+ var v;
27
+ d("success"), (v = k.value) == null || v.resetFields(), m.value = !1;
28
+ }).finally(() => {
29
+ C.value = !1;
30
+ });
31
+ }
32
+ });
33
+ }
34
+ const U = g([]);
35
+ let w = null;
36
+ function $(y, t) {
37
+ var o;
38
+ U.value = y, w = null, (o = k.value) == null || o.resetFields(), t && (w = t.id, Object.assign(n.value, t), n.value.shelfTimeArr = [new Date(t.shelfTime), new Date(t.offShelfTime)]), m.value = !0;
39
+ }
40
+ return r({
41
+ show: $
42
+ }), (y, t) => {
43
+ const o = u("el-option"), p = u("el-select"), h = u("el-form-item"), v = u("pg-upload"), A = u("el-input"), L = u("el-date-picker"), c = u("el-form"), R = u("el-button"), E = u("el-dialog");
44
+ return i(), _(E, {
45
+ modelValue: m.value,
46
+ "onUpdate:modelValue": t[6] || (t[6] = (s) => m.value = s),
47
+ width: "400"
48
+ }, {
49
+ footer: l(() => [
50
+ e(R, {
51
+ type: "primary",
52
+ disabled: C.value,
53
+ loading: C.value,
54
+ onClick: x
55
+ }, {
56
+ default: l(() => [
57
+ f("提交")
58
+ ]),
59
+ _: 1
60
+ }, 8, ["disabled", "loading"])
61
+ ]),
62
+ default: l(() => [
63
+ e(c, {
64
+ ref_key: "form",
65
+ ref: k,
66
+ rules: F.value,
67
+ model: n.value,
68
+ "label-position": "top"
69
+ }, {
70
+ default: l(() => [
71
+ e(h, {
72
+ label: "场景代码",
73
+ prop: "sceneCode"
74
+ }, {
75
+ default: l(() => [
76
+ e(p, {
77
+ modelValue: n.value.sceneCode,
78
+ "onUpdate:modelValue": t[0] || (t[0] = (s) => n.value.sceneCode = s),
79
+ placeholder: "请输入/选择场景代码",
80
+ "allow-create": "",
81
+ filterable: ""
82
+ }, {
83
+ default: l(() => [
84
+ (i(!0), S(D, null, I(U.value, (s) => (i(), _(o, {
85
+ key: s,
86
+ value: s,
87
+ label: s
88
+ }, null, 8, ["value", "label"]))), 128))
89
+ ]),
90
+ _: 1
91
+ }, 8, ["modelValue"])
92
+ ]),
93
+ _: 1
94
+ }),
95
+ e(h, {
96
+ label: "图片",
97
+ prop: "image"
98
+ }, {
99
+ default: l(() => [
100
+ e(v, {
101
+ accept: "jpg,jpeg,png",
102
+ modelValue: n.value.image,
103
+ "onUpdate:modelValue": t[1] || (t[1] = (s) => n.value.image = s),
104
+ "list-type": "picture-card",
105
+ "upload-type": "banner",
106
+ limit: 1
107
+ }, null, 8, ["modelValue"])
108
+ ]),
109
+ _: 1
110
+ }),
111
+ e(h, {
112
+ label: "目标地址",
113
+ prop: "targetPath"
114
+ }, {
115
+ default: l(() => [
116
+ e(A, {
117
+ placeholder: "请输入目标地址",
118
+ modelValue: n.value.targetPath,
119
+ "onUpdate:modelValue": t[2] || (t[2] = (s) => n.value.targetPath = s)
120
+ }, null, 8, ["modelValue"])
121
+ ]),
122
+ _: 1
123
+ }),
124
+ e(h, {
125
+ label: "目标地址类型",
126
+ prop: "targetPathType"
127
+ }, {
128
+ default: l(() => [
129
+ e(p, {
130
+ placeholder: "请选择目标地址类型",
131
+ modelValue: n.value.targetPathType,
132
+ "onUpdate:modelValue": t[3] || (t[3] = (s) => n.value.targetPathType = s)
133
+ }, {
134
+ default: l(() => [
135
+ e(o, {
136
+ value: "WEB_URL",
137
+ label: "Web地址"
138
+ }),
139
+ e(o, {
140
+ value: "PAGE_PATH",
141
+ label: "页面地址"
142
+ }),
143
+ e(o, {
144
+ value: "API",
145
+ label: "API地址"
146
+ })
147
+ ]),
148
+ _: 1
149
+ }, 8, ["modelValue"])
150
+ ]),
151
+ _: 1
152
+ }),
153
+ e(h, {
154
+ label: "目标地址参数",
155
+ prop: "params"
156
+ }, {
157
+ default: l(() => [
158
+ e(A, {
159
+ type: "textarea",
160
+ modelValue: n.value.params,
161
+ "onUpdate:modelValue": t[4] || (t[4] = (s) => n.value.params = s)
162
+ }, null, 8, ["modelValue"])
163
+ ]),
164
+ _: 1
165
+ }),
166
+ e(h, {
167
+ label: "生效时段",
168
+ prop: "shelfTimeArr"
169
+ }, {
170
+ default: l(() => [
171
+ e(L, {
172
+ type: "datetimerange",
173
+ modelValue: n.value.shelfTimeArr,
174
+ "onUpdate:modelValue": t[5] || (t[5] = (s) => n.value.shelfTimeArr = s),
175
+ "start-placeholder": "上架时间",
176
+ "end-placeholder": "下架时间",
177
+ "default-time": [new Date(2e3, 1, 1, 0, 0, 0), new Date(2e3, 1, 1, 23, 59, 59)]
178
+ }, null, 8, ["modelValue", "default-time"])
179
+ ]),
180
+ _: 1
181
+ })
182
+ ]),
183
+ _: 1
184
+ }, 8, ["rules", "model"])
185
+ ]),
186
+ _: 1
187
+ }, 8, ["modelValue"]);
188
+ };
189
+ }
190
+ }), Q = {
191
+ WEB_URL: {
192
+ name: "Web地址"
193
+ },
194
+ PAGE_PATH: {
195
+ name: "页面地址"
196
+ },
197
+ API: {
198
+ name: "API地址"
199
+ }
200
+ }, X = /* @__PURE__ */ W({
201
+ __name: "BannerListView",
202
+ setup(P) {
203
+ const r = j("http"), d = g({
204
+ sceneCode: null,
205
+ status: null
206
+ }), m = g([]);
207
+ function n() {
208
+ r == null || r.get("/api/banner/all-scene-code").then((t) => {
209
+ m.value = t.data;
210
+ });
211
+ }
212
+ const F = g(), C = g(!1);
213
+ function b() {
214
+ C.value = !!d.value.sceneCode, F.value.search();
215
+ }
216
+ function k(t) {
217
+ r == null || r.post(`/api/banner/${t}/publish`).then((o) => {
218
+ b();
219
+ });
220
+ }
221
+ function x(t) {
222
+ r == null || r.post(`/api/banner/${t}/off-shelf`).then((o) => {
223
+ b();
224
+ });
225
+ }
226
+ function U(t, o) {
227
+ r == null || r.post(`/api/banner/${t}/move-up`).then((p) => {
228
+ d.value.sceneCode = o, b();
229
+ });
230
+ }
231
+ function w(t, o) {
232
+ r == null || r.post(`/api/banner/${t}/move-down`).then((p) => {
233
+ d.value.sceneCode = o, b();
234
+ });
235
+ }
236
+ J(() => {
237
+ n();
238
+ });
239
+ const $ = g();
240
+ function y(t) {
241
+ $.value.show(m.value, t);
242
+ }
243
+ return (t, o) => {
244
+ const p = u("el-option"), h = u("el-select"), v = u("el-button"), A = u("el-space"), L = u("el-card"), c = u("el-table-column"), R = u("el-image"), E = u("el-descriptions-item"), s = u("el-descriptions"), q = u("el-popover"), H = u("el-tag"), O = u("el-popconfirm"), N = u("pg-table");
245
+ return i(), S(D, null, [
246
+ e(L, null, {
247
+ default: l(() => [
248
+ e(A, null, {
249
+ default: l(() => [
250
+ e(h, {
251
+ modelValue: d.value.sceneCode,
252
+ "onUpdate:modelValue": o[0] || (o[0] = (a) => d.value.sceneCode = a),
253
+ placeholder: "场景代码",
254
+ clearable: ""
255
+ }, {
256
+ default: l(() => [
257
+ (i(!0), S(D, null, I(m.value, (a, T) => (i(), _(p, {
258
+ label: a,
259
+ value: a,
260
+ key: `sc_con_${T}`
261
+ }, null, 8, ["label", "value"]))), 128))
262
+ ]),
263
+ _: 1
264
+ }, 8, ["modelValue"]),
265
+ e(h, {
266
+ modelValue: d.value.status,
267
+ "onUpdate:modelValue": o[1] || (o[1] = (a) => d.value.status = a),
268
+ placeholder: "状态",
269
+ clearable: "",
270
+ style: { width: "150px" }
271
+ }, {
272
+ default: l(() => [
273
+ e(p, {
274
+ label: "草稿",
275
+ value: "DRAFT"
276
+ }),
277
+ e(p, {
278
+ label: "已发布",
279
+ value: "PUBLISH"
280
+ }),
281
+ e(p, {
282
+ label: "已下架",
283
+ value: "OFF_SHELF"
284
+ })
285
+ ]),
286
+ _: 1
287
+ }, 8, ["modelValue"]),
288
+ e(v, {
289
+ type: "primary",
290
+ icon: "search",
291
+ onClick: b
292
+ }, {
293
+ default: l(() => [
294
+ f("搜索")
295
+ ]),
296
+ _: 1
297
+ }),
298
+ e(v, {
299
+ icon: "plus",
300
+ onClick: o[2] || (o[2] = (a) => y())
301
+ }, {
302
+ default: l(() => [
303
+ f("创建Banner")
304
+ ]),
305
+ _: 1
306
+ })
307
+ ]),
308
+ _: 1
309
+ })
310
+ ]),
311
+ _: 1
312
+ }),
313
+ e(N, {
314
+ ref_key: "table",
315
+ ref: F,
316
+ "data-url": "/api/banner/page",
317
+ onRowDbClick: y,
318
+ condition: d.value,
319
+ style: { "margin-top": "10px" }
320
+ }, {
321
+ default: l(() => [
322
+ C.value ? (i(), _(c, {
323
+ key: 0,
324
+ align: "center",
325
+ width: "80"
326
+ }, {
327
+ default: l(({ row: a }) => [
328
+ e(A, { direction: "vertical" }, {
329
+ default: l(() => [
330
+ e(v, {
331
+ icon: "ArrowUpBold",
332
+ onClick: (T) => U(a.id, a.sceneCode)
333
+ }, null, 8, ["onClick"]),
334
+ e(v, {
335
+ icon: "ArrowDownBold",
336
+ onClick: (T) => w(a.id, a.sceneCode)
337
+ }, null, 8, ["onClick"])
338
+ ]),
339
+ _: 2
340
+ }, 1024)
341
+ ]),
342
+ _: 1
343
+ })) : V("", !0),
344
+ e(c, {
345
+ label: "场景代码",
346
+ prop: "sceneCode",
347
+ width: "150"
348
+ }),
349
+ e(c, {
350
+ label: "图片",
351
+ width: "300",
352
+ align: "center"
353
+ }, {
354
+ default: l(({ row: a }) => [
355
+ e(R, {
356
+ src: a.image,
357
+ style: { "max-width": "300px" },
358
+ "preview-src-list": [a.image],
359
+ "preview-teleported": ""
360
+ }, null, 8, ["src", "preview-src-list"])
361
+ ]),
362
+ _: 1
363
+ }),
364
+ e(c, {
365
+ label: "目标路径",
366
+ prop: "targetPath",
367
+ "show-overflow-tooltip": ""
368
+ }),
369
+ e(c, {
370
+ label: "目标路径类型",
371
+ prop: "targetPathType",
372
+ width: "120"
373
+ }, {
374
+ default: l(({ row: a }) => [
375
+ f(B(M(Q)[a.targetPathType].name), 1)
376
+ ]),
377
+ _: 1
378
+ }),
379
+ e(c, {
380
+ label: "目标路径参数",
381
+ width: "120",
382
+ "show-overflow-tooltip": ""
383
+ }, {
384
+ default: l(({ row: a }) => [
385
+ a.params ? (i(), _(q, {
386
+ key: 0,
387
+ trigger: "hover",
388
+ width: "300"
389
+ }, {
390
+ reference: l(() => [
391
+ f(B(a.params.substring(0, 100)) + "... ", 1)
392
+ ]),
393
+ default: l(() => [
394
+ a.params.startsWith("{") ? (i(), _(s, {
395
+ key: 0,
396
+ column: "1",
397
+ border: ""
398
+ }, {
399
+ default: l(() => [
400
+ (i(!0), S(D, null, I(JSON.parse(a.params), (T, G) => (i(), _(E, {
401
+ label: G,
402
+ "min-width": "150"
403
+ }, {
404
+ default: l(() => [
405
+ f(B(T), 1)
406
+ ]),
407
+ _: 2
408
+ }, 1032, ["label"]))), 256))
409
+ ]),
410
+ _: 2
411
+ }, 1024)) : (i(), S(D, { key: 1 }, [
412
+ f(B(a.params), 1)
413
+ ], 64))
414
+ ]),
415
+ _: 2
416
+ }, 1024)) : V("", !0)
417
+ ]),
418
+ _: 1
419
+ }),
420
+ e(c, {
421
+ label: "上架时间",
422
+ prop: "shelfTime",
423
+ width: "180",
424
+ align: "center"
425
+ }),
426
+ e(c, {
427
+ label: "下架时间",
428
+ prop: "offShelfTime",
429
+ width: "180",
430
+ align: "center"
431
+ }),
432
+ e(c, {
433
+ label: "状态",
434
+ align: "center",
435
+ width: "88"
436
+ }, {
437
+ default: l(({ row: a }) => [
438
+ a.status == "DRAFT" ? (i(), _(H, {
439
+ key: 0,
440
+ type: "danger"
441
+ }, {
442
+ default: l(() => [
443
+ f("草稿")
444
+ ]),
445
+ _: 1
446
+ })) : V("", !0),
447
+ a.status == "PUBLISH" ? (i(), _(H, {
448
+ key: 1,
449
+ type: "success"
450
+ }, {
451
+ default: l(() => [
452
+ f("已发布")
453
+ ]),
454
+ _: 1
455
+ })) : V("", !0),
456
+ a.status == "OFF_SHELF" ? (i(), _(H, {
457
+ key: 2,
458
+ type: "warning"
459
+ }, {
460
+ default: l(() => [
461
+ f("已下架")
462
+ ]),
463
+ _: 1
464
+ })) : V("", !0)
465
+ ]),
466
+ _: 1
467
+ }),
468
+ e(c, {
469
+ align: "center",
470
+ width: "90"
471
+ }, {
472
+ default: l(({ row: a }) => [
473
+ ["DRAFT", "OFF_SHELF"].indexOf(a.status) >= 0 ? (i(), _(O, {
474
+ key: 0,
475
+ onConfirm: (T) => k(a.id),
476
+ title: `确定要${a.status == "DRAFT" ? "发布" : "上架"}该Banner吗?`
477
+ }, {
478
+ reference: l(() => [
479
+ e(v, { type: "success" }, {
480
+ default: l(() => [
481
+ f(B(a.status == "DRAFT" ? "发布" : "上架"), 1)
482
+ ]),
483
+ _: 2
484
+ }, 1024)
485
+ ]),
486
+ _: 2
487
+ }, 1032, ["onConfirm", "title"])) : V("", !0),
488
+ a.status == "PUBLISH" ? (i(), _(O, {
489
+ key: 1,
490
+ onConfirm: (T) => x(a.id),
491
+ title: "确定要[下架]该Banner吗?"
492
+ }, {
493
+ reference: l(() => [
494
+ e(v, { type: "warning" }, {
495
+ default: l(() => [
496
+ f("下架")
497
+ ]),
498
+ _: 1
499
+ })
500
+ ]),
501
+ _: 2
502
+ }, 1032, ["onConfirm"])) : V("", !0)
503
+ ]),
504
+ _: 1
505
+ })
506
+ ]),
507
+ _: 1
508
+ }, 8, ["condition"]),
509
+ e(K, {
510
+ ref_key: "bannerDialog",
511
+ ref: $,
512
+ onSuccess: b
513
+ }, null, 512)
514
+ ], 64);
515
+ };
516
+ }
517
+ }), Y = {
518
+ install: (P, r) => {
519
+ let d = r.router, m = d.getRoutes().find((n) => n.path == "/");
520
+ m && m.meta && d.addRoute({
521
+ path: "/terminal/banner",
522
+ name: "TerminalBanner",
523
+ redirect: "/terminal/banner/list",
524
+ component: m.meta.commonLayout,
525
+ children: [{
526
+ path: "list",
527
+ name: "BannerListView",
528
+ component: X
529
+ }]
530
+ });
531
+ }
532
+ }, Z = (P, r) => {
533
+ z.forEach((d) => P.use(d)), P.use(Y, r);
534
+ }, le = {
535
+ install: Z
536
+ };
537
+ export {
538
+ le as default,
539
+ Z as install
540
+ };
package/index.umd.cjs ADDED
@@ -0,0 +1 @@
1
+ (function(_,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(_=typeof globalThis<"u"?globalThis:_||self,e(_["pg-user-core"]={},_.Vue))})(this,function(_,e){"use strict";const F=[],U=e.defineComponent({__name:"BannerDialog",emits:["success"],setup(b,{expose:n,emit:c}){const s=e.ref(!1),l=e.ref({sceneCode:null,image:null,targetPath:null,targetPathType:null,params:null,shelfTimeArr:[]}),N=e.ref({sceneCode:[{required:!0,message:"请输入场景代码"}],image:[{required:!0,message:"请上传图片"}],targetPath:[{required:!0,message:"请输入目标地址"}],targetPathType:[{required:!0,message:"请选择目标地址类型"}]}),h=e.ref(!1),m=e.inject("http"),g=e.ref();function B(){var C;(C=g.value)==null||C.validate(t=>{if(t){h.value=!0;let a=`/api/banner/${u??""}/${u?"update":"create"}`,i={...l.value};l.value.shelfTimeArr.length&&(i.shelfTime=l.value.shelfTimeArr[0],i.offShelfTime=l.value.shelfTimeArr[1]),m==null||m.post(a,i).then(f=>{var p;c("success"),(p=g.value)==null||p.resetFields(),s.value=!1}).finally(()=>{h.value=!1})}})}const x=e.ref([]);let u=null;function k(C,t){var a;x.value=C,u=null,(a=g.value)==null||a.resetFields(),t&&(u=t.id,Object.assign(l.value,t),l.value.shelfTimeArr=[new Date(t.shelfTime),new Date(t.offShelfTime)]),s.value=!0}return n({show:k}),(C,t)=>{const a=e.resolveComponent("el-option"),i=e.resolveComponent("el-select"),f=e.resolveComponent("el-form-item"),p=e.resolveComponent("pg-upload"),w=e.resolveComponent("el-input"),y=e.resolveComponent("el-date-picker"),d=e.resolveComponent("el-form"),T=e.resolveComponent("el-button"),P=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(P,{modelValue:s.value,"onUpdate:modelValue":t[6]||(t[6]=r=>s.value=r),width:"400"},{footer:e.withCtx(()=>[e.createVNode(T,{type:"primary",disabled:h.value,loading:h.value,onClick:B},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1},8,["disabled","loading"])]),default:e.withCtx(()=>[e.createVNode(d,{ref_key:"form",ref:g,rules:N.value,model:l.value,"label-position":"top"},{default:e.withCtx(()=>[e.createVNode(f,{label:"场景代码",prop:"sceneCode"},{default:e.withCtx(()=>[e.createVNode(i,{modelValue:l.value.sceneCode,"onUpdate:modelValue":t[0]||(t[0]=r=>l.value.sceneCode=r),placeholder:"请输入/选择场景代码","allow-create":"",filterable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,r=>(e.openBlock(),e.createBlock(a,{key:r,value:r,label:r},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),e.createVNode(f,{label:"图片",prop:"image"},{default:e.withCtx(()=>[e.createVNode(p,{accept:"jpg,jpeg,png",modelValue:l.value.image,"onUpdate:modelValue":t[1]||(t[1]=r=>l.value.image=r),"list-type":"picture-card","upload-type":"banner",limit:1},null,8,["modelValue"])]),_:1}),e.createVNode(f,{label:"目标地址",prop:"targetPath"},{default:e.withCtx(()=>[e.createVNode(w,{placeholder:"请输入目标地址",modelValue:l.value.targetPath,"onUpdate:modelValue":t[2]||(t[2]=r=>l.value.targetPath=r)},null,8,["modelValue"])]),_:1}),e.createVNode(f,{label:"目标地址类型",prop:"targetPathType"},{default:e.withCtx(()=>[e.createVNode(i,{placeholder:"请选择目标地址类型",modelValue:l.value.targetPathType,"onUpdate:modelValue":t[3]||(t[3]=r=>l.value.targetPathType=r)},{default:e.withCtx(()=>[e.createVNode(a,{value:"WEB_URL",label:"Web地址"}),e.createVNode(a,{value:"PAGE_PATH",label:"页面地址"}),e.createVNode(a,{value:"API",label:"API地址"})]),_:1},8,["modelValue"])]),_:1}),e.createVNode(f,{label:"目标地址参数",prop:"params"},{default:e.withCtx(()=>[e.createVNode(w,{type:"textarea",modelValue:l.value.params,"onUpdate:modelValue":t[4]||(t[4]=r=>l.value.params=r)},null,8,["modelValue"])]),_:1}),e.createVNode(f,{label:"生效时段",prop:"shelfTimeArr"},{default:e.withCtx(()=>[e.createVNode(y,{type:"datetimerange",modelValue:l.value.shelfTimeArr,"onUpdate:modelValue":t[5]||(t[5]=r=>l.value.shelfTimeArr=r),"start-placeholder":"上架时间","end-placeholder":"下架时间","default-time":[new Date(2e3,1,1,0,0,0),new Date(2e3,1,1,23,59,59)]},null,8,["modelValue","default-time"])]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["modelValue"])}}}),L={WEB_URL:{name:"Web地址"},PAGE_PATH:{name:"页面地址"},API:{name:"API地址"}},$=e.defineComponent({__name:"BannerListView",setup(b){const n=e.inject("http"),c=e.ref({sceneCode:null,status:null}),s=e.ref([]);function l(){n==null||n.get("/api/banner/all-scene-code").then(t=>{s.value=t.data})}const N=e.ref(),h=e.ref(!1);function m(){h.value=!!c.value.sceneCode,N.value.search()}function g(t){n==null||n.post(`/api/banner/${t}/publish`).then(a=>{m()})}function B(t){n==null||n.post(`/api/banner/${t}/off-shelf`).then(a=>{m()})}function x(t,a){n==null||n.post(`/api/banner/${t}/move-up`).then(i=>{c.value.sceneCode=a,m()})}function u(t,a){n==null||n.post(`/api/banner/${t}/move-down`).then(i=>{c.value.sceneCode=a,m()})}e.onBeforeMount(()=>{l()});const k=e.ref();function C(t){k.value.show(s.value,t)}return(t,a)=>{const i=e.resolveComponent("el-option"),f=e.resolveComponent("el-select"),p=e.resolveComponent("el-button"),w=e.resolveComponent("el-space"),y=e.resolveComponent("el-card"),d=e.resolveComponent("el-table-column"),T=e.resolveComponent("el-image"),P=e.resolveComponent("el-descriptions-item"),r=e.resolveComponent("el-descriptions"),H=e.resolveComponent("el-popover"),S=e.resolveComponent("el-tag"),D=e.resolveComponent("el-popconfirm"),I=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(y,null,{default:e.withCtx(()=>[e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(f,{modelValue:c.value.sceneCode,"onUpdate:modelValue":a[0]||(a[0]=o=>c.value.sceneCode=o),placeholder:"场景代码",clearable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(o,V)=>(e.openBlock(),e.createBlock(i,{label:o,value:o,key:`sc_con_${V}`},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),e.createVNode(f,{modelValue:c.value.status,"onUpdate:modelValue":a[1]||(a[1]=o=>c.value.status=o),placeholder:"状态",clearable:"",style:{width:"150px"}},{default:e.withCtx(()=>[e.createVNode(i,{label:"草稿",value:"DRAFT"}),e.createVNode(i,{label:"已发布",value:"PUBLISH"}),e.createVNode(i,{label:"已下架",value:"OFF_SHELF"})]),_:1},8,["modelValue"]),e.createVNode(p,{type:"primary",icon:"search",onClick:m},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1}),e.createVNode(p,{icon:"plus",onClick:a[2]||(a[2]=o=>C())},{default:e.withCtx(()=>[e.createTextVNode("创建Banner")]),_:1})]),_:1})]),_:1}),e.createVNode(I,{ref_key:"table",ref:N,"data-url":"/api/banner/page",onRowDbClick:C,condition:c.value,style:{"margin-top":"10px"}},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createBlock(d,{key:0,align:"center",width:"80"},{default:e.withCtx(({row:o})=>[e.createVNode(w,{direction:"vertical"},{default:e.withCtx(()=>[e.createVNode(p,{icon:"ArrowUpBold",onClick:V=>x(o.id,o.sceneCode)},null,8,["onClick"]),e.createVNode(p,{icon:"ArrowDownBold",onClick:V=>u(o.id,o.sceneCode)},null,8,["onClick"])]),_:2},1024)]),_:1})):e.createCommentVNode("",!0),e.createVNode(d,{label:"场景代码",prop:"sceneCode",width:"150"}),e.createVNode(d,{label:"图片",width:"300",align:"center"},{default:e.withCtx(({row:o})=>[e.createVNode(T,{src:o.image,style:{"max-width":"300px"},"preview-src-list":[o.image],"preview-teleported":""},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(d,{label:"目标路径",prop:"targetPath","show-overflow-tooltip":""}),e.createVNode(d,{label:"目标路径类型",prop:"targetPathType",width:"120"},{default:e.withCtx(({row:o})=>[e.createTextVNode(e.toDisplayString(e.unref(L)[o.targetPathType].name),1)]),_:1}),e.createVNode(d,{label:"目标路径参数",width:"120","show-overflow-tooltip":""},{default:e.withCtx(({row:o})=>[o.params?(e.openBlock(),e.createBlock(H,{key:0,trigger:"hover",width:"300"},{reference:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.params.substring(0,100))+"... ",1)]),default:e.withCtx(()=>[o.params.startsWith("{")?(e.openBlock(),e.createBlock(r,{key:0,column:"1",border:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(JSON.parse(o.params),(V,j)=>(e.openBlock(),e.createBlock(P,{label:j,"min-width":"150"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V),1)]),_:2},1032,["label"]))),256))]),_:2},1024)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(o.params),1)],64))]),_:2},1024)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,{label:"上架时间",prop:"shelfTime",width:"180",align:"center"}),e.createVNode(d,{label:"下架时间",prop:"offShelfTime",width:"180",align:"center"}),e.createVNode(d,{label:"状态",align:"center",width:"88"},{default:e.withCtx(({row:o})=>[o.status=="DRAFT"?(e.openBlock(),e.createBlock(S,{key:0,type:"danger"},{default:e.withCtx(()=>[e.createTextVNode("草稿")]),_:1})):e.createCommentVNode("",!0),o.status=="PUBLISH"?(e.openBlock(),e.createBlock(S,{key:1,type:"success"},{default:e.withCtx(()=>[e.createTextVNode("已发布")]),_:1})):e.createCommentVNode("",!0),o.status=="OFF_SHELF"?(e.openBlock(),e.createBlock(S,{key:2,type:"warning"},{default:e.withCtx(()=>[e.createTextVNode("已下架")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,{align:"center",width:"90"},{default:e.withCtx(({row:o})=>[["DRAFT","OFF_SHELF"].indexOf(o.status)>=0?(e.openBlock(),e.createBlock(D,{key:0,onConfirm:V=>g(o.id),title:`确定要${o.status=="DRAFT"?"发布":"上架"}该Banner吗?`},{reference:e.withCtx(()=>[e.createVNode(p,{type:"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.status=="DRAFT"?"发布":"上架"),1)]),_:2},1024)]),_:2},1032,["onConfirm","title"])):e.createCommentVNode("",!0),o.status=="PUBLISH"?(e.openBlock(),e.createBlock(D,{key:1,onConfirm:V=>B(o.id),title:"确定要[下架]该Banner吗?"},{reference:e.withCtx(()=>[e.createVNode(p,{type:"warning"},{default:e.withCtx(()=>[e.createTextVNode("下架")]),_:1})]),_:2},1032,["onConfirm"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["condition"]),e.createVNode(U,{ref_key:"bannerDialog",ref:k,onSuccess:m},null,512)],64)}}}),E={install:(b,n)=>{let c=n.router,s=c.getRoutes().find(l=>l.path=="/");s&&s.meta&&c.addRoute({path:"/terminal/banner",name:"TerminalBanner",redirect:"/terminal/banner/list",component:s.meta.commonLayout,children:[{path:"list",name:"BannerListView",component:$}]})}},A=(b,n)=>{F.forEach(c=>b.use(c)),b.use(E,n)},R={install:A};_.default=R,_.install=A,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@pangu-backend-ui/apputil-core",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "main": "index.js",
6
+ "module": "index.js",
7
+ "unpkg": "index.umd.cjs",
8
+ "types": "types/index.d.ts",
9
+ "license": "MIT",
10
+ "exports": {
11
+ ".": {
12
+ "import": "index.js",
13
+ "require": "index.umd.cjs",
14
+ "types": "types/index.d.ts"
15
+ },
16
+ "./*": "./*"
17
+ },
18
+ "dependencies": {
19
+ "axios": "^1.3.2",
20
+ "element-plus": "^2.2.29",
21
+ "vue": "^3.2.45",
22
+ "vue-router": "^4.1.6",
23
+ "pinia": "^2.0.28",
24
+ "@pangu-backend-ui/common": "^0.0.27",
25
+ "@pangu-backend-ui/admin-core": "^0.0.4"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public",
29
+ "registry": "https://registry.npmjs.org/"
30
+ },
31
+ "web-types": "web-types.json",
32
+ "browserslist": [
33
+ "> 1%",
34
+ "not ie 11",
35
+ "not op_mini all"
36
+ ]
37
+ }
@@ -0,0 +1,11 @@
1
+ export declare const bannerTargetPathType: {
2
+ WEB_URL: {
3
+ name: string;
4
+ };
5
+ PAGE_PATH: {
6
+ name: string;
7
+ };
8
+ API: {
9
+ name: string;
10
+ };
11
+ };
@@ -0,0 +1,3 @@
1
+ declare const _default: never[];
2
+ export default _default;
3
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { App } from 'vue';
2
+ import InstallOptions from './types/InstallOptions';
3
+ export declare const install: (app: App, option: InstallOptions) => void;
4
+ declare const _default: {
5
+ install: (app: App<any>, option: InstallOptions) => void;
6
+ };
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { App } from "vue";
2
+ import InstallOptions from '../types/InstallOptions';
3
+ declare const _default: {
4
+ install: (app: App, option: InstallOptions) => void;
5
+ };
6
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { Router } from "vue-router";
2
+ export default interface InstallOptions {
3
+ router: Router;
4
+ }