wangtao 2 سال پیش
والد
کامیت
00887b941e
4فایلهای تغییر یافته به همراه230 افزوده شده و 140 حذف شده
  1. 1 0
      src/assets/icons/svg/刷新.svg
  2. 19 9
      src/layout/components/Navbar.vue
  3. 2 2
      src/views/index.vue
  4. 208 129
      src/views/login.vue

+ 1 - 0
src/assets/icons/svg/刷新.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1663055880128" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2371" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M960 416V192l-73.056 73.056a447.712 447.712 0 0 0-373.6-201.088C265.92 63.968 65.312 264.544 65.312 512S265.92 960.032 513.344 960.032a448.064 448.064 0 0 0 415.232-279.488 38.368 38.368 0 1 0-71.136-28.896 371.36 371.36 0 0 1-344.096 231.584C308.32 883.232 142.112 717.024 142.112 512S308.32 140.768 513.344 140.768c132.448 0 251.936 70.08 318.016 179.84L736 416h224z" p-id="2372" fill="#bfbfbf"></path></svg>

+ 19 - 9
src/layout/components/Navbar.vue

@@ -24,7 +24,9 @@
         <div class="avatar-wrapper">
           {{$store.state.user.nickName}}
           <!-- <img :src="avatar" class="user-avatar"> -->
-          <i class="el-icon-caret-bottom" />
+        </div>
+        <div class="logout"  @click="logout">
+          <span>安全退出</span>
         </div>
         <el-dropdown-menu slot="dropdown">
           <!-- <router-link to="/user/profile">
@@ -33,9 +35,9 @@
           <!-- <el-dropdown-item @click.native="setting = true">
             <span>布局设置</span>
           </el-dropdown-item> -->
-          <el-dropdown-item divided @click.native="logout">
-            <span>退出登录</span>
-          </el-dropdown-item>
+          <!-- <el-dropdown-item divided @click.native="logout">
+            <span>安全退出</span>
+          </el-dropdown-item> -->
         </el-dropdown-menu>
       </el-dropdown>
     </div>
@@ -115,6 +117,7 @@ export default {
       this.$store.dispatch('app/toggleSideBar')
     },
     async logout() {
+      alert(1)
       this.$confirm('确定注销并退出系统吗?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -192,12 +195,13 @@ export default {
     }
 
     .avatar-container {
-      margin-right: 30px;
-
+      margin-right: 10px;
+      font-size: 16px;
       .avatar-wrapper {
-        margin-top: 5px;
+        margin-top: 0px;
         position: relative;
-
+        display: inline-block;
+        cursor: default;
         .user-avatar {
           cursor: pointer;
           width: 40px;
@@ -206,13 +210,19 @@ export default {
         }
 
         .el-icon-caret-bottom {
-          cursor: pointer;
+
           position: absolute;
           right: -20px;
           top: 25px;
           font-size: 12px;
         }
       }
+      .logout{
+        margin: 0px 0 0 20px;
+        position: relative;
+        display: inline-block;
+        z-index: 1;
+      }
     }
   }
 }

+ 2 - 2
src/views/index.vue

@@ -663,10 +663,10 @@ export default {
         text-align: left;
         span{
           font-size: 14px;
-          color:#0C83FB;
+          color:#D7000F;
           font-weight: 700;;
           padding-left:10px;
-          border-left:3px solid #0C83FB;
+          border-left:3px solid #D7000F;
           opacity: 1;
         }
       }

+ 208 - 129
src/views/login.vue

@@ -1,18 +1,35 @@
 <template>
-  <div class="login" >
-    <div class="bg" v-if="erp"><img :src="bg" alt="" style="width:100%;height:100%"></div>
+  <div class="login">
+    <div class="bg" v-if="erp">
+      <img :src="bg" alt="" style="width: 100%; height: 100%" />
+    </div>
     <div class="logo" v-if="erp">
-      <img :src="logo" alt="">
+      <img :src="logo" alt="" />
       <span class="logo_txt">东信充值管理系统</span>
     </div>
-    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" v-if="erp">
+    <el-form
+      ref="loginForm"
+      :model="loginForm"
+      :rules="loginRules"
+      class="login-form"
+      v-if="erp"
+    >
       <h3 class="title">用户登录 <span>LOGIN</span></h3>
-      <el-form-item prop="username" >
-        <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
-          <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
+      <el-form-item prop="username">
+        <el-input
+          v-model="loginForm.username"
+          type="text"
+          auto-complete="off"
+          placeholder="账号"
+        >
+          <svg-icon
+            slot="prefix"
+            icon-class="user"
+            class="el-input__icon input-icon"
+          />
         </el-input>
       </el-form-item>
-      <el-form-item prop="password" >
+      <el-form-item prop="password">
         <el-input
           v-model="loginForm.password"
           :type="passwordtxt"
@@ -20,14 +37,31 @@
           placeholder="密码"
           @keyup.enter.native="handleLogin"
         >
-
-        <template #prefix>
-          <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
+          <template #prefix>
+            <svg-icon
+              slot="prefix"
+              icon-class="password"
+              class="el-input__icon input-icon"
+            />
           </template>
         </el-input>
         <div class="eyeWrap">
-          <svg-icon slot="prefix" icon-class="eye"  class="el-input__icon input-icon eye"   style="file:currentColor" @click="eyeTab" v-show="passwordtxt =='password'" />
-          <svg-icon slot="prefix" icon-class="eye-open"  class="el-input__icon input-icon eye"   style="file:currentColor"  @click="eyeTab" v-show="passwordtxt =='text'" />
+          <svg-icon
+            slot="prefix"
+            icon-class="eye"
+            class="el-input__icon input-icon eye"
+            style="file: currentColor"
+            @click="eyeTab"
+            v-show="passwordtxt == 'password'"
+          />
+          <svg-icon
+            slot="prefix"
+            icon-class="eye-open"
+            class="el-input__icon input-icon eye"
+            style="file: currentColor"
+            @click="eyeTab"
+            v-show="passwordtxt == 'text'"
+          />
         </div>
       </el-form-item>
       <el-form-item prop="code" v-if="captchaOnOff">
@@ -35,22 +69,34 @@
           v-model="loginForm.code"
           auto-complete="off"
           placeholder="验证码"
-          style="width: 63%"
+          style="width: 61%"
           @keyup.enter.native="handleLogin"
         >
-          <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
+          <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"/>
+          <img :src="codeUrl" class="login-code-img" />
+        </div>
+        <div class="shuaxin" :class="xuan ? 'xuanz' :''">
+          <svg-icon slot="prefix" icon-class="刷新" @click="getCode" />
         </div>
       </el-form-item>
-      <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;" @change="memory">记住密码</el-checkbox>
-      <el-form-item style="width:100%;">
+      <el-checkbox
+        v-model="loginForm.rememberMe"
+        style="margin: 0px 0px 25px 0px"
+        @change="memory"
+        >记住密码</el-checkbox
+      >
+      <el-form-item style="width: 100%">
         <el-button
           :loading="loading"
           size="medium"
           type="primary"
-          style="width:100%;"
+          style="width: 100%"
           @click.native.prevent="handleLogin"
         >
           <span v-if="!loading">登 录</span>
@@ -66,10 +112,10 @@
       <!-- <span>Copyright © 2018-2021 yongtian.vip All Rights Reserved.</span> -->
     </div>
     <div id="loader-wrapper" v-if="ERPloading">
-        <div id="loader"></div>
-        <div class="loader-section section-left"></div>
-        <div class="loader-section section-right"></div>
-        <div class="load_title">正在加载系统资源,请耐心等待</div>
+      <div id="loader"></div>
+      <div class="loader-section section-left"></div>
+      <div class="loader-section section-right"></div>
+      <div class="load_title">正在加载系统资源,请耐心等待</div>
     </div>
   </div>
 </template>
@@ -79,17 +125,17 @@ import bgImg from "@/assets/images/bg.png";
 import logoImg from "@/assets/logo/logo-b.png";
 import { getCodeImg } from "@/api/login";
 import Cookies from "js-cookie";
-import { encrypt, decrypt } from '@/utils/jsencrypt'
+import { encrypt, decrypt } from "@/utils/jsencrypt";
 
 export default {
   name: "Login",
   data() {
     return {
-      erp:false,
-      ERPloading:true,
-      passwordtxt:"password",
-      bg:bgImg,
-      logo:logoImg,
+      erp: false,
+      ERPloading: true,
+      passwordtxt: "password",
+      bg: bgImg,
+      logo: logoImg,
       codeUrl: "",
       cookiePassword: "",
       loginForm: {
@@ -99,153 +145,168 @@ export default {
         // password: "admin123",
         rememberMe: false,
         code: "",
-        uuid: ""
+        uuid: "",
       },
       loginRules: {
         username: [
-          { required: true, trigger: "blur", message: "请输入您的账号" }
+          { required: true, trigger: "blur", message: "请输入您的账号" },
         ],
         password: [
-          { required: true, trigger: "blur", message: "请输入您的密码" }
+          { required: true, trigger: "blur", message: "请输入您的密码" },
         ],
-        code: [{ required: true, trigger: "change", message: "请输入验证码" }]
+        code: [{ required: true, trigger: "change", message: "请输入验证码" }],
       },
       loading: false,
       // 验证码开关
       captchaOnOff: false,
       // 注册开关
       register: false,
-      redirect: undefined
+      redirect: undefined,
+      xuan:false,
     };
   },
   watch: {
     $route: {
-      handler: function(route) {
+      handler: function (route) {
         this.redirect = route.query && route.query.redirect;
       },
-      immediate: true
-    }
+      immediate: true,
+    },
   },
   created() {
-    this.getUrl()
+    this.getUrl();
   },
   methods: {
-    getUrl(){
-      let url = this.$route.query
-      if(url.username && url.password){
-        let data = {username:url.username,password:url.password}
-        this.handleLoginERP(data)
-      }else{
+    getUrl() {
+      let url = this.$route.query;
+      if (url.username && url.password) {
+        let data = { username: url.username, password: url.password };
+        this.handleLoginERP(data);
+      } else {
         this.getCode();
         this.getCookie();
       }
     },
-    eyeTab(){
-      if(this.passwordtxt == "password"){
-        this.passwordtxt = "text"
-      }else{
-        this.passwordtxt = "password"
+    eyeTab() {
+      if (this.passwordtxt == "password") {
+        this.passwordtxt = "text";
+      } else {
+        this.passwordtxt = "password";
       }
     },
     getCode() {
-      getCodeImg().then(res => {
-        this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
+      this.xuan = true
+      getCodeImg().then((res) => {
+        this.captchaOnOff =
+          res.captchaOnOff === undefined ? true : res.captchaOnOff;
         if (this.captchaOnOff) {
-          if(res.data){
+          if (res.data) {
             this.codeUrl = "data:image/gif;base64," + res.data.img;
             this.loginForm.uuid = res.data.uuid;
-            this.erp = true
-            setTimeout(()=>{
-              this.ERPloading = false
-            },)
-          }else{
-            this.erp = true
-            setTimeout(()=>{
-              this.ERPloading = false
-            },)
-            this.captchaOnOff = false
+            this.erp = true;
+            setTimeout(() => {
+              this.ERPloading = false;
+            });
+          } else {
+            this.erp = true;
+            setTimeout(() => {
+              this.ERPloading = false;
+            });
+            this.captchaOnOff = false;
           }
-
         }
+        this.xuan = false
       });
     },
     getCookie() {
       const username = Cookies.get("username314");
       const password = Cookies.get("password314");
-      const rememberMe = Cookies.get('rememberMe314')
+      const rememberMe = Cookies.get("rememberMe314");
       this.loginForm = {
         username: username === undefined ? this.loginForm.username : username,
-        password: password === undefined ? this.loginForm.password : decrypt(password),
-        rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
+        password:
+          password === undefined ? this.loginForm.password : decrypt(password),
+        rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
       };
     },
-    memory(){
+    memory() {
       if (this.loginForm.rememberMe) {
         Cookies.set("username314", this.loginForm.username, { expires: 30 });
-        Cookies.set("password314", encrypt(this.loginForm.password), { expires: 30 });
-        Cookies.set('rememberMe314', this.loginForm.rememberMe, { expires: 30 });
+        Cookies.set("password314", encrypt(this.loginForm.password), {
+          expires: 30,
+        });
+        Cookies.set("rememberMe314", this.loginForm.rememberMe, {
+          expires: 30,
+        });
       } else {
         Cookies.remove("username314");
         Cookies.remove("password314");
-        Cookies.remove('rememberMe314');
+        Cookies.remove("rememberMe314");
       }
     },
     handleLogin() {
-      this.$refs.loginForm.validate(valid => {
+      this.$refs.loginForm.validate((valid) => {
         if (valid) {
           this.loading = true;
-          this.$store.dispatch("Login", this.loginForm).then((res) => {
-            this.$router.push({ path: "/index"}).catch(()=>{});
-          }).catch(() => {
-            this.loading = false;
-            if (this.captchaOnOff) {
-              this.getCode();
-            }
-          });
+          this.$store
+            .dispatch("Login", this.loginForm)
+            .then((res) => {
+              this.$router.push({ path: "/index" }).catch(() => {});
+            })
+            .catch(() => {
+              this.loading = false;
+              if (this.captchaOnOff) {
+                this.getCode();
+              }
+            });
         }
       });
     },
-    handleLoginERP(data) {//erp登录
-      this.$store.dispatch("LoginERP", data).then((res) => {
-        this.$router.push({ path: "/index"}).catch(()=>{});
-      }).catch((err) => {
-        location.href = '/vuedx/#/';
-      });
-    }
-  }
+    handleLoginERP(data) {
+      //erp登录
+      this.$store
+        .dispatch("LoginERP", data)
+        .then((res) => {
+          this.$router.push({ path: "/index" }).catch(() => {});
+        })
+        .catch((err) => {
+          location.href = "/vuedx/#/";
+        });
+    },
+  },
 };
 </script>
 
-<style  lang="scss" scoped>
-.bg{
-  width:100%;
-  height:100%;
+<style lang="scss" scoped>
+.bg {
+  width: 100%;
+  height: 100%;
   overflow: hidden;
   position: fixed;
-  top:0;
-  left:0;
+  top: 0;
+  left: 0;
   z-index: -1;
-  .bgimg{
-    width:100%;
-    height:100%;
+  .bgimg {
+    width: 100%;
+    height: 100%;
     position: absolute;
-    top:0;
-    left:0;
+    top: 0;
+    left: 0;
     z-index: -1;
   }
 }
-.logo{
-  width:100%;
+.logo {
+  width: 100%;
   position: fixed;
-  top:0;
-  img{
-    width:152px;
-    margin:10px 2rem 0 20px;
+  top: 0;
+  img {
+    width: 152px;
+    margin: 10px 2rem 0 20px;
     vertical-align: middle;
   }
-  .logo_txt{
+  .logo_txt {
     font-size: 1.5rem;
-    color:#fff;
+    color: #fff;
     vertical-align: middle;
     letter-spacing: 4px;
   }
@@ -255,9 +316,7 @@ export default {
   justify-content: center;
   align-items: center;
   height: 100%;
-  // background-image: url("../assets/images/login-background.jpg");
   background-size: cover;
-
 }
 .title {
   margin: 0px auto 30px auto;
@@ -265,8 +324,8 @@ export default {
   color: #000000;
   font-size: 20px;
   font-weight: 700;
-  span{
-    margin-left:10px;
+  span {
+    margin-left: 10px;
     opacity: 0.25;
   }
 }
@@ -280,7 +339,7 @@ export default {
   .el-input {
     height: 40px;
     font-size: 16px !important;
-    margin-top:10px !important;
+    margin-top: 10px !important;
     input {
       height: 40px;
     }
@@ -297,16 +356,38 @@ export default {
   color: #bfbfbf;
 }
 .login-code {
-  width: 33%;
+  width: 30%;
   height: 36px;
-  float: right;
-  margin-top:10px !important;
+  display: inline-block;
+  margin: 10px 0 0 10px !important;
   img {
-    cursor: pointer;
     vertical-align: middle;
-    width:100%;
     height: 36px;
-    margin-top:-1px;
+    margin-top: -4px;
+  }
+}
+
+.shuaxin {
+  font-size: 20px;
+  float: right;
+  margin-top: 10px;
+  cursor: pointer;
+}
+.xuanz {
+  animation: mymove 2s 1;
+  -webkit-animation: mymove 2s 1; /* Safari and Chrome */
+}
+@keyframes mymove {
+  100% {
+    transform: rotate(360deg);
+  }
+}
+
+@-webkit-keyframes mymove {
+  /* Safari and Chrome */
+
+  100% {
+    transform: rotate(360deg);
   }
 }
 .el-login-footer {
@@ -321,18 +402,17 @@ export default {
   font-size: 12px;
   letter-spacing: 1px;
 }
-::v-deep .el-input__inner{
-  height:36px !important;
+::v-deep .el-input__inner {
+  height: 36px !important;
   line-height: 36px !important;
 }
-.eyeWrap{
+.eyeWrap {
   position: relative;
-
 }
-.eye{
+.eye {
   position: absolute;
-  right:10px;
-  top:-40px;
+  right: 10px;
+  top: -40px;
   fill: #ccc;
 }
 </style>
@@ -341,10 +421,9 @@ export default {
 html,
 body,
 #app {
-    height: 100%;
-    margin: 0px;
-    padding: 0px;
-    /* background-color: transparent !important; */
-
+  height: 100%;
+  margin: 0px;
+  padding: 0px;
+  /* background-color: transparent !important; */
 }
 </style>