|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
<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="title-container">
|
|
|
|
|
<h3 class="title">安全生产管理系统登录</h3>
|
|
|
|
|
@ -10,47 +11,34 @@
|
|
|
|
|
<span class="svg-container">
|
|
|
|
|
<svg-icon icon-class="user" />
|
|
|
|
|
</span>
|
|
|
|
|
<el-input
|
|
|
|
|
ref="username"
|
|
|
|
|
v-model="loginForm.username"
|
|
|
|
|
placeholder="请输入账号"
|
|
|
|
|
name="username"
|
|
|
|
|
type="text"
|
|
|
|
|
tabindex="1"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
/>
|
|
|
|
|
<el-input ref="username" v-model="loginForm.username" placeholder="请输入账号" name="username" type="text"
|
|
|
|
|
tabindex="1" auto-complete="off" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item prop="password">
|
|
|
|
|
<span class="svg-container">
|
|
|
|
|
<svg-icon icon-class="password" />
|
|
|
|
|
</span>
|
|
|
|
|
<el-input
|
|
|
|
|
:key="passwordType"
|
|
|
|
|
ref="password"
|
|
|
|
|
v-model="loginForm.password"
|
|
|
|
|
:type="passwordType"
|
|
|
|
|
placeholder="请输入密码"
|
|
|
|
|
name="password"
|
|
|
|
|
tabindex="2"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
|
|
/>
|
|
|
|
|
<span class="show-pwd" @click="showPwd">
|
|
|
|
|
<el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType"
|
|
|
|
|
placeholder="请输入密码" name="password" tabindex="2" auto-complete="off" @keyup.enter.native="handleLogin" />
|
|
|
|
|
<!-- <span class="show-pwd" @click="showPwd">
|
|
|
|
|
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
|
|
|
|
</span>
|
|
|
|
|
</span> -->
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">登录</el-button>
|
|
|
|
|
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;"
|
|
|
|
|
@click.native.prevent="handleLogin">登录</el-button>
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { validUsername } from '@/utils/validate'
|
|
|
|
|
import {
|
|
|
|
|
validUsername
|
|
|
|
|
} from '@/utils/validate'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
export default {
|
|
|
|
|
name: 'Login',
|
|
|
|
|
data() {
|
|
|
|
|
const validateUsername = (rule, value, callback) => {
|
|
|
|
|
@ -73,8 +61,16 @@ export default {
|
|
|
|
|
password: ''
|
|
|
|
|
},
|
|
|
|
|
loginRules: {
|
|
|
|
|
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
|
|
|
|
|
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
|
|
|
|
|
username: [{
|
|
|
|
|
required: true,
|
|
|
|
|
trigger: 'blur',
|
|
|
|
|
validator: validateUsername
|
|
|
|
|
}],
|
|
|
|
|
password: [{
|
|
|
|
|
required: true,
|
|
|
|
|
trigger: 'blur',
|
|
|
|
|
validator: validatePassword
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
loading: false,
|
|
|
|
|
passwordType: 'password',
|
|
|
|
|
@ -106,7 +102,9 @@ export default {
|
|
|
|
|
this.loading = true
|
|
|
|
|
this.$store.dispatch('user/login', this.loginForm).then(() => {
|
|
|
|
|
console.log(this.redirect)
|
|
|
|
|
this.$router.push({ path: this.redirect || '/' })
|
|
|
|
|
this.$router.push({
|
|
|
|
|
path: this.redirect || '/'
|
|
|
|
|
})
|
|
|
|
|
this.loading = false
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.loading = false
|
|
|
|
|
@ -118,25 +116,25 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
/* 修复input 背景不协调 和光标变色 */
|
|
|
|
|
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
|
|
|
|
|
/* 修复input 背景不协调 和光标变色 */
|
|
|
|
|
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
|
|
|
|
|
|
|
|
|
|
$bg:#283443;
|
|
|
|
|
$light_gray:#fff;
|
|
|
|
|
$cursor: #fff;
|
|
|
|
|
$bg:#283443;
|
|
|
|
|
$light_gray:#fff;
|
|
|
|
|
$cursor: #fff;
|
|
|
|
|
|
|
|
|
|
@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
|
|
|
|
|
@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
|
|
|
|
|
.login-container .el-input input {
|
|
|
|
|
color: $cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* reset element-ui css */
|
|
|
|
|
.login-container {
|
|
|
|
|
/* reset element-ui css */
|
|
|
|
|
.login-container {
|
|
|
|
|
.el-input {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
height: 47px;
|
|
|
|
|
@ -165,15 +163,15 @@ $cursor: #fff;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
color: #454545;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
$bg:#2d3a4b;
|
|
|
|
|
$dark_gray:#889aa4;
|
|
|
|
|
$light_gray:#eee;
|
|
|
|
|
$bg:#2d3a4b;
|
|
|
|
|
$dark_gray:#889aa4;
|
|
|
|
|
$light_gray:#eee;
|
|
|
|
|
|
|
|
|
|
.login-container {
|
|
|
|
|
.login-container {
|
|
|
|
|
min-height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
background-color: $bg;
|
|
|
|
|
@ -229,5 +227,5 @@ $light_gray:#eee;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
user-select: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|