|
@@ -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>
|