Sfoglia il codice sorgente

Merge branch 'dev' of http://94.191.59.107:3000/wukai/lzga-doc into dev

yxc 2 anni fa
parent
commit
6482330cd3
3 ha cambiato i file con 31 aggiunte e 12 eliminazioni
  1. 1 1
      public/index.html
  2. 26 11
      src/permission.js
  3. 4 0
      src/router/index.js

+ 1 - 1
public/index.html

@@ -7,7 +7,7 @@
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title><%= webpackConfig.name %></title>
-    <script type="text/javascript" src="http://192.168.188.88:19531/web-apps/apps/api/documents/api.js" charset="utf-8" async></script>
+    <script type="text/javascript" src="http://192.168.1.13:19531/web-apps/apps/api/documents/api.js" charset="utf-8" async></script>
     <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
     <style>
       html,

+ 26 - 11
src/permission.js

@@ -1,14 +1,22 @@
 import router from './router'
 import store from './store'
-import { Message } from 'element-ui'
+import {
+  Message
+} from 'element-ui'
 import NProgress from 'nprogress'
 import 'nprogress/nprogress.css'
-import { getToken } from '@/utils/auth'
-import { isRelogin } from '@/utils/request'
+import {
+  getToken
+} from '@/utils/auth'
+import {
+  isRelogin
+} from '@/utils/request'
 
-NProgress.configure({ showSpinner: false })
+NProgress.configure({
+  showSpinner: false
+})
 
-const whiteList = ['/login', '/register']
+const whiteList = ['/login', '/register', '/admin/login']
 
 router.beforeEach((to, from, next) => {
   NProgress.start()
@@ -16,7 +24,9 @@ router.beforeEach((to, from, next) => {
     to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
     /* has token*/
     if (to.path === '/login') {
-      next({ path: '/' })
+      next({
+        path: '/home/page'
+      })
       NProgress.done()
     } else {
       if (store.getters.roles.length === 0) {
@@ -27,14 +37,19 @@ router.beforeEach((to, from, next) => {
           store.dispatch('GenerateRoutes').then(accessRoutes => {
             // 根据roles权限生成可访问的路由表
             router.addRoutes(accessRoutes) // 动态添加可访问路由表
-            next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
+            next({
+              ...to,
+              replace: true
+            }) // hack方法 确保addRoutes已完成
           })
         }).catch(err => {
-            store.dispatch('LogOut').then(() => {
-              Message.error(err)
-              next({ path: '/' })
+          store.dispatch('LogOut').then(() => {
+            Message.error(err)
+            next({
+              path: '/'
             })
           })
+        })
       } else {
         next()
       }
@@ -53,4 +68,4 @@ router.beforeEach((to, from, next) => {
 
 router.afterEach(() => {
   NProgress.done()
-})
+})

+ 4 - 0
src/router/index.js

@@ -40,6 +40,10 @@ export const constantRoutes = [{
   },
   {
     path: '/login',
+    component: () => import('@/views1/LoginView'),
+    hidden: true
+  },{
+    path: '/admin/login',
     component: () => import('@/views/login'),
     hidden: true
   },