This commit is contained in:
zyronon
2024-05-22 01:57:29 +08:00
parent cee18aa246
commit 25c3797322
4 changed files with 4984 additions and 4130 deletions

9032
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -86,7 +86,7 @@ const showCollectToggleButton = $computed(() => {
</script>
<template>
<Transition name="fade">
<div class="panel anim" v-show="settingStore.showPanel">
<div class="panel anim" v-show="settingStore.showPanel || 1">
<header>
<div class="tabs">
<div class="tab" :class="tabIndex === 0 && 'active'" @click="tabIndex = 0">当前学习</div>

View File

@@ -473,7 +473,7 @@ $article-width: 1000px;
header {
word-wrap: break-word;
position: relative;
padding: .9rem 0;
padding-top: 1rem;
.title {
text-align: center;
@@ -490,14 +490,11 @@ $article-width: 1000px;
}
.options-wrapper {
//position: absolute;
right: 1.2rem;
top: 0;
display: flex;
margin-top: 1rem;
justify-content: center;
justify-content: flex-end;
gap: .6rem;
font-size: 1.1rem;
margin-bottom: .3rem;
}
}
@@ -514,11 +511,10 @@ $article-width: 1000px;
word-break: keep-all;
word-wrap: break-word;
white-space: pre-wrap;
padding-top: 1.2rem;
.section {
font-family: var(--word-font-family);
margin-bottom: var(--space);
margin-bottom: 3rem;
.sentence {
transition: all .3s;

View File

@@ -1,5 +1,5 @@
import {defineStore} from 'pinia'
import {DefaultDict, Dict, DictType, DisplayStatistics, Sort, Word} from "../types.ts"
import {Article, DefaultDict, Dict, DictType, DisplayStatistics, Sort, Word} from "../types.ts"
import {chunk, cloneDeep, merge, reverse, shuffle} from "lodash-es";
import {emitter, EventKey} from "@/utils/eventBus.ts"
import {useRuntimeStore} from "@/stores/runtime.ts";
@@ -17,9 +17,60 @@ export interface BaseState {
},
simpleWords: string[],
load: boolean
collectWord?: Word[],
collectArticle?: Article[],
simple?: Word[],
wrong?: Word[],
articleDictList?: Dict[]
wordDictList?: Dict[],
currentLearn?: {
wordIndex: number,
articleIndex: number,
}
}
export const DefaultBaseState = (): BaseState => ({
collectWord: [],
collectArticle: [],
simple: [],
wrong: [],
articleDictList: [
{
...cloneDeep(DefaultDict),
id: 'article_nce2',
name: "新概念英语2-课文",
description: '新概念英语2-课文',
category: '英语学习',
tags: ['新概念英语'],
url: 'NCE_2.json',
translateLanguage: 'common',
language: 'en',
type: DictType.article,
resourceId: 'article_nce2',
length: 96
},
],
wordDictList: [
{
...cloneDeep(DefaultDict),
id: 'cet4',
name: 'CET-4',
description: '大学英语四级词库',
category: '中国考试',
tags: ['大学英语'],
url: 'CET4_T.json',
length: 2607,
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
],
currentLearn: {
wordIndex: 0,
articleIndex: 0
},
myDictList: [
{
...cloneDeep(DefaultDict),
@@ -237,6 +288,21 @@ export const useBaseStore = defineStore('base', {
}
}
}
let currentDict = this.wordDictList[this.currentLearn.wordIndex]
let dictResourceUrl = `./dicts/${currentDict.language}/${currentDict.type}/${currentDict.translateLanguage}/${currentDict.url}`;
if (!currentDict.originWords.length) {
let v = await getDictFile(dictResourceUrl)
// v = v.slice(0, 50)
v.map(s => {
s.id = nanoid(6)
})
currentDict.originWords = cloneDeep(v)
currentDict.words = cloneDeep(v)
currentDict.chapterWords = chunk(currentDict.words, currentDict.chapterWordNumber)
}
console.log('this.wordDictList',this.wordDictList)
emitter.emit(EventKey.changeDict)
resolve(true)
})