|
@@ -5,18 +5,19 @@
|
|
|
<el-form-item prop="userName" class="el-form-item">
|
|
|
<el-input v-model="loginForm.userName" name="userName" type="text" autocomplete="off" placeholder="账号"/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="password" class="el-form-item">
|
|
|
- <el-input type="password" v-model="loginForm.password" autocomplete="off" show-password placeholder="密码"/>
|
|
|
+ <el-form-item prop="passWord" class="el-form-item">
|
|
|
+ <el-input type="passWord" v-model="loginForm.passWord" autocomplete="off" show-passWord placeholder="密码" @keyup.enter.native="submitForm('loginForm')"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="submitForm('loginForm')">登录</el-button>
|
|
|
+ <el-button type="primary" style="width:100%;" @click.native.prevent="submitForm('loginForm')">登录</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { mapGetters } from 'vuex'
|
|
|
+ import { mapGetters } from 'vuex';
|
|
|
+ import { Message } from 'element-ui'
|
|
|
export default {
|
|
|
name: 'Login',
|
|
|
data() {
|
|
@@ -37,13 +38,13 @@
|
|
|
return {
|
|
|
loginForm: {
|
|
|
userName: '',
|
|
|
- password: ''
|
|
|
+ passWord: ''
|
|
|
},
|
|
|
rules: {
|
|
|
userName: [
|
|
|
{ validator: checkUserName, trigger: 'blur' }
|
|
|
],
|
|
|
- password: [
|
|
|
+ passWord: [
|
|
|
{ validator: validatePass, trigger: 'blur' }
|
|
|
]
|
|
|
}
|
|
@@ -61,11 +62,14 @@
|
|
|
if (valid) {
|
|
|
// console.log(this.loginForm.userName);
|
|
|
// const userName = this.loginForm.userName;
|
|
|
- // const password = this.loginForm.password;
|
|
|
+ // const passWord = this.loginForm.passWord;
|
|
|
this.$store.dispatch('Login', this.loginForm).then(() => {
|
|
|
+ Message({
|
|
|
+ message: '登陆成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 5 * 1000
|
|
|
+ })
|
|
|
this.$router.push({ path: '/channel/index' })
|
|
|
- }).catch(() => {
|
|
|
- alert('登录失败');
|
|
|
})
|
|
|
//alert('submit!');
|
|
|
} else {
|
|
@@ -103,6 +107,9 @@
|
|
|
.el-form-item__label {
|
|
|
color:#fff;
|
|
|
}
|
|
|
+ .el-form-item__content {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
.el-input input{
|
|
|
background: transparent;
|
|
|
border: 0px;
|