forked from Gitlink/forgeplus-react
207 lines
5.2 KiB
JavaScript
207 lines
5.2 KiB
JavaScript
import React, { Component } from "react";
|
||
import { SnackbarHOC, queryString } from 'educoder';
|
||
import axios from 'axios';
|
||
import { Breadcrumb } from "antd";
|
||
import { TPMIndexHOC } from "../tpm/TPMIndexHOC";
|
||
import './testioncss/testioncss.css';
|
||
import '../tpm/newshixuns/css/Newshixuns.css';
|
||
import Bottomsubmit from "../../modules/modals/Bottomsubmit";
|
||
import Seeoagertit from "./component/Seeoagertit";
|
||
import Paperlibraryseeid_item from './component/Paperlibraryseeid_item';
|
||
import QuestionModal from "../question/component/QuestionModal";
|
||
import SendTopicsModel from "./component/SendTopicsModel";
|
||
//人工组卷预览
|
||
class Paperlibraryseeid extends Component {
|
||
constructor(props) {
|
||
super(props);
|
||
this.contentMdRef = React.createRef();
|
||
this.state = {
|
||
paperlibrartdata: [],
|
||
defaultActiveKey: "0",
|
||
modalsType: false,
|
||
titilesm: "",
|
||
titiless: "",
|
||
boolok: "知道了",
|
||
exercise_id: 0,
|
||
SendTop: false,
|
||
paramsid: null,
|
||
}
|
||
|
||
|
||
}
|
||
|
||
//初始化
|
||
componentDidMount() {
|
||
this.getdata();
|
||
const query = this.props.location.search;
|
||
const parsed = queryString.parse(query);
|
||
if (JSON.stringify(parsed) === "{}") {
|
||
this.setState({
|
||
defaultActiveKey: "0",
|
||
})
|
||
} else {
|
||
if (parsed.defaultActiveKey === "0") {
|
||
this.setState({
|
||
defaultActiveKey: "0",
|
||
})
|
||
} else {
|
||
this.setState({
|
||
defaultActiveKey: "1",
|
||
})
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
getdata = () => {
|
||
let urls = `/examination_banks/${this.props.match.params.id}.json`;
|
||
axios.get(urls).then((response) => {
|
||
if (response) {
|
||
this.setState({
|
||
paperlibrartdata: response.data,
|
||
})
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
|
||
//跳转道描点的地方
|
||
scrollToAnchor = (anchorName) => {
|
||
try {
|
||
if (anchorName) {
|
||
// 找到锚点
|
||
let anchorElement = document.getElementById(anchorName);
|
||
// 如果对应id的锚点存在,就跳转到锚点
|
||
if (anchorElement) {
|
||
anchorElement.scrollIntoView();
|
||
}
|
||
}
|
||
} catch (e) {
|
||
|
||
}
|
||
|
||
}
|
||
preservation = () => {
|
||
//保存试卷
|
||
this.submitInfos(true);
|
||
}
|
||
|
||
|
||
getcontentMdRef = (Ref) => {
|
||
this.contentMdRef = Ref;
|
||
}
|
||
|
||
modalCancel = () => {
|
||
this.setState({
|
||
modalsType: false,
|
||
})
|
||
|
||
}
|
||
|
||
setDownload = () => {
|
||
this.setState({
|
||
modalsType: false,
|
||
})
|
||
|
||
}
|
||
submitInfos = (bool) => {
|
||
this.setState({
|
||
SendTop: bool,
|
||
paramsid: this.props.match.params.id
|
||
})
|
||
}
|
||
|
||
render() {
|
||
let { paperlibrartdata, defaultActiveKey, modalsType, SendTop, paramsid } = this.state;
|
||
let urlsysl = `/paperlibrary?defaultActiveKey=${defaultActiveKey}`;
|
||
return (
|
||
<div>
|
||
{SendTop === true ?
|
||
<SendTopicsModel paramsid={paramsid} visible={SendTop} mypaper={true} {...this.state} {...this.props} submitInfos={(b) => this.submitInfos(b)}></SendTopicsModel> : ""
|
||
}
|
||
{
|
||
modalsType === true ?
|
||
<QuestionModal {...this.props}{...this.state} modalsType={modalsType} modalCancel={() => this.modalCancel()}
|
||
setDownload={() => this.setDownload()}></QuestionModal>
|
||
: ""
|
||
}
|
||
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "
|
||
>
|
||
|
||
<div className="w1200ms">
|
||
<div className="w100s mt30">
|
||
<Breadcrumb separator=">">
|
||
<Breadcrumb.Item className={"shubiao"} >试卷库</Breadcrumb.Item>
|
||
<Breadcrumb.Item href={urlsysl}>{defaultActiveKey === "1" ? "公开试卷库" : "我的试卷库"}</Breadcrumb.Item>
|
||
<Breadcrumb.Item className={"shubiao"}>试卷查看</Breadcrumb.Item>
|
||
</Breadcrumb>
|
||
</div>
|
||
|
||
<div className="seesjtit intermediatecenter mt16">
|
||
{paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.name}
|
||
</div>
|
||
|
||
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200wuh mt19">
|
||
|
||
<Seeoagertit all_score={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_questions_count}
|
||
all_questions_count={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_score}
|
||
>
|
||
|
||
|
||
</Seeoagertit>
|
||
|
||
<Paperlibraryseeid_item
|
||
{...this.state}
|
||
{...this.props}
|
||
getdata={() => this.getdata()}
|
||
single_questions={paperlibrartdata && paperlibrartdata.single_questions && paperlibrartdata.single_questions.questions.length > 0 ? paperlibrartdata.single_questions : null}
|
||
multiple_questions={paperlibrartdata && paperlibrartdata.multiple_questions
|
||
&& paperlibrartdata.multiple_questions.questions.length > 0 ? paperlibrartdata.multiple_questions : null
|
||
}
|
||
judgement_questions={paperlibrartdata && paperlibrartdata.judgement_questions
|
||
&& paperlibrartdata.judgement_questions.questions.length > 0 ? paperlibrartdata.judgement_questions : null
|
||
}
|
||
program_questions={paperlibrartdata && paperlibrartdata.program_questions
|
||
&& paperlibrartdata.program_questions.questions.length > 0 ? paperlibrartdata.program_questions : null
|
||
}
|
||
>
|
||
|
||
|
||
</Paperlibraryseeid_item>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<Bottomsubmit {...this.props} {...this.state} bottomvalue={"发送至课堂"}
|
||
setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)}
|
||
onSubmits={() => this.preservation()} url={urlsysl}></Bottomsubmit>
|
||
</div>
|
||
)
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
export default SnackbarHOC()(TPMIndexHOC(Paperlibraryseeid));
|
||
|
||
|