秦鹏 пре 3 година
родитељ
комит
fd8d917a9c
4 измењених фајлова са 83 додато и 79 уклоњено
  1. 7 0
      src/components/payment/Payment.vue
  2. 48 49
      src/permission.js
  3. 4 5
      src/store/getters.js
  4. 24 25
      src/store/modules/user.js

+ 7 - 0
src/components/payment/Payment.vue

@@ -382,4 +382,11 @@ export default {
     }
   }
 }
+</style>
+<style lang="scss">
+.tarcer-dev-Previrw{
+  .el-dialog__body{
+    padding: 30px 32px;
+  }
+}
 </style>

+ 48 - 49
src/permission.js

@@ -11,62 +11,61 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
 const whiteList = ['/login'] // no redirect whitelist
 
-router.beforeEach(async (to, from, next) => {
-  // start progress bar
-  NProgress.start()
-  // set page title
-  document.title = getPageTitle(to.meta.title)
-  //next();
-  NProgress.done()
-  const hasToken = getToken();
-  const jId = Cookies.get('JSESSSIONID');
-  if (hasToken) {
-    if (!jId) {
-      store.dispatch('user/setJsessionId').then(res => {
-        if (to.path === '/login') {
-          // if is logged in, redirect to the home page
-          next({ path: '/' })
-          NProgress.done()
+router.beforeEach(async(to, from, next) => {
+    // start progress bar
+    NProgress.start()
+        // set page title
+    document.title = getPageTitle(to.meta.title)
+        //next();
+    NProgress.done()
+    const hasToken = getToken();
+    const jId = Cookies.get('JSESSSIONID');
+    if (hasToken) {
+        if (!jId) {
+            store.dispatch('user/setJsessionId').then(res => {
+                if (to.path === '/login') {
+                    // if is logged in, redirect to the home page
+                    next({ path: '/' })
+                    NProgress.done()
+                } else {
+                    try {
+                        next()
+                    } catch (error) {
+                        Message.error(error || 'Has Error')
+                        next(`/login?redirect=${to.path}`)
+                        NProgress.done()
+                    }
+                }
+            })
         } else {
-          try {
+            if (to.path === '/login') {
+                // if is logged in, redirect to the home page
+                next({ path: '/' })
+                NProgress.done()
+            } else {
+                try {
+                    next()
+                } catch (error) {
+                    Message.error(error || 'Has Error')
+                    next(`/login?redirect=${to.path}`)
+                    NProgress.done()
+                }
+            }
+        }
+    } else {
+        /* has no token*/
+        if (whiteList.indexOf(to.path) !== -1) {
+            // in the free login whitelist, go directly
             next()
-          } catch (error) {
-            Message.error(error || 'Has Error')
+        } else {
+            // other pages that do not have permission to access are redirected to the login page.
             next(`/login?redirect=${to.path}`)
             NProgress.done()
-          }
-        }
-      })
-    } else {
-      if (to.path === '/login') {
-        // if is logged in, redirect to the home page
-        next({ path: '/' })
-        NProgress.done()
-      } else {
-        try {
-          next()
-        } catch (error) {
-          Message.error(error || 'Has Error')
-          next(`/login?redirect=${to.path}`)
-          NProgress.done()
         }
-      }
-    }
-  } else {
-    /* has no token*/
-    if (whiteList.indexOf(to.path) !== -1) {
-      // in the free login whitelist, go directly
-      next()
-    } else {
-      // other pages that do not have permission to access are redirected to the login page.
-      next(`/login?redirect=${to.path}`)
-      NProgress.done()
     }
-  }
-
 })
 
 router.afterEach(() => {
-  // finish progress bar
-  NProgress.done()
+    // finish progress bar
+    NProgress.done()
 })

+ 4 - 5
src/store/getters.js

@@ -1,8 +1,7 @@
 const getters = {
-  sidebar: state => state.app.sidebar,
-  device: state => state.app.device,
-  JSESSSIONID: state => state.user.JSESSSIONID,
-  language_type: state => state.lang.language_type,
-
+    sidebar: state => state.app.sidebar,
+    device: state => state.app.device,
+    JSESSSIONID: state => state.user.JSESSSIONID,
+    language_type: state => state.lang.language_type,
 }
 export default getters

+ 24 - 25
src/store/modules/user.js

@@ -2,39 +2,38 @@ import { VerifyLogin } from '@/api/api'
 import Cookies from 'js-cookie'
 
 const getDefaultState = () => {
-  return {
-    JSESSSIONID: Cookies.get('JSESSIONID') || '',
-  }
+    return {
+        JSESSSIONID: Cookies.get('JSESSIONID') || '',
+    }
 }
 
 const state = getDefaultState()
 
 const mutations = {
-  RESET_JSESSIONID: (state, JSESSSIONID) => {
-    Cookies.set('JSESSIONID', JSESSSIONID);
-    state.JSESSSIONID = JSESSSIONID
-  }
+    RESET_JSESSIONID: (state, JSESSSIONID) => {
+        Cookies.set('JSESSIONID', JSESSSIONID);
+        state.JSESSSIONID = JSESSSIONID
+    }
 }
 
 const actions = {
-  // user login
-  setJsessionId({ commit }) {
-    return new Promise((resolve, reject) => {
-      VerifyLogin().then(response => {
-        const { data } = response
-        commit('RESET_JSESSIONID', data.JSESSSIONID)
-        resolve()
-      }).catch(error => {
-        reject(error)
-      })
-    })
-  },
+    // user login
+    setJsessionId({ commit }) {
+        return new Promise((resolve, reject) => {
+            VerifyLogin().then(response => {
+                const { data } = response
+                commit('RESET_JSESSIONID', data.JSESSSIONID)
+                resolve()
+            }).catch(error => {
+                reject(error)
+            })
+        })
+    },
 }
 
 export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions
-}
-
+    namespaced: true,
+    state,
+    mutations,
+    actions
+}