فهرست منبع

Merge remote-tracking branch 'origin/main'

psguo 3 ماه پیش
والد
کامیت
ae42c4a6cd
7فایلهای تغییر یافته به همراه46 افزوده شده و 38 حذف شده
  1. BIN
      src/assets/logo/logo-login.png
  2. BIN
      src/assets/logo/logo.png
  3. 1 1
      src/layout/components/Sidebar/Logo.vue
  4. 29 30
      src/permission.js
  5. 3 3
      src/router/index.js
  6. 1 1
      src/utils/auth.js
  7. 12 3
      src/views/screen/main.vue

BIN
src/assets/logo/logo-login.png


BIN
src/assets/logo/logo.png


+ 1 - 1
src/layout/components/Sidebar/Logo.vue

@@ -66,7 +66,7 @@ export default {
     width: 100%;
 
     & .sidebar-logo {
-      width: 100px;
+      width: 150px;
       height: auto;
       vertical-align: middle;
       margin-right: 12px;

+ 29 - 30
src/permission.js

@@ -12,45 +12,44 @@ const whiteList = ['/login', '/auth-redirect', '/bind', '/register','/screen','/
 
 router.beforeEach((to, from, next) => {
   NProgress.start()
-  // if (getToken()) {
-  //   to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
-  //   /* has token*/
-  //   if (to.path === '/login') {
-  //     next({ path: '/' })
-  //     NProgress.done()
-  //   } else {
-  //     if (store.getters.roles.length === 0) {
-  //       isRelogin.show = true
-  //       // 判断当前用户是否已拉取完user_info信息
-  //       store.dispatch('GetInfo').then(() => {
-  //         isRelogin.show = false
-  //         store.dispatch('GenerateRoutes').then(accessRoutes => {
-  //           // 根据roles权限生成可访问的路由表
-  //           router.addRoutes(accessRoutes) // 动态添加可访问路由表
-  //           next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
-  //         })
-  //       }).catch(err => {
-  //           store.dispatch('LogOut').then(() => {
-  //             Message.error(err)
-  //             next({ path: '/' })
-  //           })
-  //         })
-  //     } else {
-  //       next()
-  //     }
-  //   }
-  // } else {
+  if (getToken()) {
+    to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
+    /* has token*/
+    if (to.path === '/login') {
+      next({ path: '/index' })
+      NProgress.done()
+    } else {
+      if (store.getters.roles.length === 0) {
+        isRelogin.show = true
+        // 判断当前用户是否已拉取完user_info信息
+        store.dispatch('GetInfo').then(() => {
+          isRelogin.show = false
+          store.dispatch('GenerateRoutes').then(accessRoutes => {
+            // 根据roles权限生成可访问的路由表
+            router.addRoutes(accessRoutes) // 动态添加可访问路由表
+            next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
+          })
+        }).catch(err => {
+          store.dispatch('LogOut').then(() => {
+            Message.error(err)
+            next({ path: '/login' })
+          })
+        })
+      } else {
+        next()
+      }
+    }
+  } else {
     // 没有token
     if (whiteList.indexOf(to.path) !== -1) {
       // 在免登录白名单,直接进入
       next()
     } else {
       // next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
-      //next(`/pad`) // 否则全部重定向到登录页
       next(`/screen`) // 否则全部重定向到登录页
       NProgress.done()
     }
-  // }
+  }
 })
 
 router.afterEach(() => {

+ 3 - 3
src/router/index.js

@@ -98,7 +98,7 @@ export const constantRoutes = [
       }
     ]
   }
-  
+
 ]
 
 // 动态路由,基于用户权限动态去加载
@@ -182,8 +182,8 @@ Router.prototype.push = function push(location) {
 }
 
 export default new Router({
-  base: "/screen",
-  mode: '', // 去掉url中的#
+  base: "",
+  mode: 'history', // 去掉url中的#
   scrollBehavior: () => ({ y: 0 }),
   routes: constantRoutes
 })

+ 1 - 1
src/utils/auth.js

@@ -1,6 +1,6 @@
 import Cookies from 'js-cookie'
 
-const TokenKey = 'Admin-Token'
+const TokenKey = 'Authorization'
 
 export function getToken() {
   return Cookies.get(TokenKey)

+ 12 - 3
src/views/screen/main.vue

@@ -23,6 +23,7 @@
               后勤资源监控
             </div>
           </div>
+          <div class="mid" @dblclick="fullScreen"></div>
           <div class="right">
             <div
               :class="['model', 3 == curIndex ? 'cur' : '']"
@@ -131,6 +132,9 @@ export default {
     document.documentElement.requestFullscreen();
   },
   methods: {
+    fullScreen(){
+      document.documentElement.requestFullscreen();
+    },
     //切换菜单
     chooseTab(index) {
       this.curIndex = index;
@@ -166,12 +170,12 @@ export default {
   height: 100vh;
   overflow: hidden;
   position: relative;
+  background-image: url("../../assets/images/main/main_bg.jpg");
+  background-size: cover;
 
   .main-wrapper {
     width: 1920px;
     height: 1080px;
-    background-image: url("../../assets/images/main/main_bg.jpg");
-    background-size: cover;
 
     margin: 0 auto;
     position: relative;
@@ -211,6 +215,11 @@ export default {
           background: url("../../assets/images/main/menu_chooe.png") no-repeat;
         }
       }
+      .mid{
+        display: flex;
+        width: 700px;
+        height: 80px;
+      }
 
       .middle {
         flex: 1;
@@ -295,7 +304,7 @@ export default {
   .main-data{
     position: relative;
     z-index:3;
- 
+
   }
 
   .map-bg{