Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
7a9fd75701
@ -1,62 +1,69 @@
|
|||||||
import React,{ Component } from "react";
|
import React,{ Component } from "react";
|
||||||
import { WordsBtn } from "educoder";
|
import { WordsBtn } from "educoder";
|
||||||
import { Checkbox } from 'antd'
|
import { Checkbox } from 'antd'
|
||||||
const CheckboxGroup = Checkbox.Group;
|
const CheckboxGroup = Checkbox.Group;
|
||||||
|
|
||||||
class CheckAllGroup extends Component{
|
class CheckAllGroup extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
checkAll: true,
|
checkAll: true,
|
||||||
checkedValues: []
|
checkedValues: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onCheckAll = () => {
|
onCheckAll = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
'checkAll': true,
|
'checkAll': true,
|
||||||
checkedValues: []
|
checkedValues: []
|
||||||
})
|
})
|
||||||
this.props.onChange && this.props.onChange([], true);
|
this.props.onChange && this.props.onChange([], true);
|
||||||
}
|
}
|
||||||
onChange = (checkedValues) => {
|
onChange = (checkedValues) => {
|
||||||
if (checkedValues.length > 0) {
|
try {
|
||||||
this.setState({
|
if(this.props.comwbool===true){
|
||||||
'checkAll': false,
|
return
|
||||||
checkedValues
|
}
|
||||||
})
|
}catch (e) {
|
||||||
this.props.onChange && this.props.onChange(checkedValues, false)
|
|
||||||
} else {
|
}
|
||||||
this.setState({
|
if (checkedValues.length > 0) {
|
||||||
'checkAll': true,
|
this.setState({
|
||||||
checkedValues: []
|
'checkAll': false,
|
||||||
})
|
checkedValues
|
||||||
this.props.onChange && this.props.onChange(checkedValues, true);
|
})
|
||||||
}
|
this.props.onChange && this.props.onChange(checkedValues, false)
|
||||||
console.log(checkedValues, arguments)
|
} else {
|
||||||
}
|
this.setState({
|
||||||
|
'checkAll': true,
|
||||||
render() {
|
checkedValues: []
|
||||||
let { label, options, checkboxGroupStyle }=this.props;
|
})
|
||||||
const { checkAll, checkedValues } = this.state;
|
this.props.onChange && this.props.onChange(checkedValues, true);
|
||||||
return (
|
}
|
||||||
<li className="clearfix">
|
console.log(checkedValues, arguments)
|
||||||
<style>{`
|
}
|
||||||
.groupList .ant-checkbox-group-item{
|
|
||||||
margin-bottom:5px;
|
render() {
|
||||||
}
|
let { label, options, checkboxGroupStyle }=this.props;
|
||||||
`}</style>
|
const { checkAll, checkedValues } = this.state;
|
||||||
<span className="fl mr10 color-grey-8">{label}</span>
|
return (
|
||||||
<span className="fl mr25">
|
<li className="clearfix">
|
||||||
<a href="javascript:void(0);" id="comment_no_limit" className={`pl10 pr10 ${checkAll ? 'check_on' : ''}`} onClick={this.onCheckAll}>全部</a>
|
<style>{`
|
||||||
</span>
|
.groupList .ant-checkbox-group-item{
|
||||||
<div className="fl groupList" style={{maxWidth:"990px"}}>
|
margin-bottom:5px;
|
||||||
{
|
}
|
||||||
options.length > 1 && <CheckboxGroup options={options} onChange={this.onChange} value={checkedValues} style={checkboxGroupStyle}/>
|
`}</style>
|
||||||
}
|
<span className="fl mr10 color-grey-8">{label}</span>
|
||||||
</div>
|
<span className="fl mr25">
|
||||||
</li>
|
<a href="javascript:void(0);" id="comment_no_limit" className={`pl10 pr10 ${checkAll ? 'check_on' : ''}`} onClick={this.onCheckAll}>全部</a>
|
||||||
)
|
</span>
|
||||||
}
|
<div className="fl groupList" style={{maxWidth:"990px"}}>
|
||||||
}
|
{
|
||||||
export default CheckAllGroup;
|
options.length > 1 && <CheckboxGroup options={options} onChange={this.onChange} value={checkedValues} style={checkboxGroupStyle}/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default CheckAllGroup;
|
||||||
|
Loading…
Reference in new issue