StepView5.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div class="working-area">
  3. <img
  4. class="effect effect-begin"
  5. src="@/assets/images/step-0-final.png"
  6. alt=""
  7. draggable="false"
  8. >
  9. <video
  10. v-show="workState === 'working' || workState === 'done'"
  11. ref="videoRef"
  12. src="@/assets/videos/step-1.mp4"
  13. playsinline
  14. webkit-playsinline="true"
  15. muted
  16. @ended="workState = 'done'"
  17. />
  18. </div>
  19. </template>
  20. <script setup>
  21. import { ref, computed, watch } from "vue"
  22. import { toolList, selectedToolNum, workState } from "@/store/index.js"
  23. const {
  24. windowSizeInCssForRef,
  25. windowSizeWhenDesignForRef,
  26. } = useSizeAdapt()
  27. const props = defineProps(['requiredToolList'])
  28. const requiredToolList = computed(() => {
  29. return props.requiredToolList
  30. })
  31. watch(selectedToolNum, (vNew) => {
  32. if (vNew === requiredToolList.value.length) {
  33. setTimeout(() => {
  34. workState.value = 'working'
  35. }, 500)
  36. }
  37. })
  38. const videoRef = ref(null)
  39. watch(workState, (vNew) => {
  40. if (vNew === 'working') {
  41. videoRef.value.play()
  42. }
  43. })
  44. </script>
  45. <style lang="less" scoped>
  46. .working-area{
  47. position: absolute;
  48. left: 50%;
  49. top: calc(314 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  50. transform: translate(-50%, -50%);
  51. width: calc(328 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  52. height: calc(438 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));;
  53. >img.effect{
  54. position: absolute;
  55. left: 0;
  56. top: 0;
  57. width: 100%;
  58. height: 100%;
  59. }
  60. >video{
  61. position: absolute;
  62. left: 0;
  63. top: 0;
  64. width: 100%;
  65. height: 100%;
  66. }
  67. }
  68. </style>