@cmstops/pro-compo 0.3.8 → 0.3.9

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,7 +1,7 @@
1
1
  import { defineComponent, ref, computed, onMounted, onBeforeUnmount, openBlock, createElementBlock, createCommentVNode, createElementVNode, Fragment, createVNode, unref, withCtx, renderList, createBlock, toDisplayString, createTextVNode, nextTick } from "vue";
2
2
  import { Select, Option, Button, Message } from "@arco-design/web-vue";
3
3
  import { IconQrcode } from "@arco-design/web-vue/es/icon";
4
- import html2canvas from "html2canvas";
4
+ import "html2canvas";
5
5
  import QRCode from "qrcodejs2-fix";
6
6
  import { getSpaceDate } from "../../../../utils/date.js";
7
7
  import { generateDocPreviewLink } from "../../../script/api.js";
@@ -85,36 +85,6 @@ const _sfc_main = defineComponent({
85
85
  return true;
86
86
  return flag;
87
87
  });
88
- const clip = (data) => {
89
- const clipboard = typeof data === "string" ? navigator.clipboard.writeText(data) : navigator.clipboard.write(data);
90
- clipboard.then(
91
- () => {
92
- Message.success({
93
- content: "\u5DF2\u4FDD\u5B58\u5230\u7C98\u8D34\u677F"
94
- });
95
- },
96
- () => {
97
- Message.success({
98
- content: "\u4FDD\u5B58\u5931\u8D25"
99
- });
100
- }
101
- );
102
- };
103
- const clipUrl = (type) => {
104
- if (!dataInfo.value.share.share_url)
105
- return;
106
- if (type === "text") {
107
- clip(dataInfo.value.share.share_url);
108
- } else {
109
- const img = document.querySelector(`#${dynamicQRId.value} img`);
110
- html2canvas(img).then((canvas) => {
111
- canvas.toBlob((blob) => {
112
- const data = [new ClipboardItem({ [blob.type]: blob })];
113
- clip(data);
114
- }, "image/png");
115
- });
116
- }
117
- };
118
88
  const genTimeLink = async (expiration2, force = true, tip = true) => {
119
89
  emit("changeLoading", true);
120
90
  const data = {
@@ -226,27 +196,8 @@ const _sfc_main = defineComponent({
226
196
  ]),
227
197
  _: 1
228
198
  })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
229
- createVNode(unref(Button), {
230
- class: "auto",
231
- light: "",
232
- onClick: _cache[2] || (_cache[2] = ($event) => clipUrl("img"))
233
- }, {
234
- default: withCtx(() => [
235
- createTextVNode("\u590D\u5236\u4E8C\u7EF4\u7801")
236
- ]),
237
- _: 1
238
- }),
239
- createVNode(unref(Button), {
240
- class: "auto",
241
- type: "primary",
242
- light: "",
243
- onClick: _cache[3] || (_cache[3] = ($event) => clipUrl("text"))
244
- }, {
245
- default: withCtx(() => [
246
- createTextVNode(toDisplayString(time.value ? "\u590D\u5236\u9884\u89C8\u5730\u5740" : "\u590D\u5236\u8BBF\u95EE\u5730\u5740"), 1)
247
- ]),
248
- _: 1
249
- })
199
+ createCommentVNode("v-if", true),
200
+ createCommentVNode("v-if", true)
250
201
  ], 64))
251
202
  ])
252
203
  ])
@@ -87,7 +87,6 @@ const _sfc_main = defineComponent({
87
87
  const emit = __emit;
88
88
  const props = __props;
89
89
  const BASE_API = props.BASE_API || DEFAULT_BASE_API;
90
- ref(props.cropper || false);
91
90
  const oldData = ref(null);
92
91
  const styleData = ref({});
93
92
  const thumbBannerModel = ref("banner");
@@ -360,10 +359,12 @@ const _sfc_main = defineComponent({
360
359
  key: index,
361
360
  id: `thumb-card-${index}`,
362
361
  data: thumbList.value[index],
362
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
363
363
  "preview-list": previewList.value,
364
364
  "thumb-model": "thumb",
365
+ onUploadLocal: _cache[0] || (_cache[0] = (cb) => _ctx.$emit("upload", cb)),
365
366
  onOpen: ($event) => openDialogMediaSelection($event, index)
366
- }, null, 8, ["id", "data", "preview-list", "onOpen"]);
367
+ }, null, 8, ["id", "data", "onUpdate:data", "preview-list", "onOpen"]);
367
368
  }), 128))
368
369
  ])) : currentModel.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
369
370
  createCommentVNode(" \u5C01\u9762\u56FEcard "),
@@ -373,11 +374,13 @@ const _sfc_main = defineComponent({
373
374
  key: index,
374
375
  id: `thumb-card-${index}`,
375
376
  data: thumbList.value[index],
377
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
376
378
  model: model.value,
377
379
  "preview-list": previewList.value,
378
380
  "thumb-model": "thumb",
381
+ onUploadLocal: _cache[1] || (_cache[1] = (cb) => _ctx.$emit("upload", cb)),
379
382
  onOpen: ($event) => openDialogMediaSelection($event, index)
380
- }, null, 8, ["id", "data", "model", "preview-list", "onOpen"]);
383
+ }, null, 8, ["id", "data", "onUpdate:data", "model", "preview-list", "onOpen"]);
381
384
  }), 128))
382
385
  ])
383
386
  ], 2112)) : createCommentVNode("v-if", true),
@@ -389,7 +392,7 @@ const _sfc_main = defineComponent({
389
392
  createCommentVNode(" \u9009\u62E9\u5927\u56FE\u3001\u4E09\u56FE\u3001\u5355\u56FE...\u7B49\u6A21\u5F0F "),
390
393
  createVNode(unref(RadioGroup), {
391
394
  modelValue: model.value,
392
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
395
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value = $event),
393
396
  size: "small",
394
397
  type: "button",
395
398
  style: { "margin-top": "10px" },
@@ -427,7 +430,7 @@ const _sfc_main = defineComponent({
427
430
  !_ctx.flex ? (openBlock(), createBlock(unref(Switch), {
428
431
  key: 0,
429
432
  modelValue: hasBanner.value,
430
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => hasBanner.value = $event),
433
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => hasBanner.value = $event),
431
434
  size: "small"
432
435
  }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true)
433
436
  ], 4),
@@ -436,7 +439,7 @@ const _sfc_main = defineComponent({
436
439
  _ctx.flex ? (openBlock(), createBlock(unref(Switch), {
437
440
  key: 0,
438
441
  modelValue: hasBanner.value,
439
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => hasBanner.value = $event),
442
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => hasBanner.value = $event),
440
443
  style: { "margin-bottom": "10px" },
441
444
  size: "small"
442
445
  }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true),
@@ -444,8 +447,10 @@ const _sfc_main = defineComponent({
444
447
  key: 1,
445
448
  id: `banner-card`,
446
449
  data: banner.value,
450
+ "onUpdate:data": _cache[5] || (_cache[5] = ($event) => banner.value = $event),
447
451
  "preview-list": previewList.value,
448
452
  "thumb-model": "banner",
453
+ onUploadLocal: _cache[6] || (_cache[6] = (cb) => _ctx.$emit("upload", cb)),
449
454
  onOpen: openDialogMediaSelection
450
455
  }, null, 8, ["data", "preview-list"])) : createCommentVNode("v-if", true),
451
456
  hasBanner.value && styleData.value.banner_theme_color ? (openBlock(), createElementBlock("div", _hoisted_11, _hoisted_13)) : createCommentVNode("v-if", true),
@@ -476,8 +481,10 @@ const _sfc_main = defineComponent({
476
481
  createVNode(_sfc_main$1, {
477
482
  id: `pc-banner-card`,
478
483
  data: pcBanner.value,
484
+ "onUpdate:data": _cache[7] || (_cache[7] = ($event) => pcBanner.value = $event),
479
485
  previewList: previewList.value,
480
486
  thumbModel: "pcBanner",
487
+ onUploadLocal: _cache[8] || (_cache[8] = (cb) => _ctx.$emit("upload", cb)),
481
488
  onOpen: openDialogMediaSelection
482
489
  }, null, 8, ["data", "previewList"]),
483
490
  _ctx.flex ? (openBlock(), createElementBlock("span", _hoisted_19, "(\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A1242px*662px)")) : createCommentVNode("v-if", true),
@@ -493,18 +500,18 @@ const _sfc_main = defineComponent({
493
500
  ], 64)) : createCommentVNode("v-if", true),
494
501
  createVNode(_sfc_main$3, {
495
502
  dialogVisible: dialogMediaSelectionShow.value,
496
- "onUpdate:dialogVisible": _cache[3] || (_cache[3] = ($event) => dialogMediaSelectionShow.value = $event),
503
+ "onUpdate:dialogVisible": _cache[9] || (_cache[9] = ($event) => dialogMediaSelectionShow.value = $event),
497
504
  preview: false,
498
505
  "catalog-props": "image",
499
506
  ai_static_covers: _ctx.aiImages,
500
507
  BASE_API: unref(BASE_API),
501
508
  onSubmit: submitCallback,
502
- onUpload: _cache[4] || (_cache[4] = (cb) => _ctx.$emit("upload", cb))
509
+ onUpload: _cache[10] || (_cache[10] = (cb) => _ctx.$emit("upload", cb))
503
510
  }, null, 8, ["dialogVisible", "ai_static_covers", "BASE_API"]),
504
511
  refreshCrop.value ? (openBlock(), createBlock(_sfc_main$4, {
505
512
  key: 1,
506
513
  visible: dialogCropperShow.value,
507
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => dialogCropperShow.value = $event),
514
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => dialogCropperShow.value = $event),
508
515
  "aspect-ratio-prop": aspectRatioProp.value,
509
516
  BASE_API: unref(BASE_API),
510
517
  "corp-data": cropperData.value,
@@ -1,5 +1,5 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createVNode, unref, Transition, withCtx, createElementVNode, withModifiers, createCommentVNode, normalizeStyle } from "vue";
2
- import { Image } from "@arco-design/web-vue";
1
+ import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeStyle, normalizeClass, createElementBlock, createVNode, Transition, withModifiers, createCommentVNode } from "vue";
2
+ import { Popover, Image } from "@arco-design/web-vue";
3
3
  import { IconEdit, IconDelete, IconPlus } from "@arco-design/web-vue/es/icon";
4
4
  import { DEFAULT_BASE_API } from "../../config.js";
5
5
  const _hoisted_1 = {
@@ -14,9 +14,10 @@ const _sfc_main = defineComponent({
14
14
  previewList: {},
15
15
  thumbModel: {},
16
16
  along: { type: Boolean },
17
- model: {}
17
+ model: {},
18
+ changeThumbModel: { type: Function }
18
19
  },
19
- emits: ["open", "remove"],
20
+ emits: ["open", "remove", "uploadLocal", "update:data"],
20
21
  setup(__props, { emit: __emit }) {
21
22
  const waterBg = `${DEFAULT_BASE_API}/static/images/waterBg.png`;
22
23
  const props = __props;
@@ -29,9 +30,24 @@ const _sfc_main = defineComponent({
29
30
  [`model-${props.model}`]: ((_a = props.data) == null ? void 0 : _a.url) && props.model
30
31
  };
31
32
  });
33
+ const btnStyle = computed(() => {
34
+ return {
35
+ padding: "5px 10px",
36
+ cursor: "pointer"
37
+ };
38
+ });
32
39
  const clickMask = () => {
33
40
  props.along && openDialogMediaSelection();
34
41
  };
42
+ const loaclUpload = () => {
43
+ emit("uploadLocal", (file) => {
44
+ const { data } = props;
45
+ if (!data || !file)
46
+ return;
47
+ data.url = file.url;
48
+ emit("update:data", data);
49
+ });
50
+ };
35
51
  const openDialogMediaSelection = () => {
36
52
  emit("open", props.thumbModel);
37
53
  };
@@ -39,48 +55,67 @@ const _sfc_main = defineComponent({
39
55
  emit("remove");
40
56
  };
41
57
  return (_ctx, _cache) => {
42
- var _a, _b;
43
- return openBlock(), createElementBlock("div", {
44
- class: normalizeClass(["thumb-card-container", classObj.value])
45
- }, [
46
- ((_a = props.data) == null ? void 0 : _a.url) ? (openBlock(), createElementBlock("div", _hoisted_1, [
47
- createVNode(unref(Image), {
48
- class: "item",
49
- fit: "cover",
50
- src: (_b = props.data) == null ? void 0 : _b.url
51
- }, null, 8, ["src"]),
52
- createVNode(Transition, { name: "fade" }, {
53
- default: withCtx(() => [
54
- createElementVNode("div", {
55
- class: "mask",
56
- onClick: clickMask
58
+ return openBlock(), createBlock(unref(Popover), {
59
+ trigger: "hover",
60
+ "content-style": "padding: 0;"
61
+ }, {
62
+ content: withCtx(() => [
63
+ createElementVNode("div", {
64
+ style: normalizeStyle(btnStyle.value),
65
+ onClick: openDialogMediaSelection
66
+ }, "\u7D20\u6750\u5E93\u9009\u62E9", 4),
67
+ createElementVNode("div", {
68
+ style: normalizeStyle(btnStyle.value),
69
+ onClick: loaclUpload
70
+ }, "\u672C\u5730\u4E0A\u4F20", 4)
71
+ ]),
72
+ default: withCtx(() => {
73
+ var _a, _b;
74
+ return [
75
+ createElementVNode("div", {
76
+ class: normalizeClass(["thumb-card-container", classObj.value])
77
+ }, [
78
+ ((_a = props.data) == null ? void 0 : _a.url) ? (openBlock(), createElementBlock("div", _hoisted_1, [
79
+ createVNode(unref(Image), {
80
+ class: "item",
81
+ fit: "cover",
82
+ src: (_b = props.data) == null ? void 0 : _b.url
83
+ }, null, 8, ["src"]),
84
+ createVNode(Transition, { name: "fade" }, {
85
+ default: withCtx(() => [
86
+ createElementVNode("div", {
87
+ class: "mask",
88
+ onClick: clickMask
89
+ }, [
90
+ createElementVNode("span", {
91
+ class: "half",
92
+ onClick: withModifiers(openDialogMediaSelection, ["stop"])
93
+ }, [
94
+ createVNode(unref(IconEdit))
95
+ ]),
96
+ _ctx.along ? (openBlock(), createElementBlock("span", {
97
+ key: 0,
98
+ class: "half",
99
+ onClick: withModifiers(remove, ["stop"])
100
+ }, [
101
+ createVNode(unref(IconDelete))
102
+ ])) : createCommentVNode("v-if", true)
103
+ ])
104
+ ]),
105
+ _: 1
106
+ })
107
+ ])) : (openBlock(), createElementBlock("div", {
108
+ key: 1,
109
+ class: "item add-thumb",
110
+ style: normalizeStyle({ backgroundImage: `url(${waterBg})` })
57
111
  }, [
58
- createElementVNode("span", {
59
- class: "half",
60
- onClick: withModifiers(openDialogMediaSelection, ["stop"])
61
- }, [
62
- createVNode(unref(IconEdit))
63
- ]),
64
- _ctx.along ? (openBlock(), createElementBlock("span", {
65
- key: 0,
66
- class: "half",
67
- onClick: withModifiers(remove, ["stop"])
68
- }, [
69
- createVNode(unref(IconDelete))
70
- ])) : createCommentVNode("v-if", true)
71
- ])
72
- ]),
73
- _: 1
74
- })
75
- ])) : (openBlock(), createElementBlock("div", {
76
- key: 1,
77
- class: "item add-thumb",
78
- style: normalizeStyle({ backgroundImage: `url(${waterBg})` }),
79
- onClick: withModifiers(openDialogMediaSelection, ["stop"])
80
- }, [
81
- createVNode(unref(IconPlus))
82
- ], 4))
83
- ], 2);
112
+ createVNode(unref(IconPlus))
113
+ ], 4))
114
+ ], 2)
115
+ ];
116
+ }),
117
+ _: 1
118
+ });
84
119
  };
85
120
  }
86
121
  });
@@ -1 +1 @@
1
- // Global Style
1
+ // Global Style
@@ -2,14 +2,13 @@
2
2
  var vue = require("vue");
3
3
  var webVue = require("@arco-design/web-vue");
4
4
  var icon = require("@arco-design/web-vue/es/icon");
5
- var html2canvas = require("html2canvas");
5
+ require("html2canvas");
6
6
  var QRCode = require("qrcodejs2-fix");
7
7
  var date = require("../../../../utils/date.js");
8
8
  var api = require("../../../script/api.js");
9
9
  function _interopDefaultLegacy(e) {
10
10
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
11
11
  }
12
- var html2canvas__default = /* @__PURE__ */ _interopDefaultLegacy(html2canvas);
13
12
  var QRCode__default = /* @__PURE__ */ _interopDefaultLegacy(QRCode);
14
13
  const _hoisted_1 = { class: "preview-qrcode-iframe-container-v" };
15
14
  const _hoisted_2 = { class: "doc-qrcode-preview-container-v" };
@@ -91,36 +90,6 @@ const _sfc_main = vue.defineComponent({
91
90
  return true;
92
91
  return flag;
93
92
  });
94
- const clip = (data) => {
95
- const clipboard = typeof data === "string" ? navigator.clipboard.writeText(data) : navigator.clipboard.write(data);
96
- clipboard.then(
97
- () => {
98
- webVue.Message.success({
99
- content: "\u5DF2\u4FDD\u5B58\u5230\u7C98\u8D34\u677F"
100
- });
101
- },
102
- () => {
103
- webVue.Message.success({
104
- content: "\u4FDD\u5B58\u5931\u8D25"
105
- });
106
- }
107
- );
108
- };
109
- const clipUrl = (type) => {
110
- if (!dataInfo.value.share.share_url)
111
- return;
112
- if (type === "text") {
113
- clip(dataInfo.value.share.share_url);
114
- } else {
115
- const img = document.querySelector(`#${dynamicQRId.value} img`);
116
- html2canvas__default["default"](img).then((canvas) => {
117
- canvas.toBlob((blob) => {
118
- const data = [new ClipboardItem({ [blob.type]: blob })];
119
- clip(data);
120
- }, "image/png");
121
- });
122
- }
123
- };
124
93
  const genTimeLink = async (expiration2, force = true, tip = true) => {
125
94
  emit("changeLoading", true);
126
95
  const data = {
@@ -232,27 +201,8 @@ const _sfc_main = vue.defineComponent({
232
201
  ]),
233
202
  _: 1
234
203
  })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
235
- vue.createVNode(vue.unref(webVue.Button), {
236
- class: "auto",
237
- light: "",
238
- onClick: _cache[2] || (_cache[2] = ($event) => clipUrl("img"))
239
- }, {
240
- default: vue.withCtx(() => [
241
- vue.createTextVNode("\u590D\u5236\u4E8C\u7EF4\u7801")
242
- ]),
243
- _: 1
244
- }),
245
- vue.createVNode(vue.unref(webVue.Button), {
246
- class: "auto",
247
- type: "primary",
248
- light: "",
249
- onClick: _cache[3] || (_cache[3] = ($event) => clipUrl("text"))
250
- }, {
251
- default: vue.withCtx(() => [
252
- vue.createTextVNode(vue.toDisplayString(time.value ? "\u590D\u5236\u9884\u89C8\u5730\u5740" : "\u590D\u5236\u8BBF\u95EE\u5730\u5740"), 1)
253
- ]),
254
- _: 1
255
- })
204
+ vue.createCommentVNode("v-if", true),
205
+ vue.createCommentVNode("v-if", true)
256
206
  ], 64))
257
207
  ])
258
208
  ])
@@ -88,7 +88,6 @@ const _sfc_main = vue.defineComponent({
88
88
  const emit = __emit;
89
89
  const props = __props;
90
90
  const BASE_API = props.BASE_API || config.DEFAULT_BASE_API;
91
- vue.ref(props.cropper || false);
92
91
  const oldData = vue.ref(null);
93
92
  const styleData = vue.ref({});
94
93
  const thumbBannerModel = vue.ref("banner");
@@ -361,10 +360,12 @@ const _sfc_main = vue.defineComponent({
361
360
  key: index,
362
361
  id: `thumb-card-${index}`,
363
362
  data: thumbList.value[index],
363
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
364
364
  "preview-list": previewList.value,
365
365
  "thumb-model": "thumb",
366
+ onUploadLocal: _cache[0] || (_cache[0] = (cb) => _ctx.$emit("upload", cb)),
366
367
  onOpen: ($event) => openDialogMediaSelection($event, index)
367
- }, null, 8, ["id", "data", "preview-list", "onOpen"]);
368
+ }, null, 8, ["id", "data", "onUpdate:data", "preview-list", "onOpen"]);
368
369
  }), 128))
369
370
  ])) : currentModel.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
370
371
  vue.createCommentVNode(" \u5C01\u9762\u56FEcard "),
@@ -374,11 +375,13 @@ const _sfc_main = vue.defineComponent({
374
375
  key: index,
375
376
  id: `thumb-card-${index}`,
376
377
  data: thumbList.value[index],
378
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
377
379
  model: model.value,
378
380
  "preview-list": previewList.value,
379
381
  "thumb-model": "thumb",
382
+ onUploadLocal: _cache[1] || (_cache[1] = (cb) => _ctx.$emit("upload", cb)),
380
383
  onOpen: ($event) => openDialogMediaSelection($event, index)
381
- }, null, 8, ["id", "data", "model", "preview-list", "onOpen"]);
384
+ }, null, 8, ["id", "data", "onUpdate:data", "model", "preview-list", "onOpen"]);
382
385
  }), 128))
383
386
  ])
384
387
  ], 2112)) : vue.createCommentVNode("v-if", true),
@@ -390,7 +393,7 @@ const _sfc_main = vue.defineComponent({
390
393
  vue.createCommentVNode(" \u9009\u62E9\u5927\u56FE\u3001\u4E09\u56FE\u3001\u5355\u56FE...\u7B49\u6A21\u5F0F "),
391
394
  vue.createVNode(vue.unref(webVue.RadioGroup), {
392
395
  modelValue: model.value,
393
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
396
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value = $event),
394
397
  size: "small",
395
398
  type: "button",
396
399
  style: { "margin-top": "10px" },
@@ -428,7 +431,7 @@ const _sfc_main = vue.defineComponent({
428
431
  !_ctx.flex ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Switch), {
429
432
  key: 0,
430
433
  modelValue: hasBanner.value,
431
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => hasBanner.value = $event),
434
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => hasBanner.value = $event),
432
435
  size: "small"
433
436
  }, null, 8, ["modelValue"])) : vue.createCommentVNode("v-if", true)
434
437
  ], 4),
@@ -437,7 +440,7 @@ const _sfc_main = vue.defineComponent({
437
440
  _ctx.flex ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Switch), {
438
441
  key: 0,
439
442
  modelValue: hasBanner.value,
440
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => hasBanner.value = $event),
443
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => hasBanner.value = $event),
441
444
  style: { "margin-bottom": "10px" },
442
445
  size: "small"
443
446
  }, null, 8, ["modelValue"])) : vue.createCommentVNode("v-if", true),
@@ -445,8 +448,10 @@ const _sfc_main = vue.defineComponent({
445
448
  key: 1,
446
449
  id: `banner-card`,
447
450
  data: banner.value,
451
+ "onUpdate:data": _cache[5] || (_cache[5] = ($event) => banner.value = $event),
448
452
  "preview-list": previewList.value,
449
453
  "thumb-model": "banner",
454
+ onUploadLocal: _cache[6] || (_cache[6] = (cb) => _ctx.$emit("upload", cb)),
450
455
  onOpen: openDialogMediaSelection
451
456
  }, null, 8, ["data", "preview-list"])) : vue.createCommentVNode("v-if", true),
452
457
  hasBanner.value && styleData.value.banner_theme_color ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, _hoisted_13)) : vue.createCommentVNode("v-if", true),
@@ -477,8 +482,10 @@ const _sfc_main = vue.defineComponent({
477
482
  vue.createVNode(card, {
478
483
  id: `pc-banner-card`,
479
484
  data: pcBanner.value,
485
+ "onUpdate:data": _cache[7] || (_cache[7] = ($event) => pcBanner.value = $event),
480
486
  previewList: previewList.value,
481
487
  thumbModel: "pcBanner",
488
+ onUploadLocal: _cache[8] || (_cache[8] = (cb) => _ctx.$emit("upload", cb)),
482
489
  onOpen: openDialogMediaSelection
483
490
  }, null, 8, ["data", "previewList"]),
484
491
  _ctx.flex ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_19, "(\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A1242px*662px)")) : vue.createCommentVNode("v-if", true),
@@ -494,18 +501,18 @@ const _sfc_main = vue.defineComponent({
494
501
  ], 64)) : vue.createCommentVNode("v-if", true),
495
502
  vue.createVNode(component, {
496
503
  dialogVisible: dialogMediaSelectionShow.value,
497
- "onUpdate:dialogVisible": _cache[3] || (_cache[3] = ($event) => dialogMediaSelectionShow.value = $event),
504
+ "onUpdate:dialogVisible": _cache[9] || (_cache[9] = ($event) => dialogMediaSelectionShow.value = $event),
498
505
  preview: false,
499
506
  "catalog-props": "image",
500
507
  ai_static_covers: _ctx.aiImages,
501
508
  BASE_API: vue.unref(BASE_API),
502
509
  onSubmit: submitCallback,
503
- onUpload: _cache[4] || (_cache[4] = (cb) => _ctx.$emit("upload", cb))
510
+ onUpload: _cache[10] || (_cache[10] = (cb) => _ctx.$emit("upload", cb))
504
511
  }, null, 8, ["dialogVisible", "ai_static_covers", "BASE_API"]),
505
512
  refreshCrop.value ? (vue.openBlock(), vue.createBlock(component$1, {
506
513
  key: 1,
507
514
  visible: dialogCropperShow.value,
508
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => dialogCropperShow.value = $event),
515
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => dialogCropperShow.value = $event),
509
516
  "aspect-ratio-prop": aspectRatioProp.value,
510
517
  BASE_API: vue.unref(BASE_API),
511
518
  "corp-data": cropperData.value,
@@ -15,9 +15,10 @@ const _sfc_main = vue.defineComponent({
15
15
  previewList: {},
16
16
  thumbModel: {},
17
17
  along: { type: Boolean },
18
- model: {}
18
+ model: {},
19
+ changeThumbModel: { type: Function }
19
20
  },
20
- emits: ["open", "remove"],
21
+ emits: ["open", "remove", "uploadLocal", "update:data"],
21
22
  setup(__props, { emit: __emit }) {
22
23
  const waterBg = `${config.DEFAULT_BASE_API}/static/images/waterBg.png`;
23
24
  const props = __props;
@@ -30,9 +31,24 @@ const _sfc_main = vue.defineComponent({
30
31
  [`model-${props.model}`]: ((_a = props.data) == null ? void 0 : _a.url) && props.model
31
32
  };
32
33
  });
34
+ const btnStyle = vue.computed(() => {
35
+ return {
36
+ padding: "5px 10px",
37
+ cursor: "pointer"
38
+ };
39
+ });
33
40
  const clickMask = () => {
34
41
  props.along && openDialogMediaSelection();
35
42
  };
43
+ const loaclUpload = () => {
44
+ emit("uploadLocal", (file) => {
45
+ const { data } = props;
46
+ if (!data || !file)
47
+ return;
48
+ data.url = file.url;
49
+ emit("update:data", data);
50
+ });
51
+ };
36
52
  const openDialogMediaSelection = () => {
37
53
  emit("open", props.thumbModel);
38
54
  };
@@ -40,48 +56,67 @@ const _sfc_main = vue.defineComponent({
40
56
  emit("remove");
41
57
  };
42
58
  return (_ctx, _cache) => {
43
- var _a, _b;
44
- return vue.openBlock(), vue.createElementBlock("div", {
45
- class: vue.normalizeClass(["thumb-card-container", classObj.value])
46
- }, [
47
- ((_a = props.data) == null ? void 0 : _a.url) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
48
- vue.createVNode(vue.unref(webVue.Image), {
49
- class: "item",
50
- fit: "cover",
51
- src: (_b = props.data) == null ? void 0 : _b.url
52
- }, null, 8, ["src"]),
53
- vue.createVNode(vue.Transition, { name: "fade" }, {
54
- default: vue.withCtx(() => [
55
- vue.createElementVNode("div", {
56
- class: "mask",
57
- onClick: clickMask
59
+ return vue.openBlock(), vue.createBlock(vue.unref(webVue.Popover), {
60
+ trigger: "hover",
61
+ "content-style": "padding: 0;"
62
+ }, {
63
+ content: vue.withCtx(() => [
64
+ vue.createElementVNode("div", {
65
+ style: vue.normalizeStyle(btnStyle.value),
66
+ onClick: openDialogMediaSelection
67
+ }, "\u7D20\u6750\u5E93\u9009\u62E9", 4),
68
+ vue.createElementVNode("div", {
69
+ style: vue.normalizeStyle(btnStyle.value),
70
+ onClick: loaclUpload
71
+ }, "\u672C\u5730\u4E0A\u4F20", 4)
72
+ ]),
73
+ default: vue.withCtx(() => {
74
+ var _a, _b;
75
+ return [
76
+ vue.createElementVNode("div", {
77
+ class: vue.normalizeClass(["thumb-card-container", classObj.value])
78
+ }, [
79
+ ((_a = props.data) == null ? void 0 : _a.url) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
80
+ vue.createVNode(vue.unref(webVue.Image), {
81
+ class: "item",
82
+ fit: "cover",
83
+ src: (_b = props.data) == null ? void 0 : _b.url
84
+ }, null, 8, ["src"]),
85
+ vue.createVNode(vue.Transition, { name: "fade" }, {
86
+ default: vue.withCtx(() => [
87
+ vue.createElementVNode("div", {
88
+ class: "mask",
89
+ onClick: clickMask
90
+ }, [
91
+ vue.createElementVNode("span", {
92
+ class: "half",
93
+ onClick: vue.withModifiers(openDialogMediaSelection, ["stop"])
94
+ }, [
95
+ vue.createVNode(vue.unref(icon.IconEdit))
96
+ ]),
97
+ _ctx.along ? (vue.openBlock(), vue.createElementBlock("span", {
98
+ key: 0,
99
+ class: "half",
100
+ onClick: vue.withModifiers(remove, ["stop"])
101
+ }, [
102
+ vue.createVNode(vue.unref(icon.IconDelete))
103
+ ])) : vue.createCommentVNode("v-if", true)
104
+ ])
105
+ ]),
106
+ _: 1
107
+ })
108
+ ])) : (vue.openBlock(), vue.createElementBlock("div", {
109
+ key: 1,
110
+ class: "item add-thumb",
111
+ style: vue.normalizeStyle({ backgroundImage: `url(${waterBg})` })
58
112
  }, [
59
- vue.createElementVNode("span", {
60
- class: "half",
61
- onClick: vue.withModifiers(openDialogMediaSelection, ["stop"])
62
- }, [
63
- vue.createVNode(vue.unref(icon.IconEdit))
64
- ]),
65
- _ctx.along ? (vue.openBlock(), vue.createElementBlock("span", {
66
- key: 0,
67
- class: "half",
68
- onClick: vue.withModifiers(remove, ["stop"])
69
- }, [
70
- vue.createVNode(vue.unref(icon.IconDelete))
71
- ])) : vue.createCommentVNode("v-if", true)
72
- ])
73
- ]),
74
- _: 1
75
- })
76
- ])) : (vue.openBlock(), vue.createElementBlock("div", {
77
- key: 1,
78
- class: "item add-thumb",
79
- style: vue.normalizeStyle({ backgroundImage: `url(${waterBg})` }),
80
- onClick: vue.withModifiers(openDialogMediaSelection, ["stop"])
81
- }, [
82
- vue.createVNode(vue.unref(icon.IconPlus))
83
- ], 4))
84
- ], 2);
113
+ vue.createVNode(vue.unref(icon.IconPlus))
114
+ ], 4))
115
+ ], 2)
116
+ ];
117
+ }),
118
+ _: 1
119
+ });
85
120
  };
86
121
  }
87
122
  });
@@ -1 +1 @@
1
- // Global Style
1
+ // Global Style
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmstops/pro-compo",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",