From d5786ed5bcb549ad4ea37437b2acc48d0bac9413 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期三, 21 二月 2024 16:05:50 +0800
Subject: [PATCH] 11

---
 src/views/home/index.vue |   55 +++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 135e229..9b2051d 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -763,6 +763,24 @@
               autocomplete="off"
             ></el-input>
           </el-form-item>
+          <el-form-item prop="code" label-width="80px">
+            <el-input
+              v-model="code"
+              auto-complete="off"
+              placeholder="楠岃瘉鐮�"
+              style="width: 63%"
+              @keyup.enter.native="loginFn"
+            >
+              <svg-icon
+                slot="prefix"
+                icon-class="validCode"
+                class="el-input__icon input-icon"
+              />
+            </el-input>
+            <div class="login-code">
+              <img :src="codeUrl" @click="getCode" class="login-code-img" />
+            </div>
+          </el-form-item>
         </el-form>
         <span slot="footer" class="dialog-footer">
           <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
@@ -795,7 +813,7 @@
   getDonateorganDistrictDonateCalculate
 } from "@/api/project/donateorgan";
 import { listData } from "@/api/system/dict/data";
-import { login, logout, getInfo } from "@/api/login";
+import { login, logout, getInfo, getCodeImg } from "@/api/login";
 import { listDonatebaseinfo } from "@/api/project/donatebaseinfo";
 import { getToken, setToken, removeToken } from "@/utils/auth";
 import MapChart from "./components/MapChart";
@@ -840,9 +858,13 @@
       },
       leijishuju: {},
       arrrrr: [],
+      captchaOnOff: true,
+      uuid:'',
       form: {},
       hospitallist: [],
       year: "",
+      code: "",
+      codeUrl: "",
       dialogVisible: true,
       isloading: false,
       tableLoading: false,
@@ -1250,6 +1272,7 @@
   },
   created() {
     this.height = window.innerHeight - 72;
+    this.getCode();
     //this.getinfos();
     //this.getOrgansOfHospitalByMonthss();
   },
@@ -1259,10 +1282,18 @@
     // let defaultPassword = "Admin@123";
   },
   methods: {
+    getCode() {
+      getCodeImg().then(res => {
+        this.captchaOnOff =
+          res.captchaOnOff === undefined ? true : res.captchaOnOff;
+        if (this.captchaOnOff) {
+          this.codeUrl = "data:image/gif;base64," + res.img;
+          this.uuid = res.uuid;
+        }
+      });
+    },
     loginFn() {
-      let code;
-      let uuid;
-      login(this.defaultAccount, this.defaultPassword, code, uuid)
+      login(this.defaultAccount, this.defaultPassword, this.code, this.uuid)
         .then(async res => {
           if (res.code == 200) {
             setToken(res.token);
@@ -2102,10 +2133,10 @@
   left: 0;
   position: relative;
   margin: 0 auto;
-  .el-dialog__title{
+  .el-dialog__title {
     color: #fff;
   }
-  .el-form-item__label{
+  .el-form-item__label {
     text-align: right;
     vertical-align: middle;
     float: left;
@@ -2125,4 +2156,16 @@
     margin-right: -27px;
   }
 }
+.login-code {
+  width: 33%;
+  height: 38px;
+  float: right;
+  img {
+    cursor: pointer;
+    vertical-align: middle;
+  }
+}
+.login-code-img {
+  height: 38px;
+}
 </style>

--
Gitblit v1.9.3