From 11cd6f4d30fbae557d18aaa44afc0b32de54ad32 Mon Sep 17 00:00:00 2001
From: lixuliang <lixuliang_hd@126.com>
Date: 星期四, 29 八月 2024 15:04:07 +0800
Subject: [PATCH] 更新登录

---
 se-ui/src/utils/request.js             |    4 +-
 se-ui/src/layout/components/Navbar.vue |   47 ++++++++++++-----------
 se-ui/src/permission.js                |   12 +++--
 se-ui/src/router/index.js              |   29 +++++++-------
 se-ui/src/views/login.vue              |    2 
 se-ui/.env.development                 |    5 ++
 se-ui/.env.production                  |    3 +
 se-ui/vue.config.js                    |    4 +-
 8 files changed, 58 insertions(+), 48 deletions(-)

diff --git a/se-ui/.env.development b/se-ui/.env.development
index 85bfeec..4462057 100644
--- a/se-ui/.env.development
+++ b/se-ui/.env.development
@@ -5,7 +5,10 @@
 ENV = 'development'
 
 # 绠$悊绯荤粺/寮�鍙戠幆澧�
-VUE_APP_BASE_API = '/dev-api'
+VUE_APP_BASE_API = '/prod-api'
 
 # 璺敱鎳掑姞杞�
 VUE_CLI_BABEL_TRANSPILE_MODULES = true
+
+#椤圭洰瀛愯矾寰�
+VUE_APP_ITEM_PATH = '/sys'
\ No newline at end of file
diff --git a/se-ui/.env.production b/se-ui/.env.production
index 5feb40b..13ffacb 100644
--- a/se-ui/.env.production
+++ b/se-ui/.env.production
@@ -6,3 +6,6 @@
 
 # 绠$悊绯荤粺/鐢熶骇鐜
 VUE_APP_BASE_API = '/prod-api'
+
+#椤圭洰瀛愯矾寰�
+VUE_APP_ITEM_PATH = '/sys'
diff --git a/se-ui/src/layout/components/Navbar.vue b/se-ui/src/layout/components/Navbar.vue
index 8df0e8f..4806bea 100644
--- a/se-ui/src/layout/components/Navbar.vue
+++ b/se-ui/src/layout/components/Navbar.vue
@@ -73,41 +73,42 @@
       'sidebar',
       'avatar',
       'device'
-    ]),
-    setting: {
+    ]),    setting: {
       get() {
-        return this.$store.state.settings.showSettings
+        return this.$store.state.settings.showSettings;
       },
       set(val) {
-        this.$store.dispatch('settings/changeSetting', {
-          key: 'showSettings',
+        this.$store.dispatch("settings/changeSetting", {
+          key: "showSettings",
           value: val
-        })
+        });
       }
     },
     topNav: {
       get() {
-        return this.$store.state.settings.topNav
+        return this.$store.state.settings.topNav;
       }
     }
   },
   methods: {
     toggleSideBar() {
-      this.$store.dispatch('app/toggleSideBar')
+      this.$store.dispatch("app/toggleSideBar");
     },
     async logout() {
-      this.$confirm('纭畾娉ㄩ攢骞堕��鍑虹郴缁熷悧锛�', '鎻愮ず', {
-        confirmButtonText: '纭畾',
-        cancelButtonText: '鍙栨秷',
-        type: 'warning'
-      }).then(() => {
-        this.$store.dispatch('LogOut').then(() => {
-          location.href = '/index';
+      this.$confirm("纭畾娉ㄩ攢骞堕��鍑虹郴缁熷悧锛�", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          this.$store.dispatch("LogOut").then(() => {
+            location.href = window.location.origin + '/sso/login'
+          });
         })
-      }).catch(() => {});
+        .catch(() => {});
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>
@@ -116,18 +117,18 @@
   overflow: hidden;
   position: relative;
   background: #fff;
-  box-shadow: 0 1px 4px rgba(0,21,41,.08);
+  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
 
   .hamburger-container {
     line-height: 46px;
     height: 100%;
     float: left;
     cursor: pointer;
-    transition: background .3s;
-    -webkit-tap-highlight-color:transparent;
+    transition: background 0.3s;
+    -webkit-tap-highlight-color: transparent;
 
     &:hover {
-      background: rgba(0, 0, 0, .025)
+      background: rgba(0, 0, 0, 0.025);
     }
   }
 
@@ -164,10 +165,10 @@
 
       &.hover-effect {
         cursor: pointer;
-        transition: background .3s;
+        transition: background 0.3s;
 
         &:hover {
-          background: rgba(0, 0, 0, .025)
+          background: rgba(0, 0, 0, 0.025);
         }
       }
     }
diff --git a/se-ui/src/permission.js b/se-ui/src/permission.js
index c568979..ddb9d8a 100644
--- a/se-ui/src/permission.js
+++ b/se-ui/src/permission.js
@@ -32,11 +32,12 @@
             next({ ...to, replace: true }) // hack鏂规硶 纭繚addRoutes宸插畬鎴�
           })
         }).catch(err => {
-            store.dispatch('LogOut').then(() => {
-              Message.error(err)
-              next({ path: '/' })
-            })
+          store.dispatch('LogOut').then(() => {
+            Message.error(err)
+            window.location.href = window.location.origin + '/sso/login'
+            // next({ path: '/' })
           })
+        })
       } else {
         next()
       }
@@ -47,7 +48,8 @@
       // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
       next()
     } else {
-      next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
+      // next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
+      window.location.href = window.location.origin + '/sso/login'
       NProgress.done()
     }
   }
diff --git a/se-ui/src/router/index.js b/se-ui/src/router/index.js
index 71907b6..6b1ce51 100644
--- a/se-ui/src/router/index.js
+++ b/se-ui/src/router/index.js
@@ -41,11 +41,11 @@
       }
     ]
   },
-  {
-    path: '/login',
-    component: () => import('@/views/login'),
-    hidden: true
-  },
+  // {
+  //   path: '/login',
+  //   component: () => import('@/views/login'),
+  //   hidden: true
+  // },
   {
     path: '/register',
     component: () => import('@/views/register'),
@@ -64,15 +64,15 @@
   {
     path: '',
     component: Layout,
-    redirect: 'index',
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/index'),
-        name: 'Index',
-        meta: { title: '棣栭〉', icon: 'dashboard', affix: true }
-      }
-    ]
+    redirect: 'system/user',
+    // children: [
+    //   {
+    //     path: 'index',
+    //     component: () => import('@/views/index'),
+    //     name: 'Index',
+    //     meta: { title: '棣栭〉', icon: 'dashboard', affix: true }
+    //   }
+    // ]
   },
   {
     path: '/user',
@@ -178,6 +178,7 @@
 
 export default new Router({
   mode: 'history', // 鍘绘帀url涓殑#
+  base: process.env.VUE_APP_ITEM_PATH,
   scrollBehavior: () => ({ y: 0 }),
   routes: constantRoutes
 })
diff --git a/se-ui/src/utils/request.js b/se-ui/src/utils/request.js
index fa431b5..6283580 100644
--- a/se-ui/src/utils/request.js
+++ b/se-ui/src/utils/request.js
@@ -15,8 +15,8 @@
 // 鍒涘缓axios瀹炰緥
 const service = axios.create({
   // axios涓姹傞厤缃湁baseURL閫夐」锛岃〃绀鸿姹俇RL鍏叡閮ㄥ垎
-  // baseURL: process.env.VUE_APP_BASE_API,
-  baseURL: 'http://192.168.11.203:8090/prod-api',
+  baseURL: process.env.VUE_APP_BASE_API,
+  // baseURL: 'http://192.168.11.203:8090/prod-api',
   // 瓒呮椂
   timeout: 10000
 })
diff --git a/se-ui/src/views/login.vue b/se-ui/src/views/login.vue
index 4894d33..4f28dca 100644
--- a/se-ui/src/views/login.vue
+++ b/se-ui/src/views/login.vue
@@ -47,7 +47,7 @@
 </template>
 
 <script>
-import { getCodeImg } from "@/api/login";
+// import { getCodeImg } from "@/api/login";
 import Cookies from "js-cookie";
 import { encrypt, decrypt } from '@/utils/jsencrypt'
 
diff --git a/se-ui/vue.config.js b/se-ui/vue.config.js
index 4bd6086..7ef2354 100644
--- a/se-ui/vue.config.js
+++ b/se-ui/vue.config.js
@@ -17,7 +17,7 @@
   // 閮ㄧ讲鐢熶骇鐜鍜屽紑鍙戠幆澧冧笅鐨刄RL銆�
   // 榛樿鎯呭喌涓嬶紝Vue CLI 浼氬亣璁句綘鐨勫簲鐢ㄦ槸琚儴缃插湪涓�涓煙鍚嶇殑鏍硅矾寰勪笂
   // 渚嬪 https://www.se.vip/銆傚鏋滃簲鐢ㄨ閮ㄧ讲鍦ㄤ竴涓瓙璺緞涓婏紝浣犲氨闇�瑕佺敤杩欎釜閫夐」鎸囧畾杩欎釜瀛愯矾寰勩�備緥濡傦紝濡傛灉浣犵殑搴旂敤琚儴缃插湪 https://www.se.vip/admin/锛屽垯璁剧疆 baseUrl 涓� /admin/銆�
-  publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
+  publicPath: process.env.NODE_ENV === "production" ? process.env.VUE_APP_ITEM_PATH : "/",
   // 鍦╪pm run build 鎴� yarn build 鏃� 锛岀敓鎴愭枃浠剁殑鐩綍鍚嶇О锛堣鍜宐aseUrl鐨勭敓浜х幆澧冭矾寰勪竴鑷达級锛堥粯璁ist锛�
   outputDir: 'dist',
   // 鐢ㄤ簬鏀剧疆鐢熸垚鐨勯潤鎬佽祫婧� (js銆乧ss銆乮mg銆乫onts) 鐨勶紱锛堥」鐩墦鍖呬箣鍚庯紝闈欐�佽祫婧愪細鏀惧湪杩欎釜鏂囦欢澶逛笅锛�
@@ -37,7 +37,7 @@
         target: `http://192.168.11.203:8090`,
         changeOrigin: true,
         pathRewrite: {
-          ['^' + process.env.VUE_APP_BASE_API]: ''
+          ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API
         }
       }
     },

--
Gitblit v1.9.3