index.jsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { Component } from "react";
  2. import $ from 'jquery';
  3. import config from '@config/index';
  4. class SlideIpt extends Component {
  5. constructor(props) {
  6. super(props);
  7. this.state = {
  8. show:false,
  9. activeInd:false,
  10. activeName:'',
  11. canEdit:true,
  12. style:'',
  13. value:''
  14. };
  15. this.setEdit = this.setEdit.bind(this);
  16. }
  17. componentDidMount(){
  18. const {item} = this.props
  19. this.setState({value:item.time})
  20. }
  21. handleInput(e,item,sign,idx){
  22. const {setTipValue,handlePush} = this.props;
  23. setTipValue(item,e.target.value,sign,idx)
  24. //右侧推送--延时推送
  25. const stimer = this.state.timer;
  26. clearTimeout(stimer);
  27. let timer = setTimeout(function(){
  28. handlePush&&handlePush({mode:8});
  29. clearTimeout(stimer);
  30. },config.delayPushTime);
  31. this.setState({timer})
  32. }
  33. handleFocus(){
  34. const {handlePush} = this.props;
  35. handlePush&&handlePush({mode:8});
  36. }
  37. setEdit(e){
  38. $(e.target).removeAttr('disabled').focus()
  39. }
  40. render() {
  41. const {item,idx} = this.props;
  42. return (
  43. <input type="text"
  44. class="canEdit"
  45. // onDoubleClick={(e)=>this.setEdit(e)}
  46. style={{color:'#333'}}
  47. placeholder='时间'
  48. autoComplete="off"
  49. value={this.state.value}
  50. onInput={(e)=>{this.handleInput(e,item,1,idx)}}
  51. onFocus={()=>{this.handleFocus()}}
  52. />
  53. );
  54. }
  55. }
  56. export default SlideIpt;