6位交易密码框

import React, { Component } from 'react'
import { Form, Input } from 'antd';

export default class Passwordbeifen extends Component {
    constructor(props) {
        super(props)
        this.password1 = React.createRef()
        this.password2 = React.createRef()
        this.password3 = React.createRef()
        this.password4 = React.createRef()
        this.password5 = React.createRef()
        this.password6 = React.createRef()
        this.state = {
            number: []
        }
    }

    confirm = (e) => {
        if (e.keyCode == 37 || e.keyCode == 38) {
            e.preventDefault()
        }
    }
    changeValue = (num, e) => {

        let { number } = this.state
        number[num] = e.target.value


        this.props.getValue(number)

    }
    changePassword1 = (e) => {

        if (this.password1.current.state.value !== '') {
            if (e.keyCode == 37) {
                this.password6.current.focus();
            } else {
                this.password2.current.focus();
            }

        }
        if (e.keyCode == 39) {//向后
            this.password2.current.focus();
        }

    }
    changePassword2 = (e) => {
        if (this.password2.current.state.value !== '') {
            this.password3.current.focus();
        }
        if (e.keyCode == 8 && this.password2.current.state.value == '') {  //删除
            this.password1.current.focus()
        } else if (e.keyCode == 37) {//向前
            e.preventDefault()
            this.password1.current.focus()
        } else if (e.keyCode == 39) {//向后
            this.password3.current.focus();
        }

    }
    changePassword3 = (e) => {
        if (this.password3.current.state.value !== '') {
            this.password4.current.focus();
        }
        if (e.keyCode == 8 && this.password3.current.state.value == '') {
            this.password2.current.focus()
        } else if (e.keyCode == 37) {//向前
            e.preventDefault()
            this.password2.current.focus()
        } else if (e.keyCode == 39) {//向后
            this.password4.current.focus();
        }

    }
    changePassword4 = (e) => {
        if (this.password4.current.state.value !== '') {
            this.password5.current.focus();
        }
        if (e.keyCode == 8 && this.password4.current.state.value == '') {
            this.password3.current.focus()
        } else if (e.keyCode == 37) {//向前
            e.preventDefault()
            this.password3.current.focus()
        } else if (e.keyCode == 39) {//向后
            this.password5.current.focus();
        }
    }
    changePassword5 = (e) => {
        if (this.password5.current.state.value !== '') {
            this.password6.current.focus();
        }
        if (e.keyCode == 8 && this.password5.current.state.value == '') {
            this.password4.current.focus()
        } else if (e.keyCode == 37) {//向前
            e.preventDefault()
            this.password4.current.focus()
        } else if (e.keyCode == 39) {//向后
            this.password6.current.focus();
        }
    }
    changePassword6 = (e) => {

        if (e.keyCode == 8 && this.password6.current.state.value == '') {

            this.password5.current.focus()
        } else if (e.keyCode == 37) {//向前
            e.preventDefault()
            this.password5.current.focus()
        }
    }
    render() {
        return (
            <div className='loan'>
                <>
                    <div>
                        <Input type='tel' ref={this.password1} className='input_password' maxLength={1} onKeyUp={this.changePassword1.bind(this)} onKeyDown={this.confirm.bind(this)} onChange={this.changeValue.bind(this, 0)} />
                        <Input type='tel' ref={this.password2} className='input_password' maxLength={1} onKeyUp={this.changePassword2.bind(this)} onKeyDown={this.confirm.bind(this)} onChange={this.changeValue.bind(this, 1)} />
                        <Input type='tel' ref={this.password3} className='input_password' maxLength={1} onKeyUp={this.changePassword3.bind(this)} onKeyDown={this.confirm.bind(this)} onChange={this.changeValue.bind(this, 2)} />
                        <Input type='tel' ref={this.password4} className='input_password' maxLength={1} onKeyUp={this.changePassword4.bind(this)} onKeyDown={this.confirm.bind(this)} onChange={this.changeValue.bind(this, 3)} />
                        <Input type='tel' ref={this.password5} className='input_password' maxLength={1} onKeyUp={this.changePassword5.bind(this)} onKeyDown={this.confirm.bind(this)} onChange={this.changeValue.bind(this, 4)} />
                        <Input type='tel' ref={this.password6} className='input_password' maxLength={1} onKeyUp={this.changePassword6.bind(this)} onKeyDown={this.confirm.bind(this)} onChange={this.changeValue.bind(this, 5)} />
                    </div>

                </>
            </div>
        )
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
校园二手交易平台可以基于Web应用程序的架进行开发,以下是一个简单的校园二手交易平台架的示例: 1. 前端部分: - 使用HTML、CSS和JavaScript构建用户界面,实现页面布局和样式。 - 使用前端架如React、Angular或Vue.js来实现动态交互和页面组件化。 - 通过AJAX或WebSocket与后端进行数据交互。 2. 后端部分: - 使用一种服务器端编程语言如Java、Python、Node.js等进行开发。 - 采用MVC(Model-View-Controller)设计模式来组织代码。 - 构建RESTful API来处理前端的请求和响应,包括用户注册、登录、商品发布、订单管理等功能。 - 使用ORM(Object Relational Mapping)工具来操作数据库,如Hibernate、SQLAlchemy等。 - 使用数据库管理系统如MySQL、PostgreSQL等来存储用户信息、商品信息、订单信息等。 - 实现用户认证和授权机制,确保只有授权用户才能进行交易和操作。 3. 数据存储: - 设计数据库表结构,包括用户表、商品表、订单表等。 - 使用数据库管理系统进行数据的持久化和查询。 - 可以考虑使用缓存技术如Redis来提高系统性能和响应速度。 4. 安全性和性能优化: - 实现用户密码的加密存储,确保用户信息的安全性。 - 使用HTTPS协议来保护数据传输的安全性。 - 对用户输入进行有效性验证和过滤,防止XSS(跨站脚本攻击)和SQL注入等安全漏洞。 - 对系统进行性能优化,如使用CDN、缓存、异步处理等方式来提高系统的响应速度和并发能力。 这只是一个校园二手交易平台的简单架示例,具体的实现细节还需要根据具体需求进行调整和完善。同时,也可以考虑使用现有的开源架或平台来加快开发速度和提高系统稳定性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值