Browse Source

删除验证码

zhifei 1 year ago
parent
commit
bd9655aeac
2 changed files with 37 additions and 37 deletions
  1. 10 10
      src/api/login.js
  2. 27 27
      src/views/login.vue

+ 10 - 10
src/api/login.js

@@ -47,13 +47,13 @@ export function logout() {
 }
 }
 
 
 // 获取验证码
 // 获取验证码
-export function getCodeImg() {
-  return request({
-    url: '/captchaImage',
-    headers: {
-      isToken: false
-    },
-    method: 'get',
-    timeout: 20000
-  })
-}
+// export function getCodeImg() {
+//   return request({
+//     url: '/captchaImage',
+//     headers: {
+//       isToken: false
+//     },
+//     method: 'get',
+//     timeout: 20000
+//   })
+// }

+ 27 - 27
src/views/login.vue

@@ -25,21 +25,21 @@
           <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
           <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
         </el-input>
         </el-input>
       </el-form-item>
       </el-form-item>
-      <el-form-item prop="code" v-if="captchaEnabled">
-        <el-input
-          v-model="loginForm.code"
-          size="large"
-          auto-complete="off"
-          placeholder="验证码"
-          style="width: 63%"
-          @keyup.enter="handleLogin"
-        >
-          <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
-        </el-input>
-        <div class="login-code">
-          <img :src="codeUrl" @click="getCode" class="login-code-img"/>
-        </div>
-      </el-form-item>
+<!--      <el-form-item prop="code" v-if="captchaEnabled">-->
+<!--        <el-input-->
+<!--          v-model="loginForm.code"-->
+<!--          size="large"-->
+<!--          auto-complete="off"-->
+<!--          placeholder="验证码"-->
+<!--          style="width: 63%"-->
+<!--          @keyup.enter="handleLogin"-->
+<!--        >-->
+<!--          <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>-->
+<!--        </el-input>-->
+<!--        <div class="login-code">-->
+<!--          <img :src="codeUrl" @click="getCode" class="login-code-img"/>-->
+<!--        </div>-->
+<!--      </el-form-item>-->
       <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
       <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
       <el-form-item style="width:100%;">
       <el-form-item style="width:100%;">
         <el-button
         <el-button
@@ -65,7 +65,7 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import { getCodeImg } from "@/api/login";
+// import { getCodeImg } from "@/api/login";
 import Cookies from "js-cookie";
 import Cookies from "js-cookie";
 import { encrypt, decrypt } from "@/utils/jsencrypt";
 import { encrypt, decrypt } from "@/utils/jsencrypt";
 import useUserStore from '@/store/modules/user'
 import useUserStore from '@/store/modules/user'
@@ -85,7 +85,7 @@ const loginForm = ref({
 const loginRules = {
 const loginRules = {
   username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
   username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
   password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
   password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
-  code: [{ required: true, trigger: "change", message: "请输入验证码" }]
+  // code: [{ required: true, trigger: "change", message: "请输入验证码" }]
 };
 };
 
 
 const codeUrl = ref("");
 const codeUrl = ref("");
@@ -117,22 +117,22 @@ function handleLogin() {
       }).catch(() => {
       }).catch(() => {
         loading.value = false;
         loading.value = false;
         // 重新获取验证码
         // 重新获取验证码
-        if (captchaEnabled.value) {
-          getCode();
-        }
+        // if (captchaEnabled.value) {
+        //   getCode();
+        // }
       });
       });
     }
     }
   });
   });
 }
 }
 
 
 function getCode() {
 function getCode() {
-  getCodeImg().then(res => {
-    captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
-    if (captchaEnabled.value) {
-      codeUrl.value = "data:image/gif;base64," + res.img;
-      loginForm.value.uuid = res.uuid;
-    }
-  });
+  // getCodeImg().then(res => {
+  //   captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
+  //   if (captchaEnabled.value) {
+  //     codeUrl.value = "data:image/gif;base64," + res.img;
+  //     loginForm.value.uuid = res.uuid;
+  //   }
+  // });
 }
 }
 
 
 function getCookie() {
 function getCookie() {