index.jsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import React, { Component } from 'react';
  2. import style from './index.less';
  3. import arrowIcon from '@images/arrowIcon.png';
  4. import pushEmpty from '@images/pushEmpty.png';
  5. import {pushPage2} from '@utils/config';
  6. import {dragBox} from '@utils/drag';
  7. class PushData extends Component{
  8. constructor(props){
  9. super(props);
  10. this.state = {
  11. hashNum:0
  12. }
  13. this.showPushData = this.showPushData.bind(this)
  14. this.hidePushData = this.hidePushData.bind(this)
  15. }
  16. showPushData(){
  17. const {togglePushData} = this.props
  18. setTimeout(function(){
  19. dragBox('dragModalWrap','dragModalTitle','add')
  20. })
  21. togglePushData()
  22. }
  23. hidePushData(){
  24. const {togglePushData} = this.props
  25. dragBox('dragModalWrap','dragModalTitle','del')
  26. togglePushData()
  27. }
  28. componentWillReceiveProps(next){
  29. // if(next.update!=this.props.update){
  30. this.setState({
  31. hashNum:Math.random()
  32. });
  33. // }
  34. }
  35. render(){
  36. const {hashNum } = this.state
  37. const {mrId,planCode,showPushData,togglePushData ,windowWidth,windowHeight} = this.props
  38. // console.log(windowWidth,windowHeight)
  39. const url =`${pushPage2}?mrId=${mrId}&planCode=${planCode}&data=${hashNum}`;
  40. return <div >
  41. {!showPushData&&<div className={style['slideButton']} style={{right:(windowWidth-1200)/2+'px'}} onClick={this.showPushData}>
  42. 朗通智能提醒
  43. <img class={style['arrowIcon']} src={arrowIcon} alt=""/>
  44. </div>}
  45. {showPushData&&<div id="dragModalWrap" className={style['pushWrapper']} style={{right:(windowWidth-1200)/2+'px'}}>
  46. {/* <div id="dragModalTitle" className={style['pushDataTitle']}>朗通智能提醒 <span className={style['pushDataHide']} onClick={this.hidePushData}>收起</span></div> */}
  47. <div className={style['pushDataTitle']}>朗通智能提醒 <span className={style['pushDataHide']} onClick={this.hidePushData}>收起</span></div>
  48. {mrId&&<iframe id='embedPage' src={url} frameborder="0" width="400" height="560"></iframe>}
  49. {!mrId&&<div className={style['pushEmpty']}>
  50. <div className={style['pushEmptyBox']}>
  51. <img className={style['pushEmptyImg']} src={pushEmpty} alt=""/>
  52. <p>等待内容输入中…</p>
  53. </div>
  54. </div>}
  55. </div>}
  56. </div>
  57. }
  58. }
  59. export default PushData;