|
@@ -7,31 +7,36 @@
|
|
|
auto-complete="on"
|
|
|
label-position="left">
|
|
|
<div class="title-container">
|
|
|
- <h3 class="title">大雅乐盟后台管理系统</h3>
|
|
|
+ <img src="@/assets/images/base/login-logo.png"
|
|
|
+ alt="">
|
|
|
</div>
|
|
|
|
|
|
- <el-form-item prop="username">
|
|
|
+ <el-form-item prop="username"
|
|
|
+ class='logitem'>
|
|
|
<span class="svg-container">
|
|
|
<svg-icon icon-class="user" />
|
|
|
</span>
|
|
|
<el-input ref="username"
|
|
|
v-model="loginForm.username"
|
|
|
- placeholder="Username"
|
|
|
+ placeholder="请输入用户名"
|
|
|
+ class='login-input'
|
|
|
name="username"
|
|
|
type="text"
|
|
|
tabindex="1"
|
|
|
auto-complete="on" />
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item prop="password">
|
|
|
+ <el-form-item prop="password"
|
|
|
+ class='logitem'>
|
|
|
<span class="svg-container">
|
|
|
<svg-icon icon-class="password" />
|
|
|
</span>
|
|
|
<el-input :key="passwordType"
|
|
|
ref="password"
|
|
|
+ class='login-input'
|
|
|
v-model="loginForm.password"
|
|
|
:type="passwordType"
|
|
|
- placeholder="Password"
|
|
|
+ placeholder="请输入密码"
|
|
|
name="password"
|
|
|
tabindex="2"
|
|
|
auto-complete="on"
|
|
@@ -42,14 +47,14 @@
|
|
|
</span>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-button :loading="loading"
|
|
|
- type="primary"
|
|
|
- style="width:100%;margin-bottom:30px;"
|
|
|
- @click.native.prevent="handleLogin">登录</el-button>
|
|
|
-
|
|
|
- <div class="tips">
|
|
|
- <span style="margin-right:20px;">username: admin</span>
|
|
|
- <span>password: any</span>
|
|
|
+ <div class="loginBtn"
|
|
|
+ style="width:100%;margin-bottom:30px;"
|
|
|
+ @click="handleLogin">登录</div>
|
|
|
+ <div class='remberBox'
|
|
|
+ @click='saveUserInfo'>
|
|
|
+ <div class="dotWrap">
|
|
|
+ <div :class="isSaveUserInfo?'active':''"></div>
|
|
|
+ </div>记住密码
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -63,22 +68,22 @@ export default {
|
|
|
data () {
|
|
|
const validateUsername = (rule, value, callback) => {
|
|
|
if (!validUsername(value)) {
|
|
|
- callback(new Error("Please enter the correct user name"));
|
|
|
+ callback(new Error("请输入用户名"));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
const validatePassword = (rule, value, callback) => {
|
|
|
if (value.length < 6) {
|
|
|
- callback(new Error("The password can not be less than 6 digits"));
|
|
|
+ callback(new Error("密码必须大于六位"));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
return {
|
|
|
loginForm: {
|
|
|
- username: "admin",
|
|
|
- password: "111111"
|
|
|
+ username: "",
|
|
|
+ password: ""
|
|
|
},
|
|
|
loginRules: {
|
|
|
username: [
|
|
@@ -90,9 +95,14 @@ export default {
|
|
|
},
|
|
|
loading: false,
|
|
|
passwordType: "password",
|
|
|
- redirect: undefined
|
|
|
+ redirect: undefined,
|
|
|
+ isSaveUserInfo: true
|
|
|
};
|
|
|
},
|
|
|
+ mounted () {
|
|
|
+ this.loginForm.username = localStorage.getItem('username');
|
|
|
+ this.loginForm.password = localStorage.getItem('password');
|
|
|
+ },
|
|
|
watch: {
|
|
|
$route: {
|
|
|
handler: function (route) {
|
|
@@ -113,23 +123,34 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
handleLogin () {
|
|
|
+ // 判断是否点击了记住密码 => 存储密码
|
|
|
+ if (this.isSaveUserInfo) {
|
|
|
+ localStorage.setItem('username', this.loginForm.username);
|
|
|
+ localStorage.setItem('password', this.loginForm.password);
|
|
|
+ } else {
|
|
|
+ localStorage.setItem('username', '');
|
|
|
+ localStorage.setItem('password', '');
|
|
|
+ }
|
|
|
this.$refs.loginForm.validate(valid => {
|
|
|
+
|
|
|
if (valid) {
|
|
|
- this.loading = true;
|
|
|
+
|
|
|
this.$store
|
|
|
.dispatch("user/login", this.loginForm)
|
|
|
.then(() => {
|
|
|
+ console.log('登录成功');
|
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
|
- this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- this.loading = false;
|
|
|
});
|
|
|
} else {
|
|
|
- console.log("error submit!!");
|
|
|
+ console.log("登录错误");
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ saveUserInfo () {
|
|
|
+ this.isSaveUserInfo = !this.isSaveUserInfo;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -138,7 +159,70 @@ export default {
|
|
|
<style lang="scss">
|
|
|
/* 修复input 背景不协调 和光标变色 */
|
|
|
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
|
|
|
+.loginBtn {
|
|
|
+ background-color: #777 !important;
|
|
|
+ text-align: center;
|
|
|
+ width: 100%;
|
|
|
+ height: 51px;
|
|
|
+ line-height: 51px;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 25px;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-bottom: 10px !important;
|
|
|
+}
|
|
|
+::-webkit-input-placeholder {
|
|
|
+ /* WebKit browsers */
|
|
|
+ color: #444;
|
|
|
+ font-size: 16px;
|
|
|
+}
|
|
|
+
|
|
|
+::-moz-placeholder {
|
|
|
+ /* Mozilla Firefox 19+ */
|
|
|
+ color: #444;
|
|
|
+ font-size: 16px;
|
|
|
+}
|
|
|
|
|
|
+:-ms-input-placeholder {
|
|
|
+ /* Internet Explorer 10+ */
|
|
|
+ color: #444;
|
|
|
+ font-size: 16px;
|
|
|
+}
|
|
|
+.logitem {
|
|
|
+ border-radius: 25px !important;
|
|
|
+ border: 1px solid #444 !important;
|
|
|
+ background-color: transparent !important;
|
|
|
+}
|
|
|
+.login-container .el-input input {
|
|
|
+ color: #444 !important;
|
|
|
+ caret-color: #444 !important;
|
|
|
+}
|
|
|
+.remberBox {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: flex-end;
|
|
|
+ margin-bottom: 50px;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+ .dotWrap {
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ border: 1px solid #444;
|
|
|
+ border-radius: 50%;
|
|
|
+ margin-right: 8px;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ .active {
|
|
|
+ width: 10px;
|
|
|
+ height: 10px;
|
|
|
+ background-color: #444;
|
|
|
+ border-radius: 50%;
|
|
|
+ overflow: hidden;
|
|
|
+ position: absolute;
|
|
|
+ top: 3px;
|
|
|
+ left: 3px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
$bg: #283443;
|
|
|
$light_gray: #fff;
|
|
|
$cursor: #fff;
|
|
@@ -190,16 +274,22 @@ $light_gray: #eee;
|
|
|
.login-container {
|
|
|
min-height: 100%;
|
|
|
width: 100%;
|
|
|
- background-color: $bg;
|
|
|
+ // background-color: $bg;
|
|
|
+ background: url("../../assets/images/base/login-bg.png") no-repeat 100% 100%;
|
|
|
+ background-size: cover;
|
|
|
overflow: hidden;
|
|
|
|
|
|
.login-form {
|
|
|
position: relative;
|
|
|
- width: 520px;
|
|
|
+ width: 26%;
|
|
|
max-width: 100%;
|
|
|
- padding: 160px 35px 0;
|
|
|
- margin: 0 auto;
|
|
|
+ padding: 0px 35px;
|
|
|
+ margin: 12% auto 0;
|
|
|
overflow: hidden;
|
|
|
+ background-color: #fff;
|
|
|
+ opacity: 0.85;
|
|
|
+ box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.66);
|
|
|
+ border-radius: 20px;
|
|
|
}
|
|
|
|
|
|
.tips {
|
|
@@ -224,7 +314,13 @@ $light_gray: #eee;
|
|
|
|
|
|
.title-container {
|
|
|
position: relative;
|
|
|
-
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ padding: 30px 0;
|
|
|
+ img {
|
|
|
+ width: 30%;
|
|
|
+ }
|
|
|
.title {
|
|
|
font-size: 26px;
|
|
|
color: $light_gray;
|