index.tsx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import { defineComponent, onBeforeMount, watch } from "vue";
  2. import styles from "./index.module.less";
  3. import iconClose from "../image/close2.svg";
  4. import { Cell, Field, NoticeBar, Radio, RadioGroup, Slider, Switch, Tab, Tabs } from "vant";
  5. import state from "/src/state";
  6. import { api_closeCamera, api_openCamera } from "/src/helpers/communication";
  7. import store from "store";
  8. import iconInfo from "../image/info.svg";
  9. import iconDown from "../image/down.svg";
  10. import iconTv from "../image/tv.svg";
  11. import iconYijian from "../image/yijian.svg";
  12. export default defineComponent({
  13. name: "header-settting",
  14. emits: ["close"],
  15. setup(props, { emit }) {
  16. return () => (
  17. <div class={styles["header-settting"]}>
  18. <div class={styles.closeBtn} onClick={() => emit("close")}>
  19. <img src={iconClose} />
  20. </div>
  21. <div class={styles.content}>
  22. <Tabs border animated swipeable>
  23. <Tab title="全局设置">
  24. <NoticeBar class={styles.noticebar} left-icon={iconInfo} text="全局设置会更改所有乐谱练习及评测" />
  25. <Cell title="护眼模式" center>
  26. {{
  27. extra: () => <Switch v-model={state.setting.eyeProtection}></Switch>,
  28. }}
  29. </Cell>
  30. <div class={styles.btnsbar}>
  31. <div class={styles.btn}>
  32. <img src={iconDown} />
  33. 下载曲谱
  34. </div>
  35. <div class={styles.btn}>
  36. <img src={iconTv} />
  37. 投屏帮助
  38. </div>
  39. <div class={styles.btn}>
  40. <img src={iconYijian} />
  41. 意见反馈
  42. </div>
  43. </div>
  44. </Tab>
  45. <Tab title="练习设置">
  46. <Cell title="循环播放" center>
  47. {{
  48. extra: () => <Switch v-model={state.setting.repeatAutoPlay}></Switch>,
  49. }}
  50. </Cell>
  51. <Cell title="显示指法" center>
  52. {{
  53. extra: () => <Switch v-model={state.setting.displayFingering}></Switch>,
  54. }}
  55. </Cell>
  56. </Tab>
  57. <Tab title="评测">
  58. <Cell title="选择评测难度" center>
  59. {{
  60. extra: () => (
  61. <RadioGroup iconSize={20} class={styles.radioGroup} v-model={state.setting.evaluationDifficulty}>
  62. <Radio name="BEGINNER">入门</Radio>
  63. <Radio name="ADVANCED">进阶</Radio>
  64. <Radio name="PERFORMER">大师</Radio>
  65. </RadioGroup>
  66. ),
  67. }}
  68. </Cell>
  69. <Cell title="校音提醒" center>
  70. {{
  71. extra: () => <Switch v-model={state.setting.soundEffect}></Switch>,
  72. }}
  73. </Cell>
  74. <Cell title="摄像头" center>
  75. {{
  76. extra: () => (
  77. <Switch
  78. v-model={state.setting.camera}
  79. onChange={(value) => {
  80. if (value) {
  81. api_openCamera();
  82. } else {
  83. api_closeCamera();
  84. }
  85. }}
  86. ></Switch>
  87. ),
  88. }}
  89. </Cell>
  90. <Cell style={{ display: state.setting.camera ? "" : "none" }} title="透明度" class={styles.sliderWrap} center>
  91. {{
  92. extra: () => (
  93. <Slider class={styles.slider} min={0} max={100} v-model:modelValue={state.setting.cameraOpacity}>
  94. {{
  95. button: () => <div class={styles.sliderBtn}>{state.setting.cameraOpacity}</div>,
  96. }}
  97. </Slider>
  98. ),
  99. }}
  100. </Cell>
  101. <Cell title="保存到相册" center>
  102. {{
  103. extra: () => <Switch v-model={state.setting.saveToAlbum}></Switch>,
  104. }}
  105. </Cell>
  106. <Cell title="开启伴奏" center>
  107. {{
  108. extra: () => <Switch v-model={state.setting.enableAccompaniment}></Switch>,
  109. }}
  110. </Cell>
  111. <Cell title="标准音高" center>
  112. {{
  113. extra: () => (
  114. <RadioGroup iconSize={20} class={styles.radioGroup} v-model={state.setting.frequency}>
  115. <Radio name={440}>440Hz</Radio>
  116. <Radio name={442}>442Hz</Radio>
  117. </RadioGroup>
  118. ),
  119. }}
  120. </Cell>
  121. <Field class={styles.reactionTime} label="反应时间(毫秒)" type="digit" v-model:modelValue={state.setting.reactionTimeMs} />
  122. </Tab>
  123. </Tabs>
  124. </div>
  125. </div>
  126. );
  127. },
  128. });