shengBoChuChen.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <view class="content p-rel pdt-100">
  3. <view class="p-rel h-200 flex ai_center fd_c">
  4. <ourLoading active translateY="50" background-color="transparent" color="#ea9f8a" />
  5. </view>
  6. <view class="p-rel flex ai_center fd_c">
  7. <view class="text-62 mgt-10">{{ statusNum }}%</view>
  8. <view class="text-36 text-500 mgy-30">正在声波初尘中...</view>
  9. <view class="text-24 text-555 mgb-80">手机音量调到最大,可以获得最后的除尘效果</view>
  10. <view class="btn_s w-300" @click="handleClick">{{ open? '除尘结束':'开始除尘' }}</view>
  11. </view>
  12. </view>
  13. </template>
  14. <script setup>
  15. import { ref, onMounted } from "vue";
  16. import { onShow } from "@dcloudio/uni-app";
  17. import ourLoading from '@/components/our-loading/our-loading.vue'
  18. const open = ref(false)
  19. const statusNum = ref(0)
  20. var timer = null
  21. const handleClick = () =>{
  22. if(open.value) return
  23. open.value = !open.value
  24. if(open.value){
  25. timer = setInterval(() => {
  26. if(statusNum.value < 100){
  27. let num = Math.ceil(Math.random()*3)
  28. statusNum.value += statusNum.value + num > 100 ? 1 : num
  29. }else{
  30. clearInterval(timer)
  31. }
  32. }, 30)
  33. }else{
  34. statusNum.value = 0
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. .content{
  40. height: 100vh;
  41. background: linear-gradient(to bottom, #a9d4ff, #cce6ff);
  42. }
  43. </style>