Skip to content

Commit

Permalink
fix: 修复了点击Back按钮时白屏的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Zecyel committed Oct 8, 2024
1 parent 642cc5b commit f09a355
Show file tree
Hide file tree
Showing 13 changed files with 2,089 additions and 2,208 deletions.
17 changes: 11 additions & 6 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<template #breadcrumb>
<el-breadcrumb separator="/">

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

<template #content>
<div class="flex items-center">
<span class="text-large font-600 mr-3">{{ layout_store.title }}</span>
<span class="text-large font-600 mr-3">{{ page_info.title }}</span>
<span
class="text-sm mr-2"
style="color: var(--el-text-color-regular)"
v-if="'subtitle' in layout_store"
>{{ layout_store.subtitle }}</span>
v-if="'subtitle' in page_info"
>{{ page_info.subtitle }}</span>
</div>
</template>

Expand All @@ -85,13 +85,18 @@
</template>

<script setup>
import { pageInfoMapper } from '~/util/route';
const layout_store = useLayoutStore()
const user_store = useUserStore()
const router = useRouter()
const page_info = computed(() => {
return pageInfoMapper[router.currentRoute.value.fullPath]
})
function goBack() {
router.push('/')
// router.push('/')
window.location.href = '/'
}
function login() {
Expand Down
9 changes: 0 additions & 9 deletions pages/decrypt/history.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@
import { getDecryptHistorySchema } from '~/api/shamir/decrypt';
import { callApi } from '~/util/callApi';
const layoutStore = useLayoutStore();
layoutStore.title = "我的解密历史"
layoutStore.path = [
{ name: "Home", path: "/" },
{ name: "Decrypt" },
{ name: "History" }
]
const identity_name = ref('')
const history = ref([])
Expand Down
9 changes: 0 additions & 9 deletions pages/decrypt/status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@
import { getDecryptStatusSchema, getDecryptedEmailSchema } from '~/api/shamir/decrypt';
import { callApi } from '~/util/callApi';
const layoutStore = useLayoutStore();
layoutStore.title = "查询解密状态"
layoutStore.path = [
{ name: "Home", path: "/" },
{ name: "Decrypt" },
{ name: "Status" }
]
const user_id = ref('')
const visibility = ref(false)
Expand Down
9 changes: 0 additions & 9 deletions pages/decrypt/upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@ import { decryptSchema, getPGPMessageSchema } from '~/api/shamir/decrypt';
import { callApi } from '~/util/callApi';
import * as openpgp from 'openpgp';
const layoutStore = useLayoutStore();
layoutStore.title = "解密用户数据"
layoutStore.path = [
{ name: "Home", path: "/" },
{ name: "Decrypt" },
{ name: "Upload" }
]
const activeTab = ref('manual')
const cipher = ref('')
Expand Down
8 changes: 0 additions & 8 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@

<script setup>
import { useLayoutStore } from '@/store/layout'
const layoutStore = useLayoutStore()
layoutStore.title = 'Home'
layoutStore.path = [
{ name: "Home", path: "/" }
]
const target = ref([
// { desc: "User", path: "/user" },
// { desc: "Treehole", path: "/treehole" }
Expand Down
8 changes: 0 additions & 8 deletions pages/treehole/message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@
<script setup lang="ts">
import { callApi } from '@/util/callApi'
import { sendMessageSchema } from '~/api/treehole/message'
const layoutStore = useLayoutStore();
layoutStore.title = "发送站内信"
layoutStore.path = [
{ name: "Home", path: "/" },
{ name: "Treehole" },
{ name: "Message" }
]
const message = ref('')
Expand Down
11 changes: 0 additions & 11 deletions pages/treehole/tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,9 @@
</template>

<script setup async>
import { useLayoutStore } from '@/store/layout'
import { callApi } from '@/util/callApi'
import { tagListSchema, tagDeleteSchema, tagCreateSchema } from '~/api/treehole/tag'
const layoutStore = useLayoutStore()
layoutStore.title = "Tag Management"
layoutStore.path = [
{ name: "Home", path: "/" },
{ name: "Treehole" },
{ name: "Tag" }
]
// the following code is mess
// but it works
Expand Down
21 changes: 0 additions & 21 deletions pages/user/index.vue

This file was deleted.

9 changes: 0 additions & 9 deletions pages/user/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,13 @@
</template>

<script setup>
import { useLayoutStore } from '@/store/layout'
import { useUserStore } from '@/store/user'
import { callApi } from '@/util/callApi'
import { loginSchema } from '@/api/user/login'
const layoutStore = useLayoutStore()
const router = useRouter()
const userStore = useUserStore();
layoutStore.title = "Login"
layoutStore.path = [
{ name: "Home", path: "/" },
{ name: "User", path: '/user' },
{ name: "Login" }
]
let login_form = reactive({
email: "",
password: ""
Expand Down
11 changes: 0 additions & 11 deletions pages/user/logout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,8 @@
</template>

<script setup>
import { useLayoutStore } from '@/store/layout'
// import { useUserStore } from '@/store/user'
const layoutStore = useLayoutStore()
const userStore = useUserStore()
layoutStore.title = "Logout"
layoutStore.path = [
{ name: "Home", path: "/" },
{ name: "User", path: '/user' },
{ name: "Logout" }
]
function logout() {
userStore.logout();
const route = useRouter();
Expand Down
Loading

0 comments on commit f09a355

Please sign in to comment.