import React, { Component } from "react";
import $ from 'jquery';
import config from '@config/index';

class SlideIpt extends Component {
  constructor(props) {
    super(props);
    this.state = {
      show:false,
      activeInd:false,
      activeName:'',
      canEdit:true,
      style:'',
      value:''
    };
  }
  
  handleInput(e,item,sign,idx){
    const {setTipValue,handlePush} = this.props;
    setTipValue(item,e.target.value,sign,idx)
    //右侧推送--延时推送
    const stimer = this.state.timer;
    clearTimeout(stimer);
    let timer = setTimeout(function(){
      handlePush&&handlePush({mode:8});
      clearTimeout(stimer);
    },config.delayPushTime);
    this.setState({timer})
  }
  handleFocus(){
    const {handlePush} = this.props;
    handlePush&&handlePush({mode:8});
  }
  render() {
    const {item,idx} = this.props;
    return (
      <input type="text"
          class="canEdit"
          style={{color:'#333'}}
          placeholder='时间'
          autoComplete="off"
          value={item.time}
          onInput={(e)=>{this.handleInput(e,item,1,idx)}}
          onFocus={()=>{this.handleFocus()}}
          />
    );
  }
}
export default SlideIpt;
