@cmstops/pro-compo 0.3.8 → 0.3.10

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.
@@ -118,11 +118,11 @@ const _sfc_main = defineComponent({
118
118
  ]),
119
119
  createElementVNode("div", _hoisted_4, [
120
120
  createElementVNode("div", _hoisted_5, [
121
+ renderSlot(_ctx.$slots, "index"),
121
122
  createVNode(_sfc_main$1, {
122
123
  item: _ctx.item,
123
124
  BASE_API: _ctx.BASE_API
124
125
  }, null, 8, ["item", "BASE_API"]),
125
- renderSlot(_ctx.$slots, "index"),
126
126
  createElementVNode("span", {
127
127
  class: "text",
128
128
  onClick: clickTitle
@@ -1,7 +1,6 @@
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";
5
4
  import QRCode from "qrcodejs2-fix";
6
5
  import { getSpaceDate } from "../../../../utils/date.js";
7
6
  import { generateDocPreviewLink } from "../../../script/api.js";
@@ -86,33 +85,59 @@ const _sfc_main = defineComponent({
86
85
  return flag;
87
86
  });
88
87
  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
- );
88
+ try {
89
+ const input = document.createElement("input");
90
+ input.setAttribute("value", data);
91
+ document.body.appendChild(input);
92
+ input.select();
93
+ document.execCommand("copy");
94
+ document.body.removeChild(input);
95
+ Message.success({
96
+ content: "\u5DF2\u4FDD\u5B58\u5230\u7C98\u8D34\u677F"
97
+ });
98
+ } catch (e) {
99
+ console.log(e);
100
+ Message.success({
101
+ content: `\u4FDD\u5B58\u5931\u8D25`
102
+ });
103
+ }
102
104
  };
103
- const clipUrl = (type) => {
105
+ const clipUrl = async (type) => {
104
106
  if (!dataInfo.value.share.share_url)
105
107
  return;
106
108
  if (type === "text") {
107
109
  clip(dataInfo.value.share.share_url);
108
110
  } else {
109
111
  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
- });
112
+ if (!img)
113
+ return;
114
+ const response = await fetch(img.src);
115
+ const blob = await response.blob();
116
+ if (!blob)
117
+ return;
118
+ try {
119
+ if (window.__POWERED_BY_WUJIE__) {
120
+ await window.parent.navigator.clipboard.write([
121
+ new ClipboardItem({
122
+ "image/png": blob
123
+ })
124
+ ]);
125
+ } else {
126
+ await navigator.clipboard.write([
127
+ new ClipboardItem({
128
+ "image/png": blob
129
+ })
130
+ ]);
131
+ }
132
+ Message.success({
133
+ content: "\u5DF2\u4FDD\u5B58\u5230\u7C98\u8D34\u677F"
134
+ });
135
+ } catch (e) {
136
+ console.log(e);
137
+ Message.success({
138
+ content: `\u4FDD\u5B58\u5931\u8D25`
139
+ });
140
+ }
116
141
  }
117
142
  };
118
143
  const genTimeLink = async (expiration2, force = true, tip = true) => {
@@ -201,11 +226,11 @@ const _sfc_main = defineComponent({
201
226
  placeholder: "\u8BF7\u9009\u62E9"
202
227
  }, {
203
228
  default: withCtx(() => [
204
- (openBlock(true), createElementBlock(Fragment, null, renderList(expirationOptions.value, (time2, index) => {
229
+ (openBlock(true), createElementBlock(Fragment, null, renderList(expirationOptions.value, (t, index) => {
205
230
  return openBlock(), createBlock(unref(Option), {
206
231
  key: index,
207
- label: time2.label,
208
- value: time2.value
232
+ label: t.label,
233
+ value: t.value
209
234
  }, null, 8, ["label", "value"]);
210
235
  }), 128))
211
236
  ]),
@@ -213,7 +238,7 @@ const _sfc_main = defineComponent({
213
238
  }, 8, ["modelValue"])
214
239
  ])
215
240
  ])),
216
- is_share.value && time.value ? (openBlock(), createElementBlock("div", _hoisted_10, "\u94FE\u63A5\u5269\u4F59\u65F6\u95F4: " + toDisplayString(time.value), 1)) : is_share.value && time.value === 0 ? (openBlock(), createElementBlock("div", _hoisted_11, "\u94FE\u63A5\u5DF2\u8FC7\u671F")) : createCommentVNode("v-if", true),
241
+ is_share.value && time.value ? (openBlock(), createElementBlock("div", _hoisted_10, " \u94FE\u63A5\u5269\u4F59\u65F6\u95F4: " + toDisplayString(time.value), 1)) : is_share.value && time.value === 0 ? (openBlock(), createElementBlock("div", _hoisted_11, "\u94FE\u63A5\u5DF2\u8FC7\u671F")) : createCommentVNode("v-if", true),
217
242
  createElementVNode("div", _hoisted_12, [
218
243
  showGetLink.value ? (openBlock(), createBlock(unref(Button), {
219
244
  key: 0,
@@ -222,7 +247,7 @@ const _sfc_main = defineComponent({
222
247
  onClick: _cache[1] || (_cache[1] = ($event) => genTimeLink(expiration.value))
223
248
  }, {
224
249
  default: withCtx(() => [
225
- createTextVNode("\u751F\u6210\u9884\u89C8\u94FE\u63A5")
250
+ createTextVNode(" \u751F\u6210\u9884\u89C8\u94FE\u63A5 ")
226
251
  ]),
227
252
  _: 1
228
253
  })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
@@ -232,7 +257,7 @@ const _sfc_main = defineComponent({
232
257
  onClick: _cache[2] || (_cache[2] = ($event) => clipUrl("img"))
233
258
  }, {
234
259
  default: withCtx(() => [
235
- createTextVNode("\u590D\u5236\u4E8C\u7EF4\u7801")
260
+ createTextVNode(" \u590D\u5236\u4E8C\u7EF4\u7801 ")
236
261
  ]),
237
262
  _: 1
238
263
  }),
@@ -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");
@@ -219,9 +218,14 @@ const _sfc_main = defineComponent({
219
218
  }
220
219
  return modelList.value.find((item) => item.value === model.value);
221
220
  });
222
- const thumbList = computed(() => {
223
- var _a;
224
- return ((_a = styleData.value) == null ? void 0 : _a.data) || [];
221
+ const thumbList = computed({
222
+ get() {
223
+ var _a;
224
+ return ((_a = styleData.value) == null ? void 0 : _a.data) || [];
225
+ },
226
+ set(value) {
227
+ styleData.value.data = value || [];
228
+ }
225
229
  });
226
230
  const previewList = computed(() => {
227
231
  return thumbList.value.map((item) => item.url);
@@ -315,9 +319,14 @@ const _sfc_main = defineComponent({
315
319
  }
316
320
  callback(styleData.value);
317
321
  };
318
- const banner = computed(() => {
319
- const { banner: banner2, banner_theme_color, banner_url } = styleData.value;
320
- return { banner: banner2, banner_theme_color, url: banner_url };
322
+ const banner = computed({
323
+ get() {
324
+ const { banner: banner2, banner_theme_color, banner_url } = styleData.value;
325
+ return { banner: banner2, banner_theme_color, url: banner_url };
326
+ },
327
+ set(value) {
328
+ styleData.value.banner_url = value.url;
329
+ }
321
330
  });
322
331
  const hasBanner = computed({
323
332
  get() {
@@ -329,9 +338,14 @@ const _sfc_main = defineComponent({
329
338
  callback(styleData.value);
330
339
  }
331
340
  });
332
- const pcBanner = computed(() => {
333
- const { pc_banner_url_info, pc_banner_url } = styleData.value;
334
- return { pc_banner_url_info, url: pc_banner_url };
341
+ const pcBanner = computed({
342
+ get() {
343
+ const { pc_banner_url_info, pc_banner_url } = styleData.value;
344
+ return { pc_banner_url_info, url: pc_banner_url };
345
+ },
346
+ set(value) {
347
+ styleData.value.pc_banner_url = value.url;
348
+ }
335
349
  });
336
350
  const colorChange = (styleData2) => {
337
351
  callback(styleData2);
@@ -360,10 +374,12 @@ const _sfc_main = defineComponent({
360
374
  key: index,
361
375
  id: `thumb-card-${index}`,
362
376
  data: thumbList.value[index],
377
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
363
378
  "preview-list": previewList.value,
364
379
  "thumb-model": "thumb",
380
+ onUploadLocal: _cache[0] || (_cache[0] = (cb) => _ctx.$emit("upload", cb)),
365
381
  onOpen: ($event) => openDialogMediaSelection($event, index)
366
- }, null, 8, ["id", "data", "preview-list", "onOpen"]);
382
+ }, null, 8, ["id", "data", "onUpdate:data", "preview-list", "onOpen"]);
367
383
  }), 128))
368
384
  ])) : currentModel.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
369
385
  createCommentVNode(" \u5C01\u9762\u56FEcard "),
@@ -373,11 +389,13 @@ const _sfc_main = defineComponent({
373
389
  key: index,
374
390
  id: `thumb-card-${index}`,
375
391
  data: thumbList.value[index],
392
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
376
393
  model: model.value,
377
394
  "preview-list": previewList.value,
378
395
  "thumb-model": "thumb",
396
+ onUploadLocal: _cache[1] || (_cache[1] = (cb) => _ctx.$emit("upload", cb)),
379
397
  onOpen: ($event) => openDialogMediaSelection($event, index)
380
- }, null, 8, ["id", "data", "model", "preview-list", "onOpen"]);
398
+ }, null, 8, ["id", "data", "onUpdate:data", "model", "preview-list", "onOpen"]);
381
399
  }), 128))
382
400
  ])
383
401
  ], 2112)) : createCommentVNode("v-if", true),
@@ -389,7 +407,7 @@ const _sfc_main = defineComponent({
389
407
  createCommentVNode(" \u9009\u62E9\u5927\u56FE\u3001\u4E09\u56FE\u3001\u5355\u56FE...\u7B49\u6A21\u5F0F "),
390
408
  createVNode(unref(RadioGroup), {
391
409
  modelValue: model.value,
392
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
410
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value = $event),
393
411
  size: "small",
394
412
  type: "button",
395
413
  style: { "margin-top": "10px" },
@@ -427,7 +445,7 @@ const _sfc_main = defineComponent({
427
445
  !_ctx.flex ? (openBlock(), createBlock(unref(Switch), {
428
446
  key: 0,
429
447
  modelValue: hasBanner.value,
430
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => hasBanner.value = $event),
448
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => hasBanner.value = $event),
431
449
  size: "small"
432
450
  }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true)
433
451
  ], 4),
@@ -436,7 +454,7 @@ const _sfc_main = defineComponent({
436
454
  _ctx.flex ? (openBlock(), createBlock(unref(Switch), {
437
455
  key: 0,
438
456
  modelValue: hasBanner.value,
439
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => hasBanner.value = $event),
457
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => hasBanner.value = $event),
440
458
  style: { "margin-bottom": "10px" },
441
459
  size: "small"
442
460
  }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true),
@@ -444,8 +462,10 @@ const _sfc_main = defineComponent({
444
462
  key: 1,
445
463
  id: `banner-card`,
446
464
  data: banner.value,
465
+ "onUpdate:data": _cache[5] || (_cache[5] = ($event) => banner.value = $event),
447
466
  "preview-list": previewList.value,
448
467
  "thumb-model": "banner",
468
+ onUploadLocal: _cache[6] || (_cache[6] = (cb) => _ctx.$emit("upload", cb)),
449
469
  onOpen: openDialogMediaSelection
450
470
  }, null, 8, ["data", "preview-list"])) : createCommentVNode("v-if", true),
451
471
  hasBanner.value && styleData.value.banner_theme_color ? (openBlock(), createElementBlock("div", _hoisted_11, _hoisted_13)) : createCommentVNode("v-if", true),
@@ -476,8 +496,10 @@ const _sfc_main = defineComponent({
476
496
  createVNode(_sfc_main$1, {
477
497
  id: `pc-banner-card`,
478
498
  data: pcBanner.value,
499
+ "onUpdate:data": _cache[7] || (_cache[7] = ($event) => pcBanner.value = $event),
479
500
  previewList: previewList.value,
480
501
  thumbModel: "pcBanner",
502
+ onUploadLocal: _cache[8] || (_cache[8] = (cb) => _ctx.$emit("upload", cb)),
481
503
  onOpen: openDialogMediaSelection
482
504
  }, null, 8, ["data", "previewList"]),
483
505
  _ctx.flex ? (openBlock(), createElementBlock("span", _hoisted_19, "(\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A1242px*662px)")) : createCommentVNode("v-if", true),
@@ -493,18 +515,18 @@ const _sfc_main = defineComponent({
493
515
  ], 64)) : createCommentVNode("v-if", true),
494
516
  createVNode(_sfc_main$3, {
495
517
  dialogVisible: dialogMediaSelectionShow.value,
496
- "onUpdate:dialogVisible": _cache[3] || (_cache[3] = ($event) => dialogMediaSelectionShow.value = $event),
518
+ "onUpdate:dialogVisible": _cache[9] || (_cache[9] = ($event) => dialogMediaSelectionShow.value = $event),
497
519
  preview: false,
498
520
  "catalog-props": "image",
499
521
  ai_static_covers: _ctx.aiImages,
500
522
  BASE_API: unref(BASE_API),
501
523
  onSubmit: submitCallback,
502
- onUpload: _cache[4] || (_cache[4] = (cb) => _ctx.$emit("upload", cb))
524
+ onUpload: _cache[10] || (_cache[10] = (cb) => _ctx.$emit("upload", cb))
503
525
  }, null, 8, ["dialogVisible", "ai_static_covers", "BASE_API"]),
504
526
  refreshCrop.value ? (openBlock(), createBlock(_sfc_main$4, {
505
527
  key: 1,
506
528
  visible: dialogCropperShow.value,
507
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => dialogCropperShow.value = $event),
529
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => dialogCropperShow.value = $event),
508
530
  "aspect-ratio-prop": aspectRatioProp.value,
509
531
  BASE_API: unref(BASE_API),
510
532
  "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,16 @@ 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: [
21
+ "open",
22
+ "remove",
23
+ "change",
24
+ "uploadLocal",
25
+ "update:data"
26
+ ],
20
27
  setup(__props, { emit: __emit }) {
21
28
  const waterBg = `${DEFAULT_BASE_API}/static/images/waterBg.png`;
22
29
  const props = __props;
@@ -29,9 +36,27 @@ const _sfc_main = defineComponent({
29
36
  [`model-${props.model}`]: ((_a = props.data) == null ? void 0 : _a.url) && props.model
30
37
  };
31
38
  });
39
+ const btnStyle = computed(() => {
40
+ return {
41
+ padding: "5px 10px",
42
+ cursor: "pointer"
43
+ };
44
+ });
32
45
  const clickMask = () => {
33
46
  props.along && openDialogMediaSelection();
34
47
  };
48
+ const loaclUpload = () => {
49
+ emit("uploadLocal", (file) => {
50
+ let { data } = props;
51
+ if (!file)
52
+ return;
53
+ if (!data) {
54
+ data = {};
55
+ }
56
+ data.url = file.url;
57
+ emit("update:data", data);
58
+ });
59
+ };
35
60
  const openDialogMediaSelection = () => {
36
61
  emit("open", props.thumbModel);
37
62
  };
@@ -39,48 +64,68 @@ const _sfc_main = defineComponent({
39
64
  emit("remove");
40
65
  };
41
66
  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
67
+ return openBlock(), createBlock(unref(Popover), {
68
+ trigger: "hover",
69
+ "content-style": { padding: 0 }
70
+ }, {
71
+ content: withCtx(() => [
72
+ createElementVNode("div", {
73
+ style: normalizeStyle(btnStyle.value),
74
+ onClick: openDialogMediaSelection
75
+ }, "\u7D20\u6750\u5E93\u9009\u62E9", 4),
76
+ createElementVNode("div", {
77
+ style: normalizeStyle(btnStyle.value),
78
+ onClick: loaclUpload
79
+ }, "\u672C\u5730\u4E0A\u4F20", 4)
80
+ ]),
81
+ default: withCtx(() => {
82
+ var _a;
83
+ return [
84
+ createElementVNode("div", {
85
+ class: normalizeClass(["thumb-card-container", classObj.value])
86
+ }, [
87
+ ((_a = props.data) == null ? void 0 : _a.url) ? (openBlock(), createElementBlock("div", _hoisted_1, [
88
+ createVNode(unref(Image), {
89
+ class: "item",
90
+ fit: "cover",
91
+ src: props.data.url,
92
+ "show-loader": ""
93
+ }, null, 8, ["src"]),
94
+ createVNode(Transition, { name: "fade" }, {
95
+ default: withCtx(() => [
96
+ createElementVNode("div", {
97
+ class: "mask",
98
+ onClick: clickMask
99
+ }, [
100
+ createElementVNode("span", {
101
+ class: "half",
102
+ onClick: withModifiers(openDialogMediaSelection, ["stop"])
103
+ }, [
104
+ createVNode(unref(IconEdit))
105
+ ]),
106
+ _ctx.along ? (openBlock(), createElementBlock("span", {
107
+ key: 0,
108
+ class: "half",
109
+ onClick: withModifiers(remove, ["stop"])
110
+ }, [
111
+ createVNode(unref(IconDelete))
112
+ ])) : createCommentVNode("v-if", true)
113
+ ])
114
+ ]),
115
+ _: 1
116
+ })
117
+ ])) : (openBlock(), createElementBlock("div", {
118
+ key: 1,
119
+ class: "item add-thumb",
120
+ style: normalizeStyle({ backgroundImage: `url(${waterBg})` })
57
121
  }, [
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);
122
+ createVNode(unref(IconPlus))
123
+ ], 4))
124
+ ], 2)
125
+ ];
126
+ }),
127
+ _: 1
128
+ });
84
129
  };
85
130
  }
86
131
  });
@@ -1 +1 @@
1
- // Global Style
1
+ // Global Style
@@ -119,11 +119,11 @@ const _sfc_main = vue.defineComponent({
119
119
  ]),
120
120
  vue.createElementVNode("div", _hoisted_4, [
121
121
  vue.createElementVNode("div", _hoisted_5, [
122
+ vue.renderSlot(_ctx.$slots, "index"),
122
123
  vue.createVNode(index$1, {
123
124
  item: _ctx.item,
124
125
  BASE_API: _ctx.BASE_API
125
126
  }, null, 8, ["item", "BASE_API"]),
126
- vue.renderSlot(_ctx.$slots, "index"),
127
127
  vue.createElementVNode("span", {
128
128
  class: "text",
129
129
  onClick: clickTitle
@@ -2,14 +2,12 @@
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");
6
5
  var QRCode = require("qrcodejs2-fix");
7
6
  var date = require("../../../../utils/date.js");
8
7
  var api = require("../../../script/api.js");
9
8
  function _interopDefaultLegacy(e) {
10
9
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
11
10
  }
12
- var html2canvas__default = /* @__PURE__ */ _interopDefaultLegacy(html2canvas);
13
11
  var QRCode__default = /* @__PURE__ */ _interopDefaultLegacy(QRCode);
14
12
  const _hoisted_1 = { class: "preview-qrcode-iframe-container-v" };
15
13
  const _hoisted_2 = { class: "doc-qrcode-preview-container-v" };
@@ -92,33 +90,59 @@ const _sfc_main = vue.defineComponent({
92
90
  return flag;
93
91
  });
94
92
  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
- );
93
+ try {
94
+ const input = document.createElement("input");
95
+ input.setAttribute("value", data);
96
+ document.body.appendChild(input);
97
+ input.select();
98
+ document.execCommand("copy");
99
+ document.body.removeChild(input);
100
+ webVue.Message.success({
101
+ content: "\u5DF2\u4FDD\u5B58\u5230\u7C98\u8D34\u677F"
102
+ });
103
+ } catch (e) {
104
+ console.log(e);
105
+ webVue.Message.success({
106
+ content: `\u4FDD\u5B58\u5931\u8D25`
107
+ });
108
+ }
108
109
  };
109
- const clipUrl = (type) => {
110
+ const clipUrl = async (type) => {
110
111
  if (!dataInfo.value.share.share_url)
111
112
  return;
112
113
  if (type === "text") {
113
114
  clip(dataInfo.value.share.share_url);
114
115
  } else {
115
116
  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
- });
117
+ if (!img)
118
+ return;
119
+ const response = await fetch(img.src);
120
+ const blob = await response.blob();
121
+ if (!blob)
122
+ return;
123
+ try {
124
+ if (window.__POWERED_BY_WUJIE__) {
125
+ await window.parent.navigator.clipboard.write([
126
+ new ClipboardItem({
127
+ "image/png": blob
128
+ })
129
+ ]);
130
+ } else {
131
+ await navigator.clipboard.write([
132
+ new ClipboardItem({
133
+ "image/png": blob
134
+ })
135
+ ]);
136
+ }
137
+ webVue.Message.success({
138
+ content: "\u5DF2\u4FDD\u5B58\u5230\u7C98\u8D34\u677F"
139
+ });
140
+ } catch (e) {
141
+ console.log(e);
142
+ webVue.Message.success({
143
+ content: `\u4FDD\u5B58\u5931\u8D25`
144
+ });
145
+ }
122
146
  }
123
147
  };
124
148
  const genTimeLink = async (expiration2, force = true, tip = true) => {
@@ -207,11 +231,11 @@ const _sfc_main = vue.defineComponent({
207
231
  placeholder: "\u8BF7\u9009\u62E9"
208
232
  }, {
209
233
  default: vue.withCtx(() => [
210
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(expirationOptions.value, (time2, index) => {
234
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(expirationOptions.value, (t, index) => {
211
235
  return vue.openBlock(), vue.createBlock(vue.unref(webVue.Option), {
212
236
  key: index,
213
- label: time2.label,
214
- value: time2.value
237
+ label: t.label,
238
+ value: t.value
215
239
  }, null, 8, ["label", "value"]);
216
240
  }), 128))
217
241
  ]),
@@ -219,7 +243,7 @@ const _sfc_main = vue.defineComponent({
219
243
  }, 8, ["modelValue"])
220
244
  ])
221
245
  ])),
222
- is_share.value && time.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, "\u94FE\u63A5\u5269\u4F59\u65F6\u95F4: " + vue.toDisplayString(time.value), 1)) : is_share.value && time.value === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, "\u94FE\u63A5\u5DF2\u8FC7\u671F")) : vue.createCommentVNode("v-if", true),
246
+ is_share.value && time.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, " \u94FE\u63A5\u5269\u4F59\u65F6\u95F4: " + vue.toDisplayString(time.value), 1)) : is_share.value && time.value === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, "\u94FE\u63A5\u5DF2\u8FC7\u671F")) : vue.createCommentVNode("v-if", true),
223
247
  vue.createElementVNode("div", _hoisted_12, [
224
248
  showGetLink.value ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Button), {
225
249
  key: 0,
@@ -228,7 +252,7 @@ const _sfc_main = vue.defineComponent({
228
252
  onClick: _cache[1] || (_cache[1] = ($event) => genTimeLink(expiration.value))
229
253
  }, {
230
254
  default: vue.withCtx(() => [
231
- vue.createTextVNode("\u751F\u6210\u9884\u89C8\u94FE\u63A5")
255
+ vue.createTextVNode(" \u751F\u6210\u9884\u89C8\u94FE\u63A5 ")
232
256
  ]),
233
257
  _: 1
234
258
  })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
@@ -238,7 +262,7 @@ const _sfc_main = vue.defineComponent({
238
262
  onClick: _cache[2] || (_cache[2] = ($event) => clipUrl("img"))
239
263
  }, {
240
264
  default: vue.withCtx(() => [
241
- vue.createTextVNode("\u590D\u5236\u4E8C\u7EF4\u7801")
265
+ vue.createTextVNode(" \u590D\u5236\u4E8C\u7EF4\u7801 ")
242
266
  ]),
243
267
  _: 1
244
268
  }),
@@ -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");
@@ -220,9 +219,14 @@ const _sfc_main = vue.defineComponent({
220
219
  }
221
220
  return modelList.value.find((item) => item.value === model.value);
222
221
  });
223
- const thumbList = vue.computed(() => {
224
- var _a;
225
- return ((_a = styleData.value) == null ? void 0 : _a.data) || [];
222
+ const thumbList = vue.computed({
223
+ get() {
224
+ var _a;
225
+ return ((_a = styleData.value) == null ? void 0 : _a.data) || [];
226
+ },
227
+ set(value) {
228
+ styleData.value.data = value || [];
229
+ }
226
230
  });
227
231
  const previewList = vue.computed(() => {
228
232
  return thumbList.value.map((item) => item.url);
@@ -316,9 +320,14 @@ const _sfc_main = vue.defineComponent({
316
320
  }
317
321
  callback(styleData.value);
318
322
  };
319
- const banner = vue.computed(() => {
320
- const { banner: banner2, banner_theme_color, banner_url } = styleData.value;
321
- return { banner: banner2, banner_theme_color, url: banner_url };
323
+ const banner = vue.computed({
324
+ get() {
325
+ const { banner: banner2, banner_theme_color, banner_url } = styleData.value;
326
+ return { banner: banner2, banner_theme_color, url: banner_url };
327
+ },
328
+ set(value) {
329
+ styleData.value.banner_url = value.url;
330
+ }
322
331
  });
323
332
  const hasBanner = vue.computed({
324
333
  get() {
@@ -330,9 +339,14 @@ const _sfc_main = vue.defineComponent({
330
339
  callback(styleData.value);
331
340
  }
332
341
  });
333
- const pcBanner = vue.computed(() => {
334
- const { pc_banner_url_info, pc_banner_url } = styleData.value;
335
- return { pc_banner_url_info, url: pc_banner_url };
342
+ const pcBanner = vue.computed({
343
+ get() {
344
+ const { pc_banner_url_info, pc_banner_url } = styleData.value;
345
+ return { pc_banner_url_info, url: pc_banner_url };
346
+ },
347
+ set(value) {
348
+ styleData.value.pc_banner_url = value.url;
349
+ }
336
350
  });
337
351
  const colorChange = (styleData2) => {
338
352
  callback(styleData2);
@@ -361,10 +375,12 @@ const _sfc_main = vue.defineComponent({
361
375
  key: index,
362
376
  id: `thumb-card-${index}`,
363
377
  data: thumbList.value[index],
378
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
364
379
  "preview-list": previewList.value,
365
380
  "thumb-model": "thumb",
381
+ onUploadLocal: _cache[0] || (_cache[0] = (cb) => _ctx.$emit("upload", cb)),
366
382
  onOpen: ($event) => openDialogMediaSelection($event, index)
367
- }, null, 8, ["id", "data", "preview-list", "onOpen"]);
383
+ }, null, 8, ["id", "data", "onUpdate:data", "preview-list", "onOpen"]);
368
384
  }), 128))
369
385
  ])) : currentModel.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
370
386
  vue.createCommentVNode(" \u5C01\u9762\u56FEcard "),
@@ -374,11 +390,13 @@ const _sfc_main = vue.defineComponent({
374
390
  key: index,
375
391
  id: `thumb-card-${index}`,
376
392
  data: thumbList.value[index],
393
+ "onUpdate:data": ($event) => thumbList.value[index] = $event,
377
394
  model: model.value,
378
395
  "preview-list": previewList.value,
379
396
  "thumb-model": "thumb",
397
+ onUploadLocal: _cache[1] || (_cache[1] = (cb) => _ctx.$emit("upload", cb)),
380
398
  onOpen: ($event) => openDialogMediaSelection($event, index)
381
- }, null, 8, ["id", "data", "model", "preview-list", "onOpen"]);
399
+ }, null, 8, ["id", "data", "onUpdate:data", "model", "preview-list", "onOpen"]);
382
400
  }), 128))
383
401
  ])
384
402
  ], 2112)) : vue.createCommentVNode("v-if", true),
@@ -390,7 +408,7 @@ const _sfc_main = vue.defineComponent({
390
408
  vue.createCommentVNode(" \u9009\u62E9\u5927\u56FE\u3001\u4E09\u56FE\u3001\u5355\u56FE...\u7B49\u6A21\u5F0F "),
391
409
  vue.createVNode(vue.unref(webVue.RadioGroup), {
392
410
  modelValue: model.value,
393
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
411
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value = $event),
394
412
  size: "small",
395
413
  type: "button",
396
414
  style: { "margin-top": "10px" },
@@ -428,7 +446,7 @@ const _sfc_main = vue.defineComponent({
428
446
  !_ctx.flex ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Switch), {
429
447
  key: 0,
430
448
  modelValue: hasBanner.value,
431
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => hasBanner.value = $event),
449
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => hasBanner.value = $event),
432
450
  size: "small"
433
451
  }, null, 8, ["modelValue"])) : vue.createCommentVNode("v-if", true)
434
452
  ], 4),
@@ -437,7 +455,7 @@ const _sfc_main = vue.defineComponent({
437
455
  _ctx.flex ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Switch), {
438
456
  key: 0,
439
457
  modelValue: hasBanner.value,
440
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => hasBanner.value = $event),
458
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => hasBanner.value = $event),
441
459
  style: { "margin-bottom": "10px" },
442
460
  size: "small"
443
461
  }, null, 8, ["modelValue"])) : vue.createCommentVNode("v-if", true),
@@ -445,8 +463,10 @@ const _sfc_main = vue.defineComponent({
445
463
  key: 1,
446
464
  id: `banner-card`,
447
465
  data: banner.value,
466
+ "onUpdate:data": _cache[5] || (_cache[5] = ($event) => banner.value = $event),
448
467
  "preview-list": previewList.value,
449
468
  "thumb-model": "banner",
469
+ onUploadLocal: _cache[6] || (_cache[6] = (cb) => _ctx.$emit("upload", cb)),
450
470
  onOpen: openDialogMediaSelection
451
471
  }, null, 8, ["data", "preview-list"])) : vue.createCommentVNode("v-if", true),
452
472
  hasBanner.value && styleData.value.banner_theme_color ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, _hoisted_13)) : vue.createCommentVNode("v-if", true),
@@ -477,8 +497,10 @@ const _sfc_main = vue.defineComponent({
477
497
  vue.createVNode(card, {
478
498
  id: `pc-banner-card`,
479
499
  data: pcBanner.value,
500
+ "onUpdate:data": _cache[7] || (_cache[7] = ($event) => pcBanner.value = $event),
480
501
  previewList: previewList.value,
481
502
  thumbModel: "pcBanner",
503
+ onUploadLocal: _cache[8] || (_cache[8] = (cb) => _ctx.$emit("upload", cb)),
482
504
  onOpen: openDialogMediaSelection
483
505
  }, null, 8, ["data", "previewList"]),
484
506
  _ctx.flex ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_19, "(\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A1242px*662px)")) : vue.createCommentVNode("v-if", true),
@@ -494,18 +516,18 @@ const _sfc_main = vue.defineComponent({
494
516
  ], 64)) : vue.createCommentVNode("v-if", true),
495
517
  vue.createVNode(component, {
496
518
  dialogVisible: dialogMediaSelectionShow.value,
497
- "onUpdate:dialogVisible": _cache[3] || (_cache[3] = ($event) => dialogMediaSelectionShow.value = $event),
519
+ "onUpdate:dialogVisible": _cache[9] || (_cache[9] = ($event) => dialogMediaSelectionShow.value = $event),
498
520
  preview: false,
499
521
  "catalog-props": "image",
500
522
  ai_static_covers: _ctx.aiImages,
501
523
  BASE_API: vue.unref(BASE_API),
502
524
  onSubmit: submitCallback,
503
- onUpload: _cache[4] || (_cache[4] = (cb) => _ctx.$emit("upload", cb))
525
+ onUpload: _cache[10] || (_cache[10] = (cb) => _ctx.$emit("upload", cb))
504
526
  }, null, 8, ["dialogVisible", "ai_static_covers", "BASE_API"]),
505
527
  refreshCrop.value ? (vue.openBlock(), vue.createBlock(component$1, {
506
528
  key: 1,
507
529
  visible: dialogCropperShow.value,
508
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => dialogCropperShow.value = $event),
530
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => dialogCropperShow.value = $event),
509
531
  "aspect-ratio-prop": aspectRatioProp.value,
510
532
  BASE_API: vue.unref(BASE_API),
511
533
  "corp-data": cropperData.value,
@@ -15,9 +15,16 @@ 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: [
22
+ "open",
23
+ "remove",
24
+ "change",
25
+ "uploadLocal",
26
+ "update:data"
27
+ ],
21
28
  setup(__props, { emit: __emit }) {
22
29
  const waterBg = `${config.DEFAULT_BASE_API}/static/images/waterBg.png`;
23
30
  const props = __props;
@@ -30,9 +37,27 @@ const _sfc_main = vue.defineComponent({
30
37
  [`model-${props.model}`]: ((_a = props.data) == null ? void 0 : _a.url) && props.model
31
38
  };
32
39
  });
40
+ const btnStyle = vue.computed(() => {
41
+ return {
42
+ padding: "5px 10px",
43
+ cursor: "pointer"
44
+ };
45
+ });
33
46
  const clickMask = () => {
34
47
  props.along && openDialogMediaSelection();
35
48
  };
49
+ const loaclUpload = () => {
50
+ emit("uploadLocal", (file) => {
51
+ let { data } = props;
52
+ if (!file)
53
+ return;
54
+ if (!data) {
55
+ data = {};
56
+ }
57
+ data.url = file.url;
58
+ emit("update:data", data);
59
+ });
60
+ };
36
61
  const openDialogMediaSelection = () => {
37
62
  emit("open", props.thumbModel);
38
63
  };
@@ -40,48 +65,68 @@ const _sfc_main = vue.defineComponent({
40
65
  emit("remove");
41
66
  };
42
67
  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
68
+ return vue.openBlock(), vue.createBlock(vue.unref(webVue.Popover), {
69
+ trigger: "hover",
70
+ "content-style": { padding: 0 }
71
+ }, {
72
+ content: vue.withCtx(() => [
73
+ vue.createElementVNode("div", {
74
+ style: vue.normalizeStyle(btnStyle.value),
75
+ onClick: openDialogMediaSelection
76
+ }, "\u7D20\u6750\u5E93\u9009\u62E9", 4),
77
+ vue.createElementVNode("div", {
78
+ style: vue.normalizeStyle(btnStyle.value),
79
+ onClick: loaclUpload
80
+ }, "\u672C\u5730\u4E0A\u4F20", 4)
81
+ ]),
82
+ default: vue.withCtx(() => {
83
+ var _a;
84
+ return [
85
+ vue.createElementVNode("div", {
86
+ class: vue.normalizeClass(["thumb-card-container", classObj.value])
87
+ }, [
88
+ ((_a = props.data) == null ? void 0 : _a.url) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
89
+ vue.createVNode(vue.unref(webVue.Image), {
90
+ class: "item",
91
+ fit: "cover",
92
+ src: props.data.url,
93
+ "show-loader": ""
94
+ }, null, 8, ["src"]),
95
+ vue.createVNode(vue.Transition, { name: "fade" }, {
96
+ default: vue.withCtx(() => [
97
+ vue.createElementVNode("div", {
98
+ class: "mask",
99
+ onClick: clickMask
100
+ }, [
101
+ vue.createElementVNode("span", {
102
+ class: "half",
103
+ onClick: vue.withModifiers(openDialogMediaSelection, ["stop"])
104
+ }, [
105
+ vue.createVNode(vue.unref(icon.IconEdit))
106
+ ]),
107
+ _ctx.along ? (vue.openBlock(), vue.createElementBlock("span", {
108
+ key: 0,
109
+ class: "half",
110
+ onClick: vue.withModifiers(remove, ["stop"])
111
+ }, [
112
+ vue.createVNode(vue.unref(icon.IconDelete))
113
+ ])) : vue.createCommentVNode("v-if", true)
114
+ ])
115
+ ]),
116
+ _: 1
117
+ })
118
+ ])) : (vue.openBlock(), vue.createElementBlock("div", {
119
+ key: 1,
120
+ class: "item add-thumb",
121
+ style: vue.normalizeStyle({ backgroundImage: `url(${waterBg})` })
58
122
  }, [
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);
123
+ vue.createVNode(vue.unref(icon.IconPlus))
124
+ ], 4))
125
+ ], 2)
126
+ ];
127
+ }),
128
+ _: 1
129
+ });
85
130
  };
86
131
  }
87
132
  });
@@ -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.10",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",