index.vue 2.9 KB
<!--
 * @Date: 2024-01-16 10:06:47
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2026-01-13 15:19:11
 * @FilePath: /xyxBooking-weapp/src/pages/bookingCode/index.vue
 * @Description: 文件描述
-->
<template>
  <view class="booking-code-page">
    <view style="padding: 32rpx;">
      <qrCode></qrCode>
      <view class="warning">
        <view style="display: flex; align-items: center; justify-content: center;"><IconFont name="tips" /><text style="margin-left: 10rpx;">温馨提示</text></view>
        <view style="margin-top: 16rpx;">一人一码,扫码或识别身份证成功后进入</view>
        <view style="height: 256rpx;"></view>
      </view>
    </view>
    <view class="index-nav">
      <view class="nav-logo" @tap="toHome">
        <image :src="icon_3" style="width: 48rpx; height: 48rpx;" />
        首页
      </view>
      <view class="nav-logo">
        <image :src="icon_4" style="width: 48rpx; height: 48rpx; margin-bottom: 3rpx;" />
        预约码
      </view>
      <view class="nav-logo" @tap="toMy">
        <image :src="icon_5" style="width: 48rpx; height: 48rpx;" />
        我的
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'
import Taro, { useDidShow } from '@tarojs/taro'
import qrCode from '@/components/qrCode';
import { IconFont } from '@nutui/icons-vue-taro'
import icon_3 from '@/assets/images/首页01@2x.png'
import icon_4 from '@/assets/images/二维码icon.png'
import icon_5 from '@/assets/images/我的01@2x.png'
import { useGo } from '@/hooks/useGo'
import { has_offline_booking_cache } from '@/composables/useOfflineBookingCache'

const go = useGo();

useDidShow(() => {
    Taro.getNetworkType({
        success: (res) => {
            const isConnected = ['wifi', '4g', '5g', '3g'].includes(res.networkType);
            if (!isConnected) {
                if (has_offline_booking_cache()) {
                    Taro.redirectTo({ url: '/pages/offlineBookingList/index' })
                } else {
                    Taro.redirectTo({ url: '/pages/weakNetwork/index' })
                }
            }
        }
    });
})

const toMy = () => { // 跳转到我的
  Taro.redirectTo({
    url: '/pages/me/index'
  })
}
const toHome = () => { // 跳转到首页
  Taro.redirectTo({
    url: '/pages/index/index'
  })
}

</script>

<style lang="less">
.booking-code-page {
  position: relative;
  min-height: 100vh;
  background-color: #F6F6F6;

  .warning {
    text-align: center;
    color: #A67939;
    margin-top: 32rpx;
  }

  .index-nav {
    position: fixed;
    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>