Commit 75958a61 authored by derong.zhang's avatar derong.zhang

优化部分列表

parent af503111
......@@ -9,7 +9,7 @@
</Input>
</FormItem>
<FormItem prop="password">
<Input type="password" v-model="loginForm.password" placeholder="Password">
<Input type="password" v-model="loginForm.password" placeholder="Password" @keyup.enter.native='login'>
<Icon type="ios-lock-outline" slot="prepend"></Icon>
</Input>
</FormItem>
......@@ -27,14 +27,13 @@ import {login} from '../api/user.api'
import localStorage from '../services/localStorage.service.js'
export default {
data () {
var that=this
    const validateMenuClassifyId = (rule, value, callback) => {
    if (this.status) {  
      callback(new Error('用户名或密码错误'))
const validateMenuClassifyId = (rule, value, callback) => {
if (this.status) {
callback(new Error('用户名或密码错误'))
this.status = false
      } else {
        callback()
      }
} else {
callback()
}
}
return {
loginForm: {
......@@ -49,7 +48,7 @@ export default {
],
password: [
{required: true, message: '请输入密码', trigger: 'blur'},
{ required: true,validator: validateMenuClassifyId , trigger: 'blur'}
{ required: true, validator: validateMenuClassifyId, trigger: 'blur' }
]
}
}
......@@ -60,11 +59,11 @@ export default {
if (valid) {
let data = btoa(`${this.loginForm.loginName}:${this.loginForm.password}`)
login(data).then((data) => {
if(data.code === 400) {
if (data.code === 400) {
this.error = data.body
this.status = true
this.$refs['loginForm'].validate()
return
return false
} else {
this.status = false
localStorage.set('heimdallr-token', data.body['heimdallr-token'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment