From 6dfe6863c5abfe07afd834ad57f269efb213e89a Mon Sep 17 00:00:00 2001 From: fanxb Date: Wed, 17 Mar 2021 19:36:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bookmark_front/src/router/index.js | 9 ++++++++ bookmark_front/src/views/public/Public.vue | 5 +--- .../src/views/public/pages/Login.vue | 4 ++++ .../src/views/public/pages/NotFound.vue | 23 +++++++++++++++++++ .../src/views/public/pages/Register.vue | 5 ++++ 5 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 bookmark_front/src/views/public/pages/NotFound.vue diff --git a/bookmark_front/src/router/index.js b/bookmark_front/src/router/index.js index 01c77cd..ea52f0e 100644 --- a/bookmark_front/src/router/index.js +++ b/bookmark_front/src/router/index.js @@ -53,8 +53,17 @@ const routes = [ path: "oauth/github", name: "GithubRedirect", component: GithubOauth + }, + { + path: "notFound", + name: "NOTFOUND", + component: () => import("@/views/public/pages/NotFound") } ] + }, + { + path: "*", + redirect: "/public/notFound" } ]; diff --git a/bookmark_front/src/views/public/Public.vue b/bookmark_front/src/views/public/Public.vue index e69976b..d3dd1fc 100644 --- a/bookmark_front/src/views/public/Public.vue +++ b/bookmark_front/src/views/public/Public.vue @@ -12,9 +12,6 @@ export default { name: "Public", async created() { - //进入注册、登录页需要清理掉所有的缓存数据 - await this.$store.dispatch("treeData/clear"); - await this.$store.dispatch("globalConfig/clear"); }, }; @@ -42,7 +39,7 @@ export default { @media screen and (min-width: 500px) { .main-body { - width: 5rem; + min-width: 5rem; } } diff --git a/bookmark_front/src/views/public/pages/Login.vue b/bookmark_front/src/views/public/pages/Login.vue index 0c91a0c..a8b4c89 100644 --- a/bookmark_front/src/views/public/pages/Login.vue +++ b/bookmark_front/src/views/public/pages/Login.vue @@ -69,6 +69,10 @@ export default { async created() { let _this = this; window.addEventListener("storage", this.storageDeal.bind(this)); + + //进入注册、登录页需要清理掉所有的缓存数据 + await this.$store.dispatch("treeData/clear"); + await this.$store.dispatch("globalConfig/clear"); }, destroyed() { window.removeEventListener("storage", this.storageDeal); diff --git a/bookmark_front/src/views/public/pages/NotFound.vue b/bookmark_front/src/views/public/pages/NotFound.vue new file mode 100644 index 0000000..4893b36 --- /dev/null +++ b/bookmark_front/src/views/public/pages/NotFound.vue @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/bookmark_front/src/views/public/pages/Register.vue b/bookmark_front/src/views/public/pages/Register.vue index e39bb31..ac3656c 100644 --- a/bookmark_front/src/views/public/pages/Register.vue +++ b/bookmark_front/src/views/public/pages/Register.vue @@ -79,6 +79,11 @@ export default { }, }; }, + async created() { + //进入注册、登录页需要清理掉所有的缓存数据 + await this.$store.dispatch("treeData/clear"); + await this.$store.dispatch("globalConfig/clear"); + }, methods: { submit() { let _this = this;