From 19aea05abd63fdc327afe19840f1e83dcb729b6d Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期一, 06 十一月 2023 17:18:51 +0800
Subject: [PATCH] 退出动态跳转到登录页

---
 src/components/layout/components/appHeader/index.vue |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/components/layout/components/appHeader/index.vue b/src/components/layout/components/appHeader/index.vue
index c793bd8..673e5be 100644
--- a/src/components/layout/components/appHeader/index.vue
+++ b/src/components/layout/components/appHeader/index.vue
@@ -24,6 +24,27 @@
     return {}
   },
   methods: {
+    environmentType(){
+      let type
+      if (location.href.includes('192.168.20.119')) {
+          type = 'test'
+      } else if (location.href.includes('192.168') || location.href.includes('localhost')) {
+          type = 'dev'
+      } else {
+          type = 'prod'
+      }
+      return type
+    },
+    getApsPage(){
+      // 棣栭〉閮ㄧ讲鍦ㄥ悇涓幆澧冪殑绔彛
+      const loginPathMap = {
+          prod:`//${window.location.hostname}:9080`,
+          test:`//192.168.20.119:9080`,
+          // 鎯宠烦鍒版湰鍦板惎鍔ㄧ殑鐧诲綍椤电殑璇濋渶瑕佹妸dev鏀规垚浣犳湰鍦伴」鐩矾寰�
+          dev: `//192.168.8.112:8082`
+      }
+      return loginPathMap[this.environmentType()]
+    },
     handleCommand(command) {
       console.log(command)
       if (command === "logout") {
@@ -35,7 +56,8 @@
           type: 'warning'
         }).then(() => {
           Cookies.remove('token')
-          window.location.href = 'http://localhost:8080/login'; //鏈湴鐨勬櫤鎱у伐鍘�-鐧诲綍椤�
+          // window.location.href = 'http://localhost:8080/login'; //鏈湴鐨勬櫤鎱у伐鍘�-鐧诲綍椤�
+          window.location.href = 'http:'+this.getApsPage()+'/login'; 
           this.$message({
             type: 'success',
             message: '娉ㄩ攢鎴愬姛!'

--
Gitblit v1.8.0