index.tsx 6.2 KB

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