|
|
|
@ -1,332 +0,0 @@
|
|
|
|
|
import React, {Component} from "react";
|
|
|
|
|
import '../pollStyle.css'
|
|
|
|
|
import {Input, Tooltip, Checkbox, Radio, Select} from 'antd'
|
|
|
|
|
import {WordsBtn, ActionBtn} from 'educoder'
|
|
|
|
|
const TextArea = Input.TextArea
|
|
|
|
|
const RadioGroup = Radio.Group
|
|
|
|
|
const CheckboxGroup = Checkbox.Group
|
|
|
|
|
class Editingcomponent extends Component {
|
|
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
adddom:this.props.adddom,
|
|
|
|
|
Newedit:this.props.Newedit,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
|
|
const { adddom } = this.state
|
|
|
|
|
const newdata = nextProps.adddom.toString()
|
|
|
|
|
if (adddom.toString() !== newdata) {
|
|
|
|
|
this.setState({
|
|
|
|
|
adddom: nextProps.adddom,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// componentWillReceiveProps(nextProps) {
|
|
|
|
|
// // console.log("46");
|
|
|
|
|
// // console.log(nextProps);
|
|
|
|
|
// // console.log(this.props);
|
|
|
|
|
// if (nextProps.adddom != this.props.adddom) {
|
|
|
|
|
// // console.log("50");
|
|
|
|
|
// // console.log(nextProps.user);
|
|
|
|
|
// if (nextProps.adddom !== undefined) {
|
|
|
|
|
// // console.log("53");
|
|
|
|
|
// // console.log(nextProps.user);
|
|
|
|
|
// this.setState({
|
|
|
|
|
// adddom: nextProps.adddom,
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
OnCheckAllChange =(e, indexo)=>{
|
|
|
|
|
this.props.OnCheckAllChange(e, indexo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HandleInputTopic = (e, indexo)=>{
|
|
|
|
|
this.props.HandleInputTopic(e, indexo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Deleteentrys=(id, i, stirngname)=>{
|
|
|
|
|
this.props.Deleteentrys(id, i, stirngname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HandleInputChanges=(e, i, k)=>{
|
|
|
|
|
console.log("handleInputChanges"+" "+e);
|
|
|
|
|
console.log("handleInputChanges"+" "+i);
|
|
|
|
|
console.log("handleInputChanges"+" "+k);
|
|
|
|
|
|
|
|
|
|
this.props.HandleInputChanges(e, i, k);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ewoption = (id, object) => {
|
|
|
|
|
this.props.Ewoption(id, object)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Addanotheroption = (id) => {
|
|
|
|
|
this.props.Addanotheroption(id);
|
|
|
|
|
}
|
|
|
|
|
Deleteadddom = (indexo) => {
|
|
|
|
|
this.props.Deleteadddom(indexo);
|
|
|
|
|
}
|
|
|
|
|
Deleteadddomthree= (indexo, object)=>{
|
|
|
|
|
this.props.Deleteadddomthree(indexo, object);
|
|
|
|
|
}
|
|
|
|
|
Deleteadddomtwo =(indexo, object)=>{
|
|
|
|
|
this.props.Deleteadddomtwo(indexo, object);
|
|
|
|
|
}
|
|
|
|
|
HandleGradationGroupChangee = (value, index, max, length) => {
|
|
|
|
|
this.props.HandleGradationGroupChangee(value, index, max, length);
|
|
|
|
|
}
|
|
|
|
|
HandleGradationGroupChangeee= (value, index) => {
|
|
|
|
|
this.props.HandleGradationGroupChangeee(value, index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div className="myyslwidth">
|
|
|
|
|
{this.state.adddom === undefined ? "" : this.state.adddom.map((itemo, indexo) => {
|
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
|
let resultDomtwo;
|
|
|
|
|
resultDomtwo =
|
|
|
|
|
<div className="problemShow">
|
|
|
|
|
<span
|
|
|
|
|
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
|
|
|
|
|
<Checkbox value={itemo.question.is_necessary}
|
|
|
|
|
checked={itemo.question.is_necessary === 1 ? true : false}
|
|
|
|
|
onChange={(e) => this.OnCheckAllChange(e, indexo)}
|
|
|
|
|
className="lineh-40"
|
|
|
|
|
style={{"marginLeft": "20px"}}>必答</Checkbox>
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<TextArea placeholder="请输入题目" className="mb20 TextAreas"
|
|
|
|
|
autosize={{minRows: 1, maxRows: 5}}
|
|
|
|
|
id="textArea"
|
|
|
|
|
style={{
|
|
|
|
|
"height": "45px",
|
|
|
|
|
"max-height": "9.0072e+15px",
|
|
|
|
|
"overflow-y": "hidden",
|
|
|
|
|
"line-height": "35px",
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
onInput={(e) => this.HandleInputTopic(e, indexo)}>{itemo.question.question_title}</TextArea>
|
|
|
|
|
|
|
|
|
|
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
{itemt.answer_text === undefined ? (
|
|
|
|
|
<div></div>) : itemt.answer_text === "其他" ? (
|
|
|
|
|
<p className="df mb20">
|
|
|
|
|
<span
|
|
|
|
|
className="color-grey-6 mr10 w60 font-16 lineh-40"
|
|
|
|
|
style={{"text-align": "center"}}>其它</span>
|
|
|
|
|
|
|
|
|
|
<input
|
|
|
|
|
className="mr20 input-flex-40 TextAreainput" disabled
|
|
|
|
|
placeholder='无法编辑!将由参与答题的人手动录入'></input>
|
|
|
|
|
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
|
|
|
|
|
<a className="lineh-40"
|
|
|
|
|
onClick={() => this.Deleteentrys(arrid, indext, true)}><Tooltip
|
|
|
|
|
title="删除"
|
|
|
|
|
placement={"bottom"}><i
|
|
|
|
|
className="iconfont icon-htmal5icon19 font-20 color-grey-c"></i></Tooltip></a>
|
|
|
|
|
: ""}
|
|
|
|
|
</p>) : (<p className="df mb20">
|
|
|
|
|
<span className="color-grey-6 mr10 w60 font-16 lineh-40"
|
|
|
|
|
style={{"text-align": "center"}}>选项</span>
|
|
|
|
|
|
|
|
|
|
<TextArea
|
|
|
|
|
autosize={{minRows: 1, maxRows: 5}}
|
|
|
|
|
className="mr20 TextAreas"
|
|
|
|
|
value={itemt.answer_text}
|
|
|
|
|
style={{
|
|
|
|
|
"height": "45px",
|
|
|
|
|
"max-height": "9.0072e+15px",
|
|
|
|
|
"overflow-y": "hidden",
|
|
|
|
|
"line-height": "35px",
|
|
|
|
|
}}
|
|
|
|
|
onInput={(e) => this.HandleInputChanges(e, indexo, indext)}></TextArea>
|
|
|
|
|
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
|
|
|
|
|
<a className="lineh-40"
|
|
|
|
|
onClick={() => this.Deleteentrys(arrid, indext, false)}><Tooltip
|
|
|
|
|
title="删除" placement={"bottom"}><i
|
|
|
|
|
className="iconfont icon-htmal5icon19 font-20 color-grey-c"></i></Tooltip></a>
|
|
|
|
|
: ""}
|
|
|
|
|
</p>)}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
|
|
<div className="df">
|
|
|
|
|
{itemo.question.question_type === 1 ? (
|
|
|
|
|
<div>
|
|
|
|
|
<div style={{minWidth: "1100px"}}>
|
|
|
|
|
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
|
|
|
|
|
<ActionBtn style="grey" className="mr20 mt5"
|
|
|
|
|
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
|
|
|
|
|
|
|
|
|
|
: ""}
|
|
|
|
|
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
|
|
|
|
|
|
|
|
|
|
(this.state.newoption === false ?
|
|
|
|
|
<ActionBtn style="grey" className="mr20 mt5"
|
|
|
|
|
onClick={() => this.Addanotheroption(itemo.question.id)}>新增其他选项</ActionBtn>
|
|
|
|
|
: "")
|
|
|
|
|
: ""}
|
|
|
|
|
<span className="fr mt5">
|
|
|
|
|
<ActionBtn style="greyBack" className="mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className="mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className=" w100"
|
|
|
|
|
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: itemo.question.question_type === 2 ? (
|
|
|
|
|
//////////////////////////////////////////// 可选
|
|
|
|
|
<div>
|
|
|
|
|
<div style={{minWidth: "1100px"}}>
|
|
|
|
|
<div>
|
|
|
|
|
<span
|
|
|
|
|
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
|
|
|
|
|
<div className="mr40 flex1 ">
|
|
|
|
|
{/*可选最小*/}
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
.ant-select-selection .ant-select-selection-selected .ant-select-selection__rendered .ant-select-selection-selected-value{
|
|
|
|
|
"width":"100%";
|
|
|
|
|
"height": "80%";
|
|
|
|
|
"margin-top": "5px";
|
|
|
|
|
"margin-left": "5px";
|
|
|
|
|
"text-align": "center";
|
|
|
|
|
"display": "block";
|
|
|
|
|
"opacity": "1";
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<Select className="fl w100"
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
|
|
|
|
|
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices}
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
<Option value={String("0")}>--</Option>
|
|
|
|
|
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
|
|
|
|
|
return (
|
|
|
|
|
indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : ""
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
</Select>
|
|
|
|
|
<span
|
|
|
|
|
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
|
|
|
|
|
{/*可选最大*/}
|
|
|
|
|
<Select className="fl w100"
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo)}
|
|
|
|
|
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
|
|
|
|
|
>
|
|
|
|
|
<Option value={String("0")}>--</Option>
|
|
|
|
|
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
|
|
|
|
|
return (
|
|
|
|
|
indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : ""
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
</Select>
|
|
|
|
|
<span
|
|
|
|
|
className="ml10 mr20 color-grey-6 lineh-40 fl font-16">项</span>
|
|
|
|
|
<span
|
|
|
|
|
className="color-grey-9 fl lineh-40">(学生答题时,系统对其选择的选项个数进行限制,--表示不限制)</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
: (<div style={{minWidth: "1100px"}}></div>)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
{itemo.question.question_type === 2 ?
|
|
|
|
|
(
|
|
|
|
|
this.state.polls_status === undefined || this.state.polls_status === 1 ?
|
|
|
|
|
<div className="clearfix mt30" >
|
|
|
|
|
|
|
|
|
|
<div><ActionBtn style="grey" className="mr20 fl mt5"
|
|
|
|
|
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
this.state.newoption === false ? <ActionBtn style="grey" className="mr20 fl mt5"
|
|
|
|
|
onClick={() => this.Addanotheroption(itemo.question.id)}>新增其他选项</ActionBtn> : ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span className="fr mt5">
|
|
|
|
|
<ActionBtn style="greyBack" className=" mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className="mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className=" w100"
|
|
|
|
|
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:
|
|
|
|
|
<div className="clearfix mt30" >
|
|
|
|
|
<span className="fr mt5">
|
|
|
|
|
<ActionBtn style="greyBack" className=" mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className="mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className=" w100"
|
|
|
|
|
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
: itemo.question.question_type === 3 ?
|
|
|
|
|
<div className="clearfix mt30">
|
|
|
|
|
<span className="fr">
|
|
|
|
|
<ActionBtn style="greyBack" className="mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className="mr20 w100"
|
|
|
|
|
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
|
|
|
|
|
<ActionBtn style="blue" className=" w100"
|
|
|
|
|
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
:
|
|
|
|
|
""}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
{resultDomtwo}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
export default (Editingcomponent);
|