index.jsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React, { Component } from "react";
  2. import styles from "../index.less";
  3. import $ from 'jquery';
  4. import { windowEventHandler,setFontColorSize } from '@utils/tools';
  5. import checkOff from '@common/images/check_off.png';
  6. import checkOn from '@common/images/check_on.png';
  7. class AssistName extends Component {
  8. constructor(props) {
  9. super(props);
  10. this.state = {
  11. };
  12. this.$assistName = React.createRef();
  13. this.splitName = this.splitName.bind(this);
  14. this.checkOnOff = this.checkOnOff.bind(this);
  15. }
  16. splitName(name){
  17. let wid = this.props.winWidth;
  18. if(name.length>15 && wid>1150){
  19. let tmpStr = name.substr(0,15)
  20. return tmpStr+'...'
  21. }else{
  22. return name
  23. }
  24. }
  25. checkOnOff(item){
  26. const {checkOnOff,handlePush} = this.props
  27. checkOnOff(item)
  28. handlePush && handlePush({mode:8}); //右侧推送
  29. }
  30. render() {
  31. const { winWidth, name, getInfomation,normal,item } = this.props;
  32. return (
  33. <span className={`${styles.assistName} ${setFontColorSize(2)}`} style={{ width: winWidth < 1150 ? '120px' : 'auto',fontWeight:normal?'normal':'bold'}} ref={this.$assistName}>
  34. <img className={styles.imgCheck} src={item.check?checkOn:checkOff} onClick={()=>this.checkOnOff(item)} alt=""/>
  35. <span className={styles.tagSpan} title={name}>
  36. {name&&this.splitName(name)}:
  37. {/* <span className={styles.imgInfo} title='点击i图标可查看详细说明' onClick={() => getInfomation({ name: name, position: 1, type: 6 })}></span> */}
  38. </span>
  39. </span>
  40. );
  41. }
  42. }
  43. export default AssistName;