123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <view class="words-bei-box">
- <!-- 单词区 -->
- <!-- <selectWordsVue :active-words="activeWords" :activeWord="activeWord"></selectWordsVue> -->
- <!-- 显示区 -->
- <selectTypesVue activeSelect="5"></selectTypesVue>
- <!-- 输入区 -->
- <!-- <view class="words-answer-box">{{data.answer}}</view> -->
- <input class="words-answer-box" placeholder="请输入答案" v-model.trim="data.answer" readonly/>
- <!-- 清空和提示互斥 需要分成多行 大哥看这里 -->
- <!-- 清空按钮 -->
- <view class="clean-btn" @click="handleReset('all')"></view>
- <view class="bei-body-box">
- <!-- 提示 -->
- <!-- <view class="pin-tip">提示:请点击页面下方键盘,输入正确字母。</view> -->
- <!-- 解释区 需要分成多行 大哥看这里-->
- <view class="pin-words-explain-box">
- <view class="words-explain-item">{{activeWord.jianyi.join(';')}}</view>
- </view>
- <!-- 播放和待播放需要写个切换 大哥看这里 -->
- <!-- 待播放 -->
- <view class="audio-play-btn"></view>
- <!-- 播放中 -->
- <view class="audio-playing-btn" v-if="false"></view>
- </view>
- <!-- 浮层输入区 -->
- <view class="words-keyboard-box">
- <view class="keyboard-row">
- <btnTxtVue @text-select="handleSelect('a')">a</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('b')">b</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('c')">c</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('d')">d</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('e')">e</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('f')">f</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('g')">g</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('h')">h</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('i')">i</btnTxtVue>
- </view>
- <view class="keyboard-row">
- <btnTxtVue @text-select="handleSelect('j')">j</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('k')">k</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('l')">l</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('m')">m</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('n')">n</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('o')">o</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('p')">p</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('q')">q</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('r')">r</btnTxtVue>
- </view>
- <view class="keyboard-row">
- <btnTxtVue @text-select="handleSelect('s')">s</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('t')">t</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('u')">u</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('v')">v</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('w')">w</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('x')">x</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('y')">y</btnTxtVue>
- <btnTxtVue @text-select="handleSelect('z')">z</btnTxtVue>
- <btnTxtVue @text-select="handleReset" class="del-btn"></btnTxtVue>
- </view>
- <view class="bei-confirm-btn"></view>
- </view>
- </view>
- </template>
- <script setup>
- import selectWordsVue from './selectWords.vue';
- import selectTypesVue from './selectTypes.vue';
- import btnTxtVue from './btnTxt.vue';
- import {
- reactive,
- computed
- } from 'vue';
- import {
- getUserIdentity,
- } from "@/utils/common.js"
- const userCode = getUserIdentity();
- const props = defineProps({
- activeWord: { // 单词数据
- type: Object,
- },
- activeWords: {
- type: Array
- },
- })
- const data = reactive({
- answer: '',
- result: false, // 正确性
- })
- // 选择单词
- function checkIsRight() {
- if (data.answer == props.activeWord.value) {
- data.result = true;
- noticeBackDb()
- } else {
- data.result = false;
- }
- }
- function noticeBackDb() {
- // 通知后台已学完当前单词
- if (userCode == 'Visitor') {
- // 游客不更新后台
- return;
- }
- }
- function handleReset(code) {
- if (code == 'all') {
- // 全部清空
- data.answer = '';
- } else {
- // 单个清空
- data.answer = data.answer ? data.answer.slice(0, -1):''
- }
- }
- function handleSelect(word) {
- console.log('xxxx',word)
- data.answer+=word;
- }
- </script>
- <style>
- </style>
|