dev_aliyun2
harry 5 years ago
parent 4c44e599a5
commit 3ebfa74a18

@ -1,9 +1,9 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { markdownToHTML } from 'educoder'; import { markdownToHTML } from 'educoder';
import { import {
Radio, Radio,
Tooltip, Tooltip
Icon
} from "antd"; } from "antd";
import './../questioncss/questioncom.css'; import './../questioncss/questioncom.css';
import QuillForEditor from "../../../common/quillForEditor"; import QuillForEditor from "../../../common/quillForEditor";
@ -21,24 +21,24 @@ const tagArrays = [
] ]
const questionType = [ const questionType = [
{ {
type:'SINGLE', type: 'SINGLE',
color:'typeGreen', color: 'typeGreen',
name:'单选题' name: '单选题'
}, },
{ {
type:'MULTIPLE', type: 'MULTIPLE',
color:'typeBlue', color: 'typeBlue',
name:'多选题' name: '多选题'
}, },
{ {
type:'JUDGMENT', type: 'JUDGMENT',
color:'typeRed', color: 'typeRed',
name:'判断题' name: '判断题'
}, },
{ {
type:'PROGRAM', type: 'PROGRAM',
color:'typeYellow', color: 'typeYellow',
name:'编程题' name: '编程题'
} }
] ]
//Paperreview_single.js Paperlibraryseeid_items.js //Paperreview_single.js Paperlibraryseeid_items.js
@ -50,57 +50,57 @@ class Listjihe extends Component {
name: "单选题", name: "单选题",
nd: "简单", nd: "简单",
url: "", url: "",
mydisplay:false, mydisplay: false,
occupation:2, occupation: 2,
isysladmins:false, isysladmins: false,
} }
} }
//初始化 //初始化
componentDidMount() { componentDidMount() {
let isysladmins=false; let isysladmins = false;
if(this.props){ if (this.props) {
if(this.props.current_user){ if (this.props.current_user) {
if(this.props.current_user.admin){ if (this.props.current_user.admin) {
isysladmins=true; isysladmins = true;
} }
else if(this.props.current_user.business){ else if (this.props.current_user.business) {
isysladmins=true; isysladmins = true;
} }
} }
} }
this.setState({ this.setState({
isysladmins:isysladmins isysladmins: isysladmins
}) })
} }
handleShowUploadImage = (url) => { handleShowUploadImage = (url) => {
try { try {
this.props.handleShowUploadImage(url); this.props.handleShowUploadImage(url);
}catch (e) { } catch (e) {
} }
} }
handleClose=()=>{ handleClose = () => {
try { try {
this.props.handleClose(); this.props.handleClose();
}catch (e) { } catch (e) {
} }
} }
//选用 //选用
Selectingpracticaltraining = (id) => { Selectingpracticaltraining = (id) => {
try { try {
if(this.props.Datacountbool){ if (this.props.Datacountbool) {
if(this.props.Datacount===100){ if (this.props.Datacount === 100) {
this.props.showNotification(`已选100个试题不能在选用更多试题`); this.props.showNotification(`已选100个试题不能在选用更多试题`);
return; return;
} }
} }
}catch (e) { } catch (e) {
} }
@ -115,13 +115,13 @@ class Listjihe extends Component {
exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id),
} }
} }
if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ if (this.props.current_user.professional_certification === false && this.state.isysladmins === false) {
this.HideAddcoursestypess(2); this.HideAddcoursestypess(2);
return return
} }
this.getitem_baskets(data); this.getitem_baskets(data);
} }
getitem_baskets=(data)=>{ getitem_baskets = (data) => {
this.props.getitem_baskets(data); this.props.getitem_baskets(data);
} }
@ -132,30 +132,30 @@ class Listjihe extends Component {
} }
seturls(url){ seturls(url) {
if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ if (this.props.current_user.professional_certification === false && this.state.isysladmins === false) {
this.HideAddcoursestypess(2); this.HideAddcoursestypess(2);
return return
} }
this.props.history.replace(url); this.props.history.replace(url);
} }
HideAddcoursestypess=(i)=>{ HideAddcoursestypess = (i) => {
console.log("调用了"); console.log("调用了");
this.setState({ this.setState({
mydisplay:true, mydisplay: true,
occupation:i, occupation: i,
}) })
} }
mydisplayHidedel=()=>{ mydisplayHidedel = () => {
this.setState({ this.setState({
mydisplay:false, mydisplay: false,
}) })
} }
render() { render() {
let {page, name, nd,url,mydisplay} = this.state; let { page, name, nd, url, mydisplay } = this.state;
let {defaultActiveKey, items, listjihe, chakanjiexiboolindex, keindex} = this.props; let { defaultActiveKey, items, listjihe, chakanjiexiboolindex, keindex } = this.props;
// 编程答案 // 编程答案
var rightkey = null var rightkey = null
@ -193,72 +193,54 @@ class Listjihe extends Component {
MULTIPLEkey = MULTIPLEkey + tagArrays[i]; MULTIPLEkey = MULTIPLEkey + tagArrays[i];
} }
// 编程答案 }
var rightkey = null }
}
if (items) { }
if (items.item_type) {
if (items.item_type === "PROGRAM") { } else {
if (items.choices) {
} else { if (items.choices.length > 0) {
if (items.item_type === "JUDGMENT") { var arr = items.choices;
for (var i = 0; i < arr.length; i++) {
if (arr[i].is_answer === true) {
if (items.choices) { rightkey = i;
if (items.choices.length > 0) { break;
var arr = items.choices; }
for (let data of arr) { }
if (data.is_answer === true) { }
rightkey = data.choice_text; }
break; }
} }
} }
} }
}
} else {
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
for (var i = 0; i < arr.length; i++) {
if (arr[i].is_answer === true) {
rightkey = i;
break;
}
}
}
}
}
}
}
} }
var itemssname=""; var itemssname = "";
try { try {
itemssname= JSON.parse(items.name); itemssname = JSON.parse(items.name);
}catch (e) { } catch (e) {
} }
if(itemssname===undefined){ if (itemssname === undefined) {
itemssname=items.name+"" itemssname = items.name + ""
} }
var itemsnamesy = ""; var itemsnamesy = "";
try { try {
itemsnamesy = JSON.parse(items && items.program_attr && items.program_attr.description); itemsnamesy = JSON.parse(items && items.program_attr && items.program_attr.description);
}catch (e) { } catch (e) {
itemsnamesy=items&&items.program_attr&&items.program_attr.description+""; itemsnamesy = items && items.program_attr && items.program_attr.description + "";
} }
var analysisnames = ""; var analysisnames = "";
try { try {
analysisnames = JSON.parse(items && items.analysis); analysisnames = JSON.parse(items && items.analysis);
}catch (e) { } catch (e) {
analysisnames=items&&items.analysis+""; analysisnames = items && items.analysis + "";
} }
// console.log(items.name); // console.log(items.name);
// console.log(itemsnamesy); // console.log(itemsnamesy);
@ -269,30 +251,30 @@ class Listjihe extends Component {
] ]
try { try {
if(itemsnamesy.constructor === Object){ if (itemsnamesy.constructor === Object) {
// console.log("是对象"); // console.log("是对象");
// console.log(itemsnamesy); // console.log(itemsnamesy);
}else { } else {
// console.log("不是对象"); // console.log("不是对象");
// console.log(itemsnamesy); // console.log(itemsnamesy);
itemsnamesy=itemsnamesy+""; itemsnamesy = itemsnamesy + "";
} }
}catch (e) { } catch (e) {
} }
const types = questionType.filter(item=>item.type === items.item_type); const types = questionType.filter(item => item.type === items.item_type);
return ( return (
<div key={keindex} <div key={keindex}
className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : "borderwds pd20 mb20 listjihecolors"}> className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : "borderwds pd20 mb20 listjihecolors"}>
{/*顶部*/} {/*顶部*/}
{ {
mydisplay===true? mydisplay === true ?
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.mydisplayHidedel} /> <Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.mydisplayHidedel} />
:"" : ""
} }
{ {
mydisplay===true? mydisplay === true ?
<style> <style>
{ {
` `
@ -304,7 +286,7 @@ class Listjihe extends Component {
} }
</style> </style>
:"" : ""
} }
<style> <style>
{ {
@ -350,40 +332,40 @@ class Listjihe extends Component {
<div className="w100s sortinxdirection"> <div className="w100s sortinxdirection">
<span className={`typesBtn ${types && types[0].color}`}>{types && types[0].name}</span> <span className={`typesBtn ${types && types[0].color}`}>{types && types[0].name}</span>
<div className="listjihetixingstitsy" style={{ <div className="listjihetixingstitsy" style={{
fontWeight:"bold" fontWeight: "bold"
}} > }} >
{ {
this.props.listjihe this.props.listjihe
}. }.
</div> </div>
{ {
items.item_type==="PROGRAM"? items.item_type === "PROGRAM" ?
( (
this.props.defaultActiveKeys&&this.props.defaultActiveKeys==="0"? this.props.defaultActiveKeys && this.props.defaultActiveKeys === "0" ?
<a onClick={()=>this.seturls(`/problems/${items.program_attr.identifier}/edit`)} className="ml10 flex1 mt2 xiaoshou"> <a onClick={() => this.seturls(`/problems/${items.program_attr.identifier}/edit`)} className="ml10 flex1 mt2 xiaoshou">
<div style={{wordBreak: "break-word",fontWeight:"bold"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}></div> <div style={{ wordBreak: "break-word", fontWeight: "bold" }} dangerouslySetInnerHTML={{ __html: markdownToHTML(items && items.name).replace(/▁/g, "▁▁▁") }}></div>
</a> </a>
: :
<p className="ml10 flex1 mt2 xiaoshout"> <p className="ml10 flex1 mt2 xiaoshout">
<div style={{wordBreak: "break-word",fontWeight:"bold"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}></div> <div style={{ wordBreak: "break-word", fontWeight: "bold" }} dangerouslySetInnerHTML={{ __html: markdownToHTML(items && items.name).replace(/▁/g, "▁▁▁") }}></div>
</p> </p>
) )
: :
<div className="ml10 flex1 markdown-body mt2" style={{wordBreak: "break-word",fontWeight:"bold"}}> <div className="ml10 flex1 markdown-body mt2" style={{ wordBreak: "break-word", fontWeight: "bold" }}>
{ items===undefined||items===null||items===""?"": {items === undefined || items === null || items === "" ? "" :
items.name === undefined || items.name === null || items.name === "" ? items.name === undefined || items.name === null || items.name === "" ?
"" ""
: :
items.name.length>0? items.name.length > 0 ?
itemssname===null|| itemssname===undefined?"": itemssname === null || itemssname === undefined ? "" :
<QuillForEditor <QuillForEditor
readOnly={true} readOnly={true}
value={itemssname} value={itemssname}
showUploadImage={this.handleShowUploadImage} showUploadImage={this.handleShowUploadImage}
/> />
:"" : ""
} }
</div> </div>
} }
@ -407,13 +389,13 @@ class Listjihe extends Component {
</p> : </p> :
items.item_type === "PROGRAM" ? items.item_type === "PROGRAM" ?
<p className="w100s listjihetixingstitssy sortinxdirection "> <p className="w100s listjihetixingstitssy sortinxdirection ">
<p id={"itemsnamesyid"} className={"sortinxdirection mt15"}> <p id={"itemsnamesyid"} className={"sortinxdirection mt15"}>
{ {
items&&items.program_attr&&items.program_attr.description? items && items.program_attr && items.program_attr.description ?
<p className="programquill" style={{wordBreak: "break-word"}} <p className="programquill" style={{ wordBreak: "break-word" }}
> >
{ {
itemsnamesy===null || itemsnamesy===undefined? itemsnamesy === null || itemsnamesy === undefined ?
"" ""
: :
<QuillForEditor <QuillForEditor
@ -423,7 +405,7 @@ class Listjihe extends Component {
/> />
} }
</p> </p>
:"" : ""
} }
@ -434,28 +416,28 @@ class Listjihe extends Component {
<p className="w100s listjihetixingstitsp verticallayout "> <p className="w100s listjihetixingstitsp verticallayout ">
{ {
items === undefined || items === null ? "" : items.choices.map((object, index) => { items === undefined || items === null ? "" : items.choices.map((object, index) => {
var string="" var string = ""
try { try {
string=JSON.parse(object.choice_text); string = JSON.parse(object.choice_text);
}catch (e) { } catch (e) {
string=object.choice_text; string = object.choice_text;
} }
return ( return (
<p className={index === 0 ? "sortinxdirection " : "sortinxdirection mt15 "}> <p className={index === 0 ? "sortinxdirection " : "sortinxdirection mt15 "}>
<p className="lh20s">{tagArray[index]}</p> <p className="lh20s">{tagArray[index]}</p>
<p className="programquill" style={{wordBreak: "break-word"}}> <p className="programquill" style={{ wordBreak: "break-word" }}>
{object ? {object ?
object.choice_text === undefined || object.choice_text=== null || object.choice_text === "" ? object.choice_text === undefined || object.choice_text === null || object.choice_text === "" ?
"" ""
: :
object.choice_text.length>0? object.choice_text.length > 0 ?
<QuillForEditor <QuillForEditor
readOnly={true} readOnly={true}
value={string} value={string}
showUploadImage={this.handleShowUploadImage} showUploadImage={this.handleShowUploadImage}
/> />
:"" : ""
: :
@ -538,25 +520,25 @@ class Listjihe extends Component {
</p> </p>
{ {
items.item_type === "PROGRAM" ? items.item_type === "PROGRAM" ?
this.props.Isitapopup&&this.props.Isitapopup==="true"? this.props.Isitapopup && this.props.Isitapopup === "true" ?
"" ""
: :
<a onClick={()=>this.seturls(`/problems/${items.program_attr.identifier}/edit`)}> <a onClick={() => this.seturls(`/problems/${items.program_attr.identifier}/edit`)}>
<p className="viewparsings xiaoshou mr25"> <p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span> <span>编辑</span>
</p> </p>
</a> </a>
: :
this.props.Isitapopup&&this.props.Isitapopup==="true"? this.props.Isitapopup && this.props.Isitapopup === "true" ?
"" ""
: :
<a onClick={()=>this.seturls(`/problemset/edit/${items.id}`)}> <a onClick={() => this.seturls(`/problemset/edit/${items.id}`)}>
<p className="viewparsings xiaoshou mr25"> <p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span> <span>编辑</span>
</p> </p>
</a> </a>
} }
{ {
items.public === false ? items.public === false ?
@ -565,40 +547,40 @@ class Listjihe extends Component {
items.program_attr.status === 0 ? items.program_attr.status === 0 ?
"" ""
: :
items.apply===false? items.apply === false ?
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}> <p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span> <span>公开</span>
</p> </p>
: :
( (
items.public==true? items.public == true ?
<p className="viewparsings xiaoshou mr25" > <p className="viewparsings xiaoshou mr25" >
<i className="iconfont icon-dianjiliang font-13 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-dianjiliang font-13 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>已公开</span> <span>已公开</span>
</p> </p>
: :
<p className="viewparsings xiaoshou mr25" onClick={(e) => this.props.showmodelsInaudit(e)}> <p className="viewparsings xiaoshou mr25" onClick={(e) => this.props.showmodelsInaudit(e)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开审核中</span> <span>公开审核中</span>
</p> </p>
) )
) )
:items.apply===false? : items.apply === false ?
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}> <p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span> <span>公开</span>
</p> </p>
: :
( (
items.public==true? items.public == true ?
"" ""
: :
<p className="viewparsings xiaoshou mr25" onClick={(e) => this.props.showmodelsInaudit(e)}> <p className="viewparsings xiaoshou mr25" onClick={(e) => this.props.showmodelsInaudit(e)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开审核中</span> <span>公开审核中</span>
</p> </p>
) )
: :
<p className="viewparsings mr25" > <p className="viewparsings mr25" >
<i className="iconfont icon-dianjiliang font-13 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-dianjiliang font-13 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
@ -629,52 +611,52 @@ class Listjihe extends Component {
<div className=" sortinxdirection mt15 yldxtit"> <div className=" sortinxdirection mt15 yldxtit">
{ {
items.item_type === "SINGLE" ? items.item_type === "SINGLE" ?
<p className=" testfondex yldxtit" <p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}} style={{ wordBreak: "break-word" }}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + tagArrays[rightkey]).replace(/▁/g, "▁▁▁")}} dangerouslySetInnerHTML={{ __html: markdownToHTML("答案:" + tagArrays[rightkey]).replace(/▁/g, "▁▁▁") }}
> >
</p> </p>
: items.item_type === "MULTIPLE"? : items.item_type === "MULTIPLE" ?
<p className=" testfondex yldxtit" <p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}} style={{ wordBreak: "break-word" }}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + MULTIPLEkey).replace(/▁/g, "▁▁▁")}} dangerouslySetInnerHTML={{ __html: markdownToHTML("答案:" + MULTIPLEkey).replace(/▁/g, "▁▁▁") }}
> >
</p> </p>
: :
<p className=" testfondex yldxtit" <p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}} style={{ wordBreak: "break-word" }}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + rightkey).replace(/▁/g, "▁▁▁")}} dangerouslySetInnerHTML={{ __html: markdownToHTML("答案:" + rightkey).replace(/▁/g, "▁▁▁") }}
> >
</p> </p>
} }
</div> </div>
<div className=" sortinxdirection mt15 yldxtit"> <div className=" sortinxdirection mt15 yldxtit">
<p className=" testfondex yldxtit " <p className=" testfondex yldxtit "
style={{wordBreak: "break-word"}} style={{ wordBreak: "break-word" }}
> >
解析 解析
</p> </p>
<p id={"analysisnamesid"} className="wt930px testfondex yldxtit programquill" <p id={"analysisnamesid"} className="wt930px testfondex yldxtit programquill"
style={{wordBreak: "break-word"}} style={{ wordBreak: "break-word" }}
> >
{items ? {items ?
items.analysis=== undefined || items.analysis=== null || items.analysis === "" ? items.analysis === undefined || items.analysis === null || items.analysis === "" ?
"暂无解析" "暂无解析"
: :
items.analysis.length>0? items.analysis.length > 0 ?
analysisnames===null || analysisnames===undefined?"": analysisnames === null || analysisnames === undefined ? "" :
<QuillForEditor <QuillForEditor
imgAttrs={{width: '60px', height: '30px'}} imgAttrs={{ width: '60px', height: '30px' }}
readOnly={true} readOnly={true}
value={analysisnames} value={analysisnames}
showUploadImage={this.handleShowUploadImage} showUploadImage={this.handleShowUploadImage}
/> />
: :
"暂无解析" "暂无解析"
: :
"" ""
} }
@ -684,11 +666,11 @@ class Listjihe extends Component {
} }
</div> </div>
) )
} }
} }
export default Listjihe; export default Listjihe;

Loading…
Cancel
Save