From fb63a395d5303e0178c99afb69807fa0990412be Mon Sep 17 00:00:00 2001 From: zyronon Date: Wed, 13 Dec 2023 02:11:14 +0800 Subject: [PATCH] Adapt to mobile devices --- .../mobile/practice/practice-word/Typing.vue | 280 ----------- .../practice/practice-word/TypingWord.vue | 46 +- .../practice/practice-word/TypingWord2.vue | 467 ++++++++++++++++++ .../mobile/practice/practice-word/index.vue | 1 - 4 files changed, 489 insertions(+), 305 deletions(-) delete mode 100644 src/pages/mobile/practice/practice-word/Typing.vue create mode 100644 src/pages/mobile/practice/practice-word/TypingWord2.vue diff --git a/src/pages/mobile/practice/practice-word/Typing.vue b/src/pages/mobile/practice/practice-word/Typing.vue deleted file mode 100644 index 528b77fc..00000000 --- a/src/pages/mobile/practice/practice-word/Typing.vue +++ /dev/null @@ -1,280 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/pages/mobile/practice/practice-word/TypingWord.vue b/src/pages/mobile/practice/practice-word/TypingWord.vue index 4a859891..0c0bb6db 100644 --- a/src/pages/mobile/practice/practice-word/TypingWord.vue +++ b/src/pages/mobile/practice/practice-word/TypingWord.vue @@ -8,7 +8,7 @@ import {cloneDeep, reverse, shuffle} from "lodash-es" import {usePracticeStore} from "@/stores/practice.ts" import {useSettingStore} from "@/stores/setting.ts"; import {useOnKeyboardEventListener, useWindowClick} from "@/hooks/event.ts"; -import Typing from "@/pages/mobile/practice/practice-word/Typing.vue"; +import Typing from "@/pages/pc/practice/practice-word/Typing.vue"; import {useRuntimeStore} from "@/stores/runtime.ts"; import {useWordOptions} from "@/hooks/dict.ts"; import BaseIcon from "@/components/BaseIcon.vue"; @@ -244,7 +244,6 @@ watch(() => index, n => { let inputRef = $ref() - function change(e) { console.log('e', e) e.key = e.data @@ -252,10 +251,11 @@ function change(e) { inputRef.value = '' } -function know() { +function know(isTyping: boolean = false) { + inputRef.blur() settingStore.translate = false setTimeout(() => { - data.index++ + next(isTyping) }, 300) } @@ -263,10 +263,16 @@ function unknow() { settingStore.translate = true inputRef.focus() } + +let bodyHeight = $ref('100vh') +onMounted(() => { + bodyHeight = document.body.clientHeight + 'px' +}) + \ No newline at end of file diff --git a/src/pages/mobile/practice/practice-word/TypingWord2.vue b/src/pages/mobile/practice/practice-word/TypingWord2.vue new file mode 100644 index 00000000..6182eb74 --- /dev/null +++ b/src/pages/mobile/practice/practice-word/TypingWord2.vue @@ -0,0 +1,467 @@ + + + + + \ No newline at end of file diff --git a/src/pages/mobile/practice/practice-word/index.vue b/src/pages/mobile/practice/practice-word/index.vue index ec6134ad..ccfc7cb2 100644 --- a/src/pages/mobile/practice/practice-word/index.vue +++ b/src/pages/mobile/practice/practice-word/index.vue @@ -81,6 +81,5 @@ defineExpose({getCurrentPractice}) .practice { flex: 1; display: flex; - width: 100%; } \ No newline at end of file