save
This commit is contained in:
9138
pnpm-lock.yaml
generated
9138
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@
|
||||
--color-font-active-1: white;
|
||||
--color-font-active-2: whitesmoke;
|
||||
--color-main-active: rgb(12, 140, 233);
|
||||
--color-primary: rgb(12, 140, 233);
|
||||
--color-scrollbar: rgb(147, 173, 227);
|
||||
--color-gray: gray;
|
||||
--color-sub-gray: #c0bfbf;
|
||||
|
||||
@@ -14,8 +14,8 @@ defineEmits(['click'])
|
||||
|
||||
<template>
|
||||
<Tooltip :title="title">
|
||||
<IconWrapper v-bind="$attrs">
|
||||
<Icon @click.stop="$emit('click')" :icon="icon"/>
|
||||
<IconWrapper v-bind="$attrs" @click.stop="$emit('click')">
|
||||
<Icon :icon="icon"/>
|
||||
</IconWrapper>
|
||||
</Tooltip>
|
||||
</template>
|
||||
|
||||
@@ -18,10 +18,10 @@ $w: 1.4rem;
|
||||
border-radius: .3rem;
|
||||
background: transparent;
|
||||
transition: all .3s;
|
||||
color: var(--color-main-active);
|
||||
//color: var(--color-main-active);
|
||||
|
||||
&:hover {
|
||||
background: var(--color-main-active);
|
||||
background: var(--color-primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ const runtimeStore = useRuntimeStore()
|
||||
const router = useRouter()
|
||||
const {toggleTheme} = useTheme()
|
||||
|
||||
let show = $ref(false)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -69,11 +70,43 @@ const {toggleTheme} = useTheme()
|
||||
icon="uil:setting"/>
|
||||
</div>
|
||||
</div>
|
||||
<BaseIcon
|
||||
class="fixed top-5 left-6 z-9"
|
||||
:title="`收起(${settingStore.shortcutKeyMap[ShortcutKey.OpenSetting]})`"
|
||||
@click="settingStore.showSide = !settingStore.showSide"
|
||||
icon="formkit:right"/>
|
||||
<div class="fixed top-8 left-8 z-9">
|
||||
<BaseIcon
|
||||
:title="`收起(${settingStore.shortcutKeyMap[ShortcutKey.OpenSetting]})`"
|
||||
@click="show = !show"
|
||||
icon="hugeicons:menu-square"/>
|
||||
<div class="menus flex flex-col" v-if="show">
|
||||
<BaseIcon
|
||||
title="单词"
|
||||
@click="router.push('/word')"
|
||||
icon="material-symbols-light:dictionary-outline-sharp"/>
|
||||
<BaseIcon
|
||||
title="文章"
|
||||
@click="router.push('/article')"
|
||||
icon="ph:article-ny-times"/>
|
||||
<BaseIcon
|
||||
title="试卷"
|
||||
icon="healthicons:i-exam-multiple-choice-outline"/>
|
||||
<BaseIcon
|
||||
:title="`展开(${settingStore.shortcutKeyMap[ShortcutKey.OpenSetting]})`"
|
||||
@click="settingStore.showSide = !settingStore.showSide"
|
||||
icon="formkit:right"/>
|
||||
<Tooltip
|
||||
:title="`切换主题(${settingStore.shortcutKeyMap[ShortcutKey.ToggleTheme]})`"
|
||||
>
|
||||
<IconWrapper>
|
||||
<Icon icon="ep:moon" v-if="settingStore.theme === 'dark'"
|
||||
@click="toggleTheme"/>
|
||||
<Icon icon="tabler:sun" v-else @click="toggleTheme"/>
|
||||
</IconWrapper>
|
||||
</Tooltip>
|
||||
<BaseIcon
|
||||
:title="`设置(${settingStore.shortcutKeyMap[ShortcutKey.OpenSetting]})`"
|
||||
@click="runtimeStore.showSettingModal = true"
|
||||
icon="uil:setting"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 z-1">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
@@ -104,16 +137,16 @@ const {toggleTheme} = useTheme()
|
||||
transition: all .3s;
|
||||
|
||||
.row {
|
||||
@apply cursor-pointer;
|
||||
padding: 0.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1rem;
|
||||
//font-weight: bold;
|
||||
@apply cursor-pointer rounded-md text p-2 my-2 flex items-center gap-2;
|
||||
transition: all .5s;
|
||||
|
||||
&:hover {
|
||||
background: var(--color-primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
svg {
|
||||
font-size: 2rem;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,17 +39,9 @@ watch(practiceStore, () => {
|
||||
practiceStore.correctRate = 100 - Math.trunc(((practiceStore.wrongWordNumber) / (practiceStore.inputWordNumber)) * 100)
|
||||
})
|
||||
|
||||
|
||||
function test() {
|
||||
MessageBox.confirm(
|
||||
'2您选择了“本地翻译”,但译文内容却为空白,是否修改为“不需要翻译”并保存?',
|
||||
'1提示',
|
||||
() => {
|
||||
console.log('ok')
|
||||
},
|
||||
() => {
|
||||
console.log('cencal')
|
||||
})
|
||||
function next() {
|
||||
store.currentStudy.word.lastLearnIndex = store.currentStudy.word.lastLearnIndex + store.currentStudy.word.perDayStudyNumber
|
||||
repeat()
|
||||
}
|
||||
|
||||
function write() {
|
||||
@@ -108,6 +100,7 @@ function jumpSpecifiedChapter(val: number) {
|
||||
onMounted(() => {
|
||||
emitter.on(EventKey.write, write)
|
||||
emitter.on(EventKey.repeat, repeat)
|
||||
emitter.on(EventKey.next, next)
|
||||
emitter.on(EventKey.jumpSpecifiedChapter, jumpSpecifiedChapter)
|
||||
|
||||
emitter.on(ShortcutKey.PreviousChapter, prev)
|
||||
@@ -125,6 +118,7 @@ onMounted(() => {
|
||||
onUnmounted(() => {
|
||||
emitter.off(EventKey.write, write)
|
||||
emitter.off(EventKey.repeat, repeat)
|
||||
emitter.off(EventKey.next, next)
|
||||
emitter.off(EventKey.jumpSpecifiedChapter, jumpSpecifiedChapter)
|
||||
|
||||
emitter.off(ShortcutKey.PreviousChapter, prev)
|
||||
@@ -139,7 +133,6 @@ onUnmounted(() => {
|
||||
emitter.off(ShortcutKey.TogglePanel, togglePanel)
|
||||
})
|
||||
|
||||
|
||||
let wordData = $ref({
|
||||
words: [],
|
||||
index: -1
|
||||
|
||||
@@ -8,6 +8,7 @@ import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import {useNav} from "@/utils";
|
||||
import BasePage from "@/pages/pc/components/BasePage.vue";
|
||||
import {watch} from "vue";
|
||||
import {getDefaultDict} from "@/types.ts";
|
||||
|
||||
const base = useBaseStore()
|
||||
const router = useRouter()
|
||||
@@ -17,10 +18,11 @@ function clickEvent(e) {
|
||||
console.log('e', e)
|
||||
}
|
||||
|
||||
watch(() => base.currentStudyWordProgress, n => {
|
||||
console.log('n', n)
|
||||
}, {immediate: true})
|
||||
|
||||
let showMore = $ref(false)
|
||||
const otherWordDictList = $computed(() => {
|
||||
if (showMore) return base.otherWordDictList
|
||||
else return base.otherWordDictList.slice(0, 4)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -87,7 +89,7 @@ watch(() => base.currentStudyWordProgress, n => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card" v-if="otherWordDictList.length">
|
||||
<div class="flex justify-between">
|
||||
<div class="title">
|
||||
其他学习词典
|
||||
@@ -97,20 +99,21 @@ watch(() => base.currentStudyWordProgress, n => {
|
||||
@click="router.push('/dict')"/>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-6 mt-5 ">
|
||||
<div class=" p-4 rounded-md justify-between items-center bg-slate-200 " v-for="i in 3">
|
||||
<div class=" p-4 rounded-md justify-between items-center bg-slate-200 " v-for="i in otherWordDictList">
|
||||
<div class="flex justify-between w-full">
|
||||
<span>{{ base.currentDict.name }}</span>
|
||||
<span>{{ i.name }}</span>
|
||||
<div class="text-2xl ml-2 flex gap-4">
|
||||
<Icon icon="hugeicons:delete-02"/>
|
||||
<Icon icon="nonicons:go-16"/>
|
||||
<BaseIcon title="删除" icon="hugeicons:delete-02" @click="base.delWordDict(i)"/>
|
||||
<BaseIcon title="学习" icon="nonicons:go-16" @click="base.changeWordDict(getDefaultDict(i))"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 text-sm">已学习5555个单词的1%</div>
|
||||
<el-progress class="mt-1" :percentage="80" color="white" :show-text="false"></el-progress>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-center mt-2 text-2xl">
|
||||
<Icon icon="mingcute:down-line"/>
|
||||
<div class="flex justify-center mt-2 text-2xl" v-if="base.otherWordDictList.length > 4">
|
||||
<BaseIcon @click="showMore = !showMore" v-if="showMore" icon="mingcute:up-line"/>
|
||||
<BaseIcon @click="showMore = !showMore" v-else icon="mingcute:down-line"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -267,6 +267,9 @@ export const useBaseStore = defineStore('base', {
|
||||
if (!this.currentStudyWordDict.words?.length) return 0
|
||||
return Number(((this.currentStudy.word.lastLearnIndex / this.currentStudyWordDict.words?.length) * 100).toFixed())
|
||||
},
|
||||
otherWordDictList(): Dict[] {
|
||||
return this.wordDictList.filter(v => this.currentStudyWordDict.id !== v.id)
|
||||
},
|
||||
currentArticleDict(): Dict {
|
||||
return this.articleDictList[this.currentStudy.article.dictIndex] ?? {}
|
||||
},
|
||||
@@ -479,6 +482,11 @@ export const useBaseStore = defineStore('base', {
|
||||
}
|
||||
console.log('changeDict', cloneDeep(dict),)
|
||||
|
||||
this.wordDictList.map(v => {
|
||||
v.words = []
|
||||
v.originWords = []
|
||||
})
|
||||
|
||||
// await checkDictHasTranslate(dict)
|
||||
let rIndex = this.wordDictList.findIndex((v: Dict) => v.id === dict.id)
|
||||
if (rIndex > -1) {
|
||||
@@ -486,7 +494,7 @@ export const useBaseStore = defineStore('base', {
|
||||
this.currentStudy.word.dictIndex = rIndex
|
||||
} else {
|
||||
this.wordDictList.push(cloneDeep(dict))
|
||||
this.currentStudy.word.dictIndex = this.wordDictList.length - 1
|
||||
this.currentStudy.word.dictIndex = this.wordDictList.length - 1
|
||||
}
|
||||
this.currentStudy.word.lastLearnIndex = 0
|
||||
emitter.emit(EventKey.changeDict)
|
||||
@@ -557,5 +565,16 @@ export const useBaseStore = defineStore('base', {
|
||||
|
||||
emitter.emit(EventKey.changeDict)
|
||||
},
|
||||
delWordDict(dict: Dict) {
|
||||
let oldId = this.currentStudyWordDict.id;
|
||||
let rIndex = this.wordDictList.findIndex((v: Dict) => v.id === dict.id)
|
||||
if (rIndex > -1) {
|
||||
this.wordDictList.splice(rIndex, 1)
|
||||
}
|
||||
rIndex = this.wordDictList.findIndex((v: Dict) => v.id === oldId)
|
||||
if (rIndex > -1) {
|
||||
this.currentStudy.word.dictIndex = rIndex
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -14,7 +14,6 @@ export const EventKey = {
|
||||
keyup: 'keyup',
|
||||
onTyping: 'onTyping',
|
||||
repeat: 'repeat',
|
||||
//TODO 废弃
|
||||
next: 'next',
|
||||
write: 'write',
|
||||
editDict: 'editDict',
|
||||
|
||||
Reference in New Issue
Block a user