@cecee/document-flip-book 1.0.17 → 1.0.18

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.
Files changed (75) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +83 -0
  3. package/dist/cjs/AccountingBook/index.d.ts +3 -0
  4. package/dist/cjs/AccountingBook/index.js +19 -0
  5. package/dist/cjs/{ArchiveCover.js → DocumentFlipBook/ArchiveCover.js} +23 -3
  6. package/dist/cjs/{ExportModal.js → DocumentFlipBook/ExportModal.js} +1 -1
  7. package/dist/cjs/{ProjectCover.js → DocumentFlipBook/ProjectCover.js} +23 -3
  8. package/dist/cjs/{exportHtml.d.ts → DocumentFlipBook/exportHtml.d.ts} +3 -3
  9. package/dist/cjs/{exportHtml.js → DocumentFlipBook/exportHtml.js} +104 -48
  10. package/dist/cjs/{exportPdf.d.ts → DocumentFlipBook/exportPdf.d.ts} +2 -0
  11. package/dist/cjs/{exportPdf.js → DocumentFlipBook/exportPdf.js} +17 -6
  12. package/dist/cjs/{globalCache.d.ts → DocumentFlipBook/globalCache.d.ts} +2 -1
  13. package/dist/cjs/DocumentFlipBook/images/Clip_1.svg +97 -0
  14. package/dist/cjs/DocumentFlipBook/images/Clip_2.svg +1114 -0
  15. package/dist/cjs/DocumentFlipBook/images/Inside.svg +10 -0
  16. package/dist/cjs/DocumentFlipBook/images/book.svg +1 -0
  17. package/dist/cjs/DocumentFlipBook/images/coverSpine.svg +4 -0
  18. package/dist/{esm/DocumentFlipBook.d.ts → cjs/DocumentFlipBook/index.d.ts} +2 -0
  19. package/dist/cjs/{DocumentFlipBook.js → DocumentFlipBook/index.js} +116 -22
  20. package/dist/cjs/{index.less → DocumentFlipBook/index.less} +193 -78
  21. package/dist/cjs/{printPdf.d.ts → DocumentFlipBook/printPdf.d.ts} +1 -0
  22. package/dist/cjs/{utils.d.ts → DocumentFlipBook/utils.d.ts} +2 -1
  23. package/dist/cjs/{utils.js → DocumentFlipBook/utils.js} +4 -1
  24. package/dist/cjs/index.d.ts +3 -3
  25. package/dist/cjs/index.js +10 -3
  26. package/dist/esm/AccountingBook/index.d.ts +3 -0
  27. package/dist/esm/AccountingBook/index.js +13 -0
  28. package/dist/esm/{ArchiveCover.js → DocumentFlipBook/ArchiveCover.js} +23 -3
  29. package/dist/esm/{ExportModal.js → DocumentFlipBook/ExportModal.js} +1 -1
  30. package/dist/esm/{ProjectCover.js → DocumentFlipBook/ProjectCover.js} +23 -3
  31. package/dist/esm/{exportHtml.d.ts → DocumentFlipBook/exportHtml.d.ts} +3 -3
  32. package/dist/esm/{exportHtml.js → DocumentFlipBook/exportHtml.js} +103 -47
  33. package/dist/esm/{exportPdf.d.ts → DocumentFlipBook/exportPdf.d.ts} +2 -0
  34. package/dist/esm/{exportPdf.js → DocumentFlipBook/exportPdf.js} +17 -6
  35. package/dist/esm/{globalCache.d.ts → DocumentFlipBook/globalCache.d.ts} +2 -1
  36. package/dist/esm/DocumentFlipBook/images/Clip_1.svg +97 -0
  37. package/dist/esm/DocumentFlipBook/images/Clip_2.svg +1114 -0
  38. package/dist/esm/DocumentFlipBook/images/Inside.svg +10 -0
  39. package/dist/esm/DocumentFlipBook/images/book.svg +1 -0
  40. package/dist/esm/DocumentFlipBook/images/coverSpine.svg +4 -0
  41. package/dist/{cjs/DocumentFlipBook.d.ts → esm/DocumentFlipBook/index.d.ts} +2 -0
  42. package/dist/esm/{DocumentFlipBook.js → DocumentFlipBook/index.js} +116 -22
  43. package/dist/esm/{index.less → DocumentFlipBook/index.less} +193 -78
  44. package/dist/esm/{printPdf.d.ts → DocumentFlipBook/printPdf.d.ts} +1 -0
  45. package/dist/esm/{utils.d.ts → DocumentFlipBook/utils.d.ts} +2 -1
  46. package/dist/esm/{utils.js → DocumentFlipBook/utils.js} +4 -1
  47. package/dist/esm/index.d.ts +3 -3
  48. package/dist/esm/index.js +5 -3
  49. package/package.json +6 -1
  50. /package/dist/cjs/{ArchiveCover.d.ts → DocumentFlipBook/ArchiveCover.d.ts} +0 -0
  51. /package/dist/cjs/{ExportModal.d.ts → DocumentFlipBook/ExportModal.d.ts} +0 -0
  52. /package/dist/cjs/{HeaderBar.d.ts → DocumentFlipBook/HeaderBar.d.ts} +0 -0
  53. /package/dist/cjs/{HeaderBar.js → DocumentFlipBook/HeaderBar.js} +0 -0
  54. /package/dist/cjs/{PdfPage.d.ts → DocumentFlipBook/PdfPage.d.ts} +0 -0
  55. /package/dist/cjs/{PdfPage.js → DocumentFlipBook/PdfPage.js} +0 -0
  56. /package/dist/cjs/{ProjectCover.d.ts → DocumentFlipBook/ProjectCover.d.ts} +0 -0
  57. /package/dist/cjs/{SideTabs.d.ts → DocumentFlipBook/SideTabs.d.ts} +0 -0
  58. /package/dist/cjs/{SideTabs.js → DocumentFlipBook/SideTabs.js} +0 -0
  59. /package/dist/cjs/{globalCache.js → DocumentFlipBook/globalCache.js} +0 -0
  60. /package/dist/cjs/{printPdf.js → DocumentFlipBook/printPdf.js} +0 -0
  61. /package/dist/cjs/{types.d.ts → DocumentFlipBook/types.d.ts} +0 -0
  62. /package/dist/cjs/{types.js → DocumentFlipBook/types.js} +0 -0
  63. /package/dist/esm/{ArchiveCover.d.ts → DocumentFlipBook/ArchiveCover.d.ts} +0 -0
  64. /package/dist/esm/{ExportModal.d.ts → DocumentFlipBook/ExportModal.d.ts} +0 -0
  65. /package/dist/esm/{HeaderBar.d.ts → DocumentFlipBook/HeaderBar.d.ts} +0 -0
  66. /package/dist/esm/{HeaderBar.js → DocumentFlipBook/HeaderBar.js} +0 -0
  67. /package/dist/esm/{PdfPage.d.ts → DocumentFlipBook/PdfPage.d.ts} +0 -0
  68. /package/dist/esm/{PdfPage.js → DocumentFlipBook/PdfPage.js} +0 -0
  69. /package/dist/esm/{ProjectCover.d.ts → DocumentFlipBook/ProjectCover.d.ts} +0 -0
  70. /package/dist/esm/{SideTabs.d.ts → DocumentFlipBook/SideTabs.d.ts} +0 -0
  71. /package/dist/esm/{SideTabs.js → DocumentFlipBook/SideTabs.js} +0 -0
  72. /package/dist/esm/{globalCache.js → DocumentFlipBook/globalCache.js} +0 -0
  73. /package/dist/esm/{printPdf.js → DocumentFlipBook/printPdf.js} +0 -0
  74. /package/dist/esm/{types.d.ts → DocumentFlipBook/types.d.ts} +0 -0
  75. /package/dist/esm/{types.js → DocumentFlipBook/types.js} +0 -0
@@ -0,0 +1,10 @@
1
+ <svg width="34" height="825" viewBox="0 0 34 825" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 0L34 8V817L0 825V0Z" fill="#3AB5EA"/>
3
+ <path d="M0 0L34 8V817L0 825V0Z" fill="url(#paint0_linear_28900_8954)" fill-opacity="0.53" style="mix-blend-mode:multiply"/>
4
+ <defs>
5
+ <linearGradient id="paint0_linear_28900_8954" x1="0" y1="412.5" x2="34" y2="412.5" gradientUnits="userSpaceOnUse">
6
+ <stop offset="0.02" stop-color="#007DB3"/>
7
+ <stop offset="0.995" stop-color="#00354B"/>
8
+ </linearGradient>
9
+ </defs>
10
+ </svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1781057525113" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11598" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M256 0C150 0 64 86 64 192v640c0 106 86 192 192 192h640c35.4 0 64-28.6 64-64s-28.6-64-64-64v-128c35.4 0 64-28.6 64-64V64c0-35.4-28.6-64-64-64H256z m0 768h512v128H256c-35.4 0-64-28.6-64-64s28.6-64 64-64z m64-480c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32s-14.4 32-32 32H352c-17.6 0-32-14.4-32-32z m32 96h384c17.6 0 32 14.4 32 32s-14.4 32-32 32H352c-17.6 0-32-14.4-32-32s14.4-32 32-32z" p-id="11599" fill="#64c3f5"></path></svg>
@@ -0,0 +1,4 @@
1
+ <svg width="17" height="825" viewBox="0 0 17 825" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 30L17 0V825L0 789V30Z" fill="#22A3DA"/>
3
+ <path d="M4 43.8636L13 29.5V802L4 782.364L4 43.8636Z" fill="#DEF0FA"/>
4
+ </svg>
@@ -7,6 +7,7 @@ interface DocumentFlipBookProps {
7
7
  id?: string;
8
8
  themeColor?: string;
9
9
  documentInfo: {
10
+ fd: string;
10
11
  com00cs?: any[];
11
12
  attachments?: any[];
12
13
  edr04bs?: any[];
@@ -27,6 +28,7 @@ interface DocumentFlipBookProps {
27
28
  onSearch?: (v: string) => void;
28
29
  showHeaderBar?: boolean;
29
30
  pdfWorkerSrc?: string;
31
+ printType?: 'A4' | 'A5';
30
32
  }
31
33
  declare const DocumentFlipBook: React.FC<DocumentFlipBookProps>;
32
34
  export default DocumentFlipBook;
@@ -20,7 +20,7 @@ import PdfPage from "./PdfPage";
20
20
  import SideTabs from "./SideTabs";
21
21
  import { buildPagesFromSingleAttachment, formatPath, VIEWPORT_HEIGHT, VIEWPORT_WIDTH, setupPdfWorker } from "./utils";
22
22
  import { globalPdfCache } from "./globalCache";
23
- import ArchiveCover from "./ArchiveCover"; // 引入封面组件
23
+ import ArchiveCover from "./ArchiveCover";
24
24
  import ProjectCover from "./ProjectCover";
25
25
  import "./index.less";
26
26
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -40,7 +40,9 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
40
40
  onSearch = _ref$onSearch === void 0 ? function () {} : _ref$onSearch,
41
41
  _ref$showHeaderBar = _ref.showHeaderBar,
42
42
  showHeaderBar = _ref$showHeaderBar === void 0 ? true : _ref$showHeaderBar,
43
- pdfWorkerSrc = _ref.pdfWorkerSrc;
43
+ pdfWorkerSrc = _ref.pdfWorkerSrc,
44
+ _ref$printType = _ref.printType,
45
+ printType = _ref$printType === void 0 ? 'A4' : _ref$printType;
44
46
  var flipRef = useRef(null);
45
47
  console.log(documentInfo);
46
48
 
@@ -68,6 +70,10 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
68
70
  _useState10 = _slicedToArray(_useState9, 2),
69
71
  mode = _useState10[0],
70
72
  setMode = _useState10[1];
73
+ var _useState11 = useState(0),
74
+ _useState12 = _slicedToArray(_useState11, 2),
75
+ refreshKey = _useState12[0],
76
+ setRefreshKey = _useState12[1];
71
77
  var isFirstLoadOfDocument = useRef(true);
72
78
 
73
79
  // 内部处理全屏切换
@@ -88,6 +94,14 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
88
94
  window.history.back();
89
95
  }
90
96
  }, [onBack]);
97
+
98
+ // 计算加深的主题色,用于书本右侧阴影
99
+ var themeDarkColor = useMemo(function () {
100
+ if (!themeColor) return '#8b6d44';
101
+ // 简单的加深逻辑:使用 CSS filter 会更方便,但在 linear-gradient 中需要显式颜色
102
+ // 这里我们直接将变量传给 CSS 变量,让 CSS 处理或在 TS 中简单处理
103
+ return themeColor; // 暂时传递原始色,稍后在 CSS 中通过 mix-blend-mode 处理更佳
104
+ }, [themeColor]);
91
105
  var archiveId = useMemo(function () {
92
106
  return id || (documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.id) || (documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.code);
93
107
  }, [id, documentInfo]);
@@ -293,7 +307,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
293
307
  return function () {
294
308
  isMounted = false;
295
309
  };
296
- }, [documentInfo, activeTab, id]);
310
+ }, [documentInfo, activeTab, id, refreshKey]);
297
311
  var total = useMemo(function () {
298
312
  return 1 + pages.length;
299
313
  }, [pages]);
@@ -316,6 +330,10 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
316
330
  }, [total]);
317
331
  var handleRefresh = useCallback(function () {
318
332
  isFirstLoadOfDocument.current = true; // 标记为首次加载,使 init 逻辑停留在封面 (第 0 页)
333
+ globalPdfCache.clearAll(); // 清理所有 PDF 缓存
334
+ setRefreshKey(function (prev) {
335
+ return prev + 1;
336
+ }); // 增加 refreshKey 以触发 useEffect 重新执行初始化
319
337
  setActiveTab('');
320
338
  setCurrent(0);
321
339
  if (flipRef.current) {
@@ -329,7 +347,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
329
347
  var handleDownload = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
330
348
  var type,
331
349
  _yield$import,
332
- exportArchivePagesToHtml,
350
+ exportArchivePagesToEpub,
333
351
  hide,
334
352
  filename,
335
353
  _yield$import2,
@@ -347,12 +365,12 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
347
365
  return import("./exportHtml");
348
366
  case 4:
349
367
  _yield$import = _context2.sent;
350
- exportArchivePagesToHtml = _yield$import.exportArchivePagesToHtml;
368
+ exportArchivePagesToEpub = _yield$import.exportArchivePagesToEpub;
351
369
  _context2.next = 8;
352
- return exportArchivePagesToHtml({
370
+ return exportArchivePagesToEpub({
353
371
  pages: pages,
354
- filename: "\u6863\u6848\u7FFB\u4E66-".concat(new Date().toISOString().slice(0, 10)),
355
- title: title || '档案翻书',
372
+ filename: "".concat((documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.fd) || '电子档案书', ".epub"),
373
+ title: (documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.fd) || '电子档案书',
356
374
  getDocument: globalPdfCache.getDocument,
357
375
  coverInfo: {
358
376
  data: documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.acc51c,
@@ -378,7 +396,8 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
378
396
  pages: pages,
379
397
  getDocument: globalPdfCache.getDocument,
380
398
  filename: filename,
381
- scale: 2
399
+ scale: 2,
400
+ printType: printType
382
401
  });
383
402
  case 18:
384
403
  message.success('已开始下载');
@@ -397,7 +416,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
397
416
  return _context2.stop();
398
417
  }
399
418
  }, _callee2, null, [[10, 21, 24, 27]]);
400
- })), [pages, title]);
419
+ })), [pages, title, printType]);
401
420
  var handlePrint = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
402
421
  var hide, _yield$import3, printArchiveAsPdf;
403
422
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -414,7 +433,8 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
414
433
  return printArchiveAsPdf({
415
434
  pages: pages,
416
435
  getDocument: globalPdfCache.getDocument,
417
- scale: 2
436
+ scale: 2,
437
+ printType: printType
418
438
  });
419
439
  case 8:
420
440
  _context3.next = 13;
@@ -432,7 +452,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
432
452
  return _context3.stop();
433
453
  }
434
454
  }, _callee3, null, [[1, 10, 13, 16]]);
435
- })), [pages]);
455
+ })), [pages, printType]);
436
456
 
437
457
  // 提取为独立的渲染函数,增加懒加载逻辑
438
458
  var renderContent = useCallback(function (idx) {
@@ -517,6 +537,10 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
517
537
  }, [pages, documentInfo, current, themeColor]);
518
538
  return /*#__PURE__*/_jsxs("div", {
519
539
  className: "dfb-root ".concat(mode === 'modal' ? 'is-fullscreen-modal' : ''),
540
+ style: {
541
+ '--dfb-theme-color': themeColor,
542
+ '--dfb-theme-dark-color': themeDarkColor
543
+ },
520
544
  children: [showHeaderBar && /*#__PURE__*/_jsx(HeaderBar, {
521
545
  mode: mode,
522
546
  title: title,
@@ -538,19 +562,63 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
538
562
  children: /*#__PURE__*/_jsx(Spin, {
539
563
  size: "large",
540
564
  spinning: loading,
541
- children: /*#__PURE__*/_jsx("div", {
565
+ children: /*#__PURE__*/_jsxs("div", {
542
566
  className: "dfb-book-wrapper",
543
567
  style: {
544
568
  minHeight: VIEWPORT_HEIGHT + 40
545
569
  },
546
- children: /*#__PURE__*/_jsxs("div", {
547
- className: current === 0 && !activeTab ? 'dfb-bookShell1' : 'dfb-bookShell',
570
+ children: [/*#__PURE__*/_jsx("div", {
571
+ className: "dfb-book-background-layer",
548
572
  style: {
549
- backgroundColor: current === 0 && !activeTab ? 'transparent' : themeColor
550
- },
551
- children: [(current > 0 || activeTab) && /*#__PURE__*/_jsx("div", {
573
+ opacity: current === 0 && !activeTab ? 0 : 1
574
+ }
575
+ }), (current > 0 || activeTab) && /*#__PURE__*/_jsxs("div", {
576
+ className: "dfb-spine-decoration-layer",
577
+ children: [/*#__PURE__*/_jsx("div", {
578
+ className: "dfb-inside-spine",
579
+ children: /*#__PURE__*/_jsxs("svg", {
580
+ width: "100%",
581
+ height: "100%",
582
+ viewBox: "0 0 34 825",
583
+ preserveAspectRatio: "none",
584
+ fill: "none",
585
+ xmlns: "http://www.w3.org/2000/svg",
586
+ children: [/*#__PURE__*/_jsx("path", {
587
+ d: "M0 0L34 8V817L0 825V0Z",
588
+ fill: themeColor
589
+ }), /*#__PURE__*/_jsx("path", {
590
+ d: "M0 0L34 8V817L0 825V0Z",
591
+ fill: "url(#paint0_linear_inside)",
592
+ fillOpacity: "0.53",
593
+ style: {
594
+ mixBlendMode: 'multiply'
595
+ }
596
+ }), /*#__PURE__*/_jsx("defs", {
597
+ children: /*#__PURE__*/_jsxs("linearGradient", {
598
+ id: "paint0_linear_inside",
599
+ x1: "0",
600
+ y1: "412.5",
601
+ x2: "34",
602
+ y2: "412.5",
603
+ gradientUnits: "userSpaceOnUse",
604
+ children: [/*#__PURE__*/_jsx("stop", {
605
+ offset: "0.02",
606
+ stopColor: "#000",
607
+ stopOpacity: "0.6"
608
+ }), /*#__PURE__*/_jsx("stop", {
609
+ offset: "0.995",
610
+ stopColor: "#000",
611
+ stopOpacity: "0.2"
612
+ })]
613
+ })
614
+ })]
615
+ })
616
+ }), /*#__PURE__*/_jsx("div", {
552
617
  className: "dfb-book-spine"
553
- }), (pages === null || pages === void 0 ? void 0 : pages.length) > 0 && tabItems.length > 0 && /*#__PURE__*/_jsx(SideTabs, {
618
+ })]
619
+ }), /*#__PURE__*/_jsxs("div", {
620
+ className: current === 0 ? '' : 'dfb-book-content-layer',
621
+ children: [(pages === null || pages === void 0 ? void 0 : pages.length) > 0 && tabItems.length > 0 && !loading && /*#__PURE__*/_jsx(SideTabs, {
554
622
  items: tabItems,
555
623
  activeKey: activeTab,
556
624
  className: current === 0 ? 'is-on-cover' : !activeTab ? 'is-on-activeTab' : '',
@@ -609,7 +677,22 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
609
677
  height: '100%',
610
678
  background: '#fff'
611
679
  },
612
- children: renderContent(i)
680
+ children: /*#__PURE__*/_jsxs("div", {
681
+ style: {
682
+ position: 'relative',
683
+ width: '100%',
684
+ height: '100%'
685
+ },
686
+ children: [/*#__PURE__*/_jsx("div", {
687
+ className: "dfb-book-thickness-left-1"
688
+ }), /*#__PURE__*/_jsx("div", {
689
+ className: "dfb-book-thickness-left-2"
690
+ }), /*#__PURE__*/_jsx("div", {
691
+ className: "dfb-book-thickness-right-1"
692
+ }), /*#__PURE__*/_jsx("div", {
693
+ className: "dfb-book-thickness-right-2"
694
+ }), renderContent(i)]
695
+ })
613
696
  }, i);
614
697
  })
615
698
  }, "".concat(archiveId, "-").concat(activeTab)), !loading && pages.length === 0 && /*#__PURE__*/_jsx("div", {
@@ -620,10 +703,21 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
620
703
  margin: 'auto',
621
704
  background: '#fff'
622
705
  },
623
- children: renderContent(0)
706
+ children: /*#__PURE__*/_jsxs("div", {
707
+ style: {
708
+ position: 'relative',
709
+ width: '100%',
710
+ height: '100%'
711
+ },
712
+ children: [/*#__PURE__*/_jsx("div", {
713
+ className: "dfb-book-thickness-right-1"
714
+ }), /*#__PURE__*/_jsx("div", {
715
+ className: "dfb-book-thickness-right-2"
716
+ }), renderContent(0)]
717
+ })
624
718
  })]
625
719
  })]
626
- })
720
+ })]
627
721
  })
628
722
  })
629
723
  })]
@@ -31,42 +31,88 @@
31
31
  .book-page {
32
32
  width: 100%;
33
33
  height: 100%;
34
- background: #9F7D4E;
34
+ background: var(--dfb-theme-color, #9F7D4E);
35
35
  padding: 22px;
36
36
  }
37
37
 
38
38
  .book-view {
39
- box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
39
+ // box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
40
+ // overflow: hidden;
40
41
  position: relative;
41
- overflow: hidden;
42
+ z-index: 10;
43
+ overflow: visible; // 显式设置为 visible 以显示侧边厚度装饰
44
+ background: transparent; // 改为透明,避免遮挡背景层或产生白色边框
42
45
 
43
- // 页面内侧阴影(靠近中缝处的深度感)
44
- &::before {
45
- content: "";
46
+ // 书本左侧厚度 1
47
+ .dfb-book-thickness-left-1 {
46
48
  position: absolute;
47
49
  top: 0;
48
- bottom: 0;
50
+ left: -4px;
51
+ width: 8px;
52
+ height: 100%;
53
+ background: linear-gradient(to right, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3));
54
+ border-radius: 2px;
55
+ z-index: 20;
56
+ box-shadow: rgba(255, 255, 255, 0.6) 0px 0px 6px inset;
57
+ pointer-events: none;
58
+ display: none; // 默认隐藏,由 nth-child 控制显示
59
+ }
60
+
61
+ // 书本左侧厚度 2
62
+ .dfb-book-thickness-left-2 {
63
+ position: absolute;
64
+ top: 0;
65
+ left: -10px;
49
66
  width: 20px;
50
- z-index: 5;
67
+ height: 100%;
68
+ background: linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.2));
69
+ z-index: 14;
51
70
  pointer-events: none;
52
- transition: opacity 0.3s ease;
71
+ display: none; // 默认隐藏
53
72
  }
54
73
 
55
- // 偶数页(通常是右页)阴影在左侧
56
- &:nth-child(even)::before {
57
- left: 0;
58
- background: linear-gradient(to right, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 40%, transparent 100%);
74
+ // 书本右侧厚度 1
75
+ .dfb-book-thickness-right-1 {
76
+ position: absolute;
77
+ top: 0;
78
+ right: -4px;
79
+ width: 8px;
80
+ height: 100%;
81
+ background: linear-gradient(to right, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3));
82
+ border-radius: 2px;
83
+ z-index: 15;
84
+ box-shadow: rgba(255, 255, 255, 0.6) 0px 0px 6px inset;
85
+ pointer-events: none;
86
+ display: none; // 默认隐藏
59
87
  }
60
88
 
61
- // 奇数页(通常是左页)阴影在右侧
62
- &:nth-child(odd)::before {
63
- right: 0;
64
- background: linear-gradient(to left, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 40%, transparent 100%);
89
+ // 书本右侧厚度 2
90
+ .dfb-book-thickness-right-2 {
91
+ position: absolute;
92
+ top: 0;
93
+ right: -10px;
94
+ width: 20px;
95
+ height: 100%;
96
+ background: linear-gradient(to left, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.2));
97
+ z-index: 14;
98
+ pointer-events: none;
99
+ display: none; // 默认隐藏
65
100
  }
66
101
 
67
- // 封面页(第一页)通常不需要这种内部阴影,或者阴影较弱
68
- &:first-child::before {
69
- opacity: 0.3;
102
+ // 偶数页(第 2, 4, 6... 个子元素,对应 Page 1, 3, 5...)是左页 -> 显示左侧厚度
103
+ &:nth-child(even) {
104
+ .dfb-book-thickness-left-1,
105
+ .dfb-book-thickness-left-2 {
106
+ display: block;
107
+ }
108
+ }
109
+
110
+ // 奇数页(第 1, 3, 5... 个子元素,对应 Page 0, 2, 4...)是右页 -> 显示右侧厚度
111
+ &:nth-child(odd) {
112
+ .dfb-book-thickness-right-1,
113
+ .dfb-book-thickness-right-2 {
114
+ display: block;
115
+ }
70
116
  }
71
117
  }
72
118
 
@@ -75,8 +121,10 @@
75
121
  }
76
122
 
77
123
  .dfb-HTMLFlipBook {
78
- overflow: hidden;
79
- background: #fff;
124
+ position: relative;
125
+ z-index: 10;
126
+ overflow: visible; // 显式设置为 visible 以显示侧边厚度装饰
127
+ background: transparent; // 改为透明,避免遮挡背景层或产生白色边框
80
128
  }
81
129
 
82
130
  .dfb-root {
@@ -261,7 +309,7 @@
261
309
  display: flex;
262
310
  flex-direction: column;
263
311
  gap: 6px; //
264
- z-index: 10;
312
+ z-index: 20;
265
313
  transition: all 0.3s ease;
266
314
 
267
315
  &.is-on-cover {
@@ -341,55 +389,105 @@
341
389
  min-width: 300px;
342
390
  }
343
391
 
344
- .dfb-bookShell1 {
345
- position: relative;
346
- padding: 18px 0 18px 54px;
347
- background: transparent;
348
- transition: background-color 0.3s ease;
392
+ // 方法三:背景层样式
393
+ .dfb-book-background-layer {
394
+ position: absolute;
395
+ top: 0;
396
+ left: 0;
397
+ right: 0;
398
+ bottom: 0;
399
+ padding: 18px 54px;
400
+ z-index: 1;
401
+ transition: all 0.3s ease;
402
+ pointer-events: none;
403
+ overflow: hidden;
404
+ /* 确保伪元素不会超出容器 */
405
+ }
406
+
407
+ /* 左侧较高的背景块 */
408
+ .dfb-book-background-layer::before {
409
+ content: "";
410
+ position: absolute;
411
+ top: 2px;
412
+ left: -16px;
413
+ width: 50%;
414
+ /* 占据左半边 */
415
+ height: 100%;
416
+ /* 高度为100%,显得更高 */
417
+ background-color: var(--dfb-theme-color, #9F7D4E);
418
+ transition: all 0.3s ease;
419
+ }
420
+
421
+ /* 右侧较低的背景块 */
422
+ .dfb-book-background-layer::after {
423
+ content: "";
424
+ position: absolute;
425
+ top: 9px;
426
+ right: -16px;
427
+ width: 50%;
428
+ /* 占据右半边 */
429
+ height: calc(100% - 15px);
430
+ /* 高度减去顶部偏移量 */
431
+ background-color: var(--dfb-theme-color, #9F7D4E);
432
+ filter: brightness(0.85); // 自动加深,不再依赖额外的变量
433
+ opacity: 0.9;
434
+ transition: all 0.3s ease;
349
435
  }
350
436
 
351
- .dfb-bookShell {
437
+ // 方法三:内容层样式
438
+ .dfb-book-content-layer {
352
439
  position: relative;
353
- padding: 18px 54px;
354
- background: #9F7D4E;
355
- transition: background-color 0.3s ease;
440
+ z-index: 10; // 位于背景之上
441
+ padding: 18px 54px; // 保持与背景层一致的内边距
442
+ }
356
443
 
357
- &::after {
444
+ // 书脊内侧装饰 (Inside.svg)
445
+ .dfb-inside-spine {
446
+ position: absolute;
447
+ left: 50%;
448
+ top: 2px;
449
+ height: calc(100% - 1px);
450
+ bottom: 18px;
451
+ width: 34px; // 恢复为原始 SVG 宽度
452
+ transform: translateX(-50%);
453
+ z-index: 5; // 提高层级,确保在 .dfb-book-background-layer 的 linear-gradient 之上
454
+ pointer-events: none;
455
+ opacity: 1; // 增加不透明度使其更清晰
456
+ }
457
+
458
+ // 中缝装饰层(确保在中缝位置且高于内容层)
459
+ // .dfb-spine-decoration-layer {
460
+ // position: absolute;
461
+ // left: 50%;
462
+ // top: 0;
463
+ // bottom: 0;
464
+ // width: 0; // 仅作为定位参考
465
+ // z-index: 20; // 必须高于内容层 (10) 才能看到
466
+ // pointer-events: none;
467
+ // }
468
+
469
+ // 书本中缝分割线
470
+ .dfb-book-spine {
471
+ position: absolute;
472
+ left: 50%;
473
+ top: 17px;
474
+ bottom: 18px;
475
+ width: 2px;
476
+ transform: translateX(-50%);
477
+ background: rgba(0, 0, 0, 0.2);
478
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
479
+ z-index: 20;
480
+ pointer-events: none;
481
+ transition: opacity 0.3s ease;
482
+
483
+ &::before {
358
484
  content: "";
359
485
  position: absolute;
486
+ left: -4px;
360
487
  top: 0;
361
- left: 0;
362
- right: 0;
363
488
  bottom: 0;
364
- background-image: url("https://www.transparenttextures.com/patterns/leather.png");
365
- opacity: 0.1;
366
- pointer-events: none;
367
- border-radius: 8px;
368
- }
369
-
370
- // 书本中缝分割线
371
- .dfb-book-spine {
372
- position: absolute;
373
- left: 50%;
374
- top: 18px;
375
- bottom: 18px;
376
- width: 2px;
377
- transform: translateX(-50%);
378
- background: rgba(0, 0, 0, 0.2);
379
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
380
- z-index: 5;
381
- pointer-events: none;
382
- transition: opacity 0.3s ease;
383
-
384
- &::before {
385
- content: "";
386
- position: absolute;
387
- left: -4px;
388
- top: 0;
389
- bottom: 0;
390
- width: 10px;
391
- background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.15), transparent);
392
- }
489
+ width: 10px;
490
+ background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.15), transparent);
393
491
  }
394
492
  }
395
493
 
@@ -398,7 +496,7 @@
398
496
  height: 100%;
399
497
  display: grid;
400
498
  place-items: center;
401
- background: #9F7D4E;
499
+ background: var(--dfb-theme-color, #9F7D4E);
402
500
  color: #111;
403
501
  font-size: 46px;
404
502
  font-weight: 800;
@@ -425,14 +523,24 @@
425
523
  .archive-cover {
426
524
  width: 100%;
427
525
  height: 100%;
428
- background: #9F7D4E; // 棕黄色背景
429
526
  display: flex;
430
527
  align-items: center;
431
528
  justify-content: center;
432
529
  color: #000;
433
530
  font-family: "SimSun", "STSong", serif;
434
- padding: 40px;
531
+ padding: 40px 40px 40px 57px; // 增加左侧内边距,给背脊留出空间
435
532
  box-sizing: border-box;
533
+ position: relative; // 确保子元素绝对定位
534
+
535
+ .archive-spine {
536
+ background-color: #fff;
537
+ position: absolute;
538
+ left: 0;
539
+ top: 0;
540
+ bottom: 0;
541
+ width: 25px; // 稍微放宽一点,效果更好
542
+ z-index: 10;
543
+ }
436
544
 
437
545
  &__outer-border {
438
546
  border: 5px solid #000;
@@ -459,7 +567,7 @@
459
567
  font-size: 26px;
460
568
  font-weight: bold;
461
569
  margin-top: 10px;
462
- margin-bottom: 30px;
570
+ margin-bottom: 10px;
463
571
  letter-spacing: 4px;
464
572
  text-align: center;
465
573
  }
@@ -533,10 +641,7 @@
533
641
 
534
642
  // 项目模式封面样式
535
643
  .project-cover-container {
536
- // position: absolute;
537
- // left: 15px;
538
- // top: 0px;
539
- // width: calc(100% - 15px);
644
+ position: relative; // 确保子元素绝对定位
540
645
  width: 100%;
541
646
  height: 100%;
542
647
  z-index: 20;
@@ -544,7 +649,17 @@
544
649
  display: flex;
545
650
  flex-direction: column;
546
651
  font-family: "SimSun", "STSong", serif;
547
- padding: 30px;
652
+ padding: 30px 30px 30px 47px; // 增加左侧内边距,给背脊留出空间
653
+
654
+ .archive-spine {
655
+ background-color: #fff;
656
+ position: absolute;
657
+ left: 0;
658
+ top: 0;
659
+ bottom: 0;
660
+ width: 25px;
661
+ z-index: 10;
662
+ }
548
663
 
549
664
  // 移除 react-pageflip 默认添加的样式影响
550
665
  &.stf__item {
@@ -574,7 +689,7 @@
574
689
  box-sizing: border-box;
575
690
  }
576
691
 
577
- .project-cover-header {
692
+ .project-cover-header {
578
693
  text-align: center;
579
694
  color: #000;
580
695
  // padding: 8px 0;
@@ -599,8 +714,8 @@
599
714
  .stat-cell-label {
600
715
  flex: 1;
601
716
  text-align: center;
602
- height: 52px;
603
- line-height: 52px;
717
+ height: 42px;
718
+ line-height: 42px;
604
719
  // padding: 8px;
605
720
  border-right: 1px solid #000;
606
721
  display: flex;
@@ -612,8 +727,8 @@
612
727
  .stat-cell-value {
613
728
  flex: 1;
614
729
  text-align: center;
615
- height: 52px;
616
- line-height: 52px;
730
+ height: 42px;
731
+ line-height: 42px;
617
732
  border-right: 1px solid #000;
618
733
  font-family: "Times New Roman", serif;
619
734
  font-size: 18px;
@@ -3,4 +3,5 @@ export declare function printArchiveAsPdf(params: {
3
3
  pages: BuiltPage[];
4
4
  getDocument: (path: string) => Promise<PdfDocumentLike>;
5
5
  scale?: number;
6
+ printType?: 'A4' | 'A5';
6
7
  }): Promise<void>;