dev_jupyter
杨树林 5 years ago
parent d678ecb39c
commit c6e9b35a9f

@ -23,7 +23,8 @@ class Contentpart extends Component {
super(props);
this.state = {
page:1,
chakanjiexibool:false,
chakanjiexiboolindex:"无",
}
}
//初始化
@ -32,7 +33,18 @@ class Contentpart extends Component {
}
chakanjiexibool=(index)=>{
debugger
if(this.state.chakanjiexiboolindex===index){
this.setState({
chakanjiexiboolindex:"无",
})
return
}
this.setState({
chakanjiexiboolindex:index,
})
}
render() {
let {page}=this.state;
@ -203,7 +215,9 @@ class Contentpart extends Component {
: this.props.Contentdata.items.map((object, index) => {
return (
<Listjihe {...this.state} {...this.props}
listjihe={index}
chakanjiexibool={(keindex)=>this.chakanjiexibool(keindex)}
listjihe={index+1}
keindex={index}
items={object}
key={index}
getitem_basketss={(id)=>this.props.getitem_basketss(id)}

@ -22,7 +22,6 @@ class Listjihe extends Component {
page:1,
name:"单选题",
nd:"简单",
chakanjiexibool:false,
}
}
//初始化
@ -31,18 +30,6 @@ class Listjihe extends Component {
}
chakanjiexibool=()=>{
if(this.state.chakanjiexibool===true){
this.setState({
chakanjiexibool:false
})
}else{
this.setState({
chakanjiexibool:true
})
}
}
//选用
Selectingpracticaltraining=(id)=>{
let data={
@ -61,18 +48,41 @@ class Listjihe extends Component {
render() {
let {page,name,nd,chakanjiexibool}=this.state;
let {defaultActiveKey,items,listjihe}=this.props;
let {page,name,nd}=this.state;
let {defaultActiveKey,items,listjihe,chakanjiexiboolindex,keindex}=this.props;
// 编程答案
var rightkey=null
if(items){
if(items.item_type){
if(items.item_type==="PROGRAM"){
}else{
if(items.choices){
if(items.choices.length>0){
var arr= items.choices;
for(let data of arr) {
if(data.is_answer===true){
rightkey=data.choice_text;
break;
}
}
}
}
}
}
}
////console.log("Listjihe");
////console.log(this.props);
return (
<div className={chakanjiexibool===true?"w100s borderwds283 pd20 mb20":"w100s borderwds pd20 mb20"}>
<div className={chakanjiexiboolindex===keindex?"w100s borderwds283 pd20 mb20":"w100s borderwds pd20 mb20"}>
{/*顶部*/}
<div className="w100s sortinxdirection">
<div className="listjihetixingstitsy">
{
this.props.listjihe+1
this.props.listjihe
}
</div>
<div className="listjihetixingstitsy">
@ -174,7 +184,7 @@ class Listjihe extends Component {
items.item_type==="PROGRAM"?
""
:
<p className="viewparsings xiaoshou mr25" onClick={()=>this.chakanjiexibool()}>
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.chakanjiexibool(keindex)}>
<i className="iconfont icon-jiexi font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
查看解析</p>
}
@ -184,13 +194,13 @@ class Listjihe extends Component {
</div>
</div>
{
chakanjiexibool===true?<div>
chakanjiexiboolindex===keindex?<div>
<div className="w100s questiontypeheng mt23">
</div>
<div className=" sortinxdirection mt15 yldxtit" >
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML("答案:"+items.analysis).replace(/▁/g, "▁▁▁")}}
style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML("答案:"+rightkey).replace(/▁/g, "▁▁▁")}}
>
</p>
</div>

Loading…
Cancel
Save