Skip to content

Commit f09a355

Browse files
committed
fix: 修复了点击Back按钮时白屏的问题
1 parent 642cc5b commit f09a355

File tree

13 files changed

+2089
-2208
lines changed

13 files changed

+2089
-2208
lines changed

layouts/default.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<template #breadcrumb>
5252
<el-breadcrumb separator="/">
5353

54-
<template v-for="item in layout_store.path">
54+
<template v-for="item in page_info.path">
5555
<el-breadcrumb-item v-if="'path' in item" :to="{ path: item.path }">
5656
{{ item.name }}
5757
</el-breadcrumb-item>
@@ -66,12 +66,12 @@
6666

6767
<template #content>
6868
<div class="flex items-center">
69-
<span class="text-large font-600 mr-3">{{ layout_store.title }}</span>
69+
<span class="text-large font-600 mr-3">{{ page_info.title }}</span>
7070
<span
7171
class="text-sm mr-2"
7272
style="color: var(--el-text-color-regular)"
73-
v-if="'subtitle' in layout_store"
74-
>{{ layout_store.subtitle }}</span>
73+
v-if="'subtitle' in page_info"
74+
>{{ page_info.subtitle }}</span>
7575
</div>
7676
</template>
7777

@@ -85,13 +85,18 @@
8585
</template>
8686

8787
<script setup>
88+
import { pageInfoMapper } from '~/util/route';
8889
89-
const layout_store = useLayoutStore()
9090
const user_store = useUserStore()
9191
const router = useRouter()
9292
93+
const page_info = computed(() => {
94+
return pageInfoMapper[router.currentRoute.value.fullPath]
95+
})
96+
9397
function goBack() {
94-
router.push('/')
98+
// router.push('/')
99+
window.location.href = '/'
95100
}
96101
97102
function login() {

pages/decrypt/history.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@
2020
import { getDecryptHistorySchema } from '~/api/shamir/decrypt';
2121
import { callApi } from '~/util/callApi';
2222
23-
const layoutStore = useLayoutStore();
24-
25-
layoutStore.title = "我的解密历史"
26-
layoutStore.path = [
27-
{ name: "Home", path: "/" },
28-
{ name: "Decrypt" },
29-
{ name: "History" }
30-
]
31-
3223
const identity_name = ref('')
3324
3425
const history = ref([])

pages/decrypt/status.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@
2929
import { getDecryptStatusSchema, getDecryptedEmailSchema } from '~/api/shamir/decrypt';
3030
import { callApi } from '~/util/callApi';
3131
32-
const layoutStore = useLayoutStore();
33-
34-
layoutStore.title = "查询解密状态"
35-
layoutStore.path = [
36-
{ name: "Home", path: "/" },
37-
{ name: "Decrypt" },
38-
{ name: "Status" }
39-
]
40-
4132
const user_id = ref('')
4233
4334
const visibility = ref(false)

pages/decrypt/upload.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ import { decryptSchema, getPGPMessageSchema } from '~/api/shamir/decrypt';
7878
import { callApi } from '~/util/callApi';
7979
import * as openpgp from 'openpgp';
8080
81-
const layoutStore = useLayoutStore();
82-
83-
layoutStore.title = "解密用户数据"
84-
layoutStore.path = [
85-
{ name: "Home", path: "/" },
86-
{ name: "Decrypt" },
87-
{ name: "Upload" }
88-
]
89-
9081
const activeTab = ref('manual')
9182
9283
const cipher = ref('')

pages/index.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88

99
<script setup>
1010
11-
import { useLayoutStore } from '@/store/layout'
12-
const layoutStore = useLayoutStore()
13-
14-
layoutStore.title = 'Home'
15-
layoutStore.path = [
16-
{ name: "Home", path: "/" }
17-
]
18-
1911
const target = ref([
2012
// { desc: "User", path: "/user" },
2113
// { desc: "Treehole", path: "/treehole" }

pages/treehole/message.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@
1919
<script setup lang="ts">
2020
import { callApi } from '@/util/callApi'
2121
import { sendMessageSchema } from '~/api/treehole/message'
22-
const layoutStore = useLayoutStore();
23-
24-
layoutStore.title = "发送站内信"
25-
layoutStore.path = [
26-
{ name: "Home", path: "/" },
27-
{ name: "Treehole" },
28-
{ name: "Message" }
29-
]
3022
3123
const message = ref('')
3224

pages/treehole/tag.vue

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,9 @@
6767
</template>
6868

6969
<script setup async>
70-
71-
import { useLayoutStore } from '@/store/layout'
7270
import { callApi } from '@/util/callApi'
7371
import { tagListSchema, tagDeleteSchema, tagCreateSchema } from '~/api/treehole/tag'
7472
75-
const layoutStore = useLayoutStore()
76-
77-
layoutStore.title = "Tag Management"
78-
layoutStore.path = [
79-
{ name: "Home", path: "/" },
80-
{ name: "Treehole" },
81-
{ name: "Tag" }
82-
]
83-
8473
// the following code is mess
8574
// but it works
8675

pages/user/index.vue

Lines changed: 0 additions & 21 deletions
This file was deleted.

pages/user/login.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,13 @@
1414
</template>
1515

1616
<script setup>
17-
import { useLayoutStore } from '@/store/layout'
1817
import { useUserStore } from '@/store/user'
1918
import { callApi } from '@/util/callApi'
2019
import { loginSchema } from '@/api/user/login'
2120
22-
const layoutStore = useLayoutStore()
2321
const router = useRouter()
2422
const userStore = useUserStore();
2523
26-
layoutStore.title = "Login"
27-
layoutStore.path = [
28-
{ name: "Home", path: "/" },
29-
{ name: "User", path: '/user' },
30-
{ name: "Login" }
31-
]
32-
3324
let login_form = reactive({
3425
email: "",
3526
password: ""

pages/user/logout.vue

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,8 @@
33
</template>
44

55
<script setup>
6-
import { useLayoutStore } from '@/store/layout'
7-
// import { useUserStore } from '@/store/user'
8-
9-
const layoutStore = useLayoutStore()
106
const userStore = useUserStore()
117
12-
layoutStore.title = "Logout"
13-
layoutStore.path = [
14-
{ name: "Home", path: "/" },
15-
{ name: "User", path: '/user' },
16-
{ name: "Logout" }
17-
]
18-
198
function logout() {
209
userStore.logout();
2110
const route = useRouter();

0 commit comments

Comments
 (0)