From 1a0f8011f8e9251081bb7a5cf39fbae944459812 Mon Sep 17 00:00:00 2001
From: LiuJiaNan <liujianan@zcloudchina.com>
Date: Tue, 25 Feb 2025 11:05:03 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=B3=BB=E7=BB=9F?=
 =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E8=80=81=E7=B3=BB=E7=BB=9F=E5=9C=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/asyncRouter.js      |  6 +++++-
 src/views/map/index.vue | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/asyncRouter.js b/src/asyncRouter.js
index f9e507c..3a23a8e 100644
--- a/src/asyncRouter.js
+++ b/src/asyncRouter.js
@@ -46,7 +46,11 @@ router.beforeEach((to, from, next) => {
     if (to.path == `/login` || to.path == '/apiMonitoringCenter' || to.path == '/apiMajorHazardSources') {
       next()
     } else {
-      next(`/login`)
+      if (to.path == '/map' && to.query.userId) {
+        next()
+      } else {
+        next(`/login`)
+      }
     }
   }
 })
diff --git a/src/views/map/index.vue b/src/views/map/index.vue
index 7115566..849fb7e 100644
--- a/src/views/map/index.vue
+++ b/src/views/map/index.vue
@@ -1614,6 +1614,10 @@ export default {
     handleClickRightTools(index) {
       if (this.rightOptionsList[index].check !== '') this.rightOptionsList[index].check = !this.rightOptionsList[index].check
       if (index === 0) {
+        if (this.$route.query.userId) {
+          window.close()
+          return
+        }
         if (this.gangkouActive === '00004') {
           if (this.timer) {
             clearInterval(this.timer)
@@ -2922,10 +2926,28 @@ export default {
         this.corpInfo.CORP_INFO_ID = data.info.CORP_INFO_ID
         this.corpInfo.latitude = data.info.latitude
         this.corpInfo.longitude = data.info.longitude
+        this.initUser()
         this.initMap()
       }).catch((e) => {
         console.log(e)
       })
+    },
+    initUser() {
+      const { userId } = this.$route.query
+      if (!userId) return
+      requestFN(
+        '/admin/v2/login',
+        { userId }
+      ).then((res) => {
+        console.log(res)
+        if (res.result !== 'success') {
+          alert('登录失败')
+          window.close()
+        }
+      }).catch((e) => {
+        alert('登录失败')
+        window.close()
+      })
     }
   }
 }