feat:修改学习逻辑
This commit is contained in:
@@ -13,7 +13,6 @@ import {inject, watch} from "vue";
|
||||
|
||||
dayjs.extend(isBetween);
|
||||
|
||||
let dictIsEnd = inject<boolean>('dictIsEnd')
|
||||
|
||||
const store = useBaseStore()
|
||||
const settingStore = useSettingStore()
|
||||
@@ -21,6 +20,9 @@ const statStore = usePracticeStore()
|
||||
const model = defineModel({default: false})
|
||||
let list = $ref([])
|
||||
|
||||
defineProps<{
|
||||
dictIsEnd: boolean;
|
||||
}>()
|
||||
|
||||
function calcWeekList() {
|
||||
// 获取本周的起止时间
|
||||
@@ -61,7 +63,6 @@ watch(model, (newVal) => {
|
||||
requestIdleCallback(() => {
|
||||
store.sdict.lastLearnIndex = store.sdict.lastLearnIndex + statStore.newWordNumber
|
||||
store.sdict.statistics.push(data as any)
|
||||
store.sdict.statistics.sort((a, b) => a.startDate - b.startDate)
|
||||
calcWeekList(); // 新增:计算本周学习记录
|
||||
})
|
||||
}
|
||||
@@ -89,7 +90,7 @@ function options(emitType: string) {
|
||||
:keyboard="false"
|
||||
:show-close="false"
|
||||
v-model="model">
|
||||
<div class="w-120 bg-white color-black p-6 relative flex flex-col gap-6">
|
||||
<div class="w-140 bg-white color-black p-6 relative flex flex-col gap-6">
|
||||
<div class="w-full flex flex-col justify-evenly">
|
||||
<div class="center text-2xl mb-2">已完成今日任务</div>
|
||||
<div class="flex">
|
||||
@@ -160,6 +161,9 @@ function options(emitType: string) {
|
||||
@click="options(EventKey.continueStudy)">
|
||||
{{ dictIsEnd ? '重新练习' : '再来一组' }}
|
||||
</BaseButton>
|
||||
<BaseButton @click="$router.back">
|
||||
返回主页
|
||||
</BaseButton>
|
||||
<BaseButton>
|
||||
分享
|
||||
</BaseButton>
|
||||
|
||||
@@ -71,6 +71,7 @@ watch(() => studyData, () => {
|
||||
data.wrongWords = []
|
||||
allWrongWords = new Set()
|
||||
|
||||
settingStore.dictation = false
|
||||
statStore.step = 0
|
||||
statStore.startDate = Date.now()
|
||||
statStore.inputWordNumber = 0
|
||||
@@ -86,7 +87,6 @@ const dictIsEnd = $computed(() => {
|
||||
})
|
||||
|
||||
provide('studyData', data)
|
||||
provide('dictIsEnd', dictIsEnd)
|
||||
|
||||
const word = $computed(() => {
|
||||
return data.words[data.index] ?? getDefaultWord()
|
||||
@@ -287,7 +287,10 @@ function togglePanel() {
|
||||
|
||||
function continueStudy() {
|
||||
if (dictIsEnd) {
|
||||
|
||||
//todo 不知这样处理是否不妥?
|
||||
store.sdict.lastLearnIndex = 0
|
||||
settingStore.dictation = false
|
||||
studyData = getCurrentStudyWord()
|
||||
} else {
|
||||
settingStore.dictation = false
|
||||
studyData = getCurrentStudyWord()
|
||||
@@ -406,7 +409,7 @@ useEvents([
|
||||
</Panel>
|
||||
</div>
|
||||
</div>
|
||||
<Statistics v-model="showStatDialog"/>
|
||||
<Statistics v-model="showStatDialog" :dictIsEnd="dictIsEnd"/>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -50,6 +50,10 @@ async function init() {
|
||||
}
|
||||
|
||||
function study() {
|
||||
// getCurrentStudyWord()
|
||||
// store.sdict.lastLearnIndex += 3
|
||||
// return
|
||||
// return store.sdict.lastLearnIndex = store.sdict.length - 1
|
||||
if (store.sdict.id) {
|
||||
if (!store.sdict.words.length) {
|
||||
return ElMessage.warning('没有单词可学习!')
|
||||
@@ -278,7 +282,7 @@ function clickActivityEvent(e) {
|
||||
<div class="center text-sm" :style="{ opacity: tempPerDayStudyNumber === 20 ? 1 : 0 }">
|
||||
推荐
|
||||
</div>
|
||||
<el-slider :min="3" :step="10" show-stops :marks="{ 10: '10', 200: '200' }" size="small" class="my-6"
|
||||
<el-slider :min="10" :step="10" show-stops :marks="{ 10: '10', 200: '200' }" size="small" class="my-6"
|
||||
:max="200" v-model="tempPerDayStudyNumber"/>
|
||||
<div class="flex gap-2 mb-2 mt-10 items-center">
|
||||
<div>预计</div>
|
||||
|
||||
Reference in New Issue
Block a user