dev_aliyun2
harry 5 years ago
parent 4c44e599a5
commit 3ebfa74a18

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

Loading…
Cancel
Save