hookehuyr

feat(Home): 重构法会流程页面并添加动态装饰线效果

- 移除全屏背景图,优化页面结构
- 添加法会流程内容展示区域,包含步骤标题和装饰线
- 实现装饰线动态计算位置功能,根据标题和按钮位置自动调整
- 为流程步骤添加详细描述内容
- 优化响应式设计,适配不同屏幕尺寸
1 <template> 1 <template>
2 <div class="home-container"> 2 <div class="home-container">
3 - <!-- 全屏背景图 - 海报@2x.png -->
4 - <div class="full-background"></div>
5 3
6 <!-- 左下角背景装饰图 - bg@2x.png --> 4 <!-- 左下角背景装饰图 - bg@2x.png -->
7 <div class="bottom-left-decoration"></div> 5 <div class="bottom-left-decoration"></div>
...@@ -27,6 +25,8 @@ ...@@ -27,6 +25,8 @@
27 /> 25 />
28 </div> 26 </div>
29 27
28 + <!-- 法会流程容器 -->
29 + <div class="ceremony-wrapper">
30 <!-- 法会流程 --> 30 <!-- 法会流程 -->
31 <div class="ceremony-process"> 31 <div class="ceremony-process">
32 <!-- 标题 --> 32 <!-- 标题 -->
...@@ -64,12 +64,39 @@ ...@@ -64,12 +64,39 @@
64 </div> 64 </div>
65 </div> 65 </div>
66 </div> 66 </div>
67 +
68 + <!-- 法会流程内容 -->
69 + <div class="ceremony-intro">
70 + <div class="intro-container">
71 + <!-- 背景图片 -->
72 + <div class="intro-background"></div>
73 +
74 + <!-- 步骤标题 -->
75 + <div class="step-title" ref="stepTitleRef">
76 + <span class="step-title-text">{{ currentStep.name }}</span>
77 + </div>
78 +
79 + <!-- 装饰线 -->
80 + <div class="decorative-line" :style="decorativeLineStyle"></div>
81 +
82 + <!-- 查看更多按钮 -->
83 + <div class="more-button" @click="viewMore">
84 + <span class="more-text">查看更多</span>
85 + </div>
86 +
87 + <!-- 步骤描述(可选显示) -->
88 + <div class="step-description">
89 + <p>{{ currentStep.description }}</p>
90 + </div>
91 + </div>
92 + </div>
93 + </div>
67 </div> 94 </div>
68 </div> 95 </div>
69 </template> 96 </template>
70 97
71 <script setup> 98 <script setup>
72 -import { ref } from 'vue' 99 +import { ref, computed, nextTick, onMounted, watch } from 'vue'
73 import VideoPlayer from '@/components/VideoPlayer.vue' 100 import VideoPlayer from '@/components/VideoPlayer.vue'
74 101
75 // 视频配置 102 // 视频配置
...@@ -91,20 +118,113 @@ const videoOptions = ref({ ...@@ -91,20 +118,113 @@ const videoOptions = ref({
91 118
92 // 法会流程步骤数据 119 // 法会流程步骤数据
93 const processSteps = ref([ 120 const processSteps = ref([
94 - { name: '准 备', active: true }, 121 + {
95 - { name: '正式开堂', active: false }, 122 + name: '准备',
96 - { name: '封堂洒净', active: false }, 123 + active: true,
97 - { name: '正授沙弥戒', active: false }, 124 + description: '法会前的各项准备工作,包括场地布置、法器准备、戒子报到等重要环节。'
98 - { name: '二坛比丘戒', active: false }, 125 + },
99 - { name: '三坛菩萨戒', active: false }, 126 + {
100 - { name: '圆 满', active: false } 127 + name: '正式开堂',
128 + active: false,
129 + description: '三坛大戒法会正式开始,举行庄严的开堂仪式,宣布戒期开始。'
130 + },
131 + {
132 + name: '封堂洒净',
133 + active: false,
134 + description: '封闭戒堂,进行洒净仪式,为戒子们营造清净庄严的受戒环境。'
135 + },
136 + {
137 + name: '正授沙弥戒',
138 + active: false,
139 + description: '第一坛沙弥戒的正式传授,戒子们受持沙弥十戒,成为正式的沙弥。'
140 + },
141 + {
142 + name: '二坛比丘戒',
143 + active: false,
144 + description: '第二坛比丘戒的庄严传授,戒子们受持比丘二百五十戒,成为比丘僧。'
145 + },
146 + {
147 + name: '三坛菩萨戒',
148 + active: false,
149 + description: '第三坛菩萨戒的殊胜传授,戒子们受持菩萨戒,发菩提心,行菩萨道。'
150 + },
151 + {
152 + name: '圆满',
153 + active: false,
154 + description: '三坛大戒法会圆满结束,戒子们正式成为具足戒的僧人,功德圆满。'
155 + }
101 ]) 156 ])
102 157
158 +// 获取当前选中的步骤
159 +const currentStep = computed(() => {
160 + return processSteps.value.find(step => step.active) || processSteps.value[0]
161 +})
162 +
163 +// 步骤标题的ref引用
164 +const stepTitleRef = ref(null)
165 +
166 +// 装饰线的动态样式
167 +const decorativeLineStyle = ref({
168 + top: '4.5rem',
169 + bottom: '4rem'
170 +})
171 +
172 +// 计算装饰线位置的函数
173 +const calculateLinePosition = async () => {
174 + await nextTick()
175 + if (stepTitleRef.value) {
176 + const titleElement = stepTitleRef.value
177 + const containerElement = titleElement.closest('.intro-container')
178 + const moreButton = containerElement?.querySelector('.more-button')
179 +
180 + if (containerElement && moreButton) {
181 + // 获取标题和按钮的位置信息
182 + const titleRect = titleElement.getBoundingClientRect()
183 + const buttonRect = moreButton.getBoundingClientRect()
184 + const containerRect = containerElement.getBoundingClientRect()
185 +
186 + // 计算相对于容器的位置
187 + const titleBottom = titleRect.bottom - containerRect.top
188 + const buttonTop = buttonRect.top - containerRect.top
189 +
190 + // 装饰线从标题底部开始,留0.5rem间距
191 + const spacing = 8 // 0.5rem = 8px (基准字体16px)
192 + const lineTop = titleBottom + spacing
193 +
194 + // 装饰线到按钮上方,留0.5rem间距
195 + const lineBottom = containerRect.height - (buttonTop - spacing)
196 +
197 + decorativeLineStyle.value = {
198 + top: `${lineTop}px`,
199 + bottom: `${lineBottom}px`
200 + }
201 + }
202 + }
203 +}
204 +
103 // 点击切换步骤状态 205 // 点击切换步骤状态
104 const selectStep = (index) => { 206 const selectStep = (index) => {
105 processSteps.value.forEach((step, i) => { 207 processSteps.value.forEach((step, i) => {
106 step.active = i === index 208 step.active = i === index
107 }) 209 })
210 + // 切换步骤后重新计算装饰线位置
211 + calculateLinePosition()
212 +}
213 +
214 +// 组件挂载后计算装饰线位置
215 +onMounted(() => {
216 + calculateLinePosition()
217 +})
218 +
219 +// 监听当前步骤变化,重新计算装饰线位置
220 +watch(currentStep, () => {
221 + calculateLinePosition()
222 +}, { deep: true })
223 +
224 +// 查看更多按钮点击事件
225 +const viewMore = () => {
226 + console.log('查看更多:', currentStep.value.name)
227 + // 这里可以添加跳转到详情页面的逻辑
108 } 228 }
109 </script> 229 </script>
110 230
...@@ -116,20 +236,6 @@ const selectStep = (index) => { ...@@ -116,20 +236,6 @@ const selectStep = (index) => {
116 overflow-x: hidden; 236 overflow-x: hidden;
117 } 237 }
118 238
119 -/* 全屏背景图 - 海报@2x.png */
120 -.full-background {
121 - position: fixed;
122 - top: 0;
123 - left: 0;
124 - width: 100%;
125 - height: 100%;
126 - background-image: url('@/assets/images/02 西园戒幢律寺三坛大戒法会/海报@2x.png');
127 - background-size: cover;
128 - background-position: center;
129 - background-repeat: no-repeat;
130 - z-index: -2;
131 -}
132 -
133 /* 左下角背景装饰图 - bg@2x.png */ 239 /* 左下角背景装饰图 - bg@2x.png */
134 .bottom-left-decoration { 240 .bottom-left-decoration {
135 position: fixed; 241 position: fixed;
...@@ -199,6 +305,19 @@ const selectStep = (index) => { ...@@ -199,6 +305,19 @@ const selectStep = (index) => {
199 } 305 }
200 } 306 }
201 307
308 +/* 法会流程容器 */
309 +.ceremony-wrapper {
310 + position: relative;
311 + width: 100vw;
312 + min-height: 100vh;
313 + background-image: url('/src/assets/images/02 西园戒幢律寺三坛大戒法会/背景@2x.png');
314 + background-size: cover;
315 + background-position: center;
316 + background-repeat: no-repeat;
317 + background-attachment: fixed;
318 + overflow: hidden;
319 +}
320 +
202 /* 法会流程模块 */ 321 /* 法会流程模块 */
203 .ceremony-process { 322 .ceremony-process {
204 width: 100%; 323 width: 100%;
...@@ -308,8 +427,8 @@ const selectStep = (index) => { ...@@ -308,8 +427,8 @@ const selectStep = (index) => {
308 top: 0.5rem; 427 top: 0.5rem;
309 left: 50%; 428 left: 50%;
310 transform: translateX(-50%); 429 transform: translateX(-50%);
311 - width: 0.5rem; 430 + width: 0.45rem;
312 - height: 0.5rem; 431 + height: 0.45rem;
313 background: white; 432 background: white;
314 border-radius: 50%; 433 border-radius: 50%;
315 z-index: 3; 434 z-index: 3;
...@@ -373,8 +492,8 @@ const selectStep = (index) => { ...@@ -373,8 +492,8 @@ const selectStep = (index) => {
373 } 492 }
374 493
375 .top-circle { 494 .top-circle {
376 - width: 0.75rem; 495 + width: 0.5rem;
377 - height: 0.75rem; 496 + height: 0.5rem;
378 } 497 }
379 498
380 .bottom-arrow img { 499 .bottom-arrow img {
...@@ -386,4 +505,171 @@ const selectStep = (index) => { ...@@ -386,4 +505,171 @@ const selectStep = (index) => {
386 gap: 0.125rem; 505 gap: 0.125rem;
387 } 506 }
388 } 507 }
508 +
509 +/* 介绍容器样式 */
510 +.ceremony-intro {
511 + display: flex;
512 + justify-content: center;
513 + align-items: center;
514 +}
515 +
516 +.intro-container {
517 + position: relative;
518 + width: 100%;
519 + margin: 1rem;
520 + border-radius: 1.17rem;
521 + border: 0.08rem solid #C1A16A;
522 + overflow: hidden;
523 + cursor: pointer;
524 + transition: all 0.3s ease;
525 + aspect-ratio: 28.75 / 16.18;
526 +}
527 +
528 +.intro-container:hover {
529 + transform: translateY(-0.125rem);
530 + box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
531 +}
532 +
533 +/* 背景图片 */
534 +.intro-background {
535 + position: absolute;
536 + top: 0;
537 + left: 0;
538 + width: 100%;
539 + height: 100%;
540 + background-image: url('/src/assets/images/02 西园戒幢律寺三坛大戒法会/截图/全家福3_副本.jpg');
541 + background-size: cover;
542 + background-position: center;
543 + background-repeat: no-repeat;
544 + opacity: 0.8;
545 + z-index: 1;
546 +}
547 +
548 +.intro-background::after {
549 + content: '';
550 + position: absolute;
551 + top: 0;
552 + left: 0;
553 + width: 100%;
554 + height: 100%;
555 + background: linear-gradient(90deg, rgba(152, 81, 34, 0.75) 0%, rgba(152, 81, 34, 0.45) 30%, rgba(65, 44, 12, 0.15) 70%, transparent 100%);
556 + z-index: 2;
557 +}
558 +
559 +/* 步骤标题 */
560 +.step-title {
561 + position: absolute;
562 + top: 1.5rem;
563 + left: 1.5rem;
564 + z-index: 3;
565 +}
566 +
567 +.step-title-text {
568 + color: white;
569 + font-size: 2rem;
570 + font-weight: 700;
571 + writing-mode: vertical-rl;
572 + text-orientation: mixed;
573 + text-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.8);
574 + letter-spacing: 0.1rem;
575 + line-height: 1.2;
576 +}
577 +
578 +/* 装饰线 */
579 +.decorative-line {
580 + position: absolute;
581 + left: 2.2rem;
582 + width: 0.125rem;
583 + border-left: 0.125rem dotted #C1A16A;
584 + z-index: 3;
585 +}
586 +
587 +/* 查看更多按钮 */
588 +.more-button {
589 + position: absolute;
590 + bottom: 1.5rem;
591 + left: 1.5rem;
592 + height: 3rem;
593 + aspect-ratio: 3 / 1;
594 + background-image: url('/src/assets/images/02 西园戒幢律寺三坛大戒法会/button-bg@2x.png');
595 + background-size: contain;
596 + background-position: center;
597 + background-repeat: no-repeat;
598 + display: flex;
599 + align-items: center;
600 + justify-content: center;
601 + cursor: pointer;
602 + z-index: 3;
603 + transition: all 0.3s ease;
604 +}
605 +
606 +.more-button:hover {
607 + transform: scale(1.05);
608 + filter: brightness(1.1);
609 +}
610 +
611 +.more-text {
612 + color: white;
613 + font-size: 0.875rem;
614 + font-weight: 600;
615 + text-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.5);
616 +}
617 +
618 +/* 步骤描述(隐藏,可用于后续扩展) */
619 +.step-description {
620 + display: none;
621 +}
622 +
623 +/* 响应式设计 */
624 +@media (max-width: 48rem) {
625 + .intro-container {
626 + padding: 0.875rem;
627 + }
628 +
629 + .step-title-text {
630 + font-size: 1.75rem;
631 + }
632 +
633 + .decorative-line {
634 + /* 响应式下的装饰线样式,位置由JavaScript动态计算 */
635 + }
636 +
637 + .more-button {
638 + height: 1.75rem;
639 + }
640 +
641 + .more-text {
642 + font-size: 0.75rem;
643 + }
644 +}
645 +
646 +@media (max-width: 30rem) {
647 + .intro-container {
648 + padding: 0.75rem;
649 + }
650 +
651 + .step-title {
652 + top: 1rem;
653 + left: 1rem;
654 + }
655 +
656 + .step-title-text {
657 + font-size: 1.5rem;
658 + }
659 +
660 + .decorative-line {
661 + left: 1.8rem;
662 + /* 小屏幕下的装饰线样式,位置由JavaScript动态计算 */
663 + }
664 +
665 + .more-button {
666 + bottom: 1rem;
667 + left: 1rem;
668 + height: 1.5rem;
669 + }
670 +
671 + .more-text {
672 + font-size: 0.7rem;
673 + }
674 +}
389 </style> 675 </style>
......