dev_forum
杨树林 5 years ago
parent 066561ecd4
commit 39d9a9ad03

@ -6,7 +6,7 @@
"@flatten/array": "^1.1.7",
"@icedesign/base": "^0.2.5",
"@novnc/novnc": "^1.1.0",
"antd": "^3.20.1",
"antd": "^3.6.5",
"array-flatten": "^2.1.2",
"autoprefixer": "7.1.6",
"axios": "^0.18.0",

@ -9,7 +9,7 @@ import '../css/Courses.css'
import axios from 'axios'
import moment from "../new/CoursesNew";
import Modals from "../../modals/Modals";
import Editingcomponent from "./components/Editingcomponent"
const TextArea = Input.TextArea
const RadioGroup = Radio.Group
@ -724,7 +724,7 @@ class PollNew extends Component {
}
//删除指定条目
deleteadddom = (indexo) => {
Deleteadddom = (indexo) => {
// console.log("deleteadddom 259")
var arr = this.state.adddom;
let newarr = [...arr];
@ -739,7 +739,7 @@ class PollNew extends Component {
}
//保存并继续
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
deleteadddomtwo = (indexo, object) => {
Deleteadddomtwo = (indexo, object) => {
var thiss = this;
this.setState({
q_countst: 1,
@ -1230,7 +1230,7 @@ class PollNew extends Component {
//保存,即完成新建并退出本题编辑
// indexo 第几个数组
//object 单个数组数据
deleteadddomthree = (indexo, object) => {
Deleteadddomthree = (indexo, object) => {
// console.log("deleteadddom 349")
var thiss = this;
let arr = this.state.adddom;
@ -1648,7 +1648,7 @@ class PollNew extends Component {
q_countst: 0,
})
}
this.deleteadddom(indexo);
this.Deleteadddom(indexo);
// console.log(indexo)
}
@ -1814,7 +1814,7 @@ class PollNew extends Component {
//删除编辑新增条目
//id 条目的唯一id
//i 为要删除的子条目
deleteentrys = (id, i, stirngname) => {
Deleteentrys = (id, i, stirngname) => {
// console.log(id)
// console.log(stirngname);
var arrtwoy = this.state.adddom;
@ -1851,7 +1851,7 @@ class PollNew extends Component {
// 新增选项
ewoption = (id, object) => {
Ewoption = (id, object) => {
// console.log("ewoption 440")
// console.log("是否是新建题目还是编辑")
// console.log(object.question.new)
@ -1913,7 +1913,7 @@ class PollNew extends Component {
}
//新增其他选项
addanotheroption = (id) => {
Addanotheroption = (id) => {
// console.log("addanotheroption 457")
let arrtwo = this.state.adddom;
let newarrtwo = [...arrtwo];
@ -1989,7 +1989,10 @@ class PollNew extends Component {
//e为获取组件对象
//i外层数组
//k为内层数组
handleInputChanges = (e, i, k) => {
HandleInputChanges = (e, i, k) => {
console.log("handleInputChanges"+" "+e);
console.log("handleInputChanges"+" "+i);
console.log("handleInputChanges"+" "+k);
// console.log("handleInputChanges 612")
let value = e.target.value;//取到input的数据
@ -2006,7 +2009,7 @@ class PollNew extends Component {
}
//标题输入监听
handleInputTopic = (e, i) => {
HandleInputTopic = (e, i) => {
// console.log("handleInputTopic 633")
let value = e.target.value;//取到input的数据
@ -2021,7 +2024,7 @@ class PollNew extends Component {
}
//最小值
handleGradationGroupChangee = (value, index, max, length) => {
HandleGradationGroupChangee = (value, index, max, length) => {
debugger
var minbool = false;
@ -2058,7 +2061,7 @@ class PollNew extends Component {
}
//最大值
handleGradationGroupChangeee = (value, index) => {
HandleGradationGroupChangeee = (value, index) => {
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
@ -2151,7 +2154,7 @@ class PollNew extends Component {
}
//必答选项
onCheckAllChange = (e, index) => {
OnCheckAllChange = (e, index) => {
// console.log("onCheckAllChange");
// console.log(e.target.checked);
// console.log(e.target.value);
@ -2479,8 +2482,9 @@ class PollNew extends Component {
{/*自动生成修改好的获取到的*/}
{/**************************************************************************/}
{this.state.poll_questions === undefined ? "" : this.state.poll_questions.map((item, index) => {
// console.log('打印this.state.poll_questions')
// console.log(item.question)
console.log('打印this.state.poll_questions');
console.log(this.state.poll_questions);
console.log(this.state.adddom);
let resultDom;
resultDom = <div className="problemShow bor-bottom-greyE">
<p className="clearfix font-16">
@ -2512,7 +2516,7 @@ class PollNew extends Component {
onClick={() => this.addMytopic(item.question.question_type, this.state.pollid, index + 1, true, item.question.id)}><Tooltip
title={item.question.question_type === 1 ? "插入单选题" : item.question.question_type === 2 ? "插入多选题" : "插入主观题"}><i
className="color-green font-18 iconfont icon-roundaddfill"></i></Tooltip></a>
<a onClick={() => this.adddomedit(item)}><Tooltip title="编辑"><i
<a onClick={() => this.adddomedit(item)}><Tooltip title="编辑S"><i
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a>
</span> : <span className="fr"> <a onClick={() => this.adddomedit(item)}><Tooltip title=""><i
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a> </span>
@ -2522,60 +2526,524 @@ class PollNew extends Component {
<p className="mt20"> <span className="font-16 flex1" style={{"white-space":"pre-wrap","word-break": "break-all","word-wrap": "break-word"}}>{item.question.question_title}</span></p>
{/*<pre className="mt20 mb20 font-16 break_word flex1">{item.question.question_title}</pre>*/}
{item.question.question_type === 1 ?
(<RadioGroup defaultChecked={false} disabled>
<div>
<RadioGroup defaultChecked={false} disabled>
{item.question.answers === undefined ? "" : item.question.answers.map((items, i) => {
return (
<div className="h20 pt20" style={{"clear": "both"}}>
<Radio value={i} className={"fl"} style={{"text-align": "left",marginTop:"3px"}}></Radio>
{/*<pre className={"break_word flex1 fl"}*/}
{/* style={{"text-align": "left"}}>{items.answer_text}</pre>*/}
{/*<span className={"break_word flex1"}><pre className={"break_word flex1"}>{items.answer_text}</pre> </span>*/}
<span className={" flex1 "} style={{"text-align": "left","white-space":"pre-wrap","word-break": "break-all","word-wrap": "break-word","float": "left","width":"1116px"}} >{items.answer_text}</span>
</div>
)
})}
</RadioGroup>)
</RadioGroup>
{/*单选题*/}
<div>
{this.state.adddom === undefined ? "" : item.question.question_type === 1&&this.state.adddom.map((itemo, indexo) => {
let arrid = itemo.question.id;
let resultDomtwo;
resultDomtwo =
<div>
<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>
</div>
: item.question.question_type === 2 ?
(<CheckboxGroup defaultChecked={false} disabled>
<div>
<CheckboxGroup defaultChecked={false} disabled>
{item.question.answers === undefined ? "" : item.question.answers.map((items, i) => {
return (
<div className="mt10 pt20 " style={{"clear": "both"}}>
<Checkbox value={i} className={"fl"} style={{"text-align": "left"}}></Checkbox>
<span className={" flex1"} style={{"text-align": "left","white-space":"pre-wrap","word-break": "break-all","word-wrap": "break-word","float": "left","width":"1120px"}}>{items.answer_text}</span>
</div>
)
})}
</CheckboxGroup>
{/*多选题*/}
<div>
{this.state.adddom === undefined ? "" : item.question.question_type === 2&&this.state.adddom.map((itemo, indexo) => {
let arrid = itemo.question.id;
let resultDomtwo;
resultDomtwo =
<div>
<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>
{/*<span*/}
{/* className={"break_word flex1 fl"} style={{"text-align": "left"}}><pre*/}
{/* style={{"text-align": "left"}}>{items.answer_text}</pre></span>*/}
: ""}
{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> : ""
)
})}
</CheckboxGroup>)
: item.question.question_type === 3 ? (<div></div>) : (<div></div>)}
</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>
{resultDom}
{resultDomtwo}
</div>
)
})}
{/**************************************************************************/}
{/*编辑用的新增用的*/}
{/**************************************************************************/}
</div>
</div>
{this.state.adddom === undefined ? "" : this.state.adddom.map((itemo, indexo) => {
// console.log('打印this.state.adddom')
// console.log(this.state.adddom);
: item.question.question_type === 3 ?
// 主观题
( <div>
{this.state.adddom === undefined ? "" : item.question.question_type === 3&&this.state.adddom.map((itemo, indexo) => {
let arrid = itemo.question.id;
let resultDomtwo;
resultDomtwo =
<div className="problemShow">
<div>
<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)}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
className="lineh-40"
style={{"marginLeft": "20px"}}>必答</Checkbox>
</span>
@ -2590,7 +3058,7 @@ class PollNew extends Component {
"line-height": "35px",
}}
onInput={(e) => this.handleInputTopic(e, indexo)}>{itemo.question.question_title}</TextArea>
onInput={(e) => this.HandleInputTopic(e, indexo)}>{itemo.question.question_title}</TextArea>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return (
@ -2605,9 +3073,9 @@ class PollNew extends Component {
<input
className="mr20 input-flex-40 TextAreainput" disabled
placeholder='无法编辑!将由参与答题的人手动录入'></input>
{polls_status === undefined || polls_status === 1 ?
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<a className="lineh-40"
onClick={() => this.deleteentrys(arrid, indext, true)}><Tooltip
onClick={() => this.Deleteentrys(arrid, indext, true)}><Tooltip
title="删除"
placement={"bottom"}><i
className="iconfont icon-htmal5icon19 font-20 color-grey-c"></i></Tooltip></a>
@ -2626,10 +3094,10 @@ class PollNew extends Component {
"overflow-y": "hidden",
"line-height": "35px",
}}
onInput={(e) => this.handleInputChanges(e, indexo, indext)}></TextArea>
{polls_status === undefined || polls_status === 1 ?
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
onClick={() => this.Deleteentrys(arrid, indext, false)}><Tooltip
title="删除" placement={"bottom"}><i
className="iconfont icon-htmal5icon19 font-20 color-grey-c"></i></Tooltip></a>
: ""}
@ -2642,25 +3110,25 @@ class PollNew extends Component {
{itemo.question.question_type === 1 ? (
<div>
<div style={{minWidth: "1100px"}}>
{polls_status === undefined || polls_status === 1 ?
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
onClick={() => this.ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
: ""}
{polls_status === undefined || polls_status === 1 ?
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
(newoption === false ?
(this.state.newoption === false ?
<ActionBtn style="grey" className="mr20 mt5"
onClick={() => this.addanotheroption(itemo.question.id)}>新增其他选项</ActionBtn>
onClick={() => this.Addanotheroption(itemo.question.id)}>新增其他选项</ActionBtn>
: "")
: ""}
<span className="fr mt5">
<ActionBtn style="greyBack" className="mr20 w100"
onClick={() => this.deleteadddom(indexo)}>取消</ActionBtn>
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
<ActionBtn style="blue" className="mr20 w100"
onClick={() => this.deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
<ActionBtn style="blue" className=" w100"
onClick={() => this.deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
</span>
</div>
</div>
@ -2694,7 +3162,7 @@ class PollNew extends Component {
}
</style>
<Select className="fl w100"
onChange={(value) => this.handleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
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}
>
@ -2709,7 +3177,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.handleGradationGroupChangeee(value, indexo)}
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>
@ -2738,15 +3206,15 @@ class PollNew extends Component {
<div>
{itemo.question.question_type === 2 ?
(
polls_status === undefined || polls_status === 1 ?
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>
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
{
newoption === false ? <ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.addanotheroption(itemo.question.id)}>新增其他选项</ActionBtn> : ""
this.state.newoption === false ? <ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Addanotheroption(itemo.question.id)}>新增其他选项</ActionBtn> : ""
}
</div>
@ -2754,11 +3222,11 @@ class PollNew extends Component {
<span className="fr mt5">
<ActionBtn style="greyBack" className=" mr20 w100"
onClick={() => this.deleteadddom(indexo)}>取消</ActionBtn>
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
<ActionBtn style="blue" className="mr20 w100"
onClick={() => this.deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
<ActionBtn style="blue" className=" w100"
onClick={() => this.deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
</span>
</div>
@ -2767,11 +3235,11 @@ class PollNew extends Component {
<div className="clearfix mt30" >
<span className="fr mt5">
<ActionBtn style="greyBack" className=" mr20 w100"
onClick={() => this.deleteadddom(indexo)}>取消</ActionBtn>
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
<ActionBtn style="blue" className="mr20 w100"
onClick={() => this.deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
<ActionBtn style="blue" className=" w100"
onClick={() => this.deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
</span>
</div>
)
@ -2780,11 +3248,11 @@ class PollNew extends Component {
<div className="clearfix mt30">
<span className="fr">
<ActionBtn style="greyBack" className="mr20 w100"
onClick={() => this.deleteadddom(indexo)}>取消</ActionBtn>
onClick={() => this.Deleteadddom(indexo)}>取消</ActionBtn>
<ActionBtn style="blue" className="mr20 w100"
onClick={() => this.deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存</ActionBtn>
<ActionBtn style="blue" className=" w100"
onClick={() => this.deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
onClick={() => this.Deleteadddomtwo(indexo, itemo)}>保存并继续</ActionBtn>
</span>
</div>
:
@ -2801,8 +3269,18 @@ class PollNew extends Component {
</div>
)
})}
{/**************************************************************************/}
</div>) : (<div></div>)}
</div>
return (
<div>
{resultDom}
</div>
)
})}
<div className="myyslwidth">
{polls_status === undefined || polls_status === 1 ?
<div>
{
@ -2820,7 +3298,6 @@ class PollNew extends Component {
className="iconfont icon-tianjiafangda font-15 mr10"></i></ActionBtn>
</div>
</div>
: ""
:
<div>
@ -2838,6 +3315,7 @@ class PollNew extends Component {
</div>
: <div></div>}
</div>
</div>
{
this.props.match.params.news === "new" ?
(this.state.Newedit === false ?

@ -0,0 +1,332 @@
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);

@ -340,3 +340,6 @@ textarea:read-only{
line-height: 40px;
text-align: center;
}
.myyslwidth {
min-width:1200px
}
Loading…
Cancel
Save