index.tsx 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import { PropType, defineComponent, onMounted, watch } from "vue";
  2. import { Vue3Lottie } from 'vue3-lottie'
  3. import styles from "./index.module.less";
  4. import delay_bg from "./image/bg.json"
  5. import left_adorn from "./image/left_ adorn.json"
  6. import right_adorn from "./image/right_ adorn.json"
  7. import step1 from "./image/step1_icon.json"
  8. import step2 from "./image/step2_icon.json"
  9. import step3 from "./image/step3_icon.json"
  10. import step4 from "./image/step4_icon.json"
  11. import step5 from "./image/step5_icon.json"
  12. import step_tips_1 from "./image/step_tips_icon1.png"
  13. import step_tips_2 from "./image/step_tips_icon2.png"
  14. import step_tips_3 from "./image/step_tips_icon3.png"
  15. import step_tips_4 from "./image/step_tips_icon4.png"
  16. import step_tips_5 from "./image/step_tips_icon5.png"
  17. import step_tips_5_1 from "./image/step_tips_icon5_1.png"
  18. import step_tips_5_2 from "./image/step_tips_icon5_2.png"
  19. import step_top_icon from "./image/step_top_icon.png"
  20. import step_top_icon_1 from "./image/step_top_icon_1.png"
  21. import step_top_icon_2 from "./image/step_top_icon_2.png"
  22. import step_top_icon_3 from "./image/step_top_icon_3.png"
  23. import step_top_icon_4 from "./image/step_top_icon_4.png"
  24. import step_top_icon_5 from "./image/step_top_icon_5.png"
  25. import step_btn_1 from "./image/delay_btn_icon1.png"
  26. import step_btn_2 from "./image/delay_btn_icon2.png"
  27. import setp_dot_1 from './image/step_state_icon1.png'
  28. import setp_dot_2 from './image/step_state_icon2.png'
  29. import setp_dot_3 from './image/step_state_icon3.png'
  30. import iconBack from './image/icon-back.png'
  31. interface IDelayData {
  32. /** 延迟时间 */
  33. time: number;
  34. /** 检测次数 */
  35. count: number;
  36. /** 耳机状态 */
  37. erji: boolean;
  38. checkStatus: "init" | "ing" | "error";
  39. step: number;
  40. earPhoneType: string;
  41. }
  42. /** 延迟检测组件 */
  43. export default defineComponent({
  44. name: "CheckDelayPopup",
  45. emits: ["close", "startCheckDelay", "load", "back"],
  46. props: {
  47. delayData: {
  48. type: Object as PropType<IDelayData>,
  49. default: () => ({ time: 0, count: 0 }),
  50. },
  51. },
  52. setup(props, { emit }) {
  53. return () => (
  54. <div class={styles.delayContainer}>
  55. <Vue3Lottie class={styles.delayBg} animationData={delay_bg}></Vue3Lottie>
  56. <Vue3Lottie class={styles.leftAdorn} animationData={left_adorn}></Vue3Lottie>
  57. <Vue3Lottie class={styles.rightAdorn} animationData={right_adorn}></Vue3Lottie>
  58. {/*返回按钮*/}
  59. <img class={styles.delayBackBtn} src={iconBack} onClick={() => emit("back")} />
  60. <Vue3Lottie class={styles.delayAdorn} animationData={step1} style={{ display: props.delayData.step <= 2 ? '' : 'none' }}></Vue3Lottie>
  61. <Vue3Lottie class={styles.delayAdorn} animationData={step2} style={{ display: props.delayData.step === 3 ? '' : 'none' }}></Vue3Lottie>
  62. <Vue3Lottie class={styles.delayAdorn} animationData={step3} style={{ display: props.delayData.step === 4 ? '' : 'none' }}></Vue3Lottie>
  63. <Vue3Lottie class={styles.delayAdorn} animationData={step4} style={{ display: props.delayData.step === 5 ? '' : 'none' }}></Vue3Lottie>
  64. <Vue3Lottie class={styles.delayAdorn} animationData={step5} style={{ display: props.delayData.step >= 6 ? '' : 'none' }}></Vue3Lottie>
  65. <div class={styles.delayBody}>
  66. <div class={styles.delayBox}>
  67. <div class={styles.dbTop}>
  68. <img class={styles.topIcon} src={props.delayData.step <= 3 ? step_top_icon_1 : props.delayData.step === 4 ? step_top_icon_2 : props.delayData.step === 5 ? step_top_icon_3 :
  69. props.delayData.step >= 6 && props.delayData.earPhoneType !== "有线耳机" ? step_top_icon_4 : props.delayData.step >= 6 && props.delayData.earPhoneType === "有线耳机" ? step_top_icon_5 : '' } />
  70. {
  71. props.delayData.step <= 2 ?
  72. <div class={styles.topDots}>
  73. <img src={setp_dot_1} />
  74. <img src={setp_dot_1} />
  75. <img src={setp_dot_1} />
  76. <img src={setp_dot_1} />
  77. </div>
  78. : props.delayData.step === 3 ?
  79. <div class={styles.topDots}>
  80. <span class={styles.aniDot3} ></span>
  81. <img src={setp_dot_1} />
  82. <img src={setp_dot_1} />
  83. <img src={setp_dot_1} />
  84. </div>
  85. : props.delayData.step === 4 ?
  86. <div class={styles.topDots}>
  87. <img src={setp_dot_2} />
  88. <span class={styles.aniDot3} ></span>
  89. <img src={setp_dot_1} />
  90. <img src={setp_dot_1} />
  91. </div>
  92. : props.delayData.step === 5 ?
  93. <div class={styles.topDots}>
  94. <img src={setp_dot_2} />
  95. <img src={setp_dot_2} />
  96. <span class={styles.aniDot3} ></span>
  97. <img src={setp_dot_1} />
  98. </div>
  99. :
  100. <div class={styles.topDots}>
  101. <img src={setp_dot_2} />
  102. <img src={setp_dot_2} />
  103. <img src={setp_dot_2} />
  104. <span class={styles.aniDot3} ></span>
  105. </div>
  106. }
  107. </div>
  108. <img class={styles.dbContext} src={step_tips_1} style={{ display: props.delayData.step <= 2 ? '' : 'none' }} />
  109. <img class={styles.dbContext} src={step_tips_2} style={{ display: props.delayData.step === 3 ? '' : 'none' }} />
  110. <img class={styles.dbContext} src={step_tips_3} style={{ display: props.delayData.step === 4 ? '' : 'none' }} />
  111. <img class={styles.dbContext} src={step_tips_4} style={{ display: props.delayData.step === 5 ? '' : 'none' }} />
  112. <img class={styles.dbContext} src={step_tips_5} style={{ display: props.delayData.step >= 6 && !props.delayData.erji ? '' : 'none' }} />
  113. <img class={styles.dbContext} src={step_tips_5_1} style={{ display: props.delayData.step >= 6 && props.delayData.erji && props.delayData.earPhoneType !== "有线耳机" ? '' : 'none' }} />
  114. <img class={styles.dbContext} src={step_tips_5_2} style={{ display: props.delayData.step >= 6 && props.delayData.erji && props.delayData.earPhoneType === "有线耳机" ? '' : 'none' }} />
  115. <img class={[styles.dbBtn, styles.heartbeat]} src={step_btn_1} style={{ display: props.delayData.step <= 2 ? '' : 'none' }} onClick={() => emit("startCheckDelay")} />
  116. <img class={[styles.dbBtn, styles.heartbeat]} src={step_btn_2} style={{ display: props.delayData.step >= 6 ? '' : 'none' }} onClick={() => {emit("close")}} />
  117. </div>
  118. </div>
  119. </div>
  120. );
  121. },
  122. });