import React, { Component } from "react";
import style from "./index.less";
import possibleImg from "../../common/images/possible.png";
import doubtImg from "../../common/images/doubt.png";
import recommendImg from "../../common/images/recommend.png";
import tipsImg from "../../common/images/tips.png";
import vigilantImg from "../../common/images/vigilant.png";
import showImg from "../../common/images/show.png";
import hideImg from "../../common/images/close.png";
import PushDiag from "./PushDiag";
import DiagnosticItem from "@containers/DiagnosticItem";
import $ from "jquery";
import { getWindowInnerHeight } from "@common/js/func";
import {windowEventHandler} from '@utils/tools'
class PushItems extends Component {
constructor(props) {
super(props);
this.state = {
moreAssay: false,
moreCheck: false
};
this.showMore = this.showMore.bind(this);
this.closeMore = this.closeMore.bind(this);
this.billing = this.billing.bind(this);
this.changeAssay = this.changeAssay.bind(this);
this.changeCheck = this.changeCheck.bind(this);
this.showTips = this.showTips.bind(this);
this.$cont = React.createRef();
}
showMore(type) {
this.setState({ [type]: true });
}
closeMore(type) {
this.setState({ [type]: false });
}
billing() {
const { assay, check } = this.props.pushMessage;
const checkedAssay = assay.filter(item => item.checked);
const checkedCheck = check.filter(item => item.checked);
this.props.billing(checkedAssay, checkedCheck);
const Height = $(".src-components-BodyContainer-2SgEx").height();
const adviceHeight = $(".src-common-components-ItemBox-1Bpz3").height();
const winHeight = window.innerHeight;
const scrollTop = Height;
document.documentElement.scrollTop = 10000;
}
changeAssay(item) {
this.props.changeAssay(item);
}
changeCheck(item) {
this.props.changeCheck(item);
}
showTips(tips) {
const { getTipsDetails } = this.props;
getTipsDetails && getTipsDetails();
}
componentDidMount() {
const height = getWindowInnerHeight() - 200;
this.$cont.current.style.height = height + "px";
windowEventHandler('resize', ()=>{
const height = getWindowInnerHeight() - 200;
this.$cont.current.style.height = height + "px";
});
}
render() {
const {
vigilant,
determine,
doubt,
possible,
assay,
check,
tips
} = this.props.pushMessage;
const { tipsDiscalimer } = this.props;
const { moreAssay, moreCheck } = this.state;
const {
showMore,
closeMore,
billing,
changeCheck,
changeAssay,
showAdd,
showTips
} = this;
// console.log('tipsDiscalimer', tipsDiscalimer)
let assayNum = 0;
let assayHide = assay.map((item, index) => {
assayNum = assayNum + item.name.length + 2;
if (assayNum > 22) {
return;
} else {
return (
changeAssay(item)}
type="checkbox"
checked={item.checked}
/>
);
}
});
const assays = assay.map(item => {
return (
changeAssay(item)}
type="checkbox"
checked={item.checked}
/>
);
});
let checkNum = 0;
let checkHide = check.map((item, index) => {
checkNum = checkNum + item.name.length + 2;
if (checkNum > 22) {
return;
} else {
return (
changeCheck(item)}
type="checkbox"
checked={item.checked}
/>
);
}
});
const checks = check.map(item => {
return (
changeCheck(item)}
type="checkbox"
checked={item.checked}
/>
);
});
const vigilants = vigilant.map((item, index) => {
return