beiPage.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="words-bei-box">
  3. <!-- 单词区 -->
  4. <!-- <selectWordsVue :active-words="activeWords" :activeWord="activeWord"></selectWordsVue> -->
  5. <!-- 显示区 -->
  6. <selectTypesVue activeSelect="5"></selectTypesVue>
  7. <!-- 输入区 -->
  8. <view class="words-answer-box">{{data.answer}}</view>
  9. <!-- 清空和提示互斥 需要分成多行 大哥看这里 -->
  10. <!-- 清空按钮 -->
  11. <view class="clean-btn" @click="handleReset('all')"></view>
  12. <!-- 提示 -->
  13. <view class="pin-tip">提示:请点击页面下方键盘,输入正确字母。</view>
  14. <!-- 解释区 需要分成多行 大哥看这里-->
  15. <view class="pin-words-explain-box">
  16. <view class="words-explain-item">{{activeWord.jianyi.join(';')}}</view>
  17. </view>
  18. <!-- 播放和待播放需要写个切换 大哥看这里 -->
  19. <!-- 待播放 -->
  20. <view class="audio-play-btn"></view>
  21. <!-- 播放中 -->
  22. <view class="audio-playing-btn" v-if="false"></view>
  23. <!-- 浮层输入区 -->
  24. <view class="words-keyboard-box">
  25. <view class="keyboard-row">
  26. <btnTxtVue @text-select="handleSelect('a')">a</btnTxtVue>
  27. <btnTxtVue @text-select="handleSelect('b')">b</btnTxtVue>
  28. <btnTxtVue @text-select="handleSelect('c')">c</btnTxtVue>
  29. <btnTxtVue @text-select="handleSelect('d')">d</btnTxtVue>
  30. <btnTxtVue @text-select="handleSelect('e')">e</btnTxtVue>
  31. <btnTxtVue @text-select="handleSelect('f')">f</btnTxtVue>
  32. <btnTxtVue @text-select="handleSelect('g')">g</btnTxtVue>
  33. <btnTxtVue @text-select="handleSelect('h')">h</btnTxtVue>
  34. <btnTxtVue @text-select="handleSelect('i')">i</btnTxtVue>
  35. </view>
  36. <view class="keyboard-row">
  37. <btnTxtVue @text-select="handleSelect('j')">j</btnTxtVue>
  38. <btnTxtVue @text-select="handleSelect('k')">k</btnTxtVue>
  39. <btnTxtVue @text-select="handleSelect('l')">l</btnTxtVue>
  40. <btnTxtVue @text-select="handleSelect('m')">m</btnTxtVue>
  41. <btnTxtVue @text-select="handleSelect('n')">n</btnTxtVue>
  42. <btnTxtVue @text-select="handleSelect('o')">o</btnTxtVue>
  43. <btnTxtVue @text-select="handleSelect('p')">p</btnTxtVue>
  44. <btnTxtVue @text-select="handleSelect('q')">q</btnTxtVue>
  45. <btnTxtVue @text-select="handleSelect('r')">r</btnTxtVue>
  46. </view>
  47. <view class="keyboard-row">
  48. <btnTxtVue @text-select="handleSelect('s')">s</btnTxtVue>
  49. <btnTxtVue @text-select="handleSelect('t')">t</btnTxtVue>
  50. <btnTxtVue @text-select="handleSelect('u')">u</btnTxtVue>
  51. <btnTxtVue @text-select="handleSelect('v')">v</btnTxtVue>
  52. <btnTxtVue @text-select="handleSelect('w')">w</btnTxtVue>
  53. <btnTxtVue @text-select="handleSelect('x')">x</btnTxtVue>
  54. <btnTxtVue @text-select="handleSelect('y')">y</btnTxtVue>
  55. <btnTxtVue @text-select="handleSelect('z')">z</btnTxtVue>
  56. <btnTxtVue @text-select="handleReset" class="del-btn"></btnTxtVue>
  57. </view>
  58. <view class="bei-confirm-btn"></view>
  59. </view>
  60. </view>
  61. </template>
  62. <script setup>
  63. import selectWordsVue from './selectWords.vue';
  64. import selectTypesVue from './selectTypes.vue';
  65. import btnTxtVue from './btnTxt.vue';
  66. import {
  67. reactive,
  68. computed
  69. } from 'vue';
  70. import {
  71. getUserIdentity,
  72. } from "@/utils/common.js"
  73. const userCode = getUserIdentity();
  74. const props = defineProps({
  75. activeWord: { // 单词数据
  76. type: Object,
  77. },
  78. activeWords: {
  79. type: Array
  80. },
  81. })
  82. const data = reactive({
  83. answer: '',
  84. result: false, // 正确性
  85. })
  86. // 选择单词
  87. function checkIsRight() {
  88. if (data.answer == props.activeWord.value) {
  89. data.result = true;
  90. noticeBackDb()
  91. } else {
  92. data.result = false;
  93. }
  94. }
  95. function noticeBackDb() {
  96. // 通知后台已学完当前单词
  97. if (userCode == 'Visitor') {
  98. // 游客不更新后台
  99. return;
  100. }
  101. }
  102. function handleReset(code) {
  103. if (code == 'all') {
  104. // 全部清空
  105. data.answer = '';
  106. } else {
  107. // 单个清空
  108. data.answer = data.answer ? data.answer.slice(0, -1):''
  109. }
  110. }
  111. function handleSelect(word) {
  112. console.log('xxxx',word)
  113. data.answer+=word;
  114. }
  115. </script>
  116. <style>
  117. </style>