From 1dfd49b103e721f9bb63fd4d472b6fcc225d94a1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 12 三月 2020 18:42:20 +0800
Subject: [PATCH] 2020-03-12

---
 src/views/login/loginform.jsx |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx
index 7540a4a..15d7e31 100644
--- a/src/views/login/loginform.jsx
+++ b/src/views/login/loginform.jsx
@@ -10,6 +10,7 @@
     isDisabled: PropTypes.bool,
     changelang: PropTypes.func,
     handleSubmit: PropTypes.func,
+    loaded: PropTypes.func,
     dict: PropTypes.object,
     auth: PropTypes.bool,
     lang: PropTypes.string,
@@ -51,7 +52,20 @@
       })
       return
     }
-    this.props.handleSubmit()
+
+    if (!this.props.form.getFieldValue('username')) {
+      const input = document.getElementById('username')
+      if (input) {
+        input.focus()
+      }
+    } else if (!this.props.form.getFieldValue('password')) {
+      const input = document.getElementById('password')
+      if (input) {
+        input.focus()
+      }
+    } else {
+      this.props.handleSubmit()
+    }
   }
 
   componentDidMount () {
@@ -83,6 +97,7 @@
         input.focus()
       }
     }
+    this.props.loaded()
   }
 
   render() {

--
Gitblit v1.8.0