|
@@ -1,15 +1,20 @@
|
|
|
<template>
|
|
|
<div class="login-container">
|
|
|
- <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
|
|
|
+ <el-form
|
|
|
+ ref="loginForm"
|
|
|
+ :model="loginForm"
|
|
|
+ :rules="loginRules"
|
|
|
+ class="login-form"
|
|
|
+ auto-complete="on"
|
|
|
+ label-position="left"
|
|
|
+ >
|
|
|
<div class="image-container">
|
|
|
- <img src="@/assets/login/image.png" alt="">
|
|
|
+ <img src="@/assets/login/image.png" alt="" />
|
|
|
</div>
|
|
|
<div class="right-container">
|
|
|
<div class="empty-height" />
|
|
|
<div class="form-container">
|
|
|
- <div class="title">
|
|
|
- 售修宝平台
|
|
|
- </div>
|
|
|
+ <div class="title">售修宝平台</div>
|
|
|
<el-form-item prop="username">
|
|
|
<span class="svg-container">
|
|
|
<svg-icon icon-class="user" />
|
|
@@ -59,7 +64,7 @@
|
|
|
auto-complete="off"
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
/>
|
|
|
- <div class="code" @click="getCode"><img :src="'data:image/jpeg;base64,' + codeImage" alt=""></div>
|
|
|
+ <div class="code" @click="getCode"><img :src="'data:image/jpeg;base64,' + codeImage" alt="" /></div>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-checkbox v-model="isRemenberPw">记住密码</el-checkbox>
|
|
@@ -70,6 +75,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
+ <div class="info">
|
|
|
+ <div class="info-item">
|
|
|
+ <el-link href="https://beian.miit.gov.cn/" :underline="false" target="_blank">粤ICP备2020090308号 </el-link>
|
|
|
+ <div style="margin: 0 20px">|</div>
|
|
|
+ <el-link href="https://beian.mps.gov.cn/#/query/webSearch" :underline="false" target="_blank">
|
|
|
+ <el-image style="width: 14px; height: 16px" :src="require('@/assets/login/icon_0001.png')" />
|
|
|
+ 粤公网安备44010602008477号
|
|
|
+ </el-link>
|
|
|
+ </div>
|
|
|
+ <div>Copyright © 2014-2023 广州众炬科技有限公司 互联网技术开发</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -112,18 +128,18 @@ export default {
|
|
|
loginRules: {
|
|
|
username: [{ required: true, trigger: 'change', validator: validateUsername }],
|
|
|
password: [{ required: true, trigger: 'change', validator: validatePassword }],
|
|
|
- codeValue: [{ required: true, trigger: 'change', validator: validateCode }],
|
|
|
+ codeValue: [{ required: true, trigger: 'change', validator: validateCode }]
|
|
|
},
|
|
|
loading: false,
|
|
|
passwordType: 'password',
|
|
|
redirect: undefined,
|
|
|
isRemenberPw: false,
|
|
|
- codeImage: '',
|
|
|
+ codeImage: ''
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
$route: {
|
|
|
- handler: function(route) {
|
|
|
+ handler: function (route) {
|
|
|
this.redirect = route.query && route.query.redirect
|
|
|
},
|
|
|
immediate: true
|
|
@@ -131,24 +147,24 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
// 获取缓存信息
|
|
|
- if(localStorage.getItem("greemall_login")) {
|
|
|
- let storageData = JSON.parse(localStorage.getItem("greemall_login"));
|
|
|
- this.loginForm.username = storageData.username;
|
|
|
- this.isRemenberPw = storageData.isRemenberPw;
|
|
|
+ if (localStorage.getItem('greemall_login')) {
|
|
|
+ let storageData = JSON.parse(localStorage.getItem('greemall_login'))
|
|
|
+ this.loginForm.username = storageData.username
|
|
|
+ this.isRemenberPw = storageData.isRemenberPw
|
|
|
}
|
|
|
- if(this.isRemenberPw) {
|
|
|
- this.getCookie();
|
|
|
+ if (this.isRemenberPw) {
|
|
|
+ this.getCookie()
|
|
|
}
|
|
|
|
|
|
- this.getCode();
|
|
|
+ this.getCode()
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取验证码
|
|
|
getCode() {
|
|
|
getCode().then(res => {
|
|
|
- console.log(res);
|
|
|
- this.loginForm.code = res.data.code;
|
|
|
- this.codeImage = res.data.pic;
|
|
|
+ console.log(res)
|
|
|
+ this.loginForm.code = res.data.code
|
|
|
+ this.codeImage = res.data.pic
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -169,15 +185,18 @@ export default {
|
|
|
this.$refs.loginForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
- this.$store.dispatch('user/login', this.loginForm).then(() => {
|
|
|
- this.$router.push({ path: this.redirect || '/' })
|
|
|
- this.saveUnAndPw();
|
|
|
- this.loading = false
|
|
|
- }).catch(() => {
|
|
|
- this.getCode();
|
|
|
- this.loginForm.codeValue = '';
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
+ this.$store
|
|
|
+ .dispatch('user/login', this.loginForm)
|
|
|
+ .then(() => {
|
|
|
+ this.$router.push({ path: this.redirect || '/' })
|
|
|
+ this.saveUnAndPw()
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.getCode()
|
|
|
+ this.loginForm.codeValue = ''
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
} else {
|
|
|
console.log('error submit!!')
|
|
|
return false
|
|
@@ -191,43 +210,42 @@ export default {
|
|
|
username: this.loginForm.username,
|
|
|
isRemenberPw: this.isRemenberPw
|
|
|
}
|
|
|
- localStorage.setItem("greemall_login", JSON.stringify(storageData));
|
|
|
+ localStorage.setItem('greemall_login', JSON.stringify(storageData))
|
|
|
|
|
|
- if(this.isRemenberPw) {
|
|
|
- this.setCookie(this.loginForm.username, this.loginForm.password, 7);
|
|
|
+ if (this.isRemenberPw) {
|
|
|
+ this.setCookie(this.loginForm.username, this.loginForm.password, 7)
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//设置cookie
|
|
|
setCookie(c_name, c_pwd, exdays) {
|
|
|
- var exdate = new Date(); //获取时间
|
|
|
- exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays); //保存的天数
|
|
|
+ var exdate = new Date() //获取时间
|
|
|
+ exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays) //保存的天数
|
|
|
//字符串拼接cookie
|
|
|
- window.document.cookie = "greemall_username" + "=" + c_name + ";path=/;expires=" + exdate.toGMTString();
|
|
|
- window.document.cookie = "greemall_password" + "=" + c_pwd + ";path=/;expires=" + exdate.toGMTString();
|
|
|
+ window.document.cookie = 'greemall_username' + '=' + c_name + ';path=/;expires=' + exdate.toGMTString()
|
|
|
+ window.document.cookie = 'greemall_password' + '=' + c_pwd + ';path=/;expires=' + exdate.toGMTString()
|
|
|
},
|
|
|
|
|
|
//读取cookie
|
|
|
- getCookie: function() {
|
|
|
+ getCookie: function () {
|
|
|
if (document.cookie.length > 0) {
|
|
|
- var arr = document.cookie.split('; '); //这里显示的格式需要切割一下自己可输出看下
|
|
|
+ var arr = document.cookie.split('; ') //这里显示的格式需要切割一下自己可输出看下
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
- var arr2 = arr[i].split('='); //再次切割
|
|
|
+ var arr2 = arr[i].split('=') //再次切割
|
|
|
//判断查找相对应的值
|
|
|
if (arr2[0] == 'greemall_username') {
|
|
|
- this.loginForm.username = arr2[1]; //保存到保存数据的地方
|
|
|
+ this.loginForm.username = arr2[1] //保存到保存数据的地方
|
|
|
} else if (arr2[0] == 'greemall_password') {
|
|
|
- this.loginForm.password = arr2[1];
|
|
|
+ this.loginForm.password = arr2[1]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//清除cookie
|
|
|
- clearCookie: function() {
|
|
|
- this.setCookie("", "", -1); //修改2值都为空,天数为负1天就好了
|
|
|
+ clearCookie: function () {
|
|
|
+ this.setCookie('', '', -1) //修改2值都为空,天数为负1天就好了
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -236,8 +254,8 @@ export default {
|
|
|
/* 修复input 背景不协调 和光标变色 */
|
|
|
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
|
|
|
|
|
|
-$bg:#283443;
|
|
|
-$light_gray:#fff;
|
|
|
+$bg: #283443;
|
|
|
+$light_gray: #fff;
|
|
|
$cursor: #fff;
|
|
|
$back: #333;
|
|
|
|
|
@@ -293,9 +311,9 @@ $back: #333;
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-$bg:#2d3a4b;
|
|
|
-$dark_gray:#889aa4;
|
|
|
-$light_gray:#eee;
|
|
|
+$bg: #2d3a4b;
|
|
|
+$dark_gray: #889aa4;
|
|
|
+$light_gray: #eee;
|
|
|
|
|
|
.login-container {
|
|
|
min-height: 100%;
|
|
@@ -356,7 +374,7 @@ $light_gray:#eee;
|
|
|
|
|
|
.svg-container {
|
|
|
padding: 6px 5px 6px 5px;
|
|
|
- color: #33AEF7;
|
|
|
+ color: #33aef7;
|
|
|
vertical-align: middle;
|
|
|
width: 30px;
|
|
|
display: inline-block;
|
|
@@ -400,7 +418,7 @@ $light_gray:#eee;
|
|
|
height: 45px;
|
|
|
border-radius: 45px;
|
|
|
background: #33aef7;
|
|
|
- box-shadow: 2px 3px 8px 0px rgba(5,155,245,0.75);
|
|
|
+ box-shadow: 2px 3px 8px 0px rgba(5, 155, 245, 0.75);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -413,4 +431,28 @@ $light_gray:#eee;
|
|
|
border-radius: 15px !important;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.info {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ margin-top: 50px;
|
|
|
+ line-height: 30px;
|
|
|
+ text-align: center;
|
|
|
+ text-align-last: center;
|
|
|
+ color: #fff;
|
|
|
+ z-index: 999;
|
|
|
+ ::v-deep .el-link--inner {
|
|
|
+ color: #fff;
|
|
|
+ font-weight: initial;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.info-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ color: #fff;
|
|
|
+}
|
|
|
</style>
|