From d7e2884dc126c108b16fcb03b0260d99789ff443 Mon Sep 17 00:00:00 2001 From: zyronon Date: Thu, 24 Aug 2023 17:30:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E6=95=B0=E6=8D=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 19 ++ src/App.vue | 265 +------------------------ src/components/Side.vue | 39 +++- src/components/Toolbar/Toolbar.vue | 8 +- src/components/Type.vue | 275 ++++++++++++++++++++++++++ src/stores/base.ts | 305 ++++++++++++++++------------- src/types.ts | 202 +++++++++---------- 8 files changed, 609 insertions(+), 505 deletions(-) create mode 100644 src/components/Type.vue diff --git a/package.json b/package.json index 876e6da2..9cbbc03a 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@icon-park/vue-next": "^1.4.2", "element-plus": "^2.3.9", "hover.css": "^2.3.2", + "localforage": "^1.10.0", "lodash": "^4.17.21", "pinia": "^2.1.6", "swiper": "^10.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61e5eeb0..122b458a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ dependencies: hover.css: specifier: ^2.3.2 version: 2.3.2 + localforage: + specifier: ^1.10.0 + version: 1.10.0 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -1191,6 +1194,10 @@ packages: resolution: {integrity: sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==} dev: false + /immediate@3.0.6: + resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==} + dev: false + /immutable@4.3.2: resolution: {integrity: sha512-oGXzbEDem9OOpDWZu88jGiYCvIsLHMvGw+8OXlpsvTFvIQplQbjg1B1cvKg8f7Hoch6+NGjpPsH1Fr+Mc2D1aA==} dev: true @@ -1256,11 +1263,23 @@ packages: resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} dev: true + /lie@3.1.1: + resolution: {integrity: sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==} + dependencies: + immediate: 3.0.6 + dev: false + /local-pkg@0.4.3: resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} engines: {node: '>=14'} dev: true + /localforage@1.10.0: + resolution: {integrity: sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==} + dependencies: + lie: 3.1.1 + dev: false + /locate-path@6.0.0: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} diff --git a/src/App.vue b/src/App.vue index 4ef932cf..cb00e40b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,166 +1,10 @@ @@ -170,34 +14,7 @@ const {appearance, toggle} = useThemeColor()
-
-
{{ store.word.trans.join(';') }}
-
-
- {{ input }} - {{ wrong }} - - {{ restWord }} -
-
播放
-
-
{{ store.word.usphone }}
-
- - 忽略 - - - 收藏 - - - 下一个 - -
-
+
@@ -236,78 +53,8 @@ const {appearance, toggle} = useThemeColor() align-items: center; justify-content: center; - .type-word { - display: flex; - //display: none; - - align-items: center; - justify-content: center; - flex-direction: column; - font-size: 14rem; - color: gray; - gap: 2rem; - - .options { - margin-top: 10rem; - display: flex; - gap: 15rem; - font-size: 18rem; - - } - - .phonetic, .translate { - font-size: 20rem; - } - - .word-wrapper { - display: flex; - align-items: center; - gap: 10rem; - - .word { - font-size: 48rem; - line-height: 1; - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace; - letter-spacing: 5rem; - - .input { - color: rgba(74, 222, 128, 0.8); - } - - .wrong { - color: rgba(red, 0.6); - } - - &.is-wrong { - animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; - } - } - } - } } } } -@keyframes shake { - 10%, - 90% { - transform: translate3d(-1px, 0, 0); - } - - 20%, - 80% { - transform: translate3d(2px, 0, 0); - } - - 30%, - 50%, - 70% { - transform: translate3d(-4px, 0, 0); - } - - 40%, - 60% { - transform: translate3d(4px, 0, 0); - } -} diff --git a/src/components/Side.vue b/src/components/Side.vue index bd029ad6..d2b636e7 100644 --- a/src/components/Side.vue +++ b/src/components/Side.vue @@ -20,13 +20,9 @@ function slideTo(index: number) { swiperIns0.slideTo(tabIndex = index) } - function changeDict(dict: Dict, i: number) { - if (store.currentDictType.name !== dict.type) { - store.currentDictType = { - name: dict.type, - dictUrl: dict.url - } + if (store.currentDictType !== dict.type) { + store.currentDictType = dict.type } store.currentDict.wordIndex = i } @@ -55,7 +51,7 @@ function changeDict(dict: Dict, i: number) { :isActive="store.sideIsOpen && tabIndex === 0" :list="store.dict.chapterList[store.dict.chapterIndex]??[]" :activeIndex="store.dict.wordIndex"/> -