feat:修改在学完状态下,单词任务的返回值
This commit is contained in:
@@ -2,18 +2,17 @@
|
||||
import Dialog from "@/pages/pc/components/dialog/Dialog.vue";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
import {ShortcutKey, Statistics, StudyData} from "@/types.ts";
|
||||
import {ShortcutKey, Statistics} from "@/types.ts";
|
||||
import {emitter, EventKey, useEvents} from "@/utils/eventBus.ts";
|
||||
import {Icon} from '@iconify/vue';
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import dayjs from "dayjs";
|
||||
import isBetween from "dayjs/plugin/isBetween";
|
||||
import {inject, watch} from "vue";
|
||||
import {watch} from "vue";
|
||||
|
||||
dayjs.extend(isBetween);
|
||||
|
||||
|
||||
const store = useBaseStore()
|
||||
const settingStore = useSettingStore()
|
||||
const statStore = usePracticeStore()
|
||||
@@ -49,6 +48,7 @@ function calcWeekList() {
|
||||
// 监听 model 弹窗打开时重新计算
|
||||
watch(model, (newVal) => {
|
||||
if (newVal) {
|
||||
dictIsEnd = false;
|
||||
let data: Statistics = {
|
||||
spend: statStore.spend,
|
||||
startDate: statStore.startDate,
|
||||
@@ -79,7 +79,7 @@ useEvents([
|
||||
])
|
||||
|
||||
function options(emitType: string) {
|
||||
model.value = false
|
||||
close()
|
||||
emitter.emit(EventKey[emitType])
|
||||
}
|
||||
|
||||
@@ -106,19 +106,14 @@ function options(emitType: string) {
|
||||
</div>
|
||||
<div class="flex-1 flex flex-col items-center">
|
||||
<div class="text-sm color-gray">默写数</div>
|
||||
<div class="text-4xl font-bold">{{
|
||||
statStore.newWordNumber
|
||||
}}
|
||||
</div>
|
||||
<div class="text-4xl font-bold">{{ statStore.newWordNumber }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-xl text-center flex flex-col justify-around">
|
||||
<div>非常棒! 坚持了 <span class="color-green font-bold text-2xl">{{
|
||||
dayjs().diff(statStore.startDate, 'm')
|
||||
}}</span>
|
||||
分钟
|
||||
<div>非常棒! 坚持了 <span class="color-green font-bold text-2xl">
|
||||
{{ dayjs().diff(statStore.startDate, 'm') }}</span>分钟
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-center gap-10">
|
||||
|
||||
@@ -116,7 +116,7 @@ watch(() => studyData, () => {
|
||||
statStore.inputWordNumber = 0
|
||||
statStore.wrong = 0
|
||||
statStore.total = studyData.review.length + studyData.new.length + studyData.write.length
|
||||
statStore.newWordNumber = studyData.new.length
|
||||
statStore.newWordNumber = store.sdict.complete ? studyData.review.length : studyData.new.length
|
||||
statStore.index = 0
|
||||
})
|
||||
|
||||
@@ -327,15 +327,8 @@ function togglePanel() {
|
||||
}
|
||||
|
||||
function continueStudy() {
|
||||
if (dictIsEnd) {
|
||||
//todo 不知这样处理是否不妥?
|
||||
store.sdict.lastLearnIndex = 0
|
||||
settingStore.dictation = false
|
||||
studyData = getCurrentStudyWord()
|
||||
} else {
|
||||
settingStore.dictation = false
|
||||
studyData = getCurrentStudyWord()
|
||||
}
|
||||
settingStore.dictation = false
|
||||
studyData = getCurrentStudyWord()
|
||||
}
|
||||
|
||||
useEvents([
|
||||
@@ -450,7 +443,7 @@ useEvents([
|
||||
</Panel>
|
||||
</div>
|
||||
</div>
|
||||
<Statistics v-model="showStatDialog" :dictIsEnd="dictIsEnd"/>
|
||||
<Statistics v-model="showStatDialog"/>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -49,10 +49,13 @@ async function init() {
|
||||
|
||||
}
|
||||
|
||||
function study() {
|
||||
function startStudy() {
|
||||
// getCurrentStudyWord()
|
||||
// store.sdict.lastLearnIndex += 3
|
||||
// return
|
||||
// return store.sdict.lastLearnIndex = store.sdict.length - 1
|
||||
// store.sdict.complete = true
|
||||
// store.sdict.lastLearnIndex = 20
|
||||
// currentStudy = getCurrentStudyWord()
|
||||
// return
|
||||
// return store.sdict.lastLearnIndex = store.sdict.length - 1
|
||||
if (store.sdict.id) {
|
||||
if (!store.sdict.words.length) {
|
||||
@@ -166,6 +169,15 @@ function clickActivityEvent(e) {
|
||||
}
|
||||
}
|
||||
|
||||
const progressTextLeft = $computed(() => {
|
||||
if (store.sdict.complete) return '已学完,进入总复习阶段'
|
||||
return '已学习' + store.currentStudyProgress + '%'
|
||||
})
|
||||
const progressTextRight = $computed(() => {
|
||||
// if (store.sdict.complete) return store.sdict?.length
|
||||
return store.sdict?.lastLearnIndex
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -183,10 +195,8 @@ function clickActivityEvent(e) {
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="text-sm flex justify-between">
|
||||
已学习{{ store.currentStudyProgress }}%
|
||||
<span>{{ store.sdict.lastLearnIndex }} / {{
|
||||
store.sdict.words.length
|
||||
}}</span>
|
||||
<span>{{ progressTextLeft }}</span>
|
||||
<span>{{ progressTextRight }} / {{ store.sdict.words.length }}</span>
|
||||
</div>
|
||||
<el-progress class="mt-1" :percentage="store.currentStudyProgress" :show-text="false"></el-progress>
|
||||
</div>
|
||||
@@ -224,7 +234,7 @@ function clickActivityEvent(e) {
|
||||
个单词
|
||||
</div>
|
||||
<div class="rounded-xl bg-slate-800 flex items-center gap-2 py-3 px-5 text-white cursor-pointer"
|
||||
:class="store.sdict.name || 'opacity-70 cursor-not-allowed'" @click="study">
|
||||
:class="store.sdict.name || 'opacity-70 cursor-not-allowed'" @click="startStudy">
|
||||
<span>开始学习</span>
|
||||
<Icon icon="icons8:right-round" class="text-2xl"/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user