TODO: Route

This commit is contained in:
2020-01-03 02:12:31 +08:00
parent a5bb450d66
commit fa4156426d
11 changed files with 201 additions and 15 deletions

View File

@@ -1,7 +1,10 @@
import React from 'react';
import Route from 'react-route';
import axios from 'axios';
import './login.css';
import { TreeSelect, Row, Col, Input, Layout, Button } from 'antd';
import App from './App';
import { Row, Col, Input, Layout, Button, Icon, Tooltip } from 'antd';
import Title from 'antd/lib/typography/Title';
class Login extends React.Component {
@@ -9,9 +12,12 @@ class Login extends React.Component {
var user = this.refs["login-user"].input.value
var pwd = this.refs["login-passwd"].input.value
console.log(user, pwd);
axios.get("/api/login").then(value => {
console.log(value)
var form = new FormData();
form.append("user", user);
form.append("pwd", pwd);
axios.post("/api/login", form).then(value => {
console.log(value);
return <Route path='//' component={App} />
});
}
@@ -19,19 +25,27 @@ class Login extends React.Component {
return (
<Layout style={{ minHeight: "100vh" }}>
<div style={{ marginTop: "40vh" }}>
<div style={{ marginTop: "30vh" }}>
<Row className="login-input" type="flex" justify="center"><Title>Apollo Local</Title></Row>
<Row className="login-input" type="flex" justify="center">
<Input ref="login-user" placeholder="Basic usage" style={{ width: "50vh" }} />
<Input ref="login-user" placeholder="用户" style={{ width: "50vh" }}
prefix={ <Tooltip title="用户名"> <Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} /> </Tooltip>}
suffix={
<Icon type="info-circle" style={{ color: 'rgba(0,0,0,.45)' }} />
}
/>
</Row>
<Row className="login-input" type="flex" justify="center">
<Input ref="login-passwd" placeholder="Basic usage" style={{ width: "50vh" }} />
<Input.Password ref="login-passwd" placeholder="密码" style={{ width: "50vh" }}
prefix={<Tooltip title="密码"> <Icon type="safety" style={{ color: 'rgba(0,0,0,.25)' }} /> </Tooltip>}
/>
</Row>
<Row className="login-input" type="flex" justify="center">
<Button className="login-button" onClick={this.onClick}>登录</Button>
</Row>
<Row className="login-input" type="flex" justify="center">
<Button className="login-button">登录</Button>
</Row>
</div>