index.vue 5.44 KB
<!--
 * @Date: 2023-06-21 10:23:09
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2026-01-09 18:06:06
 * @FilePath: /xyxBooking-weapp/src/pages/index/index.vue
 * @Description: 预约页首页
-->
<template>
  <view class="index-page">
    <view class="index-content">
      <view style="height: 28vh;">
        <swiper class="my-swipe" :autoplay="true" :interval="3000" indicator-dots indicator-color="white" :circular="true">
          <swiper-item>
            <image style="height: 28vh; width: 100vw;" src="https://cdn.ipadbiz.cn/xys/booking/banner02.png?imageMogr2/thumbnail/500x/strip/quality/100" />
          </swiper-item>
        </swiper>
      </view>

      <view ref="root" class="index-circular">
        <view class="booking-wrapper">
          <view class="booking" @tap="toBooking">
            <view><image :src="icon_1" style="width: 96rpx; height: 96rpx;" /></view>
            <view style="color: #FFF;">开始预约</view>
          </view>
        </view>
      </view>
      <view class="logo"></view>
    </view>
    <view class="index-nav">
      <view class="nav-logo">
        <image :src="icon_3" style="width: 48rpx; height: 48rpx;" />
        首页
      </view>
      <view class="nav-logo" @tap="toCode">
        <image :src="icon_4" style="width: 140rpx; height: 140rpx; position: absolute; top: -100rpx;" />
        <view style="width: 48rpx; height: 48rpx;"></view>
        预约码
      </view>
      <view class="nav-logo" @tap="toMy">
        <image :src="icon_5" style="width: 48rpx; height: 48rpx;" />
        我的
      </view>
    </view>
  </view>
</template>

<script setup>
import Taro, { useShareAppMessage } from '@tarojs/taro'
// import { showSuccessToast, showFailToast } from 'vant'; // NutUI 或 Taro API
import { useGo } from '@/hooks/useGo'
import icon_1 from '@/assets/images/立即预约@2x.png'
import icon_3 from '@/assets/images/首页02@2x.png'
import icon_4 from '@/assets/images/二维码icon.png'
import icon_5 from '@/assets/images/我的01@2x.png'

const go = useGo();

const toBooking = () => { // 跳转到预约须知
  go('/notice');
}
const toCode = () => { // 跳转到预约码
  Taro.redirectTo({
    url: '/pages/bookingCode/index'
  })
}
const toMy = () => { // 跳转到我的
  Taro.redirectTo({
    url: '/pages/me/index'
  })
}

useShareAppMessage(() => {
  return {
    title: '西园寺预约',
    path: '/pages/index/index'
  }
})

</script>

<style lang="less">
.index-page {
  position: relative;
  min-height: 100vh;
  background-image: url('https://cdn.ipadbiz.cn/xys/booking/bg.jpg?imageMogr2/thumbnail/200x/strip/quality/50');
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover; /* 确保背景覆盖 */
  .index-content {
    height: calc(100vh - 134rpx);
    .index-control {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin-top: 130rpx;
      // font-weight: bold;
      font-size: 37rpx;
      .booking {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #A67939;
        border-radius: 14rpx;
        color: #FFFFFF;
        padding: 22rpx 128rpx;
        border: 2rpx solid #A67939;
      }
      .record {
        display: flex;
        justify-content: center;
        align-items: center;
        color: #A67939;
        border-radius: 14rpx;
        padding: 22rpx 128rpx;
        border: 2rpx solid #A67939;
        margin-top: 48rpx;
      }
      .search {
        display: flex;
        justify-content: center;
        align-items: center;
        color: #A67939;
        border-radius: 14rpx;
        padding: 22rpx 128rpx;
        border: 2rpx solid #A67939;
        margin-top: 48rpx;
      }
    }
    .index-circular {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 130rpx;
      // font-weight: bold;
      font-size: 35rpx;

      .booking-wrapper {
        height: 260rpx;
        width: 260rpx;
        border-radius: 50%;
        background-color: rgba(166, 121, 57, 0.26);
        display: flex;
        align-items: center;
        justify-content: center;
        .booking {
          height: 230rpx;
          width: 230rpx;
          border-radius: 50%;
          background-color: #A67939;
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
        }
      }
    }
    .logo {
      position: absolute;
      right: 0;
      bottom: 200rpx;
      height: 400rpx;
      width: 150rpx;
      background-image: url('https://cdn.ipadbiz.cn/xys/booking/logo.png?imageMogr2/thumbnail/50x/strip/quality/50');
      background-repeat: no-repeat;
      background-size: contain;
      background-position: center;
    }
  }
  .my-swipe {
    height: 400rpx;
    swiper-item { /* Taro swiper-item 编译后 */
      height: 400rpx;
      width: 750rpx;
      background-size: cover;
      background-repeat: no-repeat;
      background-position: center;
    }
  }
  .index-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 750rpx;
    height: 134rpx;
    background: #FFFFFF;
    box-shadow: 0 -10rpx 8rpx 0 rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: space-around;
    color: #A67939;
    .nav-logo {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
    }
  }
}
</style>