Răsfoiți Sursa

Merge branch 'http_test' of git.xiaojukeji.com:jacklijiajia/thoth-frontend into http_test

qinzhipeng_v@didiglobal.com 4 ani în urmă
părinte
comite
b91202b95b
3 a modificat fișierele cu 58 adăugiri și 0 ștergeri
  1. BIN
      src/assets/notFound.png
  2. 10 0
      src/router/index.js
  3. 48 0
      src/views/errorPages/notFound.vue

BIN
src/assets/notFound.png


+ 10 - 0
src/router/index.js

@@ -454,6 +454,12 @@ export const constantRoutes = [{
 },
 
 { path: '*', redirect: '/404', hidden: true, name: '*' },
+{
+  path: '/notFound',
+  name: 'notFound',
+  component: () => import('@/views/errorPages/notFound.vue'),
+  hidden: true
+},
 ...newRouter
 ]
 
@@ -465,6 +471,10 @@ const createRouter = () => new Router({
 
 const router = createRouter()
 router.beforeEach((to, from, next) => {
+  console.log(to, from)
+  if (to.name === '404' && from.path.search(/projectManage|business|workbench/)) {
+    next({ name: 'notFound' })
+  }
   if (to.name !== '接口管理') {
     next()
   } else {

+ 48 - 0
src/views/errorPages/notFound.vue

@@ -0,0 +1,48 @@
+<template>
+  <section>
+    <img src="../../assets/notFound.png" class="not-found">
+    <div class="tips">
+      <h3>很抱歉,页面无法访问!</h3>
+      <span>您可以:</span>
+      <span>1:检查网址是否正确</span>
+      <span>2:确认网址是否已失效</span>
+    </div>
+    <div class="button-link">
+      <el-button type="warning" size="mini" @click="linkTo('项目管理')">返回项目管理首页</el-button>
+      <el-button type="primary" size="mini" @click="linkTo('首页')">返回平台首页</el-button>
+    </div>
+  </section>
+</template>
+<script>
+export default {
+  methods: {
+    linkTo(name) {
+      this.$router.push({ name: name })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+section {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+.not-found {
+  margin-top: 160px;
+}
+h3 {
+  color: #444444;
+  font-size: 20px;
+  margin-top: 31px;
+}
+.tips {
+  display: flex;
+  flex-direction: column;
+  color: #666666;
+}
+.button-link {
+  margin-top: 20px;
+}
+</style>