import React from 'react'
import {Icon, Input, Modal} from 'antd'

function LoginFrame({isOpened, doHideLogin, doSubmit}) {

  function handleSubmit() {
    const username = document.querySelector('#username').value
    const password = document.querySelector('#password').value

    doSubmit(username, password)
  }

  return (
    <div id="login_frame">
      <Modal
        title="用户登入"
        okText="登入"
        cancelText="取消"
        visible={isOpened}
        onOk={handleSubmit}
        onCancel={doHideLogin}
      >
        <Input
          id="username"
          prefix={<Icon type="user" style={{color: 'rgba(0,0,0,.25)'}}/>}
          placeholder="请输入用户名"
        />
        <Input
          id="password"
          type="password"
          prefix={<Icon type="key" style={{color: 'rgba(0,0,0,.25)'}}/>}
          placeholder="请输入密码"
        />
      </Modal>
    </div>
  )
}

export default LoginFrame

@@ -665,16 +665,91 @@
 %E8%AF%B7%E8%BE%93%E5%85%A5%E7%94%A8%E6%88%B7%E5%90%8D%22%0A
+          onPressEnter=%7B() =%3E document.querySelector('#password').focus()%7D%0A
         
@@ -919,16 +919,54 @@
 %22%E8%AF%B7%E8%BE%93%E5%85%A5%E5%AF%86%E7%A0%81%22%0A
+          onPressEnter=%7BhandleSubmit%7D%0A
         

handle input press enter