From 153404ffa0a9c6d23d2c2732b46fa6929e86294f Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 18 六月 2025 13:56:18 +0800
Subject: [PATCH] 111

---
 admin/src/router/index.js |   51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/admin/src/router/index.js b/admin/src/router/index.js
index 6002274..c8bf2a8 100644
--- a/admin/src/router/index.js
+++ b/admin/src/router/index.js
@@ -9,9 +9,8 @@
 Vue.use(VueRouter)
 
 const router = new VueRouter({
-  // + (process.env.VUE_APP_ROUTER_MODE === 'hash' ? '#' : '')
-  base: '/',
-  mode: 'hash',
+  base: process.env.VUE_APP_CONTEXT_PATH + (process.env.VUE_APP_ROUTER_MODE === 'hash' ? '#' : ''),
+  mode: process.env.VUE_APP_ROUTER_MODE,
   routes: [
     // 鐧诲綍
     {
@@ -60,16 +59,12 @@
       return
     }
     // 濡傛灉璁块棶鐨勬槸鐧诲綍椤甸潰锛屽垯鐩存帴璺宠浆鑷抽椤�
-    // if (to.name === 'login') {
-    //   next({ name: 'index' })
-    //   return
-    // }
+    if (to.name === 'login') {
+      next({ name: 'index' })
+      return
+    }
     next()
     return
-  }
-  if (to.name === 'login') {
-   next()
-   return
   }
   getUserInfo()
     .then(userInfo => {
@@ -97,5 +92,39 @@
       next({ name: 'login' })
     })
 })
+router.afterEach((to, from, failure) => {
+  setTimeout(function () {
+    computeTableHeightIndex()
+    window.addEventListener('resize', function(){
+      computeTableHeightIndex()}
+    )
+  }, 1000)
+})
+function computeTableHeightIndex () {
+  const height = window.innerHeight
+  // console.log('beforeEach========================锛�' + height)
+  const height13 = getEleHeghtByClassName('common-header', 0)
+  const height4 = getEleHeghtByClassName('table-pagination', 0,-20)
+  const height5 = document.getElementsByTagName('thead') && document.getElementsByTagName('thead')[0] ? document.getElementsByTagName('thead')[0].clientHeight : 0
+    // console.log('tableLayout========================')
+    const height1 = getEleHeghtByClassName('table-search-form', 40, 16)
+    const height3 = getEleHeghtByClassName('main-header', 0)
+    // const height4 = getEleHeghtByClassName('table-pagination', 0,-20)
+    const height2 = getEleHeghtByClassName('toolbar', 0)
+    // console.log('defualtlength', document.getElementsByClassName('table-search-form').length)
+    router.app.$store.commit('setTableHeightNew', height - height4 - height3 - height2 - height1 - height5 - height13)
+    // console.log('gableHeightNew', router.app.$store.state.tableHeightNew)
+}
 
+function getEleHeghtByClassName (name, dv, margin) {
+  if ((document.getElementsByClassName(name) && document.getElementsByClassName(name)[0])) {
+    let t = 0
+    document.getElementsByClassName(name).forEach(e => {
+      // console.log(name + '========================' + t + ':' + e.clientHeight)
+      t++
+    })
+    return document.getElementsByClassName(name)[document.getElementsByClassName(name).length - 1].clientHeight + (margin || 0)
+  }
+  return dv || 0
+}
 export default router

--
Gitblit v1.9.3