From 32ec691abab0c837f34ce2c4908a40a10b9dbec7 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 29 七月 2022 17:20:15 +0800
Subject: [PATCH] 1.优化项目2.综合看板静态页面初步实现

---
 src/views/login/index.vue |   62 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 94f903d..0bf205c 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -116,11 +116,32 @@
       </el-form>
     </div>
 
+    <el-dialog
+      title="鎻愮ず"
+      :visible.sync="dialogVisible"
+      width="500px"
+      :close-on-click-modal="false"
+      :show-close="false"
+      top="5vh"
+    >
+      <div style="font-size:20px;">
+        <!--        <i class="el-icon-warning-outline" style="color: #ffef00" />-->
+        褰撳墠璐﹀彿宸茬櫥褰曪紝鏄惁寮哄埗涓嬬嚎!
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button @click="dialogVisibleCancel">鍚�</el-button>
+          <el-button type="primary" @click="dialogVisibleConfirm">鏄�</el-button>
+        </div>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { validUsername } from '@/utils/validate'
+import { getCookie, removeCookie, setCookie } from '@/utils/auth'
+import { ForcedOffline } from '@/api/user'
 
 export default {
   name: 'Login',
@@ -166,7 +187,8 @@
       passwordType: 'password',
       redirect: undefined,
       focus1: false,
-      focus2: false
+      focus2: false,
+      dialogVisible: false
     }
   },
   watch: {
@@ -193,7 +215,12 @@
         if (valid) {
           this.loading = true
           this.$store.dispatch('user/login', this.loginForm).then(() => {
-            this.$router.push({ path: this.redirect || '/' })
+            console.log(getCookie('code') === '302')
+            if (getCookie('code') === '302') {
+              this.dialogVisible = true
+            } else {
+              this.$router.push({ path: this.redirect || '/' })
+            }
             this.loading = false
           }).catch(() => {
             this.loading = false
@@ -203,6 +230,34 @@
           return false
         }
       })
+    },
+
+    dialogVisibleCancel() {
+      removeCookie('username')
+      removeCookie('admin')
+      removeCookie('navTabId')
+      removeCookie('usertype')
+      removeCookie('userid')
+      removeCookie('code')
+      this.dialogVisible = false
+    },
+    async dialogVisibleConfirm() {
+      const usercode = getCookie('navTabId')
+      const username = getCookie('admin')
+      const usertype = getCookie('usertype')
+      const userid = getCookie('userid')
+      const data = {
+        usercode,
+        username,
+        usertype,
+        userid
+      }
+      const res = await ForcedOffline(data)
+      if (res.code === '200') {
+        this.$message.success('寮哄埗涓嬬嚎鎴愬姛锛�')
+        this.dialogVisible = false
+        this.$router.push({ path: this.redirect || '/' })
+      }
     }
   }
 }
@@ -393,4 +448,7 @@
     -webkit-text-fill-color: #000 !important;
   }
 }
+::v-deep .el-dialog__title{
+  color: red;
+}
 </style>

--
Gitblit v1.9.3