index.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { Transition, defineComponent, onBeforeUnmount, onMounted, ref } from "vue";
  2. import styles from "./index.module.less";
  3. import icons from "./icons.json";
  4. import { followData, handleFollowEnd, handleFollowStart } from "/src/view/follow-practice";
  5. import { Popup } from "vant";
  6. import Microphone from "./microphone";
  7. import state, { IPlatform } from "/src/state";
  8. import PcEndIcon from "../header-top/image/pc_end_icon.png";
  9. import { headImg } from "/src/page-instrument/header-top/image";
  10. export default defineComponent({
  11. name: "follow-model",
  12. setup() {
  13. return () => (
  14. <>
  15. {/* <Transition name="pop-center">
  16. {!followData.start && (
  17. <div class={styles.startBtn} key="start">
  18. <img
  19. src={icons.start}
  20. onClick={() => {
  21. handleFollowStart();
  22. }}
  23. />
  24. </div>
  25. )}
  26. </Transition>
  27. <Transition name="pop-center">
  28. {followData.start && (
  29. <div class={[styles.endBtn, state.fingeringInfo?.name && state.fingeringInfo.direction == 'transverse' && state.setting.displayFingering ? styles.top : styles.bottom, state.platform === IPlatform.PC && styles.pcEndBtn]} key="end">
  30. <img
  31. src={state.platform === IPlatform.PC ? PcEndIcon : icons.end}
  32. onClick={() => {
  33. handleFollowEnd();
  34. }}
  35. />
  36. </div>
  37. )}
  38. </Transition> */}
  39. {/* 遮罩 */}
  40. {
  41. followData.isBeginMask && <div class={styles.beginMask}></div>
  42. }
  43. <div class={[styles.operatingBtn, state.playBtnDirection === "left" ? styles.operatingLeft : ""]}>
  44. {!followData.start && (
  45. <img
  46. class={[styles.iconBtn, "follow-1"]}
  47. src={headImg("icon_play.png")}
  48. onClick={() => {
  49. followData.start = true;
  50. handleFollowStart();
  51. }}
  52. />
  53. )}
  54. {followData.start && (
  55. <>
  56. <img class={styles.iconBtn} src={headImg("icon_reset.png")} onClick={() => handleFollowEnd()} />
  57. <img class={styles.iconBtn} src={headImg("submit.png")} onClick={() => handleFollowEnd()} />
  58. </>
  59. )}
  60. </div>
  61. {/* <div style={{ display: followData.start ? "" : "none" }} class={styles.noteState}>
  62. <span style={{ background: "#ffca67" }} class={styles.dot}></span>
  63. <span>低</span>
  64. <span style={{ background: "rgb(255, 0, 0)" }} class={styles.dot}></span>
  65. <span>高</span>
  66. </div> */}
  67. <Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={followData.earphone}>
  68. <Microphone
  69. onClose={() => {
  70. followData.earphone = false;
  71. }}
  72. />
  73. </Popup>
  74. </>
  75. );
  76. },
  77. });