Skip to content

Commit

Permalink
feat(page):新增页面以及 bug 修复
Browse files Browse the repository at this point in the history
- 新增错题本练习页面
- 删除部分页面的 page transition 功能,避免 dom 替换失败
  • Loading branch information
besscroft committed Sep 12, 2023
1 parent 1ca2051 commit 546c2a4
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 36 deletions.
3 changes: 2 additions & 1 deletion heming-web/components/Work.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
const nuxtApp = useNuxtApp()
const router = useRouter()
const wrongBook = ref({})
Expand Down Expand Up @@ -34,7 +35,7 @@ onMounted(async () => {

<v-card-text flex items-center>
<p w-full>{{ wrongBook.count || 0 }} 题</p>
<v-btn>
<v-btn @click="router.push('/practise')">
复习
</v-btn>
</v-card-text>
Expand Down
71 changes: 38 additions & 33 deletions heming-web/layouts/learn.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
const router = useRouter()
const breakpoints = useBreakpoints(breakpointsTailwind)
const smAndLarger = breakpoints.greaterOrEqual('sm')
const choiceLoading = ref<boolean>(false)
Expand All @@ -12,39 +13,43 @@ const handleChoiceLoading = (val: boolean) => {
</script>

<template>
<Header />
<div v-if="smAndLarger" p2 grid sm:px16 md:px20 lg:24 grid-cols-1 gap-4 lg:grid-cols-3 lg:gap-8>
<Today />
<Dictionary :choiceLoading="choiceLoading" @handleChoiceLoading="handleChoiceLoading" />
<Work />
</div>
<div sm:hidden p2>
<v-card>
<v-tabs
v-model="tab"
color="deep-purple-accent-4"
align-tabs="center"
>
<v-tab :value="1">今日概览</v-tab>
<v-tab :value="2">单词进度</v-tab>
<v-tab :value="3">错题本</v-tab>
</v-tabs>
<v-window v-model="tab">
<v-window-item :value="1">
<Today />
</v-window-item>
<v-window-item :value="2">
<Dictionary :choiceLoading="choiceLoading" @handleChoiceLoading="handleChoiceLoading" />
</v-window-item>
<v-window-item :value="3">
<Work />
</v-window-item>
</v-window>
</v-card>
</div>
<div p-2 w-full v-if="!choiceLoading">
<slot />
</div>
<v-app>
<div v-if="router.currentRoute.value.path === '/learn'">
<Header />
<div v-if="smAndLarger" p2 grid sm:px16 md:px20 lg:24 grid-cols-1 gap-4 lg:grid-cols-3 lg:gap-8>
<Today />
<Dictionary :choiceLoading="choiceLoading" @handleChoiceLoading="handleChoiceLoading" />
<Work />
</div>
<div sm:hidden p2>
<v-card>
<v-tabs
v-model="tab"
color="deep-purple-accent-4"
align-tabs="center"
>
<v-tab :value="1">今日概览</v-tab>
<v-tab :value="2">单词进度</v-tab>
<v-tab :value="3">错题本</v-tab>
</v-tabs>
<v-window v-model="tab">
<v-window-item :value="1">
<Today />
</v-window-item>
<v-window-item :value="2">
<Dictionary :choiceLoading="choiceLoading" @handleChoiceLoading="handleChoiceLoading" />
</v-window-item>
<v-window-item :value="3">
<Work />
</v-window-item>
</v-window>
</v-card>
</div>
</div>
<div w-full v-if="!choiceLoading">
<slot />
</div>
</v-app>
</template>

<style scoped>
Expand Down
1 change: 1 addition & 0 deletions heming-web/pages/[...all].vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const router = useRouter()
definePageMeta({
layout: 'layout',
pageTransition: false,
})
</script>

Expand Down
3 changes: 2 additions & 1 deletion heming-web/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
const router = useRouter()
definePageMeta({
layout: 'layout',
layout: 'default',
pageTransition: false,
})
</script>

Expand Down
3 changes: 2 additions & 1 deletion heming-web/pages/learn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ onMounted(() => {
definePageMeta({
layout: 'learn',
pageTransition: false,
})
</script>

<template>
<div>
<div p-2>
<v-no-ssr>
<v-card
:loading="loading"
Expand Down
1 change: 1 addition & 0 deletions heming-web/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ onUnmounted(() => {
definePageMeta({
layout: 'default',
pageTransition: false,
})
</script>

Expand Down
27 changes: 27 additions & 0 deletions heming-web/pages/practise.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script setup lang="ts">
const router = useRouter()
definePageMeta({
layout: 'learn',
pageTransition: false,
})
</script>

<template>
<div>
<v-app-bar color="primary" w-full>
<template v-slot:prepend>
<v-app-bar-nav-icon icon="mdi-arrow-left" @click="router.push('/learn')"></v-app-bar-nav-icon>
</template>

<v-app-bar-title>错题训练</v-app-bar-title>
</v-app-bar>
<div pt18 px2>
开发中...
</div>
</div>
</template>

<style scoped>
</style>

0 comments on commit 546c2a4

Please sign in to comment.