From 05569927171387146f0f67fcc5798be8b067cf0b Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期五, 21 四月 2023 12:54:53 +0800
Subject: [PATCH] 登录时密码加密

---
 src/views/login/index.vue |   52 ++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 3448171..85f76a9 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -3,9 +3,7 @@
     <!-- 浜у搧鍚嶇О -->
     <div class="text">
       <div class="logo">
-        <img
-          :src="imgUrl"
-          alt="">
+        <img :src="imgUrl" alt="" />
       </div>
       <div class="text-r">
         <h2 class="title font-extra-large">閬傛槍鍘挎櫤鎱ф墽娉曞钩鍙�</h2>
@@ -16,12 +14,24 @@
     </div>
     <el-card class="login-form-layout">
       <!-- 琛ㄥ崟 -->
-      <el-form autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="left">
+      <el-form
+        autoComplete="on"
+        :model="loginForm"
+        :rules="loginRules"
+        ref="loginForm"
+        label-position="left"
+      >
         <!-- title -->
         <h2 class="login-title">鐢ㄦ埛鐧诲綍 / USER LOGIN</h2>
         <el-form-item prop="username">
           <!-- 鐢ㄦ埛鍚嶈緭鍏ユ -->
-          <el-input name="username" type="text" v-model="loginForm.username" autoComplete="on" placeholder="璇疯緭鍏ョ敤鎴峰悕绉�">
+          <el-input
+            name="username"
+            type="text"
+            v-model="loginForm.username"
+            autoComplete="on"
+            placeholder="璇疯緭鍏ョ敤鎴峰悕绉�"
+          >
             <span slot="prefix">
               <svg-icon icon-class="user" class="color-main"></svg-icon>
             </span>
@@ -29,21 +39,35 @@
         </el-form-item>
         <el-form-item prop="password">
           <!-- 瀵嗙爜杈撳叆妗� -->
-          <el-input name="password" :type="pwdType ? 'text' : 'password'" @keyup.enter.native="handleLogin"
-            v-model="loginForm.password" autoComplete="on" placeholder="璇疯緭鍏ョ櫥褰曞瘑鐮�">
+          <el-input
+            name="password"
+            :type="pwdType ? 'text' : 'password'"
+            @keyup.enter.native="handleLogin"
+            v-model="loginForm.password"
+            autoComplete="on"
+            placeholder="璇疯緭鍏ョ櫥褰曞瘑鐮�"
+          >
             <!-- 杈撳叆妗嗗墠icon -->
             <span slot="prefix">
               <svg-icon icon-class="password" class="color"></svg-icon>
             </span>
             <!-- 杈撳叆妗嗗悗icon -->
             <span slot="suffix" @click="showPwd">
-              <svg-icon :icon-class="pwdType ? 'yanjing-zhengyan' : 'yanjing-biyan'" class="pointer"></svg-icon>
+              <svg-icon
+                :icon-class="pwdType ? 'yanjing-zhengyan' : 'yanjing-biyan'"
+                class="pointer"
+              ></svg-icon>
             </span>
           </el-input>
         </el-form-item>
         <!-- 琛ㄥ崟鎻愪氦鎸夐挳 -->
         <el-form-item style="margin-bottom: 60px; text-align: center">
-          <el-button style="width: 100%" type="primary" :loading="loading" @click.native.prevent="handleLogin">
+          <el-button
+            style="width: 100%"
+            type="primary"
+            :loading="loading"
+            @click.native.prevent="handleLogin"
+          >
             鐧诲綍
           </el-button>
         </el-form-item>
@@ -56,6 +80,8 @@
 import { isvalidUsername } from "@/utils/validate";
 import { createNamespacedHelpers } from "vuex";
 import users from "@/api/users";
+import {Decrypt,Encrypt} from '@/utils/cryptojs'
+import leafletMapVue from '../systemSetting/device/grid/components/components/leafletMap.vue';
 
 const { mapActions } = createNamespacedHelpers("users");
 export default {
@@ -112,8 +138,10 @@
     },
     ...mapActions(["login"]),
     handleLogin() {
-      const { username, password } = this.loginForm;
+      let { username, password } = this.loginForm;
       const that = this;
+      
+      password = Encrypt(password)
       this.$axios
         .post("sccg/admin/login", {
           password,
@@ -168,7 +196,7 @@
   top: 20%;
   right: 5%;
   width: 360px;
-  &:deep(.el-input__inner){
+  &:deep(.el-input__inner) {
     background-color: #fff !important;
     border: 1px solid #dcdfe6 !important;
   }
@@ -183,7 +211,7 @@
   width: 420px;
   justify-content: space-between;
 
-  .logo>img {
+  .logo > img {
     width: 75px;
     height: 75px;
     border-radius: 4px;

--
Gitblit v1.8.0