<script setup lang='ts'>
import frame from '~/assets/caiji/frame.webp'

const router = useRouter()

function onClickLeft() {
  router.back()
}

const leftTime = ref(15)
const timer = ref()

onMounted(() => {
  timer.value = setInterval(() => {
    leftTime.value--
    if (leftTime.value === 0) {
      clearInterval(timer.value)
    }
  }, 1000)
})


</script>

<template>
  <van-nav-bar title="声音采集" left-arrow @click-left="onClickLeft"></van-nav-bar>
  <div class="flex-auto w-full flex flex-col items-center justify-between py-72px px-6 box-border">
    <div class="w-full flex flex-col items-center mb-12">
      <img class="w-108px mt-6px" :src="frame" alt="">
      <div class="text-xl mt-16px">定制你的专属声音</div>
      <div class="text-base mt-22px">保持环境安静</div>
      <div class="text-base">清晰地说出指令</div>
    </div>

    <van-button v-if="leftTime" type="danger" size="large" block disabled>{{leftTime}}s 我已知悉</van-button>
    <van-button v-else type="success" size="large" block icon="success" @click="router.replace({name:'caiji-sy-name'})" >我已知悉</van-button>

  </div>
</template>