camera-result.page.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script setup lang="ts">
  2. import { useRouteQuery } from '@vueuse/router';
  3. import { useRouter } from 'vue-router';
  4. defineOptions({
  5. name: 'CameraResult',
  6. });
  7. const router = useRouter();
  8. const to = useRouteQuery('to', '/screen');
  9. const tips = computed(() => to.value.includes('screen') ? '返回首页' : '下一步');
  10. const countdown = ref(5);
  11. let timer: ReturnType<typeof setInterval>;
  12. function done() {
  13. clearInterval(timer);
  14. router.replace({ path: to.value });
  15. }
  16. onMounted(() => {
  17. timer = setInterval(() => {
  18. const _countdown = countdown.value - 1;
  19. if ( _countdown <= 0 ) { done(); } else { countdown.value = _countdown; }
  20. }, 1000);
  21. });
  22. onBeforeUnmount(() => {
  23. clearInterval(timer);
  24. });
  25. </script>
  26. <template>
  27. <div class="flex flex-col">
  28. <header class="flex flex-col justify-center px-24" style="flex: 1 1 20%">
  29. <div class="text-3xl text-center">拍摄完成</div>
  30. </header>
  31. <main class="flex flex-col justify-evenly px-24" style="flex: 1 1 50%">
  32. <img class="size-40 mx-auto" src="@/assets/images/tips.png">
  33. <div>
  34. <div class="text-3xl text-center">恭喜您!</div>
  35. <div class="text-3xl text-center my-8">完成舌面象的采集</div>
  36. </div>
  37. </main>
  38. <footer class="flex justify-evenly items-start" style="flex: 1 1 30%">
  39. <van-button class="decorate !text-xl !text-primary-400" @click="done()">
  40. {{ tips }}({{ countdown }})
  41. </van-button>
  42. </footer>
  43. </div>
  44. </template>
  45. <style scoped lang="scss">
  46. </style>