Browse Source

404页面

guoxiaohuan 4 years ago
parent
commit
82f9a2c7c8
3 changed files with 126 additions and 39 deletions
  1. BIN
      src/assets/imgs/dlsb.png
  2. 83 0
      src/components/404.vue
  3. 43 39
      src/router/index.js

BIN
src/assets/imgs/dlsb.png


+ 83 - 0
src/components/404.vue

@@ -0,0 +1,83 @@
+<template>
+    <div class='notfond'>
+        <div class='not-img'>
+            <img src='@/assets/imgs/dlsb.png' alt />
+        </div>
+        <div class='not-text' v-if='!isPermissions'>
+            <span>您的权限不足……</span>
+            <span>建议您联系管理员开通管理说明书相关权限</span>
+        </div>
+        <div class='not-text' v-else>
+            <span>您的访问出错了!</span>
+            <span>建议您稍后再试,或直接联系管理员解决</span>
+        </div>
+        <div class='not-button'>
+            <span>关闭页面</span>
+        </div>
+    </div>
+</template>
+<script>
+export default {
+    data() {
+        return {
+            isPermissions: true //是否有访问权限
+        }
+    }
+}
+</script>
+<style lang="less" scoped>
+.notfond {
+    width: 100%;
+    height: 100%;
+    background: rgba(255, 255, 255, 1);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    flex-direction: column;
+    .not-img {
+        width: 120px;
+        height: 120px;
+        img {
+            width: 100%;
+            height: 100%;
+        }
+    }
+    .not-text {
+        margin-top: 8px;
+        span {
+            display: block;
+            text-align: center;
+        }
+        span:nth-of-type(1) {
+            font-size: 16px;
+            font-family: MicrosoftYaHei;
+            color: rgba(31, 36, 41, 1);
+            line-height: 21px;
+        }
+        span:nth-of-type(2) {
+            margin-top: 4px;
+            font-size: 14px;
+            font-family: MicrosoftYaHei;
+            color: rgba(100, 108, 115, 1);
+            line-height: 19px;
+        }
+    }
+    .not-button {
+        margin-top: 32px;
+        width: 80px;
+        height: 32px;
+        background: rgba(255, 255, 255, 1);
+        border: 1px solid rgba(195, 199, 203, 1);
+        border-radius: 4px;
+        cursor: pointer;
+        span {
+            display: block;
+            font-size: 14px;
+            font-family: MicrosoftYaHei;
+            color: rgba(31, 35, 41, 1);
+            line-height: 32px;
+            text-align: center;
+        }
+    }
+}
+</style>

+ 43 - 39
src/router/index.js

@@ -1,83 +1,87 @@
-import Vue from "vue"
-import store from "@/store"
-import VueRouter from "vue-router"
-import { query } from "@/utils/query"
+import Vue from 'vue'
+import store from '@/store'
+import VueRouter from 'vue-router'
+import { query } from '@/utils/query'
 Vue.use(VueRouter)
 
 const routes = [
     // 登陆页面
     {
-        path: "/",
-        redirect: "/home/overview",
+        path: '/',
+        redirect: '/home/overview',
+    },
+    {
+        path: '/404',
+        component: () => import('../components/404'),
     },
     // home
     {
-        path: "/home",
-        name: "home",
-        component: () => import("../views/index"),
-        redirect: "/home/first",
+        path: '/home',
+        name: 'home',
+        component: () => import('../views/index'),
+        redirect: '/home/first',
         children: [
             {
-                path: "first",
-                component: () => import("../views/first"),
+                path: 'first',
+                component: () => import('../views/first'),
             },
             //概览
             {
-                path: "overview",
-                component: () => import("../views/overview"),
+                path: 'overview',
+                component: () => import('../views/overview'),
             },
             // 楼层功能
             {
-                path: "floorFunc",
-                component: () => import("../views/floorFunc"),
+                path: 'floorFunc',
+                component: () => import('../views/floorFunc'),
             },
             // 设备设施
             {
-                path: "equipment",
-                component: () => import("../views/equipment"),
+                path: 'equipment',
+                component: () => import('../views/equipment'),
             },
             // 其他功能
             {
-                path: "other",
-                component: () => import("../views/other"),
+                path: 'other',
+                component: () => import('../views/other'),
             },
             // 分析
             {
-                path: "analysis",
-                component: () => import("../views/analysis"),
+                path: 'analysis',
+                component: () => import('../views/analysis'),
             },
             //图例库管理
             {
-                path: "legendLibrary",
-                component: () => import("../views/legendLibrary"),
+                path: 'legendLibrary',
+                component: () => import('../views/legendLibrary'),
             },
             //图例绘制规则
             {
-                path: "legendRules",
-                component: () => import("../views/legendRules"),
+                path: 'legendRules',
+                component: () => import('../views/legendRules'),
             },
         ],
     },
 ]
 const router = new VueRouter({
-    mode: "history",
+    mode: 'history',
     base: process.env.BASE_URL,
     routes,
 })
 router.beforeEach(async (to, from, next) => {
     const token = query().token
     console.log(token)
-    const ssoToken = store.getters["ssoToken"]
+    const ssoToken = store.getters['ssoToken']
     if (ssoToken) {
-        store.commit("SETSSOTOKEN", ssoToken)
-        await store.dispatch("getUserInfo")
-        await store.dispatch("getFloors")
-        await store.dispatch("getBrand")
+        store.commit('SETSSOTOKEN', ssoToken)
+        await store.dispatch('getUserInfo')
+        await store.dispatch('getFloors')
+        await store.dispatch('getBrand')
         next()
     } else if (token) {
-        store.commit("SETSSOTOKEN", token)
+        store.commit('SETSSOTOKEN', token)
         console.log(store.state.ssoToken)
-        await store.dispatch("getUserInfo")
+        await store.dispatch('getUserInfo')
         next()
     } else {
         let lastRoute = {
@@ -85,14 +89,14 @@ router.beforeEach(async (to, from, next) => {
             params: to.params,
             query: to.query,
         }
-        store.commit("SETLASTROUTER", lastRoute)
-        let ssoServer = "http://oauth.wanda-dev.cn"
-        let systemcode = "CAD156",
+        store.commit('SETLASTROUTER', lastRoute)
+        let ssoServer = 'http://oauth.wanda-dev.cn'
+        let systemcode = 'CAD156',
             signal = new Date().getTime(),
-            version = "1.0.0",
+            version = '1.0.0',
             // returnurl = 'http://glsms.wanda-dev.cn/'
             // returnurl = window.location.protocol + "//" + window.location.host + "/wandaBmGuide"
-            returnurl = "http://localhost:8090/wandaBmGuide/home/equipment"
+            returnurl = 'http://localhost:8090/wandaBmGuide/home/equipment'
         window.location.href = `${ssoServer}/login?token=${token}&systemcode=${systemcode}&signal=${signal}&version=${version}&returnurl=${returnurl}`
     }
 })