Home.vue 14.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
<template>
  <div class="home-container">

    <!-- 左下角背景装饰图 - bg@2x.png -->
    <div class="bottom-left-decoration"></div>

    <!-- 主要内容区域 -->
    <div class="main-content">
      <!-- 顶部Banner图片 -->
      <div class="banner-section">
        <img
          src="@/assets/images/02 西园戒幢律寺三坛大戒法会/banner@2x.png"
          alt="三坛大戒法会Banner"
          class="banner-image"
        />
      </div>

      <!-- 视频播放器区域 -->
      <div class="video-section">
        <VideoPlayer
          :video-url="videoUrl"
          video-id="home-video"
          :autoplay="false"
          :options="videoOptions"
        />
      </div>

      <!-- 法会流程容器 -->
      <div class="ceremony-wrapper">
        <!-- 法会流程 -->
        <div class="ceremony-process">
          <!-- 标题 -->
          <div class="ceremony-title">
            <img src="/src/assets/images/02 西园戒幢律寺三坛大戒法会/法會流程@2x.png" alt="法会流程" />
          </div>

          <!-- 流程步骤 -->
          <div class="process-container">
            <!-- 麻绳背景 -->
            <div class="rope-background"></div>

            <!-- 流程步骤 -->
            <div class="process-steps">
              <div
              v-for="(step, index) in processSteps"
              :key="index"
              class="process-step"
              :class="{ active: step.active }"
              @click="selectStep(index)"
            >
                <!-- 顶部白色圆形占位(选中状态) -->
                <div class="top-circle"></div>

                <!-- 步骤内容 -->
                <div class="step-content">
                  <span class="step-text">{{ step.name }}</span>
                </div>

                <!-- 底部箭头(选中状态) -->
                <div v-if="step.active" class="bottom-arrow">
                  <img src="/src/assets/images/02 西园戒幢律寺三坛大戒法会/点@2x.png" alt="选中" />
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 法会流程内容 -->
        <div class="ceremony-intro">
          <div class="intro-container">
            <!-- 背景图片 -->
            <div class="intro-background"></div>

            <!-- 步骤标题 -->
            <div class="step-title" ref="stepTitleRef">
              <span class="step-title-text">{{ currentStep.name }}</span>
            </div>

            <!-- 装饰线 -->
            <div class="decorative-line" :style="decorativeLineStyle"></div>

            <!-- 查看更多按钮 -->
            <div class="more-button" @click="viewMore">
              <span class="more-text">查看更多</span>
            </div>

            <!-- 步骤描述(可选显示) -->
            <div class="step-description">
              <p>{{ currentStep.description }}</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, nextTick, onMounted, watch } from 'vue'
import VideoPlayer from '@/components/VideoPlayer.vue'

// 视频配置
const videoUrl = ref('/src/assets/images/02 西园戒幢律寺三坛大戒法会/sample-10s.mp4')

const videoOptions = ref({
  fluid: true,
  responsive: true,
  aspectRatio: '16:9',
  controls: true,
  preload: 'metadata',
  poster: '',
  playbackRates: [0.5, 1, 1.25, 1.5, 2],
  sources: [{
    src: '/src/assets/images/02 西园戒幢律寺三坛大戒法会/sample-10s.mp4',
    type: 'video/mp4'
  }]
})

// 法会流程步骤数据
const processSteps = ref([
  {
    name: '准备',
    active: true,
    description: '法会前的各项准备工作,包括场地布置、法器准备、戒子报到等重要环节。'
  },
  {
    name: '正式开堂',
    active: false,
    description: '三坛大戒法会正式开始,举行庄严的开堂仪式,宣布戒期开始。'
  },
  {
    name: '封堂洒净',
    active: false,
    description: '封闭戒堂,进行洒净仪式,为戒子们营造清净庄严的受戒环境。'
  },
  {
    name: '正授沙弥戒',
    active: false,
    description: '第一坛沙弥戒的正式传授,戒子们受持沙弥十戒,成为正式的沙弥。'
  },
  {
    name: '二坛比丘戒',
    active: false,
    description: '第二坛比丘戒的庄严传授,戒子们受持比丘二百五十戒,成为比丘僧。'
  },
  {
    name: '三坛菩萨戒',
    active: false,
    description: '第三坛菩萨戒的殊胜传授,戒子们受持菩萨戒,发菩提心,行菩萨道。'
  },
  {
    name: '圆满',
    active: false,
    description: '三坛大戒法会圆满结束,戒子们正式成为具足戒的僧人,功德圆满。'
  }
])

// 获取当前选中的步骤
const currentStep = computed(() => {
  return processSteps.value.find(step => step.active) || processSteps.value[0]
})

// 步骤标题的ref引用
const stepTitleRef = ref(null)

// 装饰线的动态样式
const decorativeLineStyle = ref({
  top: '4.5rem',
  bottom: '4rem'
})

// 计算装饰线位置的函数
const calculateLinePosition = async () => {
  await nextTick()
  if (stepTitleRef.value) {
    const titleElement = stepTitleRef.value
    const containerElement = titleElement.closest('.intro-container')
    const moreButton = containerElement?.querySelector('.more-button')

    if (containerElement && moreButton) {
      // 获取标题和按钮的位置信息
      const titleRect = titleElement.getBoundingClientRect()
      const buttonRect = moreButton.getBoundingClientRect()
      const containerRect = containerElement.getBoundingClientRect()

      // 计算相对于容器的位置
      const titleBottom = titleRect.bottom - containerRect.top
      const buttonTop = buttonRect.top - containerRect.top

      // 装饰线从标题底部开始,留0.5rem间距
      const spacing = 8 // 0.5rem = 8px (基准字体16px)
      const lineTop = titleBottom + spacing

      // 装饰线到按钮上方,留0.5rem间距
      const lineBottom = containerRect.height - (buttonTop - spacing)

      decorativeLineStyle.value = {
        top: `${lineTop}px`,
        bottom: `${lineBottom}px`
      }
    }
  }
}

// 点击切换步骤状态
const selectStep = (index) => {
  processSteps.value.forEach((step, i) => {
    step.active = i === index
  })
  // 切换步骤后重新计算装饰线位置
  calculateLinePosition()
}

// 组件挂载后计算装饰线位置
onMounted(() => {
  calculateLinePosition()
})

// 监听当前步骤变化,重新计算装饰线位置
watch(currentStep, () => {
  calculateLinePosition()
}, { deep: true })

// 查看更多按钮点击事件
const viewMore = () => {
  console.log('查看更多:', currentStep.value.name)
  // 这里可以添加跳转到详情页面的逻辑
}
</script>

<style scoped>
.home-container {
  position: relative;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* 左下角背景装饰图 - bg@2x.png */
.bottom-left-decoration {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 50%;
  height: 50%;
  background-image: url('@/assets/images/02 西园戒幢律寺三坛大戒法会/bg@2x.png');
  background-size: contain;
  background-position: bottom left;
  background-repeat: no-repeat;
  z-index: -1;
  pointer-events: none;
}

/* 主要内容区域 */
.main-content {
  position: relative;
  z-index: 1;
  width: 100%;
}

/* Banner区域 */
.banner-section {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.banner-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* 视频播放器区域 */
.video-section {
  width: 100%;
  margin: 0;
  padding: 0;
}

.video-section :deep(.video-player-container) {
  width: 100%;
  background: transparent;
}

.video-section :deep(.video-player) {
  width: 100%;
  height: auto;
}

/* 响应式设计 */
@media (max-width: 48rem) {
  .bottom-left-decoration {
    width: 60%;
    height: 40%;
  }
}

@media (max-width: 30rem) {
  .bottom-left-decoration {
    width: 70%;
    height: 35%;
  }
}

/* 法会流程容器 */
.ceremony-wrapper {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  background-image: url('/src/assets/images/02 西园戒幢律寺三坛大戒法会/背景@2x.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow: hidden;
}

/* 法会流程模块 */
.ceremony-process {
  width: 100%;
  padding: 2rem 1rem;
  position: relative;
  z-index: 2;
}

/* 标题部分 */
.ceremony-title {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
}

.ceremony-title img {
  max-width: 12rem;
  height: auto;
}

/* 流程容器 */
.process-container {
  position: relative;
  width: 100%;
}

/* 麻绳背景 */
.rope-background {
  position: absolute;
  top: 10%;
  left: 0;
  right: 0;
  height: 0.3rem;
  background-image: url('@/assets/images/02 西园戒幢律寺三坛大戒法会/麻绳@2x.png');
  background-size: cover;
  background-position: top;
  background-repeat: repeat-x;
  transform: translateY(-10%);
  z-index: 1;
}

/* 流程步骤容器 */
.process-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
  padding: 0 0.5rem;
  gap: 0.5rem;
}

/* 单个流程步骤 */
.process-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.process-step:hover {
  transform: scale(1.05);
}

/* 步骤内容 */
.step-content {
  width: 4rem;
  height: 10rem;
  background: linear-gradient(180deg, #DAC39E 0%, #BE9C63 100%);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* 选中状态的步骤内容 */
.process-step.active .step-content {
  background: linear-gradient(180deg, #C8916C 0%, #975021 100%);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}

/* 步骤文字 */
.step-text {
  color: white;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  text-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
  margin-top: 0.85rem;
  /* 文字间隔 */
  letter-spacing: 0.05rem;
}

/* 顶部白色圆形占位 */
.top-circle {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0.45rem;
  height: 0.45rem;
  background: white;
  border-radius: 50%;
  z-index: 3;
}

/* 底部箭头 */
.bottom-arrow {
  position: absolute;
  bottom: -1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.bottom-arrow img {
  width: 1rem;
  height: 1rem;
}

/* 响应式调整 */
@media (max-width: 48rem) {
  .ceremony-process {
    padding: 1.5rem 0.5rem;
  }

  .ceremony-title img {
    max-width: 10rem;
  }

  .step-content {
    width: 3rem;
    height: 8rem;
  }

  .step-text {
    font-size: 0.9rem;
  }

  .process-steps {
    padding: 0 0.25rem;
    gap: 0.25rem;
  }
}

@media (max-width: 30rem) {
  .ceremony-process {
    padding: 1rem 0.25rem;
  }

  .ceremony-title img {
    max-width: 8rem;
  }

  .step-content {
    width: 2.5rem;
    height: 6.5rem;
  }

  .step-text {
    font-size: 0.8rem;
  }

  .top-circle {
    width: 0.5rem;
    height: 0.5rem;
  }

  .bottom-arrow img {
    width: 1rem;
    height: 0.75rem;
  }

  .process-steps {
    gap: 0.125rem;
  }
}

/* 介绍容器样式 */
.ceremony-intro {
  display: flex;
  justify-content: center;
  align-items: center;
}

.intro-container {
  position: relative;
  width: 100%;
  margin: 1rem;
  border-radius: 1.17rem;
  border: 0.08rem solid #C1A16A;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  aspect-ratio: 28.75 / 16.18;
}

.intro-container:hover {
  transform: translateY(-0.125rem);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
}

/* 背景图片 */
.intro-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/src/assets/images/02 西园戒幢律寺三坛大戒法会/截图/全家福3_副本.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.8;
  z-index: 1;
}

.intro-background::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  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%);
  z-index: 2;
}

/* 步骤标题 */
.step-title {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 3;
}

.step-title-text {
  color: white;
  font-size: 2rem;
  font-weight: 700;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  text-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.8);
  letter-spacing: 0.1rem;
  line-height: 1.2;
}

/* 装饰线 */
.decorative-line {
  position: absolute;
  left: 2.2rem;
  width: 0.125rem;
  border-left: 0.125rem dotted #C1A16A;
  z-index: 3;
}

/* 查看更多按钮 */
.more-button {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  height: 3rem;
  aspect-ratio: 3 / 1;
  background-image: url('/src/assets/images/02 西园戒幢律寺三坛大戒法会/button-bg@2x.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: all 0.3s ease;
}

.more-button:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.more-text {
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  text-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.5);
}

/* 步骤描述(隐藏,可用于后续扩展) */
.step-description {
  display: none;
}

/* 响应式设计 */
@media (max-width: 48rem) {
  .intro-container {
    padding: 0.875rem;
  }

  .step-title-text {
    font-size: 1.75rem;
  }

  .decorative-line {
    /* 响应式下的装饰线样式,位置由JavaScript动态计算 */
  }

  .more-button {
    height: 1.75rem;
  }

  .more-text {
    font-size: 0.75rem;
  }
}

@media (max-width: 30rem) {
  .intro-container {
    padding: 0.75rem;
  }

  .step-title {
    top: 1rem;
    left: 1rem;
  }

  .step-title-text {
    font-size: 1.5rem;
  }

  .decorative-line {
    left: 1.8rem;
    /* 小屏幕下的装饰线样式,位置由JavaScript动态计算 */
  }

  .more-button {
    bottom: 1rem;
    left: 1rem;
    height: 1.5rem;
  }

  .more-text {
    font-size: 0.7rem;
  }
}
</style>