unika-components 1.0.323 → 1.0.325
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/WorkRender/WorkRenderer.vue.d.ts +2 -2
- package/dist/unika-components.css +120 -121
- package/dist/unika-components.esm.js +269 -127
- package/dist/unika-components.umd.js +268 -126
- package/package.json +14 -16
|
@@ -11,8 +11,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
};
|
|
12
12
|
}, {
|
|
13
13
|
bgMusic: Ref<HTMLAudioElement | null>;
|
|
14
|
-
personalData:
|
|
15
|
-
global:
|
|
14
|
+
personalData: import("vue").ComputedRef<PersonalData>;
|
|
15
|
+
global: import("vue").ComputedRef<GlobalData>;
|
|
16
16
|
pages: import("vue").ComputedRef<PageData[]>;
|
|
17
17
|
displayPages: import("vue").ComputedRef<PageData[]>;
|
|
18
18
|
currentPageId: Ref<string>;
|
|
@@ -240,6 +240,14 @@
|
|
|
240
240
|
background: rgba(0, 0, 0, 0.8);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
.uni-lotties-component {
|
|
244
|
+
width: 100%;
|
|
245
|
+
height: 100%;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.uni-build-up-component {
|
|
249
|
+
}
|
|
250
|
+
|
|
243
251
|
.like-button {
|
|
244
252
|
display: flex;
|
|
245
253
|
flex-direction: column;
|
|
@@ -262,11 +270,6 @@
|
|
|
262
270
|
color: #333;
|
|
263
271
|
}
|
|
264
272
|
|
|
265
|
-
.uni-lotties-component {
|
|
266
|
-
width: 100%;
|
|
267
|
-
height: 100%;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
273
|
.ant-input-number {
|
|
271
274
|
box-sizing: border-box;
|
|
272
275
|
margin: 0;
|
|
@@ -301,19 +304,16 @@
|
|
|
301
304
|
margin-bottom: 0px;
|
|
302
305
|
vertical-align: top;
|
|
303
306
|
}
|
|
307
|
+
|
|
308
|
+
.uni-svg-component {
|
|
309
|
+
display: inline-block;
|
|
310
|
+
}
|
|
304
311
|
|
|
305
312
|
.effect {
|
|
306
313
|
width: 100%;
|
|
307
314
|
height: 100%;
|
|
308
315
|
}
|
|
309
316
|
|
|
310
|
-
.uni-build-up-component {
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.uni-svg-component {
|
|
314
|
-
display: inline-block;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
317
|
|
|
318
318
|
.no-animation__card {
|
|
319
319
|
font-weight: 500;
|
|
@@ -500,7 +500,114 @@
|
|
|
500
500
|
z-index: 5;
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
|
|
503
|
+
|
|
504
|
+
.page-indicator {
|
|
505
|
+
position: fixed;
|
|
506
|
+
display: flex;
|
|
507
|
+
align-items: center;
|
|
508
|
+
justify-content: center;
|
|
509
|
+
z-index: 1000;
|
|
510
|
+
transition: all 0.3s ease;
|
|
511
|
+
|
|
512
|
+
/* 默认位置(底部居中) */
|
|
513
|
+
&.bottom {
|
|
514
|
+
bottom: 20px;
|
|
515
|
+
left: 50%;
|
|
516
|
+
transform: translateX(-50%);
|
|
517
|
+
flex-direction: row;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/* 顶部样式 */
|
|
521
|
+
&.top {
|
|
522
|
+
top: 20px;
|
|
523
|
+
left: 50%;
|
|
524
|
+
transform: translateX(-50%);
|
|
525
|
+
flex-direction: row;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* 左侧样式 */
|
|
529
|
+
&.left {
|
|
530
|
+
left: 20px;
|
|
531
|
+
top: 50%;
|
|
532
|
+
transform: translateY(-50%);
|
|
533
|
+
flex-direction: column;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/* 右侧样式 */
|
|
537
|
+
&.right {
|
|
538
|
+
right: 20px;
|
|
539
|
+
top: 50%;
|
|
540
|
+
transform: translateY(-50%);
|
|
541
|
+
flex-direction: column;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/* 点状样式 */
|
|
545
|
+
&.dot-style {
|
|
546
|
+
.indicator-dot {
|
|
547
|
+
width: v-bind('size + "px"');
|
|
548
|
+
height: v-bind('size + "px"');
|
|
549
|
+
margin: v-bind('spacing/2 + "px"');
|
|
550
|
+
border-radius: 50%;
|
|
551
|
+
background-color: v-bind('color + "4D"'); /* 添加透明度 */
|
|
552
|
+
display: flex;
|
|
553
|
+
align-items: center;
|
|
554
|
+
justify-content: center;
|
|
555
|
+
cursor: pointer;
|
|
556
|
+
transition: all 0.3s ease;
|
|
557
|
+
|
|
558
|
+
.active-dot {
|
|
559
|
+
border-radius: 50%;
|
|
560
|
+
transition: all 0.3s ease;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
&:hover {
|
|
564
|
+
background-color: v-bind('color + "80"');
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
&.active {
|
|
568
|
+
background-color: transparent;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/* 数字样式 */
|
|
574
|
+
&.number-style {
|
|
575
|
+
padding: 6px 12px;
|
|
576
|
+
border-radius: 20px;
|
|
577
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
578
|
+
color: v-bind('color');
|
|
579
|
+
font-size: 14px;
|
|
580
|
+
|
|
581
|
+
.current-page {
|
|
582
|
+
color: v-bind('activeColor');
|
|
583
|
+
font-weight: bold;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.separator {
|
|
587
|
+
margin: 0 4px;
|
|
588
|
+
opacity: 0.6;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.total-pages {
|
|
592
|
+
opacity: 0.8;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.dynamic-element {
|
|
598
|
+
position: absolute;
|
|
599
|
+
box-sizing: border-box;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.is-sign {
|
|
603
|
+
z-index: 10;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.is-locked {
|
|
607
|
+
pointer-events: none;
|
|
608
|
+
opacity: 0.7;
|
|
609
|
+
}
|
|
610
|
+
|
|
504
611
|
.unika-calendar-box {
|
|
505
612
|
position: relative;
|
|
506
613
|
width: 325px !important;
|
|
@@ -761,111 +868,3 @@
|
|
|
761
868
|
padding: 0 0px;
|
|
762
869
|
border-bottom: 1px solid
|
|
763
870
|
}
|
|
764
|
-
|
|
765
|
-
.dynamic-element {
|
|
766
|
-
position: absolute;
|
|
767
|
-
box-sizing: border-box;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
.is-sign {
|
|
771
|
-
z-index: 10;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
.is-locked {
|
|
775
|
-
pointer-events: none;
|
|
776
|
-
opacity: 0.7;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
.page-indicator {
|
|
780
|
-
position: fixed;
|
|
781
|
-
display: flex;
|
|
782
|
-
align-items: center;
|
|
783
|
-
justify-content: center;
|
|
784
|
-
z-index: 1000;
|
|
785
|
-
transition: all 0.3s ease;
|
|
786
|
-
|
|
787
|
-
/* 默认位置(底部居中) */
|
|
788
|
-
&.bottom {
|
|
789
|
-
bottom: 20px;
|
|
790
|
-
left: 50%;
|
|
791
|
-
transform: translateX(-50%);
|
|
792
|
-
flex-direction: row;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
/* 顶部样式 */
|
|
796
|
-
&.top {
|
|
797
|
-
top: 20px;
|
|
798
|
-
left: 50%;
|
|
799
|
-
transform: translateX(-50%);
|
|
800
|
-
flex-direction: row;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
/* 左侧样式 */
|
|
804
|
-
&.left {
|
|
805
|
-
left: 20px;
|
|
806
|
-
top: 50%;
|
|
807
|
-
transform: translateY(-50%);
|
|
808
|
-
flex-direction: column;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
/* 右侧样式 */
|
|
812
|
-
&.right {
|
|
813
|
-
right: 20px;
|
|
814
|
-
top: 50%;
|
|
815
|
-
transform: translateY(-50%);
|
|
816
|
-
flex-direction: column;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
/* 点状样式 */
|
|
820
|
-
&.dot-style {
|
|
821
|
-
.indicator-dot {
|
|
822
|
-
width: v-bind('size + "px"');
|
|
823
|
-
height: v-bind('size + "px"');
|
|
824
|
-
margin: v-bind('spacing/2 + "px"');
|
|
825
|
-
border-radius: 50%;
|
|
826
|
-
background-color: v-bind('color + "4D"'); /* 添加透明度 */
|
|
827
|
-
display: flex;
|
|
828
|
-
align-items: center;
|
|
829
|
-
justify-content: center;
|
|
830
|
-
cursor: pointer;
|
|
831
|
-
transition: all 0.3s ease;
|
|
832
|
-
|
|
833
|
-
.active-dot {
|
|
834
|
-
border-radius: 50%;
|
|
835
|
-
transition: all 0.3s ease;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
&:hover {
|
|
839
|
-
background-color: v-bind('color + "80"');
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
&.active {
|
|
843
|
-
background-color: transparent;
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/* 数字样式 */
|
|
849
|
-
&.number-style {
|
|
850
|
-
padding: 6px 12px;
|
|
851
|
-
border-radius: 20px;
|
|
852
|
-
background-color: rgba(0, 0, 0, 0.3);
|
|
853
|
-
color: v-bind('color');
|
|
854
|
-
font-size: 14px;
|
|
855
|
-
|
|
856
|
-
.current-page {
|
|
857
|
-
color: v-bind('activeColor');
|
|
858
|
-
font-weight: bold;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
.separator {
|
|
862
|
-
margin: 0 4px;
|
|
863
|
-
opacity: 0.6;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
.total-pages {
|
|
867
|
-
opacity: 0.8;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeStyle as normalizeStyle$1, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, nextTick, withModifiers, Fragment, renderList, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps, renderSlot, withDirectives, mergeProps, vShow, useCssVars, normalizeClass, pushScopeId, popScopeId,
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeStyle as normalizeStyle$1, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, nextTick, withModifiers, Fragment, renderList, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps, renderSlot, withDirectives, mergeProps, vShow, useCssVars, normalizeClass, pushScopeId, popScopeId, watch, resolveComponent, createVNode, Transition, withCtx, toRefs, onMounted, onBeforeMount, onUnmounted, h as h$2, isVNode, Comment, Text, reactive, getCurrentInstance, onUpdated, inject, provide, unref, shallowRef, watchEffect, onBeforeUnmount, triggerRef, resolveDirective, cloneVNode, toRef, Teleport, isRef, toRaw, render as render$o, TransitionGroup, onBeforeUpdate } from 'vue';
|
|
2
2
|
import crypto from 'crypto';
|
|
3
3
|
|
|
4
4
|
var script$l = defineComponent({
|
|
@@ -6055,6 +6055,7 @@ __default__.__file = "src/components/WorkRender/PageIndicator.vue";
|
|
|
6055
6055
|
|
|
6056
6056
|
function usePageTransition(pages, currentPageId) {
|
|
6057
6057
|
const deltaY = ref(0);
|
|
6058
|
+
// 计算页面切换动画
|
|
6058
6059
|
const pageTransition = computed(() => {
|
|
6059
6060
|
if (!deltaY.value)
|
|
6060
6061
|
return 'fade';
|
|
@@ -6070,90 +6071,139 @@ function useTouchHandler(pages, currentPageId, deltaY) {
|
|
|
6070
6071
|
const touchStartX = ref(0);
|
|
6071
6072
|
const touchStartY = ref(0);
|
|
6072
6073
|
const isDragging = ref(false);
|
|
6073
|
-
const isScrollMode = computed(() =>
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
let targetIndex;
|
|
6077
|
-
if (direction === 'up') {
|
|
6078
|
-
targetIndex = currentIndex - 1;
|
|
6079
|
-
if (targetIndex < 0) {
|
|
6080
|
-
// 如果是第一页,切换到最后一页
|
|
6081
|
-
currentPageId.value = pages.value[pages.value.length - 1].pageId;
|
|
6082
|
-
return;
|
|
6083
|
-
}
|
|
6074
|
+
const isScrollMode = computed(() => {
|
|
6075
|
+
try {
|
|
6076
|
+
return false; // This should be passed as a prop in a real implementation
|
|
6084
6077
|
}
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6078
|
+
catch (error) {
|
|
6079
|
+
console.warn('Error computing isScrollMode:', error);
|
|
6080
|
+
return false;
|
|
6081
|
+
}
|
|
6082
|
+
});
|
|
6083
|
+
const handlePageSwitch = async (direction) => {
|
|
6084
|
+
try {
|
|
6085
|
+
const currentIndex = pages.value?.findIndex(page => page.pageId === currentPageId.value);
|
|
6086
|
+
let targetIndex;
|
|
6087
|
+
if (direction === 'up') {
|
|
6088
|
+
targetIndex = currentIndex - 1;
|
|
6089
|
+
if (targetIndex < 0) {
|
|
6090
|
+
// 如果是第一页,切换到最后一页
|
|
6091
|
+
currentPageId.value = pages.value[pages.value.length - 1].pageId;
|
|
6092
|
+
return;
|
|
6093
|
+
}
|
|
6094
|
+
}
|
|
6095
|
+
else {
|
|
6096
|
+
targetIndex = currentIndex + 1;
|
|
6097
|
+
if (targetIndex >= pages.value.length) {
|
|
6098
|
+
// 如果是最后一页,切换到第一页
|
|
6099
|
+
currentPageId.value = pages.value[0].pageId;
|
|
6100
|
+
return;
|
|
6101
|
+
}
|
|
6102
|
+
}
|
|
6103
|
+
const targetPage = pages.value[targetIndex];
|
|
6104
|
+
if (targetPage) {
|
|
6105
|
+
currentPageId.value = targetPage.pageId;
|
|
6091
6106
|
}
|
|
6092
6107
|
}
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
currentPageId.value = targetPage.pageId;
|
|
6108
|
+
catch (error) {
|
|
6109
|
+
console.warn('Page switch error:', error);
|
|
6096
6110
|
}
|
|
6097
6111
|
};
|
|
6098
6112
|
const handleTouchStart = (e) => {
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6113
|
+
try {
|
|
6114
|
+
if (isScrollMode.value)
|
|
6115
|
+
return;
|
|
6116
|
+
touchStartX.value = e.touches[0].clientX;
|
|
6117
|
+
touchStartY.value = e.touches[0].clientY;
|
|
6118
|
+
isDragging.value = true;
|
|
6119
|
+
}
|
|
6120
|
+
catch (error) {
|
|
6121
|
+
console.warn('Touch start error:', error);
|
|
6122
|
+
isDragging.value = false;
|
|
6123
|
+
}
|
|
6104
6124
|
};
|
|
6105
6125
|
const handleTouchMove = (e) => {
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6126
|
+
try {
|
|
6127
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6128
|
+
return;
|
|
6129
|
+
e.preventDefault();
|
|
6130
|
+
}
|
|
6131
|
+
catch (error) {
|
|
6132
|
+
console.warn('Touch move error:', error);
|
|
6133
|
+
isDragging.value = false;
|
|
6134
|
+
}
|
|
6109
6135
|
};
|
|
6110
6136
|
const handleTouchEnd = (e) => {
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
if (deltaY.value >
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6137
|
+
try {
|
|
6138
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6139
|
+
return;
|
|
6140
|
+
const touchEndX = e.changedTouches[0].clientX;
|
|
6141
|
+
const touchEndY = e.changedTouches[0].clientY;
|
|
6142
|
+
const deltaX = touchEndX - touchStartX.value;
|
|
6143
|
+
deltaY.value = touchEndY - touchStartY.value;
|
|
6144
|
+
// 如果垂直滑动距离大于水平滑动距离,则进行翻页
|
|
6145
|
+
if (Math.abs(deltaY.value) > Math.abs(deltaX)) {
|
|
6146
|
+
if (deltaY.value > 50) {
|
|
6147
|
+
handlePageSwitch('up');
|
|
6148
|
+
}
|
|
6149
|
+
else if (deltaY.value < -50) {
|
|
6150
|
+
handlePageSwitch('down');
|
|
6151
|
+
}
|
|
6124
6152
|
}
|
|
6153
|
+
isDragging.value = false;
|
|
6154
|
+
}
|
|
6155
|
+
catch (error) {
|
|
6156
|
+
console.warn('Touch end error:', error);
|
|
6157
|
+
isDragging.value = false;
|
|
6125
6158
|
}
|
|
6126
|
-
isDragging.value = false;
|
|
6127
6159
|
};
|
|
6128
6160
|
const handleMouseDown = (e) => {
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6161
|
+
try {
|
|
6162
|
+
if (isScrollMode.value)
|
|
6163
|
+
return;
|
|
6164
|
+
touchStartX.value = e.clientX;
|
|
6165
|
+
touchStartY.value = e.clientY;
|
|
6166
|
+
isDragging.value = true;
|
|
6167
|
+
}
|
|
6168
|
+
catch (error) {
|
|
6169
|
+
console.warn('Mouse down error:', error);
|
|
6170
|
+
isDragging.value = false;
|
|
6171
|
+
}
|
|
6134
6172
|
};
|
|
6135
6173
|
const handleMouseMove = (e) => {
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6174
|
+
try {
|
|
6175
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6176
|
+
return;
|
|
6177
|
+
e.preventDefault();
|
|
6178
|
+
}
|
|
6179
|
+
catch (error) {
|
|
6180
|
+
console.warn('Mouse move error:', error);
|
|
6181
|
+
isDragging.value = false;
|
|
6182
|
+
}
|
|
6139
6183
|
};
|
|
6140
6184
|
const handleMouseUp = (e) => {
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
if (deltaY.value >
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6185
|
+
try {
|
|
6186
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6187
|
+
return;
|
|
6188
|
+
const touchEndX = e.clientX;
|
|
6189
|
+
const touchEndY = e.clientY;
|
|
6190
|
+
const deltaX = touchEndX - touchStartX.value;
|
|
6191
|
+
deltaY.value = touchEndY - touchStartY.value;
|
|
6192
|
+
// 如果垂直滑动距离大于水平滑动距离,则进行翻页
|
|
6193
|
+
if (Math.abs(deltaY.value) > Math.abs(deltaX)) {
|
|
6194
|
+
if (deltaY.value > 50) {
|
|
6195
|
+
handlePageSwitch('up');
|
|
6196
|
+
}
|
|
6197
|
+
else if (deltaY.value < -50) {
|
|
6198
|
+
handlePageSwitch('down');
|
|
6199
|
+
}
|
|
6154
6200
|
}
|
|
6201
|
+
isDragging.value = false;
|
|
6202
|
+
}
|
|
6203
|
+
catch (error) {
|
|
6204
|
+
console.warn('Mouse up error:', error);
|
|
6205
|
+
isDragging.value = false;
|
|
6155
6206
|
}
|
|
6156
|
-
isDragging.value = false;
|
|
6157
6207
|
};
|
|
6158
6208
|
return {
|
|
6159
6209
|
handleTouchStart,
|
|
@@ -6180,87 +6230,179 @@ var script$f = defineComponent({
|
|
|
6180
6230
|
},
|
|
6181
6231
|
setup(props) {
|
|
6182
6232
|
const bgMusic = ref(null);
|
|
6183
|
-
const currentPageId = ref(
|
|
6184
|
-
//
|
|
6185
|
-
|
|
6186
|
-
|
|
6233
|
+
const currentPageId = ref('');
|
|
6234
|
+
// 初始化 currentPageId
|
|
6235
|
+
try {
|
|
6236
|
+
if (props.workData && props.workData.pages && props.workData.pages[0]) {
|
|
6237
|
+
currentPageId.value = props.workData.pages[0].pageId;
|
|
6238
|
+
}
|
|
6239
|
+
}
|
|
6240
|
+
catch (error) {
|
|
6241
|
+
console.warn('Failed to initialize currentPageId:', error);
|
|
6242
|
+
}
|
|
6243
|
+
// 使用 computed 保持响应性
|
|
6244
|
+
const workData = computed(() => props.workData || {});
|
|
6245
|
+
const personalData = computed(() => workData.value.personalData || {});
|
|
6246
|
+
const global = computed(() => workData.value.global || {});
|
|
6247
|
+
const pages = computed(() => workData.value.pages || []);
|
|
6187
6248
|
// 计算是否启用循环
|
|
6188
|
-
const isLoopEnabled = computed(() =>
|
|
6249
|
+
const isLoopEnabled = computed(() => {
|
|
6250
|
+
try {
|
|
6251
|
+
return global.value?.pageLoop === true;
|
|
6252
|
+
}
|
|
6253
|
+
catch (error) {
|
|
6254
|
+
console.warn('Error computing isLoopEnabled:', error);
|
|
6255
|
+
return false;
|
|
6256
|
+
}
|
|
6257
|
+
});
|
|
6189
6258
|
// 计算显示的页面列表(循环模式下添加首尾页面)
|
|
6190
6259
|
const displayPages = computed(() => {
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6260
|
+
try {
|
|
6261
|
+
if (!isLoopEnabled.value || !pages.value?.length)
|
|
6262
|
+
return pages.value;
|
|
6263
|
+
const firstPage = pages.value[0];
|
|
6264
|
+
const lastPage = pages.value[pages.value.length - 1];
|
|
6265
|
+
return [
|
|
6266
|
+
{ ...lastPage, pageId: 'pre-' + lastPage.pageId },
|
|
6267
|
+
...pages.value,
|
|
6268
|
+
{ ...firstPage, pageId: 'post-' + firstPage.pageId }
|
|
6269
|
+
];
|
|
6270
|
+
}
|
|
6271
|
+
catch (error) {
|
|
6272
|
+
console.warn('Error computing displayPages:', error);
|
|
6273
|
+
return pages.value || [];
|
|
6274
|
+
}
|
|
6200
6275
|
});
|
|
6201
6276
|
// 使用组合式函数
|
|
6202
6277
|
const { pageTransition, deltaY } = usePageTransition();
|
|
6203
6278
|
const { handleTouchStart, handleTouchMove, handleTouchEnd, handleMouseDown, handleMouseMove, handleMouseUp } = useTouchHandler(displayPages, currentPageId, deltaY);
|
|
6204
6279
|
// 计算属性
|
|
6205
|
-
const containerStyle = computed(() =>
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6280
|
+
const containerStyle = computed(() => {
|
|
6281
|
+
try {
|
|
6282
|
+
return {
|
|
6283
|
+
width: global.value?.width ?? '100%',
|
|
6284
|
+
height: global.value?.height ?? '100vh',
|
|
6285
|
+
backgroundColor: global.value?.themeColor ?? '#ffffff'
|
|
6286
|
+
};
|
|
6287
|
+
}
|
|
6288
|
+
catch (error) {
|
|
6289
|
+
console.warn('Error computing containerStyle:', error);
|
|
6290
|
+
return {
|
|
6291
|
+
width: '100%',
|
|
6292
|
+
height: '100vh',
|
|
6293
|
+
backgroundColor: '#ffffff'
|
|
6294
|
+
};
|
|
6295
|
+
}
|
|
6218
6296
|
});
|
|
6297
|
+
const showPageIndicator = computed(() => {
|
|
6298
|
+
try {
|
|
6299
|
+
return pages.value?.length > 1 && global.value?.pageDot !== undefined;
|
|
6300
|
+
}
|
|
6301
|
+
catch (error) {
|
|
6302
|
+
console.warn('Error computing showPageIndicator:', error);
|
|
6303
|
+
return false;
|
|
6304
|
+
}
|
|
6305
|
+
});
|
|
6306
|
+
const isScrollMode = computed(() => {
|
|
6307
|
+
try {
|
|
6308
|
+
return global.value?.cat === 'long';
|
|
6309
|
+
}
|
|
6310
|
+
catch (error) {
|
|
6311
|
+
console.warn('Error computing isScrollMode:', error);
|
|
6312
|
+
return false;
|
|
6313
|
+
}
|
|
6314
|
+
});
|
|
6315
|
+
// 方法
|
|
6316
|
+
const getPageStyle = (page) => {
|
|
6317
|
+
try {
|
|
6318
|
+
return {
|
|
6319
|
+
backgroundColor: page?.bgColor,
|
|
6320
|
+
backgroundImage: page?.bgImage ? `url(${page.bgImage})` : 'none',
|
|
6321
|
+
opacity: page?.bgOpacity || '1',
|
|
6322
|
+
animation: page?.bgAni?.aniCss || page?.bgAni?.aniCss2 || ''
|
|
6323
|
+
};
|
|
6324
|
+
}
|
|
6325
|
+
catch (error) {
|
|
6326
|
+
console.warn('Error computing page style:', error);
|
|
6327
|
+
return {
|
|
6328
|
+
backgroundColor: '#ffffff',
|
|
6329
|
+
backgroundImage: 'none',
|
|
6330
|
+
opacity: '1',
|
|
6331
|
+
animation: ''
|
|
6332
|
+
};
|
|
6333
|
+
}
|
|
6334
|
+
};
|
|
6219
6335
|
const getPageClasses = (page) => {
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6336
|
+
try {
|
|
6337
|
+
const classes = [];
|
|
6338
|
+
if (page?.bgAni?.aniList?.[0]?.animate) {
|
|
6339
|
+
classes.push(`animate-${page.bgAni.aniList[0].animate}`);
|
|
6340
|
+
}
|
|
6341
|
+
return classes;
|
|
6342
|
+
}
|
|
6343
|
+
catch (error) {
|
|
6344
|
+
console.warn('Error computing page classes:', error);
|
|
6345
|
+
return [];
|
|
6223
6346
|
}
|
|
6224
|
-
return classes;
|
|
6225
6347
|
};
|
|
6226
6348
|
const switchPage = (pageId) => {
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6349
|
+
try {
|
|
6350
|
+
// 处理循环页面的切换
|
|
6351
|
+
if (isLoopEnabled.value) {
|
|
6352
|
+
const currentIndex = displayPages.value.findIndex(page => page.pageId === currentPageId.value);
|
|
6353
|
+
const targetIndex = displayPages.value.findIndex(page => page.pageId === pageId);
|
|
6354
|
+
// 如果是切换到首尾的副本页面,需要跳转到对应的真实页面
|
|
6355
|
+
if (pageId.startsWith('pre-')) {
|
|
6356
|
+
const realPageId = pageId.replace('pre-', '');
|
|
6357
|
+
currentPageId.value = realPageId;
|
|
6358
|
+
return;
|
|
6359
|
+
}
|
|
6360
|
+
if (pageId.startsWith('post-')) {
|
|
6361
|
+
const realPageId = pageId.replace('post-', '');
|
|
6362
|
+
currentPageId.value = realPageId;
|
|
6363
|
+
return;
|
|
6364
|
+
}
|
|
6365
|
+
// 处理循环切换
|
|
6366
|
+
if (currentIndex === 1 && targetIndex === 0) {
|
|
6367
|
+
currentPageId.value = pages.value[pages.value.length - 1].pageId;
|
|
6368
|
+
return;
|
|
6369
|
+
}
|
|
6370
|
+
if (currentIndex === pages.value.length && targetIndex === pages.value.length + 1) {
|
|
6371
|
+
currentPageId.value = pages.value[0].pageId;
|
|
6372
|
+
return;
|
|
6373
|
+
}
|
|
6252
6374
|
}
|
|
6375
|
+
currentPageId.value = pageId;
|
|
6376
|
+
}
|
|
6377
|
+
catch (error) {
|
|
6378
|
+
console.warn('Error switching page:', error);
|
|
6253
6379
|
}
|
|
6254
|
-
currentPageId.value = pageId;
|
|
6255
6380
|
};
|
|
6256
6381
|
const handleElementTrigger = (payload) => {
|
|
6257
|
-
|
|
6258
|
-
|
|
6382
|
+
try {
|
|
6383
|
+
console.log('Element triggered:', payload);
|
|
6384
|
+
}
|
|
6385
|
+
catch (error) {
|
|
6386
|
+
console.warn('Error handling element trigger:', error);
|
|
6387
|
+
}
|
|
6259
6388
|
};
|
|
6260
6389
|
// 自动播放处理
|
|
6261
|
-
watch(() => props.autoPlay, (newVal) => {
|
|
6390
|
+
watch(() => props.autoPlay, async (newVal) => {
|
|
6262
6391
|
if (newVal && bgMusic.value) {
|
|
6263
|
-
|
|
6392
|
+
try {
|
|
6393
|
+
await bgMusic.value.play();
|
|
6394
|
+
}
|
|
6395
|
+
catch (error) {
|
|
6396
|
+
console.warn('Autoplay prevented:', error);
|
|
6397
|
+
// 尝试静音播放
|
|
6398
|
+
try {
|
|
6399
|
+
bgMusic.value.muted = true;
|
|
6400
|
+
await bgMusic.value.play();
|
|
6401
|
+
}
|
|
6402
|
+
catch (e) {
|
|
6403
|
+
console.warn('Muted autoplay also prevented:', e);
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6264
6406
|
}
|
|
6265
6407
|
}, { immediate: true });
|
|
6266
6408
|
return {
|
|
@@ -6306,7 +6448,7 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6306
6448
|
onMouseleave: _cache[6] || (_cache[6] = (...args) => (_ctx.handleMouseUp && _ctx.handleMouseUp(...args)))
|
|
6307
6449
|
}, [
|
|
6308
6450
|
createCommentVNode(" 背景音乐 "),
|
|
6309
|
-
(_ctx.global
|
|
6451
|
+
(_ctx.global && _ctx.global.music && _ctx.global.music.musicSrc)
|
|
6310
6452
|
? (openBlock(), createElementBlock("audio", {
|
|
6311
6453
|
key: 0,
|
|
6312
6454
|
ref: "bgMusic",
|
|
@@ -6062,6 +6062,7 @@
|
|
|
6062
6062
|
|
|
6063
6063
|
function usePageTransition(pages, currentPageId) {
|
|
6064
6064
|
const deltaY = vue.ref(0);
|
|
6065
|
+
// 计算页面切换动画
|
|
6065
6066
|
const pageTransition = vue.computed(() => {
|
|
6066
6067
|
if (!deltaY.value)
|
|
6067
6068
|
return 'fade';
|
|
@@ -6077,90 +6078,139 @@
|
|
|
6077
6078
|
const touchStartX = vue.ref(0);
|
|
6078
6079
|
const touchStartY = vue.ref(0);
|
|
6079
6080
|
const isDragging = vue.ref(false);
|
|
6080
|
-
const isScrollMode = vue.computed(() =>
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
let targetIndex;
|
|
6084
|
-
if (direction === 'up') {
|
|
6085
|
-
targetIndex = currentIndex - 1;
|
|
6086
|
-
if (targetIndex < 0) {
|
|
6087
|
-
// 如果是第一页,切换到最后一页
|
|
6088
|
-
currentPageId.value = pages.value[pages.value.length - 1].pageId;
|
|
6089
|
-
return;
|
|
6090
|
-
}
|
|
6081
|
+
const isScrollMode = vue.computed(() => {
|
|
6082
|
+
try {
|
|
6083
|
+
return false; // This should be passed as a prop in a real implementation
|
|
6091
6084
|
}
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6085
|
+
catch (error) {
|
|
6086
|
+
console.warn('Error computing isScrollMode:', error);
|
|
6087
|
+
return false;
|
|
6088
|
+
}
|
|
6089
|
+
});
|
|
6090
|
+
const handlePageSwitch = async (direction) => {
|
|
6091
|
+
try {
|
|
6092
|
+
const currentIndex = pages.value?.findIndex(page => page.pageId === currentPageId.value);
|
|
6093
|
+
let targetIndex;
|
|
6094
|
+
if (direction === 'up') {
|
|
6095
|
+
targetIndex = currentIndex - 1;
|
|
6096
|
+
if (targetIndex < 0) {
|
|
6097
|
+
// 如果是第一页,切换到最后一页
|
|
6098
|
+
currentPageId.value = pages.value[pages.value.length - 1].pageId;
|
|
6099
|
+
return;
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
else {
|
|
6103
|
+
targetIndex = currentIndex + 1;
|
|
6104
|
+
if (targetIndex >= pages.value.length) {
|
|
6105
|
+
// 如果是最后一页,切换到第一页
|
|
6106
|
+
currentPageId.value = pages.value[0].pageId;
|
|
6107
|
+
return;
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
const targetPage = pages.value[targetIndex];
|
|
6111
|
+
if (targetPage) {
|
|
6112
|
+
currentPageId.value = targetPage.pageId;
|
|
6098
6113
|
}
|
|
6099
6114
|
}
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
currentPageId.value = targetPage.pageId;
|
|
6115
|
+
catch (error) {
|
|
6116
|
+
console.warn('Page switch error:', error);
|
|
6103
6117
|
}
|
|
6104
6118
|
};
|
|
6105
6119
|
const handleTouchStart = (e) => {
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6120
|
+
try {
|
|
6121
|
+
if (isScrollMode.value)
|
|
6122
|
+
return;
|
|
6123
|
+
touchStartX.value = e.touches[0].clientX;
|
|
6124
|
+
touchStartY.value = e.touches[0].clientY;
|
|
6125
|
+
isDragging.value = true;
|
|
6126
|
+
}
|
|
6127
|
+
catch (error) {
|
|
6128
|
+
console.warn('Touch start error:', error);
|
|
6129
|
+
isDragging.value = false;
|
|
6130
|
+
}
|
|
6111
6131
|
};
|
|
6112
6132
|
const handleTouchMove = (e) => {
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6133
|
+
try {
|
|
6134
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6135
|
+
return;
|
|
6136
|
+
e.preventDefault();
|
|
6137
|
+
}
|
|
6138
|
+
catch (error) {
|
|
6139
|
+
console.warn('Touch move error:', error);
|
|
6140
|
+
isDragging.value = false;
|
|
6141
|
+
}
|
|
6116
6142
|
};
|
|
6117
6143
|
const handleTouchEnd = (e) => {
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
if (deltaY.value >
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6144
|
+
try {
|
|
6145
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6146
|
+
return;
|
|
6147
|
+
const touchEndX = e.changedTouches[0].clientX;
|
|
6148
|
+
const touchEndY = e.changedTouches[0].clientY;
|
|
6149
|
+
const deltaX = touchEndX - touchStartX.value;
|
|
6150
|
+
deltaY.value = touchEndY - touchStartY.value;
|
|
6151
|
+
// 如果垂直滑动距离大于水平滑动距离,则进行翻页
|
|
6152
|
+
if (Math.abs(deltaY.value) > Math.abs(deltaX)) {
|
|
6153
|
+
if (deltaY.value > 50) {
|
|
6154
|
+
handlePageSwitch('up');
|
|
6155
|
+
}
|
|
6156
|
+
else if (deltaY.value < -50) {
|
|
6157
|
+
handlePageSwitch('down');
|
|
6158
|
+
}
|
|
6131
6159
|
}
|
|
6160
|
+
isDragging.value = false;
|
|
6161
|
+
}
|
|
6162
|
+
catch (error) {
|
|
6163
|
+
console.warn('Touch end error:', error);
|
|
6164
|
+
isDragging.value = false;
|
|
6132
6165
|
}
|
|
6133
|
-
isDragging.value = false;
|
|
6134
6166
|
};
|
|
6135
6167
|
const handleMouseDown = (e) => {
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6168
|
+
try {
|
|
6169
|
+
if (isScrollMode.value)
|
|
6170
|
+
return;
|
|
6171
|
+
touchStartX.value = e.clientX;
|
|
6172
|
+
touchStartY.value = e.clientY;
|
|
6173
|
+
isDragging.value = true;
|
|
6174
|
+
}
|
|
6175
|
+
catch (error) {
|
|
6176
|
+
console.warn('Mouse down error:', error);
|
|
6177
|
+
isDragging.value = false;
|
|
6178
|
+
}
|
|
6141
6179
|
};
|
|
6142
6180
|
const handleMouseMove = (e) => {
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6181
|
+
try {
|
|
6182
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6183
|
+
return;
|
|
6184
|
+
e.preventDefault();
|
|
6185
|
+
}
|
|
6186
|
+
catch (error) {
|
|
6187
|
+
console.warn('Mouse move error:', error);
|
|
6188
|
+
isDragging.value = false;
|
|
6189
|
+
}
|
|
6146
6190
|
};
|
|
6147
6191
|
const handleMouseUp = (e) => {
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
if (deltaY.value >
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6192
|
+
try {
|
|
6193
|
+
if (!isDragging.value || isScrollMode.value)
|
|
6194
|
+
return;
|
|
6195
|
+
const touchEndX = e.clientX;
|
|
6196
|
+
const touchEndY = e.clientY;
|
|
6197
|
+
const deltaX = touchEndX - touchStartX.value;
|
|
6198
|
+
deltaY.value = touchEndY - touchStartY.value;
|
|
6199
|
+
// 如果垂直滑动距离大于水平滑动距离,则进行翻页
|
|
6200
|
+
if (Math.abs(deltaY.value) > Math.abs(deltaX)) {
|
|
6201
|
+
if (deltaY.value > 50) {
|
|
6202
|
+
handlePageSwitch('up');
|
|
6203
|
+
}
|
|
6204
|
+
else if (deltaY.value < -50) {
|
|
6205
|
+
handlePageSwitch('down');
|
|
6206
|
+
}
|
|
6161
6207
|
}
|
|
6208
|
+
isDragging.value = false;
|
|
6209
|
+
}
|
|
6210
|
+
catch (error) {
|
|
6211
|
+
console.warn('Mouse up error:', error);
|
|
6212
|
+
isDragging.value = false;
|
|
6162
6213
|
}
|
|
6163
|
-
isDragging.value = false;
|
|
6164
6214
|
};
|
|
6165
6215
|
return {
|
|
6166
6216
|
handleTouchStart,
|
|
@@ -6187,87 +6237,179 @@
|
|
|
6187
6237
|
},
|
|
6188
6238
|
setup(props) {
|
|
6189
6239
|
const bgMusic = vue.ref(null);
|
|
6190
|
-
const currentPageId = vue.ref(
|
|
6191
|
-
//
|
|
6192
|
-
|
|
6193
|
-
|
|
6240
|
+
const currentPageId = vue.ref('');
|
|
6241
|
+
// 初始化 currentPageId
|
|
6242
|
+
try {
|
|
6243
|
+
if (props.workData && props.workData.pages && props.workData.pages[0]) {
|
|
6244
|
+
currentPageId.value = props.workData.pages[0].pageId;
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
6247
|
+
catch (error) {
|
|
6248
|
+
console.warn('Failed to initialize currentPageId:', error);
|
|
6249
|
+
}
|
|
6250
|
+
// 使用 computed 保持响应性
|
|
6251
|
+
const workData = vue.computed(() => props.workData || {});
|
|
6252
|
+
const personalData = vue.computed(() => workData.value.personalData || {});
|
|
6253
|
+
const global = vue.computed(() => workData.value.global || {});
|
|
6254
|
+
const pages = vue.computed(() => workData.value.pages || []);
|
|
6194
6255
|
// 计算是否启用循环
|
|
6195
|
-
const isLoopEnabled = vue.computed(() =>
|
|
6256
|
+
const isLoopEnabled = vue.computed(() => {
|
|
6257
|
+
try {
|
|
6258
|
+
return global.value?.pageLoop === true;
|
|
6259
|
+
}
|
|
6260
|
+
catch (error) {
|
|
6261
|
+
console.warn('Error computing isLoopEnabled:', error);
|
|
6262
|
+
return false;
|
|
6263
|
+
}
|
|
6264
|
+
});
|
|
6196
6265
|
// 计算显示的页面列表(循环模式下添加首尾页面)
|
|
6197
6266
|
const displayPages = vue.computed(() => {
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6267
|
+
try {
|
|
6268
|
+
if (!isLoopEnabled.value || !pages.value?.length)
|
|
6269
|
+
return pages.value;
|
|
6270
|
+
const firstPage = pages.value[0];
|
|
6271
|
+
const lastPage = pages.value[pages.value.length - 1];
|
|
6272
|
+
return [
|
|
6273
|
+
{ ...lastPage, pageId: 'pre-' + lastPage.pageId },
|
|
6274
|
+
...pages.value,
|
|
6275
|
+
{ ...firstPage, pageId: 'post-' + firstPage.pageId }
|
|
6276
|
+
];
|
|
6277
|
+
}
|
|
6278
|
+
catch (error) {
|
|
6279
|
+
console.warn('Error computing displayPages:', error);
|
|
6280
|
+
return pages.value || [];
|
|
6281
|
+
}
|
|
6207
6282
|
});
|
|
6208
6283
|
// 使用组合式函数
|
|
6209
6284
|
const { pageTransition, deltaY } = usePageTransition();
|
|
6210
6285
|
const { handleTouchStart, handleTouchMove, handleTouchEnd, handleMouseDown, handleMouseMove, handleMouseUp } = useTouchHandler(displayPages, currentPageId, deltaY);
|
|
6211
6286
|
// 计算属性
|
|
6212
|
-
const containerStyle = vue.computed(() =>
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6287
|
+
const containerStyle = vue.computed(() => {
|
|
6288
|
+
try {
|
|
6289
|
+
return {
|
|
6290
|
+
width: global.value?.width ?? '100%',
|
|
6291
|
+
height: global.value?.height ?? '100vh',
|
|
6292
|
+
backgroundColor: global.value?.themeColor ?? '#ffffff'
|
|
6293
|
+
};
|
|
6294
|
+
}
|
|
6295
|
+
catch (error) {
|
|
6296
|
+
console.warn('Error computing containerStyle:', error);
|
|
6297
|
+
return {
|
|
6298
|
+
width: '100%',
|
|
6299
|
+
height: '100vh',
|
|
6300
|
+
backgroundColor: '#ffffff'
|
|
6301
|
+
};
|
|
6302
|
+
}
|
|
6225
6303
|
});
|
|
6304
|
+
const showPageIndicator = vue.computed(() => {
|
|
6305
|
+
try {
|
|
6306
|
+
return pages.value?.length > 1 && global.value?.pageDot !== undefined;
|
|
6307
|
+
}
|
|
6308
|
+
catch (error) {
|
|
6309
|
+
console.warn('Error computing showPageIndicator:', error);
|
|
6310
|
+
return false;
|
|
6311
|
+
}
|
|
6312
|
+
});
|
|
6313
|
+
const isScrollMode = vue.computed(() => {
|
|
6314
|
+
try {
|
|
6315
|
+
return global.value?.cat === 'long';
|
|
6316
|
+
}
|
|
6317
|
+
catch (error) {
|
|
6318
|
+
console.warn('Error computing isScrollMode:', error);
|
|
6319
|
+
return false;
|
|
6320
|
+
}
|
|
6321
|
+
});
|
|
6322
|
+
// 方法
|
|
6323
|
+
const getPageStyle = (page) => {
|
|
6324
|
+
try {
|
|
6325
|
+
return {
|
|
6326
|
+
backgroundColor: page?.bgColor,
|
|
6327
|
+
backgroundImage: page?.bgImage ? `url(${page.bgImage})` : 'none',
|
|
6328
|
+
opacity: page?.bgOpacity || '1',
|
|
6329
|
+
animation: page?.bgAni?.aniCss || page?.bgAni?.aniCss2 || ''
|
|
6330
|
+
};
|
|
6331
|
+
}
|
|
6332
|
+
catch (error) {
|
|
6333
|
+
console.warn('Error computing page style:', error);
|
|
6334
|
+
return {
|
|
6335
|
+
backgroundColor: '#ffffff',
|
|
6336
|
+
backgroundImage: 'none',
|
|
6337
|
+
opacity: '1',
|
|
6338
|
+
animation: ''
|
|
6339
|
+
};
|
|
6340
|
+
}
|
|
6341
|
+
};
|
|
6226
6342
|
const getPageClasses = (page) => {
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6343
|
+
try {
|
|
6344
|
+
const classes = [];
|
|
6345
|
+
if (page?.bgAni?.aniList?.[0]?.animate) {
|
|
6346
|
+
classes.push(`animate-${page.bgAni.aniList[0].animate}`);
|
|
6347
|
+
}
|
|
6348
|
+
return classes;
|
|
6349
|
+
}
|
|
6350
|
+
catch (error) {
|
|
6351
|
+
console.warn('Error computing page classes:', error);
|
|
6352
|
+
return [];
|
|
6230
6353
|
}
|
|
6231
|
-
return classes;
|
|
6232
6354
|
};
|
|
6233
6355
|
const switchPage = (pageId) => {
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6356
|
+
try {
|
|
6357
|
+
// 处理循环页面的切换
|
|
6358
|
+
if (isLoopEnabled.value) {
|
|
6359
|
+
const currentIndex = displayPages.value.findIndex(page => page.pageId === currentPageId.value);
|
|
6360
|
+
const targetIndex = displayPages.value.findIndex(page => page.pageId === pageId);
|
|
6361
|
+
// 如果是切换到首尾的副本页面,需要跳转到对应的真实页面
|
|
6362
|
+
if (pageId.startsWith('pre-')) {
|
|
6363
|
+
const realPageId = pageId.replace('pre-', '');
|
|
6364
|
+
currentPageId.value = realPageId;
|
|
6365
|
+
return;
|
|
6366
|
+
}
|
|
6367
|
+
if (pageId.startsWith('post-')) {
|
|
6368
|
+
const realPageId = pageId.replace('post-', '');
|
|
6369
|
+
currentPageId.value = realPageId;
|
|
6370
|
+
return;
|
|
6371
|
+
}
|
|
6372
|
+
// 处理循环切换
|
|
6373
|
+
if (currentIndex === 1 && targetIndex === 0) {
|
|
6374
|
+
currentPageId.value = pages.value[pages.value.length - 1].pageId;
|
|
6375
|
+
return;
|
|
6376
|
+
}
|
|
6377
|
+
if (currentIndex === pages.value.length && targetIndex === pages.value.length + 1) {
|
|
6378
|
+
currentPageId.value = pages.value[0].pageId;
|
|
6379
|
+
return;
|
|
6380
|
+
}
|
|
6259
6381
|
}
|
|
6382
|
+
currentPageId.value = pageId;
|
|
6383
|
+
}
|
|
6384
|
+
catch (error) {
|
|
6385
|
+
console.warn('Error switching page:', error);
|
|
6260
6386
|
}
|
|
6261
|
-
currentPageId.value = pageId;
|
|
6262
6387
|
};
|
|
6263
6388
|
const handleElementTrigger = (payload) => {
|
|
6264
|
-
|
|
6265
|
-
|
|
6389
|
+
try {
|
|
6390
|
+
console.log('Element triggered:', payload);
|
|
6391
|
+
}
|
|
6392
|
+
catch (error) {
|
|
6393
|
+
console.warn('Error handling element trigger:', error);
|
|
6394
|
+
}
|
|
6266
6395
|
};
|
|
6267
6396
|
// 自动播放处理
|
|
6268
|
-
vue.watch(() => props.autoPlay, (newVal) => {
|
|
6397
|
+
vue.watch(() => props.autoPlay, async (newVal) => {
|
|
6269
6398
|
if (newVal && bgMusic.value) {
|
|
6270
|
-
|
|
6399
|
+
try {
|
|
6400
|
+
await bgMusic.value.play();
|
|
6401
|
+
}
|
|
6402
|
+
catch (error) {
|
|
6403
|
+
console.warn('Autoplay prevented:', error);
|
|
6404
|
+
// 尝试静音播放
|
|
6405
|
+
try {
|
|
6406
|
+
bgMusic.value.muted = true;
|
|
6407
|
+
await bgMusic.value.play();
|
|
6408
|
+
}
|
|
6409
|
+
catch (e) {
|
|
6410
|
+
console.warn('Muted autoplay also prevented:', e);
|
|
6411
|
+
}
|
|
6412
|
+
}
|
|
6271
6413
|
}
|
|
6272
6414
|
}, { immediate: true });
|
|
6273
6415
|
return {
|
|
@@ -6313,7 +6455,7 @@
|
|
|
6313
6455
|
onMouseleave: _cache[6] || (_cache[6] = (...args) => (_ctx.handleMouseUp && _ctx.handleMouseUp(...args)))
|
|
6314
6456
|
}, [
|
|
6315
6457
|
vue.createCommentVNode(" 背景音乐 "),
|
|
6316
|
-
(_ctx.global
|
|
6458
|
+
(_ctx.global && _ctx.global.music && _ctx.global.music.musicSrc)
|
|
6317
6459
|
? (vue.openBlock(), vue.createElementBlock("audio", {
|
|
6318
6460
|
key: 0,
|
|
6319
6461
|
ref: "bgMusic",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unika-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.325",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "Unika Components Library",
|
|
6
5
|
"main": "dist/unika-components.umd.js",
|
|
7
6
|
"module": "dist/unika-components.esm.js",
|
|
8
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"description": "Unika Vue3 components library",
|
|
9
9
|
"author": "Jim Yu",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"keywords": [
|
|
@@ -17,15 +17,14 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"
|
|
20
|
+
"serve": "vue-cli-service serve",
|
|
21
21
|
"build": "npm run build:es && npm run build:umd",
|
|
22
22
|
"lint": "vue-cli-service lint",
|
|
23
23
|
"build:es": "rollup --config build/rollup.esm.config.js",
|
|
24
24
|
"build:umd": "rollup --config build/rollup.umd.config.js",
|
|
25
25
|
"test": "vue-cli-service test:unit",
|
|
26
26
|
"test:watch": "vue-cli-service test:unit --watch",
|
|
27
|
-
"prepublishOnly": "npm run build"
|
|
28
|
-
"preview": "vite preview"
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
29
28
|
},
|
|
30
29
|
"husky": {
|
|
31
30
|
"hooks": {}
|
|
@@ -40,11 +39,10 @@
|
|
|
40
39
|
"particles.vue3": "^1.22.0",
|
|
41
40
|
"swiper-animation": "^1.4.0",
|
|
42
41
|
"vue-baberrage": "^3.2.4",
|
|
43
|
-
"vue-particles": "^1.0.9"
|
|
44
|
-
"vue": "^3.2.0"
|
|
42
|
+
"vue-particles": "^1.0.9"
|
|
45
43
|
},
|
|
46
44
|
"peerDependencies": {
|
|
47
|
-
"vue": "^3.
|
|
45
|
+
"vue": "^3.0.0-0"
|
|
48
46
|
},
|
|
49
47
|
"devDependencies": {
|
|
50
48
|
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
|
@@ -60,7 +58,7 @@
|
|
|
60
58
|
"@types/node": "^22.13.13",
|
|
61
59
|
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
|
62
60
|
"@typescript-eslint/parser": "^4.22.0",
|
|
63
|
-
"@vitejs/plugin-vue": "^
|
|
61
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
64
62
|
"@vue/cli-plugin-babel": "~4.5.0",
|
|
65
63
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
|
66
64
|
"@vue/cli-plugin-typescript": "^4.5.0",
|
|
@@ -81,19 +79,19 @@
|
|
|
81
79
|
"eslint-plugin-vue": "^7.0.0-0",
|
|
82
80
|
"husky": "^4.3.0",
|
|
83
81
|
"less": "^4.2.0",
|
|
84
|
-
"rollup": "^2.
|
|
82
|
+
"rollup": "^2.28.2",
|
|
85
83
|
"rollup-plugin-css-only": "^2.1.0",
|
|
86
84
|
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.13",
|
|
87
|
-
"rollup-plugin-typescript2": "^0.
|
|
88
|
-
"rollup-plugin-vue": "^6.0.0",
|
|
85
|
+
"rollup-plugin-typescript2": "^0.29.0",
|
|
86
|
+
"rollup-plugin-vue": "^6.0.0-beta.10",
|
|
89
87
|
"style-loader": "^3.3.4",
|
|
90
88
|
"swiper": "^6.8.4",
|
|
91
|
-
"typescript": "^4.
|
|
89
|
+
"typescript": "^4.0.5",
|
|
92
90
|
"uuid": "^8.0.0",
|
|
93
|
-
"vite": "^
|
|
91
|
+
"vite": "^6.2.3",
|
|
92
|
+
"vue": "^3.4.38",
|
|
94
93
|
"vue-jest": "^5.0.0-alpha.5",
|
|
95
94
|
"vue3-lottie": "^3.2.0",
|
|
96
|
-
"vue3-swiper": "^1.0.0"
|
|
97
|
-
"terser": "^5.4.0"
|
|
95
|
+
"vue3-swiper": "^1.0.0"
|
|
98
96
|
}
|
|
99
97
|
}
|