Skip to content

Commit

Permalink
feat: 增加前端拦截后端路由的提示
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Dec 14, 2023
1 parent fa69d99 commit 37106b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default {
notFoundPage: {
title: 'Oops! URL Error!',
desc: 'Back to Home Page',
backendDesc: 'If you are seeing this, it is probably due to a routing interception issue on the front end of your browser. You can force a refresh to see it or use the link directly without affecting the use of this link.',
},
// subscription management page
subPage: {
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default {
notFoundPage: {
title: '啊哦~ URL 错误!',
desc: '回首页',
backendDesc: '如果你看到这个 可能是因为浏览器前端路由拦截的问题 可以强制刷新查看或直接使用该链接 不影响此链接的使用',
},
// 订阅管理页
subPage: {
Expand Down
16 changes: 13 additions & 3 deletions src/views/NotFound.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<template>
<div class="wrapper">
<h3>{{ $t('notFoundPage.title') }}</h3>

<h3 v-if="isBackend">
<p>{{ $t('notFoundPage.backendDesc') }}</p>
</h3>
<h3 v-else>{{ $t('notFoundPage.title') }}</h3>
<router-link to="/">{{ $t('notFoundPage.desc') }}</router-link>
</div>
</template>

<script lang="ts" setup></script>
<script lang="ts" setup>
import { useRoute } from 'vue-router';
const route = useRoute();
const isBackend = /\/(api|download)\/.+/.test(route.fullPath)
</script>

<style lang="scss" scoped>
.wrapper {
Expand All @@ -15,9 +24,10 @@
justify-content: center;
align-items: center;
flex-direction: column;
color: var(--primary-text-color);
h3 {
padding-bottom: 24px;
padding: 0 24px 24px 24px;
}
}
</style>

0 comments on commit 37106b6

Please sign in to comment.