sctj-components 1.0.83 → 1.0.85

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.
@@ -130,7 +130,7 @@ const _sfc_main$v = {
130
130
  };
131
131
  const index$2 = "";
132
132
  const index$1 = "";
133
- const index_vue_vue_type_style_index_0_scoped_006fbc77_lang = "";
133
+ const index_vue_vue_type_style_index_0_scoped_8537f180_lang = "";
134
134
  const index_vue_vue_type_style_index_1_lang = "";
135
135
  const _hoisted_1$m = { class: "upload-file" };
136
136
  const _hoisted_2$f = { class: "el-upload__tip" };
@@ -138,7 +138,13 @@ const _hoisted_3$b = { style: { "color": "#f56c6c" } };
138
138
  const _hoisted_4$a = { style: { "color": "#f56c6c" } };
139
139
  const _hoisted_5$7 = ["title"];
140
140
  const _hoisted_6$4 = { class: "ele-upload-list__item-content-action" };
141
- const _hoisted_7$4 = { style: { "width": "100%", "height": "100%", "overflow": "auto" } };
141
+ const _hoisted_7$4 = { style: { "display": "flex", "justify-content": "space-between" } };
142
+ const _hoisted_8$4 = ["id"];
143
+ const _hoisted_9$3 = {
144
+ key: 0,
145
+ class: "preview-toolbar"
146
+ };
147
+ const _hoisted_10$3 = { class: "previewDialogContent" };
142
148
  const _sfc_main$u = {
143
149
  __name: "index",
144
150
  props: {
@@ -217,8 +223,11 @@ const _sfc_main$u = {
217
223
  const uploadList = ref$1([]);
218
224
  const fileList = ref$1([]);
219
225
  const previewVisible = ref$1(false);
226
+ const previewVisibleImg = ref$1(false);
220
227
  const previewUrl = ref$1("");
221
228
  const previewType = ref$1("");
229
+ const pdfRotation = ref$1(0);
230
+ const pdfScale = ref$1(1);
222
231
  const loadingInstance = ref$1(null);
223
232
  const fileUpload2 = ref$1(null);
224
233
  const showTip = computed$1(() => {
@@ -357,6 +366,11 @@ const _sfc_main$u = {
357
366
  ElMessage.error(`\u6682\u4E0D\u652F\u6301${fileExt}\u6587\u4EF6\u7C7B\u578B\u7684\u5728\u7EBF\u9884\u89C8,\u8BF7\u4E0B\u8F7D\u540E\u67E5\u770B\uFF01`);
358
367
  return;
359
368
  }
369
+ if (previewType.value === "image") {
370
+ previewUrl.value = [file.url];
371
+ previewVisibleImg.value = true;
372
+ return;
373
+ }
360
374
  previewUrl.value = file.url;
361
375
  previewVisible.value = true;
362
376
  };
@@ -365,12 +379,70 @@ const _sfc_main$u = {
365
379
  previewUrl.value = "";
366
380
  previewType.value = "";
367
381
  };
382
+ const setTransform = (element, type, value) => {
383
+ let currentTransform = element.style.transform || "";
384
+ currentTransform = currentTransform.split(" ").filter((item) => !item.includes(type));
385
+ currentTransform.push(value);
386
+ element.style.transform = currentTransform.join(" ");
387
+ };
388
+ const saclc = (value) => {
389
+ pdfScale.value += value;
390
+ if (previewType.value === "pdf") {
391
+ const pdfViewer = document.querySelector(".pdf-viewer");
392
+ if (pdfViewer) {
393
+ const canvases = pdfViewer.querySelectorAll("canvas");
394
+ canvases.forEach((canvas) => {
395
+ setTransform(canvas, "scale", `scale(${pdfScale.value})`);
396
+ });
397
+ }
398
+ }
399
+ if (previewType.value === "docx") {
400
+ const docxViewer = document.querySelector(".docx-viewer");
401
+ if (docxViewer) {
402
+ const sections = docxViewer.querySelectorAll("section");
403
+ sections.forEach((section) => {
404
+ setTransform(section, "scale", `scale(${pdfScale.value})`);
405
+ });
406
+ }
407
+ }
408
+ };
409
+ const rotate = () => {
410
+ pdfRotation.value = (pdfRotation.value + 90) % 360;
411
+ if (previewType.value === "pdf") {
412
+ const pdfViewer = document.querySelector(".pdf-viewer");
413
+ if (pdfViewer) {
414
+ const canvases = pdfViewer.querySelectorAll("canvas");
415
+ canvases.forEach((canvas) => {
416
+ setTransform(canvas, "rotate", `rotate(${pdfRotation.value}deg)`);
417
+ });
418
+ canvases[0].scrollIntoView({
419
+ behavior: "smooth",
420
+ block: "start",
421
+ inline: "nearest"
422
+ });
423
+ }
424
+ }
425
+ if (previewType.value === "docx") {
426
+ const docxViewer = document.querySelector(".docx-viewer");
427
+ if (docxViewer) {
428
+ const sections = docxViewer.querySelectorAll("section");
429
+ sections.forEach((section) => {
430
+ setTransform(section, "rotate", `rotate(${pdfRotation.value}deg)`);
431
+ });
432
+ sections[0].scrollIntoView({
433
+ behavior: "smooth",
434
+ block: "start",
435
+ inline: "nearest"
436
+ });
437
+ }
438
+ }
439
+ };
368
440
  return (_ctx, _cache) => {
369
441
  const _component_el_button = resolveComponent("el-button");
370
442
  const _component_el_upload = resolveComponent("el-upload");
371
443
  const _component_el_icon = resolveComponent("el-icon");
372
- const _component_el_image = resolveComponent("el-image");
373
444
  const _component_el_dialog = resolveComponent("el-dialog");
445
+ const _component_el_image_viewer = resolveComponent("el-image-viewer");
374
446
  return openBlock(), createElementBlock("div", _hoisted_1$m, [
375
447
  !__props.disabled ? (openBlock(), createBlock(_component_el_upload, mergeProps({
376
448
  key: 0,
@@ -482,42 +554,75 @@ const _sfc_main$u = {
482
554
  })) : createCommentVNode("", true),
483
555
  createVNode(_component_el_dialog, {
484
556
  modelValue: previewVisible.value,
485
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => previewVisible.value = $event),
557
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => previewVisible.value = $event),
486
558
  "append-to-body": "",
487
559
  class: "previewDialog",
488
560
  title: "\u6587\u4EF6\u9884\u89C8",
489
561
  fullscreen: "",
490
562
  "before-close": handlePreviewClose
491
563
  }, {
492
- default: withCtx(() => [
564
+ header: withCtx(({ close, titleId, titleClass }) => [
493
565
  createElementVNode("div", _hoisted_7$4, [
566
+ createElementVNode("div", {
567
+ id: titleId,
568
+ class: normalizeClass(titleClass)
569
+ }, "\u6587\u4EF6\u9884\u89C8", 10, _hoisted_8$4),
570
+ previewType.value === "pdf" || previewType.value === "docx" ? (openBlock(), createElementBlock("div", _hoisted_9$3, [
571
+ createVNode(_component_el_button, {
572
+ onClick: _cache[0] || (_cache[0] = ($event) => saclc(-0.1)),
573
+ title: "\u7F29\u5C0F",
574
+ type: "default",
575
+ circle: "",
576
+ icon: "Minus"
577
+ }),
578
+ createVNode(_component_el_button, {
579
+ onClick: _cache[1] || (_cache[1] = ($event) => saclc(0.1)),
580
+ title: "\u653E\u5927",
581
+ type: "default",
582
+ circle: "",
583
+ icon: "Plus"
584
+ }),
585
+ createVNode(_component_el_button, {
586
+ onClick: rotate,
587
+ title: "\u65CB\u8F6C",
588
+ type: "default",
589
+ circle: "",
590
+ icon: "RefreshRight"
591
+ })
592
+ ])) : createCommentVNode("", true)
593
+ ])
594
+ ]),
595
+ default: withCtx(() => [
596
+ createElementVNode("div", _hoisted_10$3, [
494
597
  previewType.value === "pdf" ? (openBlock(), createBlock(unref(VueOfficePdf), {
495
598
  key: 0,
496
- src: previewUrl.value
599
+ src: previewUrl.value,
600
+ class: "pdf-viewer"
497
601
  }, null, 8, ["src"])) : createCommentVNode("", true),
498
602
  previewType.value === "docx" ? (openBlock(), createBlock(unref(VueOfficeDocx), {
499
603
  key: 1,
500
- src: previewUrl.value
604
+ src: previewUrl.value,
605
+ class: "docx-viewer"
501
606
  }, null, 8, ["src"])) : createCommentVNode("", true),
502
607
  previewType.value === "xlsx" ? (openBlock(), createBlock(unref(VueOfficeExcel), {
503
608
  key: 2,
504
609
  src: previewUrl.value
505
- }, null, 8, ["src"])) : createCommentVNode("", true),
506
- previewType.value === "image" ? (openBlock(), createBlock(_component_el_image, {
507
- key: 3,
508
- src: previewUrl.value,
509
- style: { "width": "100%", "height": "99%" },
510
- fit: "contain"
511
610
  }, null, 8, ["src"])) : createCommentVNode("", true)
512
611
  ])
513
612
  ]),
514
613
  _: 1
515
- }, 8, ["modelValue"])
614
+ }, 8, ["modelValue"]),
615
+ previewVisibleImg.value ? (openBlock(), createBlock(_component_el_image_viewer, {
616
+ key: 2,
617
+ "url-list": previewUrl.value,
618
+ "show-progress": "",
619
+ onClose: _cache[3] || (_cache[3] = ($event) => previewVisibleImg.value = false)
620
+ }, null, 8, ["url-list"])) : createCommentVNode("", true)
516
621
  ]);
517
622
  };
518
623
  }
519
624
  };
520
- const SCTJFileUpload = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-006fbc77"]]);
625
+ const SCTJFileUpload = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-8537f180"]]);
521
626
  const index_vue_vue_type_style_index_0_scoped_672e5149_lang = "";
522
627
  const _hoisted_1$l = { class: "component-upload-image" };
523
628
  const _hoisted_2$e = {