从零开始到完整的React后台管理项目开发路程(第二节)

完整的项目地址

在这里插入图片描述

今天我们做登录页面

开始之前先引入一个全局初始化CSS文件,引入到html.js中

reset.css
html,
body,
p,
ol,
ul,
li,
dl,
dt,
dd,
blockquote,
figure,
fieldset,
legend,
textarea,
pre,
iframe,
hr,
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
padding: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 100%;
font-weight: normal;
}
ul {
list-style: none;
}
button,
input,
select,
textarea {
margin: 0;
}
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
img,
embed,
iframe,
object,
video {
height: auto;
max-width: 100%;
}
audio {
max-width: 100%;
}
iframe {
border: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
text-align: left;
}
html, body {
height: 100%;
}
#root {
width: 100%;
height: 100%;
}
然后在login.js
import React from 'react'
import { Form, Input, Button, Tabs } from 'antd'
import { UserOutlined, LockOutlined } from '@ant-design/icons';
import './login.less'
/* 
登录路由组件
*/
const { TabPane } = Tabs;
function callback(key) {
    console.log(key);
}
const taber = {
    margin:0
}
export default class Login extends React.Component {
    
    render() {
        return (
            <div className="login">
                <div className="loginback">
                    <div className="logintitle">欢迎登陆本管理系统</div>
                    <div className="loginmain">
                        <div className="logincenter">
                            <Tabs defaultActiveKey="1" size="large" onChange={callback} animated="true" centered tabBarGutter={20} tabBarStyle={taber}>
                                <TabPane tab="账号登陆" key="1">
                                    <Form
                                       
                                        name="normal_login"
                                        className="login-form"
                                    >
                                        <Form.Item
                                            style={{margin:'10% 0',backgroundColor:'#eee'}}
                                            name="用户名"
                                            rules={[{ required: true, message: '请输入用户名' }]}
                                        >
                                            <Input prefix={<UserOutlined className="site-form-item-icon" />} placeholder="用户名" />
                                        </Form.Item>
                                        <Form.Item
                                            name="密码"
                                            rules={[{ required: true, message: '请输入密码' }]}
                                        >
                                            <Input
                                                prefix={<LockOutlined className="site-form-item-icon" />}
                                                type="password"
                                                placeholder="密码"
                                            />
                                        </Form.Item>
                                        <Form.Item>
                                            <Button type="primary" htmlType="submit" className="login-form-button">
                                                登录
                                         </Button>
                                        </Form.Item>
                                    </Form>
                                </TabPane>
                                <TabPane tab="扫码登陆" key="2">
                                    Content of Tab Pane 2
                               </TabPane>
                            </Tabs>
                        </div>


                    </div>
                </div>
            </div>
        )
    }
}
login.less
.login {
    width: 100%;
    height: 100vh;
    min-width: 50%;
    background: url('../../resource/images/back.png');
    background-size: 100% 100%;
    position: relative;
}
.loginback {
    position: absolute;
    right: 13%;
    width: 30%;
    top: 20vh;
    height: 50vh;
    
}
.logintitle {
    font-size: 2em;
    color: #fff;
    text-align: center;
    padding-bottom: 30px;
}
.loginmain {
    width: 90%;
    height: 90%;
    padding: 0 10%;
    margin: auto;
    background-color: #fff;
    border-radius: 10px;
    display: flex;
}
.logincenter {
    width: 100%;
    margin: auto;
}
.login-form-button {
    width: 100%;
    height: 6vh;
    font-size: 2.5vh;
    border: none;
    background: linear-gradient(90deg ,#FD5EC9, #C72CFE);
    box-shadow: 3px 2px 5px 3px #ffe2f0c2;
    border-radius: 3px;
}
.login-form {
    width: 100%;
    
}
.tabs {
    font-size: 3vh;
}
.site-form-item-icon {
    height: 4vh;
    line-height: 4vh;
}

背景图素材从我的GitHub下载
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

那就可爱多一点点

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值