forgeplus-react/src/modules/question/Paperreview_single.js

244 lines
6.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { Component } from "react";
import { Radio } from "antd";
import './questioncss/questioncom.css';
import '../tpm/newshixuns/css/Newshixuns.css';
import QuestionModalPicture from "./component/QuestionModalPicture";
import RenderHtml from "../../components/render-html";
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
//单选题
//Paperlibraryseeid_items.js Listjihe.js
class Paperreview_single extends Component {
constructor(props) {
super(props);
this.state = {
questions: 0,
totalscore: 0,
total: 0,
url: ""
}
}
handleShowUploadImage = (url) => {
this.setState({
url: url
})
}
handleClose = () => {
this.setState({
url: '',
})
}
render() {
let { questions, totalscore, total, items, url } = this.state;
let { objectsingle, indexx, paperreviewsingleindex, indexxy, name } = this.props;
var itemssname = objectsingle.name;
if (itemssname) {
try {
itemssname = JSON.parse(itemssname);
} catch (e) {
itemssname = objectsingle.name;
}
}
var itemsnamesy = objectsingle && objectsingle.program_attr && objectsingle.program_attr.description;
if (itemsnamesy) {
try {
itemsnamesy = JSON.parse(itemsnamesy);
} catch (e) {
itemsnamesy = objectsingle && objectsingle.program_attr && objectsingle.program_attr.description;
}
}
return (
<div key={indexxy}
className={"w100s borderwdswuh mb20 pd20 "}
onMouseEnter={() => this.props.showparagraphs(indexxy, name)} style={{
minHeight: "114px",
}}>
{url ?
<QuestionModalPicture {...this.props} {...this.state} handleClose={() => this.handleClose()}></QuestionModalPicture>
:
""
}
<style>{
`
.programquill .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
.programquill .ql-editor p{
line-height: 28px;
}
.programquills .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
.programquills .ql-editor p{
line-height: 20px;
}
`
}</style>
{/*顶部*/}
<div className="w100s sortinxdirection ">
<div className=" sortinxdirection ">
<p className="cretitlecolrlis lh28" style={{ fontWeight: "bold" }}>{indexx}</p>
</div>
<style>
{
`
.markdown-body{
color: #333333;
font-size: 14px !important;
line-height: 28px;
}
.markdown-body p {
color: #333333;
font-size: 14px !important;
line-height: 28px;
font-weight: bold;
}
.bodyysls .ql-editor p span{
font-weight: bold;
}
`
}
</style>
{
objectsingle.item_type === "PROGRAM" ?
<div className="w100s sortinxdirection">
<div className=" tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{
wordBreak: "break-word",
minWidth: "32px", fontWeight: "bold"
}}
>
({objectsingle.score})
</div>
<RenderHtml value={itemssname} className="ml10 lh28 listjihetixingstit cretitlecolrlist " />
</div>
:
<div className="w100s sortinxdirection">
<div className=" tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{
wordBreak: "break-word",
minWidth: "32px", fontWeight: "bold"
}}
>
({objectsingle.score})
</div>
<RenderHtml value={itemssname} className="ml10 lh28 listjihetixingstit cretitlecolrlist " />
</div>
}
</div>
{/*内容*/}
<div className="w100s sortinxdirection">
{
objectsingle.item_type === "JUDGMENT" ?
<p className="w100s listjihetixingstits sortinxdirection ">
{
objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => {
return (
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}>
<Radio disabled={true}>
{object.choice_text}
</Radio>
</p>
)
})
}
</p>
:
objectsingle.item_type === "PROGRAM" ?
<p className="w100s listjihetixingstitssy sortinxdirection ">
<p className={"sortinxdirection mt15"}>
{
objectsingle && objectsingle.program_attr && objectsingle.program_attr.description ?
<div className="programquill " style={{ wordBreak: "break-word" }}
>
{
itemsnamesy === null || itemsnamesy === undefined ?
null
:
<RenderHtml value={itemsnamesy} />
}
</div>
:
null}
</p>
</p>
:
<p className="w100s listjihetixingstits verticallayout ">
{
objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => {
var string = object.choice_text;
if (string) {
try {
string = JSON.parse(string);
} catch (e) {
string = object.choice_text;
}
}
return (
<p key={index} className={index === 0 ? "sortinxdirection" : "sortinxdirection mt15"}>
{tagArray[index]}
<p className="programquills" style={{ wordBreak: "break-word" }}>
{object ?
object.choice_text === undefined || object.choice_text === null || object.choice_text === "" ?
""
:
object.choice_text.length > 0 ?
<RenderHtml value={string} />
: ""
:
""
}
</p>
</p>
)
})
}
</p>
}
</div>
</div>
)
}
}
export default Paperreview_single