第{index + 1}题:
return (
-
+
{/*这里是编辑和新增的地方*/}
{
this.state.bindingid && this.state.bindingid===item.question.id?
@@ -2798,6 +2801,7 @@ class PollNewQuestbank extends Component {
resultDomtwo =
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
) : itemt.answer_text === "其他" ? (
其它
+
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- this.Deleteentrys(arrid, indext, true)}>
- : ""}
+ itemo.question.question_type === 1?(
+ indext>1?
+
+ {
+ itemo.question.question_type === 2 ?"":
+ this.Deleteentrys(arrid, indext, true)}>
+ }
+
+
+
+ :"")
+ : "":""}
+
) : (
- 选项
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- this.Deleteentrys(arrid, indext, false)}>
+ indext>1?
+
+ this.Deleteentrys(arrid, indext, false)}>
+ {
+ itemo.question.answers[itemo.question.answers.length-1].answer_text === "其他"&&itemo.question.answers.length-2===indext?
+
+ this.Ewoption(itemo.question.id, itemo)}>
+ : itemo.question.answers.length-1===indext?
+ this.Ewoption(itemo.question.id, itemo)}>
+ :
+ }
+
+ :indext===1&&itemo.question.answers.length===2||indext===1&&itemo.question.answers.length===3? this.Ewoption(itemo.question.id, itemo)}>:""
: ""}
)}
@@ -2867,26 +2909,26 @@ class PollNewQuestbank extends Component {
{itemo.question.question_type === 1 ? (
-
+ {/*
this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
+
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
-
this.Ewoption(itemo.question.id, itemo)}>新增选项
-
+ ""
: ""}
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
(this.state.newoption === false ?
-
this.Addanotheroption(itemo.question.id)}>新增其他选项
+
this.Addanotheroption(itemo.question.id)}>添加[其它]选项
: "")
: ""}
- this.Deleteadddom(indexo,true)}>取消
this.Deleteadddomthree(indexo, itemo,true)}>保存
+ onClick={() => this.Deleteadddomtwo(indexo, itemo,true)} >保存并继续
this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ onClick={() => this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
@@ -2897,8 +2939,8 @@ class PollNewQuestbank extends Component {
: itemo.question.question_type === 2 ? (
//////////////////////////////////////////// 可选
-
-
+
+
可选
@@ -2950,6 +2992,14 @@ class PollNewQuestbank extends Component {
className="ml10 mr20 color-grey-6 lineh-40 fl font-16">项
(学生答题时,系统对其选择的选项个数进行限制,--表示不限制)
+
+ this.Deleteadddom(indexo,true)}>取消
+ this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+
@@ -2957,60 +3007,60 @@ class PollNewQuestbank extends Component {
)
- : (
)
+ : (
)
}
{itemo.question.question_type === 2 ?
- (
- this.state.polls_status === undefined || this.state.polls_status === 1 ?
-
-
-
this.Ewoption(itemo.question.id, itemo)}>新增选项
-
- {
- this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
- }
-
-
-
-
-
- this.Deleteadddom(indexo,true)}>取消
- this.Deleteadddomthree(indexo, itemo,true)}>保存
- this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
-
-
-
-
- :
-
-
- this.Deleteadddom(indexo,true)}>取消
- this.Deleteadddomthree(indexo, itemo,true)}>保存
- this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
-
-
- )
-
+ // (
+ // this.state.polls_status === undefined || this.state.polls_status === 1 ?
+ //
+ //
+ // {/*
this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
+ //
+ // {/* {*/}
+ // {/* this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""*/}
+ // {/* }*/}
+ //
+ // {/*
*/}
+ //
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+ //
+ //
+ //
+ //
+ // :
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
+ //
+ //
+ // )
+""
: itemo.question.question_type === 3 ?
- this.Deleteadddom(indexo,true)}>取消
this.Deleteadddomthree(indexo, itemo,true)}>保存
+ onClick={() => this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ onClick={() => this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
:
@@ -3041,6 +3091,7 @@ class PollNewQuestbank extends Component {
resultDomtwo =
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
this.HandleInputTopic(e, indexo)}>{itemo.question.question_title}
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
+ console.log("chishiyong1");
+ console.log( itemo.question.answers[itemo.question.answers.length - 1]);
return (
{itemt.answer_text === undefined ? (
) : itemt.answer_text === "其他" ? (
其它
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- this.Deleteentrys(arrid, indext, true)}>
+ indext>1?
+
+ {
+ itemo.question.question_type === 2?"":
+ this.Deleteentrys(arrid, indext, true)}>
+ }
+
+ {/* {*/}
+ {/* itemo.question.answers.length-1=== indext?*/}
+ {/* this.Ewoption(itemo.question.id, itemo)}>*/}
+ {/*: */}
+ {/* }*/}
+
+ :""
: ""}
) : (
- 选项
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- this.Deleteentrys(arrid, indext, false)}>
+ indext>1?
+
+ this.Deleteentrys(arrid, indext, false)}>
+ {
+ itemo.question.answers[itemo.question.answers.length - 1].answer_text==="其他"&&itemo.question.answers.length - 2 === indext ?
+ this.Ewoption(itemo.question.id, itemo)}>
+ : itemo.question.answers.length - 1 === indext ?
+ this.Ewoption(itemo.question.id, itemo)}>
+ :
+
+ }
+
+ :indext===1&&itemo.question.answers.length===2||indext===1&&itemo.question.answers.length===3? this.Ewoption(itemo.question.id, itemo)}>:""
: ""}
)}
@@ -3110,26 +3206,26 @@ class PollNewQuestbank extends Component {
{itemo.question.question_type === 1 ? (
-
+ {/*
this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
+
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
-
this.Ewoption(itemo.question.id, itemo)}>新增选项
-
+ ""
: ""}
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
(this.state.newoption === false ?
-
this.Addanotheroption(itemo.question.id)}>新增其他选项
+
this.Addanotheroption(itemo.question.id)}>添加[其它]选项
: "")
: ""}
- this.Deleteadddom(indexo,true)}>取消
this.Deleteadddomthree(indexo, itemo,true)}>保存
+ onClick={() => this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ onClick={() => this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
@@ -3141,7 +3237,7 @@ class PollNewQuestbank extends Component {
: itemo.question.question_type === 2 ? (
//////////////////////////////////////////// 可选
-
+
可选
@@ -3193,6 +3289,15 @@ class PollNewQuestbank extends Component {
className="ml10 mr20 color-grey-6 lineh-40 fl font-16">项
(学生答题时,系统对其选择的选项个数进行限制,--表示不限制)
+
+ this.Deleteadddom(indexo,true)}>取消
+ this.Deleteadddomtwo(indexo, itemo,true)}
+ >保存并继续
+ this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+
@@ -3200,60 +3305,64 @@ class PollNewQuestbank extends Component {
)
- : (
)
+ : (
)
}
{itemo.question.question_type === 2 ?
- (
- this.state.polls_status === undefined || this.state.polls_status === 1 ?
-
-
-
this.Ewoption(itemo.question.id, itemo)}>新增选项
-
- {
- this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
- }
-
-
-
-
-
- this.Deleteadddom(indexo,true)}>取消
- this.Deleteadddomthree(indexo, itemo,true)}>保存
- this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
-
-
-
-
- :
-
-
- this.Deleteadddom(indexo,true)}>取消
- this.Deleteadddomthree(indexo, itemo,true)}>保存
- this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
-
-
- )
+ // (
+ // this.state.polls_status === undefined || this.state.polls_status === 1 ?
+ //
+ //
+ //
this.Ewoption(itemo.question.id, itemo)}>新增选项
+ //
+ // {
+ // this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
+ // }
+ //
+ //
+ //
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}
+ // >保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+ //
+ //
+ //
+ //
+ // :
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}
+ // >保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
+ //
+ //
+ // )
+ ""
: itemo.question.question_type === 3 ?
- this.Deleteadddom(indexo,true)}>取消
this.Deleteadddomthree(indexo, itemo,true)}>保存
+ onClick={() => this.Deleteadddomtwo(indexo, itemo,true)}
+ >保存并继续
this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ onClick={() => this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
:
@@ -3293,6 +3402,7 @@ class PollNewQuestbank extends Component {
resultDomtwo =
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
this.HandleInputTopic(e, indexo)}>{itemo.question.question_title}
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
+ console.log("ceshiyong2");
+ console.log(itemo.question.answers.length-1);
return (
{itemt.answer_text === undefined ? (
) : itemt.answer_text === "其他" ? (
其它
{polls_status === undefined || polls_status === 1 ?
- this.Deleteentrys(arrid, indext, true)}>
+ indext>1?
+
+ {
+ itemo.question.question_type === 2?""
+ :
+ this.Deleteentrys(arrid, indext, true)}>
+ }
+
+
+
+
+ :""
: ""}
) : (
- 选项
{polls_status === undefined || polls_status === 1 ?
- this.Deleteentrys(arrid, indext, false)}>
+ (indext>1?
+
+ this.Deleteentrys(arrid, indext, false)}>
+ {
+ itemo.question.answers[itemo.question.answers.length-1].answer_text==="其他"&&itemo.question.answers.length-2===indext?
+ this.Ewoption(itemo.question.id, itemo)}>
+ :
+ itemo.question.answers.length - 1 === indext ?
+ this.Ewoption(itemo.question.id, itemo)}>
+ :
+
+
+ }
+
+ :indext===1&&itemo.question.answers.length===2||indext===1&&itemo.question.answers.length===3? this.Ewoption(itemo.question.id, itemo)}>:"")
: ""}
)}
@@ -3362,26 +3513,27 @@ class PollNewQuestbank extends Component {
{itemo.question.question_type === 1 ? (
-
+ {/*
this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
+
{polls_status === undefined || polls_status === 1 ?
-
this.Ewoption(itemo.question.id, itemo)}>新增选项
-
+ ""
: ""}
{polls_status === undefined || polls_status === 1 ?
(newoption === false ?
-
this.Addanotheroption(itemo.question.id)}>新增其他选项
+
this.Addanotheroption(itemo.question.id)}>添加[其它]选项
: "")
: ""}
- this.Deleteadddom(indexo)}>取消
this.Deleteadddomthree(indexo, itemo)}>保存
+ onClick={() => this.Deleteadddomtwo(indexo, itemo)}
+ > 保存并继续
this.Deleteadddomtwo(indexo, itemo)}>保存并继续
+ onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存并退出
@@ -3393,7 +3545,7 @@ class PollNewQuestbank extends Component {
: itemo.question.question_type === 2 ? (
//////////////////////////////////////////// 可选
-
+
可选
@@ -3445,6 +3597,15 @@ class PollNewQuestbank extends Component {
className="ml10 mr20 color-grey-6 lineh-40 fl font-16">项
(学生答题时,系统对其选择的选项个数进行限制,--表示不限制)
+
+ this.Deleteadddom(indexo)}>取消
+ this.Deleteadddomtwo(indexo, itemo)}
+ >保存并继续
+ this.Deleteadddomthree(indexo, itemo)}> 保存并退出
+
@@ -3452,60 +3613,63 @@ class PollNewQuestbank extends Component {
)
- : (
)
+ : (
)
}
{itemo.question.question_type === 2 ?
- (
- polls_status === undefined || polls_status === 1 ?
-
-
-
this.Ewoption(itemo.question.id, itemo)}>新增选项
-
- {
- newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
- }
-
-
-
-
-
- this.Deleteadddom(indexo)}>取消
- this.Deleteadddomthree(indexo, itemo)}>保存
- this.Deleteadddomtwo(indexo, itemo)}>保存并继续
-
-
-
-
- :
-
-
- this.Deleteadddom(indexo)}>取消
- this.Deleteadddomthree(indexo, itemo)}>保存
- this.Deleteadddomtwo(indexo, itemo)}>保存并继续
-
-
- )
-
+ // (
+ // polls_status === undefined || polls_status === 1 ?
+ //
+ //
+ //
this.Ewoption(itemo.question.id, itemo)}>新增选项
+ //
+ // {
+ // newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
+ // }
+ //
+ //
+ //
+ //
+ //
+ // this.Deleteadddom(indexo)}>取消
+ // this.Deleteadddomtwo(indexo, itemo)}
+ // >保存并继续
+ // this.Deleteadddomthree(indexo, itemo)}> 保存并退出
+ //
+ //
+ //
+ //
+ // :
+ //
+ //
+ // this.Deleteadddom(indexo)}>取消
+ // this.Deleteadddomtwo(indexo, itemo)}
+ // > 保存并继续
+ // this.Deleteadddomthree(indexo, itemo)}>保存并退出
+ //
+ //
+ // )
+ ""
: itemo.question.question_type === 3 ?
- this.Deleteadddom(indexo)}>取消
this.Deleteadddomthree(indexo, itemo)}>保存
+ onClick={() => this.Deleteadddomtwo(indexo, itemo)}
+ >保存并继续
this.Deleteadddomtwo(indexo, itemo)}>保存并继续
+ onClick={() => this.Deleteadddomthree(indexo, itemo)}>保存并退出
:
diff --git a/public/react/src/modules/courses/poll/pollStyle.css b/public/react/src/modules/courses/poll/pollStyle.css
index 023229f92..19f1b35cd 100644
--- a/public/react/src/modules/courses/poll/pollStyle.css
+++ b/public/react/src/modules/courses/poll/pollStyle.css
@@ -17,7 +17,22 @@
min-height: 40px;
min-line-height: 40px;
}
-
+.ml61{
+ margin-left: 61px;
+}
+.w64{
+ width: 64px;
+}
+.w55{
+ width: 55px!important;
+}
+.max1010{
+ width: 1010px !important;
+ max-width: 1010px !important;
+}
+.yw18{
+ min-width: 18px;
+}
/* 选答 */
.chooseAnswer{
display: inline-block;
diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css
index 1cceab275..05a7bdba5 100644
--- a/public/stylesheets/educoder/edu-main.css
+++ b/public/stylesheets/educoder/edu-main.css
@@ -103,6 +103,9 @@ a.decoration{text-decoration: underline}
.mb0{margin-bottom: 0px!important;}.mb3{ margin-bottom: 3px;}.mb5{ margin-bottom: 5px;}.mb7{ margin-bottom: 7px;}.mb10{ margin-bottom: 10px;}.mb11{ margin-bottom: 11px;}.mb14{ margin-bottom: 14px;}.mb15{ margin-bottom: 15px;}.mb16{ margin-bottom: 16px;}.mb20{ margin-bottom: 20px!important;}.mb25{ margin-bottom: 25px;}.mb26{ margin-bottom: 26px;}.mb28{ margin-bottom: 28px;}.mb30{ margin-bottom: 30px!important;}.mb40{ margin-bottom: 40px!important;}.mb50{ margin-bottom: 50px!important;}.mb60{ margin-bottom: 60px!important;}.mb70{ margin-bottom: 70px!important;}.mb80{ margin-bottom: 80px!important;}.mb90{ margin-bottom: 90px!important;}.mb100{ margin-bottom: 100px!important;}.mb110{ margin-bottom: 110px;}
.ml-3{ margin-left: -3px;}.ml1{margin-left: 1px;}.ml2{margin-left: 2px;}.ml3{margin-left: 3px;}.ml4{margin-left: 4px;}.ml5{ margin-left: 5px;}.ml6{ margin-left: 6px;}.ml10{ margin-left: 10px;}.ml12{ margin-left:12px!important;}.ml13{ margin-left:13px!important;}.ml15{ margin-left: 15px;}.ml18{ margin-left: 18px;}.ml20{ margin-left: 20px;}.ml22{ margin-left: 22px;}.ml25{ margin-left: 25px;}.ml29{margin-left: 29px;}.ml30{ margin-left: 30px;}.ml33{ margin-left: 33px;}.ml35{ margin-left:35px;}.ml40{margin-left:40px;}.ml42{margin-left:42px;}.ml45{ margin-left: 45px;}.ml50{ margin-left: 50px;}.ml55{ margin-left: 55px;}.ml60{ margin-left: 60px;}.ml72{ margin-left: 72px;}.ml73{ margin-left: 73px;}.ml75{ margin-left: 75px;}.ml80{ margin-left: 80px;}.ml85{margin-left:85px;}.ml95{ margin-left: 95px;}.ml115{margin-left: 115px}.ml123{ margin-left: 123px;}.ml150{ margin-left: 150px;}.ml180{ margin-left: 180px;}.ml230{ margin-left: 230px;}.ml240{margin-left: 240px;}.ml250{ margin-left: 250px;}.ml290{ margin-left: 290px;}
.mr3{margin-right: 3px}.mr4{margin-right: 4px}.mr5{ margin-right: 5px;}.mr8{ margin-right: 8px;}.mr10{ margin-right: 10px;}.mr12{ margin-right:12px!important;}.mr15{ margin-right: 15px;}.mr18{ margin-right: 18px;}.mr20{ margin-right: 20px;}.mr24{ margin-right: 24px;}.mr25{ margin-right: 25px;}.mr30{ margin-right:30px;}.mr35{margin-right:35px;}.mr40{margin-right:40px;}.mr45{margin-right:45px;}.mr50{ margin-right: 50px;}.mr60{ margin-right:60px;}.mr70{ margin-right: 70px;}.mr75{ margin-right: 75px;}.mr80{ margin-right:80px;}.mr90{ margin-right:90px;}.mr100{ margin-right: 100px;}.mr110{ margin-right:110px;}.mr350{ margin-right:350px;}
+.ml61{
+ margin-left: 61px;
+}
.pt1{ padding-top:1px;}.pt3{ padding-top:3px!important;}.pt5{ padding-top:5px!important;}.pt10{ padding-top:10px;}.pt15{ padding-top:15px;}.pt17{ padding-top:17px;}.pt20{ padding-top:20px!important;}.pt25{ padding-top:25px;}.pt30{ padding-top:30px;}.pt35{ padding-top:35px;}.pt37{ padding-top:37px;}.pt40{ padding-top:40px;}.pt47{ padding-top:47px;}.pt49{ padding-top:49px;}.pt50{ padding-top:50px;}.pt60{ padding-top:60px;}.pt70{ padding-top:70px;}.pt80{ padding-top:80px;}.pt90{ padding-top:90px;}.pt100{padding-top:100px;}.pt110{ padding-top:110px;}.pt120{ padding-top:120px;}.pt130{padding-top:130px;}
.pb3{ padding-bottom:3px!important;}.pb5{ padding-bottom:5px!important;}.pb10{ padding-bottom:10px;}.pb15{ padding-bottom:15px;}.pb20{ padding-bottom:20px;}.pb25{ padding-bottom:20px;}.pb25{ padding-bottom:20px;}.pb30{ padding-bottom:30px;}.pb35{ padding-bottom:35px;}.pb40{ padding-bottom:40px;}.pb47{ padding-bottom:47px;}.pb50{ padding-bottom:50px;}.pb60{ padding-bottom:60px;}.pb70{ padding-bottom:70px;}.pb80{ padding-bottom:80px;}.pb90{ padding-bottom:90px;}.pb100{ padding-bottom:100px;}.pb110{ padding-bottom:110px;}.pb155{ padding-bottom:155px;}
@@ -111,7 +114,6 @@ a.decoration{text-decoration: underline}
.pl0{ padding-left:0px!important;}.pl2{ padding-left:2px;}.pl5{ padding-left:5px;}.pl7{ padding-left:7px;}.pl8{ padding-left:8px;}.pl10{ padding-left:10px;}.pl15{ padding-left:15px;}.pl20{ padding-left:20px;}.pl22{ padding-left:22px;}.pl25{ padding-left:25px;}.pl28{ padding-left:28px;}.pl30{ padding-left:30px !important;}.pl33{padding-left: 33px}.pl35{ padding-left:35px;}.pl40{ padding-left:40px;}.pl42{ padding-left:42px;}.pl45{ padding-left:45px;}.pl50{ padding-left:50px;}.pl60{ padding-left:60px;}.pl70{padding-left:70px;}.pl75{padding-left:75px;}.pl80{padding-left:80px;}.pl88{ padding-left:88px;}.pl92{padding-left:92px;}.pl100{ padding-left:100px;}
.pr2{ paddding-right:2px;}.pr5{ padding-right:5px;}.pr7{ padding-right:7px;}.pr10{ padding-right:10px;}.pr15{ padding-right:15px;}.pr20{ padding-right:20px!important;}.pr25{ padding-right:25px!important;}.pr30{ padding-right:30px!important;}.pr40{ padding-right:40px;}.pr42{ padding-right:42px;}.pr45{ padding-right:45px;}.pr60{padding-right:60px;}.pr75{padding-right:75px;}
-
.padding5-10{padding:5px 10px;box-sizing: border-box}
.padding5-20{padding:5px 20px;box-sizing: border-box}
.padding10{padding: 10px;box-sizing: border-box}
From c5b41a28920123c0158da748a1122dbc114bd8d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sat, 31 Aug 2019 11:10:05 +0800
Subject: [PATCH 10/22] =?UTF-8?q?=E5=90=88=E5=B9=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/poll/PollNew.js | 10 +-
.../modules/courses/poll/PollNewQuestbank.js | 1346 +++++++++--------
2 files changed, 749 insertions(+), 607 deletions(-)
diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js
index 091f45b94..aab316d82 100644
--- a/public/react/src/modules/courses/poll/PollNew.js
+++ b/public/react/src/modules/courses/poll/PollNew.js
@@ -1752,7 +1752,7 @@ class PollNew extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
- this.edittotheserver(object, 3, null, null, 0, 0,0);
+ this.edittotheserver(object, 3, null, null, 0, 0,0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
@@ -1859,10 +1859,10 @@ class PollNew extends Component {
max_choicess = max_choices;
min_choicess = min_choices;
}
- console.log("createquestionsandanswers");
- console.log(max_choicess);
- console.log(min_choicess);
- console.log(length);
+ // console.log("createquestionsandanswers");
+ // console.log(max_choicess);
+ // console.log(min_choicess);
+ // console.log(length);
axios.put(url, {
// debug: true,
question_title: object.question.question_title,
diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js
index 35e2a60ae..f86e8515d 100644
--- a/public/react/src/modules/courses/poll/PollNewQuestbank.js
+++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js
@@ -13,6 +13,7 @@ import axios from 'axios'
import moment from "../new/CoursesNew";
import Modals from "../../modals/Modals";
import PollListItem from "./PollListItem";
+import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
const TextArea = Input.TextArea
const RadioGroup = Radio.Group
@@ -36,12 +37,13 @@ class PollNewQuestbank extends Component {
constructor(props) {
super(props);
+ this.contentMdRef = React.createRef();
this.state = {
visible: false,
poll_questions: [],
user_permission: "",
addonAfter: 0,
- addonAftertwo: 100,
+ addonAftertwo: 0,
mysingles: 0,
mydoubles: 0,
mymainsint: 0,
@@ -52,8 +54,8 @@ class PollNewQuestbank extends Component {
polls_nametest: "",
polls_description: "",
polls_descriptiontest: "",
- storagedesc:"",
- storagedesctwo:"",
+ storagedesc: "",
+ storagedesctwo: "",
coursesId: "",
pollid: undefined,
polls_status: undefined,
@@ -67,10 +69,10 @@ class PollNewQuestbank extends Component {
problemtopicbool: false,
newoption: false,
cancellation: false,
- bindingid:undefined,
- Newdisplay:false,
- first_category_url:"",
- left_banner_id:"",
+ bindingid: undefined,
+ Newdisplay: false,
+ first_category_url: "",
+ left_banner_id: "",
}
// console.log("试卷新建和编辑");
// console.log(JSON.stringify(props));
@@ -80,7 +82,7 @@ class PollNewQuestbank extends Component {
changeTopicName = (e) => {
// console.log("调用了changeTopicName");
let num = parseInt(e.target.value.length);
- if(num>60){
+ if (num > 60) {
return;
}
this.setState({
@@ -106,7 +108,7 @@ class PollNewQuestbank extends Component {
// 初始化数据
componentDidMount = () => {
// console.log("componentDidMount 50")
- if( this.props.isStudent() === true){
+ if (this.props.isStudent() === true) {
this.props.history.push("/403")
@@ -122,27 +124,28 @@ class PollNewQuestbank extends Component {
// cancellation: true,
// })
// } else {
- this.Initializatio_data();
- this.state.Newedit === false;
- this.setState({
- Newedit: false,
- mysave: false,
- readOnlys: "readOnly",
- })
- // }
+
+ this.Initializatio_data();
+ this.state.Newedit === false;
+ this.setState({
+ Newedit: false,
+ mysave: false,
+ readOnlys: "readOnly",
+ })
+ // }
// }
console.log("问卷返回");
console.log(this.props);
try {
- if(this.props.current_user!==undefined){
+ if (this.props.current_user !== undefined) {
this.setState({
- first_category_url :this.props.current_user.first_category_url,
+ first_category_url: this.props.current_user.first_category_url,
});
console.log("=======================");
console.log(this.props.current_user.first_category_url);
}
- }catch (e) {
+ } catch (e) {
console.log("12312312312")
console.log(e);
}
@@ -152,12 +155,12 @@ class PollNewQuestbank extends Component {
// console.log("componentDidUpdate");
// console.log(prevProps);
// console.log(this.props);
- if(prevProps.current_user!=this.props.current_user){
- if(this.props.current_user!==undefined){
+ if (prevProps.current_user != this.props.current_user) {
+ if (this.props.current_user !== undefined) {
// console.log(this.props.current_user.login);
// console.log(prevProps.current_user.login);
this.setState({
- first_category_url :this.props.current_user.first_category_url,
+ first_category_url: this.props.current_user.first_category_url,
})
}
}
@@ -243,7 +246,7 @@ class PollNewQuestbank extends Component {
} else {
const url = `/exercise_banks/${pollid}.json`;
axios.get(url).then((result) => {
- if (result){
+ if (result) {
console.log("247");
console.log(result);
@@ -251,10 +254,10 @@ class PollNewQuestbank extends Component {
}
- if(result.data){
- if(result.data.poll){
- if(result.data.poll.polls_name){
- let num = parseInt(result.data.poll.polls_name.length);
+ if (result.data) {
+ if (result.data.poll) {
+ if (result.data.poll.polls_name) {
+ let num = parseInt(result.data.poll.polls_name.length);
this.setState({
addonAfter: num < 0 ? 0 : num
})
@@ -266,7 +269,7 @@ class PollNewQuestbank extends Component {
this.setState({
projects: result.data,
pollid: pollid,
- polls_status: result.data.poll.is_public===false?1:2,
+ polls_status: result.data.poll.is_public === false ? 1 : 2,
polls_name: result.data.poll.name,
polls_description: result.data.poll.description,
poll_questions: result.data.questions,
@@ -278,16 +281,29 @@ class PollNewQuestbank extends Component {
polls_nametest: result.data.poll.name,
polls_descriptiontest: result.data.poll.description,
questionnair: true,
- left_banner_id:result.data.left_banner_id
+ left_banner_id: result.data.left_banner_id
})
- if(result.data.poll.name){
- if(result.data.poll.name.length>0){
- this.setState({
- addonAfter:result.data.poll.name.length,
- })
+ if (result.data.poll.name) {
+ if (result.data.poll.name.length > 0) {
+ this.setState({
+ addonAfter: result.data.poll.name.length,
+ })
+ }
+ }
+ try {
+ const crumbData={
+ title:'编辑',
+ is_public:result && result.data && result.data.is_public,
+ crumbArray:[
+ {to:`/banks/poll/${pollid}`,content:'详情'},
+ {content:'编辑'}
+ ]
}
- }
+ this.props.initPublic(crumbData);
+ }catch (e) {
+
+ }
}).catch((error) => {
console.log(error)
})
@@ -311,33 +327,30 @@ class PollNewQuestbank extends Component {
const url = `/exercise_banks/${pollidsy}.json`;
axios.get(url).then((result) => {
- if (result !== undefined){
- this.setState({
- projects: result.data,
- pollid: pollid,
- polls_status: result.data.poll.is_public===false?1:2,
- polls_name: result.data.poll.name,
- polls_description: result.data.poll.description,
- poll_questions: result.data.questions,
- question_types: result.data.question_types,
- mysingles: result.data.question_types.q_singles,
- mydoubles: result.data.question_types.q_doubles,
- mymainsint: result.data.question_types.q_mains,
- q_counts: result.data.question_types.q_counts,
- polls_nametest: result.data.poll.name,
- polls_descriptiontest: result.data.poll.description,
- questionnair: true,
- left_banner_id:result.data.left_banner_id
- });
-
-
-
+ if (result !== undefined) {
+ this.setState({
+ projects: result.data,
+ pollid: pollidsy,
+ polls_status: result.data.poll.is_public === false ? 1 : 2,
+ polls_name: result.data.poll.name,
+ polls_description: result.data.poll.description,
+ poll_questions: result.data.questions,
+ question_types: result.data.question_types,
+ mysingles: result.data.question_types.q_singles,
+ mydoubles: result.data.question_types.q_doubles,
+ mymainsint: result.data.question_types.q_mains,
+ q_counts: result.data.question_types.q_counts,
+ polls_nametest: result.data.poll.name,
+ polls_descriptiontest: result.data.poll.description,
+ questionnair: true,
+ left_banner_id: result.data.left_banner_id
+ });
- if(result.data.poll.name){
- if(result.data.poll.name.length>0){
+ if (result.data.poll.name) {
+ if (result.data.poll.name.length > 0) {
this.setState({
- addonAfter:result.data.poll.name.length,
+ addonAfter: result.data.poll.name.length,
})
}
}
@@ -346,7 +359,6 @@ class PollNewQuestbank extends Component {
// console.log("有问卷~~~")
-
// }
}).catch((error) => {
console.log(error)
@@ -384,7 +396,7 @@ class PollNewQuestbank extends Component {
})
}
this.setState({
- Newdisplay:true,
+ Newdisplay: true,
})
var Insertposition = this.state.poll_questions.length;
// console.log(JSON.stringify(this.state.poll_questions));
@@ -407,7 +419,7 @@ class PollNewQuestbank extends Component {
})
}
this.setState({
- Newdisplay:true,
+ Newdisplay: true,
})
var Insertposition = this.state.poll_questions.length;
// console.log(JSON.stringify(this.state.poll_questions));
@@ -426,7 +438,7 @@ class PollNewQuestbank extends Component {
//添加主观题目
addmymainsint = () => {
this.setState({
- Newdisplay:true,
+ Newdisplay: true,
})
var Insertposition = this.state.poll_questions.length;
// console.log(JSON.stringify(this.state.poll_questions));
@@ -453,7 +465,7 @@ class PollNewQuestbank extends Component {
var anserbool = false;
this.setState({
q_countst: 1,
- bindingid:object.question.id
+ bindingid: object.question.id
})
// window.scrollTo(0, this.refs.targetElement.offsetTops)
let {adddom} = this.state;
@@ -631,13 +643,13 @@ class PollNewQuestbank extends Component {
var question = {}
var questiontwo = {
// "id": this.state.poll_questions[arr.length - 1].question.id + 1 + arrr.length,
- "id": Whether=== true? id :this.state.poll_questions[newarr.length - 1].question.id,
+ "id": Whether === true ? id : this.state.poll_questions[newarr.length - 1].question.id,
"is_necessary": 1,
"question_number": 1,
"question_title": "",
"question_type": 1,
"new": "new",
- "newid":Whether=== true? id :this.state.poll_questions[newarr.length - 1].question.id + 1,
+ "newid": Whether === true ? id : this.state.poll_questions[newarr.length - 1].question.id + 1,
"answers": [
{"answer_id": 1, "answer_position": 1, "answer_text": ""},
{"answer_id": 2, "answer_position": 2, "answer_text": ""},
@@ -659,7 +671,7 @@ class PollNewQuestbank extends Component {
//插入多选题
var question = {}
var questiontwo = {
- "id": Whether=== true? id :this.state.poll_questions[newarr.length - 1].question.id,
+ "id": Whether === true ? id : this.state.poll_questions[newarr.length - 1].question.id,
"is_necessary": 1,
"question_number": 2,
"question_title": "",
@@ -667,7 +679,7 @@ class PollNewQuestbank extends Component {
"max_choices": 0,
"min_choices": 0,
"new": "new",
- "newid":Whether=== true? id :this.state.poll_questions[newarr.length - 1].question.id + 1,
+ "newid": Whether === true ? id : this.state.poll_questions[newarr.length - 1].question.id + 1,
"answers": [
{"answer_id": 1, "answer_position": 1, "answer_text": ""},
{"answer_id": 2, "answer_position": 2, "answer_text": ""},
@@ -690,13 +702,13 @@ class PollNewQuestbank extends Component {
// console.log(this.state.poll_questions[newarr.length - 1].question.id);
var question = {}
var questiontwo = {
- "id": Whether=== true? id :this.state.poll_questions[newarr.length - 1].question.id,
+ "id": Whether === true ? id : this.state.poll_questions[newarr.length - 1].question.id,
"is_necessary": 1,
"question_number": 3,
"question_title": "",
"question_type": 3,
"new": "new",
- "newid":Whether=== true? id :this.state.poll_questions[newarr.length - 1].question.id + 1,
+ "newid": Whether === true ? id : this.state.poll_questions[newarr.length - 1].question.id + 1,
"answers": []
};
question = {"question": questiontwo};
@@ -716,17 +728,17 @@ class PollNewQuestbank extends Component {
try {
ids = this.state.poll_questions[newarr.length - 1].question.id;
} catch (e) {
- ids= 1;
+ ids = 1;
}
var questiontwo = {
// "id": this.state.poll_questions[arr.length - 1].question.id + 1 + arrr.length,
- "id": Whether=== true? id :ids,
+ "id": Whether === true ? id : ids,
"is_necessary": 1,
"question_number": 1,
"question_title": "",
"question_type": 1,
"new": "new",
- "newid":Whether=== true? id :ids+ 1,
+ "newid": Whether === true ? id : ids + 1,
"answers": [
{"answer_id": 1, "answer_position": 1, "answer_text": ""},
{"answer_id": 2, "answer_position": 2, "answer_text": ""},
@@ -753,7 +765,7 @@ class PollNewQuestbank extends Component {
ids = 1;
}
var questiontwo = {
- "id": Whether=== true? id :ids,
+ "id": Whether === true ? id : ids,
"is_necessary": 1,
"question_number": 2,
"question_title": "",
@@ -761,7 +773,7 @@ class PollNewQuestbank extends Component {
"max_choices": 0,
"min_choices": 0,
"new": "new",
- "newid":Whether=== true? id :ids+1,
+ "newid": Whether === true ? id : ids + 1,
"answers": [
{"answer_id": 1, "answer_position": 1, "answer_text": ""},
{"answer_id": 2, "answer_position": 2, "answer_text": ""},
@@ -783,18 +795,18 @@ class PollNewQuestbank extends Component {
//插入主观题
var ids;
try {
- ids= this.state.poll_questions[newarr.length - 1].question.id;
+ ids = this.state.poll_questions[newarr.length - 1].question.id;
} catch (e) {
ids = 1;
}
var questiontwo = {
- "id":Whether=== true? id : ids,
+ "id": Whether === true ? id : ids,
"is_necessary": 1,
"question_number": 3,
"question_title": "",
"question_type": 3,
"new": "new",
- "newid":Whether=== true? id :ids + 1,
+ "newid": Whether === true ? id : ids + 1,
"answers": []
};
question = {"question": questiontwo};
@@ -809,53 +821,55 @@ class PollNewQuestbank extends Component {
}
//删除指定条目
- Deleteadddom = (indexo,bool) => {
+ Deleteadddom = (indexo, bool) => {
// console.log("deleteadddom 259")
var arr = this.state.adddom;
let newarr = [...arr];
newarr.splice(indexo, 1);
- if(bool === true) {
+ if (bool === true) {
this.setState({
adddom: newarr,
q_countst: 0,
problemtopic: null,
problemtopicbool: false,
- bindingid:undefined,
- Newdisplay:false,
+ bindingid: undefined,
+ Newdisplay: false,
newoption: false,
})
- }else{
+ } else {
this.setState({
adddom: newarr,
q_countst: 0,
problemtopic: null,
problemtopicbool: false,
- Newdisplay:false,
+ Newdisplay: false,
newoption: false,
})
}
-
}
//保存并继续
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
- Deleteadddomtwo = (indexo, object,bool) => {
+ Deleteadddomtwo = (indexo, object, bool) => {
var thiss = this;
- if(bool === true){
+ if (bool === true) {
this.setState({
q_countst: 1,
- bindingid:undefined,
- Newdisplay:false,
+ bindingid: undefined,
+ Newdisplay: false,
})
- }else {
+ } else {
this.setState({
q_countst: 1,
- Newdisplay:false,
+ Newdisplay: false,
})
}
+ if (object.question.question_type === 3) {
+ this.HandleInputTopics(this.contentMdRef.current.getValue().trim(), indexo);
+ }
var poll_questionslength = this.state.poll_questions.length;
// console.log("deleteadddomtwo|||||||||||||||||||||||||||||||||||||||||\\");
// console.log(indexo);
@@ -881,10 +895,12 @@ class PollNewQuestbank extends Component {
console.log(e)
}
}
- if (newarr[indexo].question.question_title === "") {
- this.props.showNotification(`题目不能为空`);
+ if (object.question.question_type !== 3) {
+ if (newarr[indexo].question.question_title === "") {
+ this.props.showNotification(`题目不能为空`);
- return
+ return
+ }
}
if (max > 0) {
if (object.question.question_type === 1) {
@@ -912,8 +928,6 @@ class PollNewQuestbank extends Component {
}
-
-
if (object.question.question_type === 2) {
if (object.question.max_choices > 0) {
// if (object.question.min_choices < 2) {
@@ -988,7 +1002,7 @@ class PollNewQuestbank extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
- this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex);
+ this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex,0);
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
@@ -1048,7 +1062,7 @@ class PollNewQuestbank extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
- this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex);
+ this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于选项数")
@@ -1066,6 +1080,7 @@ class PollNewQuestbank extends Component {
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
+ // this.HandleInputTopics(this.contentMdRef.current.getValue().trim(),indexo);
//插入主观题
var answers = [];
var questiontwo = {};
@@ -1103,7 +1118,7 @@ class PollNewQuestbank extends Component {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 3,
- "question_title": object.question.question_title,
+ "question_title": this.contentMdRef.current.getValue().trim(),
"question_type": 3,
"new": "",
"answers": answers
@@ -1118,7 +1133,7 @@ class PollNewQuestbank extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
- this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex);
+ this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex,0);
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
}
@@ -1181,11 +1196,11 @@ class PollNewQuestbank extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
- this.edittotheserver(object, 1, arrc, null, 0, 0);
+ this.edittotheserver(object, 1, arrc, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("他原来的删除掉了")
- this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id);
+ this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
newarr[indexo].question.new = "new"
@@ -1252,16 +1267,18 @@ class PollNewQuestbank extends Component {
// }
if (uuk !== -1) {
// console.log("修改")
- this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
+ this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
- this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
+ this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
} else if (object.question.question_type === 3) {
+ // this.HandleInputTopics(this.contentMdRef.current.getValue().trim(),indexo);
+
//插入主观题
var answers = [];
var questiontwo = {};
@@ -1289,7 +1306,7 @@ class PollNewQuestbank extends Component {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 3,
- "question_title": object.question.question_title,
+ "question_title": this.contentMdRef.current.getValue().trim(),
"question_type": 3,
"new": "",
"answers": answers
@@ -1298,11 +1315,11 @@ class PollNewQuestbank extends Component {
if (uuk !== -1) {
// console.log("修改")
- this.edittotheserver(object, 3, null, null, 0, 0);
+ this.edittotheserver(object, 3, null, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
- this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
+ this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
// console.log(newarrpoll)
@@ -1342,15 +1359,19 @@ class PollNewQuestbank extends Component {
//保存,即完成新建并退出本题编辑
// indexo 第几个数组
//object 单个数组数据
- Deleteadddomthree = (indexo, object,bool) => {
- if(bool === true) {
+ Deleteadddomthree = (indexo, object, bool) => {
+ if (bool === true) {
this.setState({
- bindingid:undefined,
+ bindingid: undefined,
})
}
this.setState({
- Newdisplay:false,
- })
+ Newdisplay: false,
+ });
+ if (object.question.question_type === 3) {
+ this.HandleInputTopics(this.contentMdRef.current.getValue().trim(), indexo);
+
+ }
// console.log("deleteadddom 349")
var thiss = this;
let arr = this.state.adddom;
@@ -1374,9 +1395,11 @@ class PollNewQuestbank extends Component {
// console.log(e)
}
}
- if (newarr[indexo].question.question_title === "") {
- this.props.showNotification('题目不能为空!');
- return
+ if (object.question.question_type !== 3) {
+ if (newarr[indexo].question.question_title === "") {
+ this.props.showNotification('题目不能为空!');
+ return
+ }
}
if (max > 0) {
if (object.question.question_type === 1) {
@@ -1401,7 +1424,6 @@ class PollNewQuestbank extends Component {
}
-
if (object.question.question_type === 2) {
if (object.question.max_choices > 0) {
// if (object.question.min_choices < 2) {
@@ -1470,7 +1492,7 @@ class PollNewQuestbank extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
- this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex);
+ this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex,0);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 2) {
//插入多选题
@@ -1524,12 +1546,14 @@ class PollNewQuestbank extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
- this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex);
+ this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
+ // this.HandleInputTopics(this.contentMdRef.current.getValue().trim(),indexo);
+
//插入主观题
var answers = [];
var questiontwo = {};
@@ -1560,7 +1584,7 @@ class PollNewQuestbank extends Component {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 3,
- "question_title": object.question.question_title,
+ "question_title": this.contentMdRef.current.getValue().trim(),
"question_type": 3,
"new": "",
"answers": answers
@@ -1572,7 +1596,7 @@ class PollNewQuestbank extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
- this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex);
+ this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex,0);
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
}
@@ -1633,11 +1657,11 @@ class PollNewQuestbank extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
- this.edittotheserver(object, 1, arrc, null, 0, 0);
+ this.edittotheserver(object, 1, arrc, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
- this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id);
+ this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
// console.log(newarrpoll)
@@ -1689,16 +1713,18 @@ class PollNewQuestbank extends Component {
//插入多选题
if (uuk !== -1) {
// console.log("修改")
- this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
+ this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
- this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
+ this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
} else if (object.question.question_type === 3) {
+ // this.HandleInputTopics(this.contentMdRef.current.getValue().trim(),indexo);
+
//插入主观题
var answers = [];
var questiontwo = {};
@@ -1726,7 +1752,7 @@ class PollNewQuestbank extends Component {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 3,
- "question_title": object.question.question_title,
+ "question_title": this.contentMdRef.current.getValue().trim(),
"question_type": 3,
"new": "",
"answers": answers
@@ -1734,11 +1760,11 @@ class PollNewQuestbank extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
- this.edittotheserver(object, 3, null, null, 0, 0);
+ this.edittotheserver(object, 3, null, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
- this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
+ this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
// console.log(newarrpoll)
@@ -1774,7 +1800,7 @@ class PollNewQuestbank extends Component {
////新增到服务器中
- createquestionsandanswers = (object, number, option, other, max_choices, min_choices, insert_id) => {
+ createquestionsandanswers = (object, number, option, other, max_choices, min_choices, insert_id,length) => {
var thiss = this;
var poll_id = this.state.pollid;
var urlly = `/poll_bank_questions.json`;
@@ -1788,12 +1814,12 @@ class PollNewQuestbank extends Component {
min_choicess = min_choices;
}
axios.post(urlly, {
- exercise_bank_id:poll_id,
+ exercise_bank_id: poll_id,
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
- max_choices: max_choicess,
- min_choices: min_choicess,
+ max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
+ min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
insert_id: insert_id
@@ -1824,7 +1850,7 @@ class PollNewQuestbank extends Component {
}
///编辑修改到服务器当中
- edittotheserver = (object, number, option, other, max_choices, min_choices) => {
+ edittotheserver = (object, number, option, other, max_choices, min_choices,length) => {
// console.log("调用了edittotheserver")
var url = `/poll_bank_questions/${object.question.id}.json`
var thiss = this;
@@ -1833,8 +1859,8 @@ class PollNewQuestbank extends Component {
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
- max_choices: max_choices,
- min_choices: min_choices,
+ max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
+ min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
}).then((result) => {
@@ -2111,9 +2137,9 @@ class PollNewQuestbank extends Component {
//i外层数组
//k为内层数组
HandleInputChanges = (e, i, k) => {
- console.log("handleInputChanges"+" "+e);
- console.log("handleInputChanges"+" "+i);
- console.log("handleInputChanges"+" "+k);
+ console.log("handleInputChanges" + " " + e);
+ console.log("handleInputChanges" + " " + i);
+ console.log("handleInputChanges" + " " + k);
// console.log("handleInputChanges 612")
let value = e.target.value;//取到input的数据
@@ -2144,6 +2170,19 @@ class PollNewQuestbank extends Component {
})
}
+ HandleInputTopics = (value, i) => {
+ console.log("handleInputTopic 633")
+ console.log(value);
+ //取到input的数据
+ // console.log("handleInputTopic value is :" + value);
+ // console.log(i);
+ let arr = this.state.adddom;
+ let newarr = [...arr];
+ newarr[i].question.question_title = value
+ this.setState({
+ adddom: newarr
+ })
+ }
//最小值
HandleGradationGroupChangee = (value, index, max, length) => {
// console.log("最小值");
@@ -2188,7 +2227,7 @@ class PollNewQuestbank extends Component {
}
//最大值
- HandleGradationGroupChangeee = (value, index,minchoices,length) => {
+ HandleGradationGroupChangeee = (value, index, minchoices, length) => {
// console.log("2112");
// console.log(value);
// console.log(minchoices);
@@ -2200,20 +2239,18 @@ class PollNewQuestbank extends Component {
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
if (index === i) {
- if(parseInt(value)===0&&parseInt(minchoices)===0){
- arr[i].question.min_choices= parseInt(0);
+ if (parseInt(value) === 0 && parseInt(minchoices) === 0) {
+ arr[i].question.min_choices = parseInt(0);
arr[i].question.max_choices = parseInt(0);
- }else if(parseInt(minchoices)===0){
- arr[i].question.min_choices= parseInt(2);
+ } else if (parseInt(minchoices) === 0) {
+ arr[i].question.min_choices = parseInt(2);
arr[i].question.max_choices = parseInt(value);
- }
- else if(parseInt(value)===0&&parseInt(minchoices)>0){
- arr[i].question.min_choices= parseInt(minchoices);
+ } else if (parseInt(value) === 0 && parseInt(minchoices) > 0) {
+ arr[i].question.min_choices = parseInt(minchoices);
+ arr[i].question.max_choices = parseInt(value);
+ } else {
+ arr[i].question.min_choices = minchoices === null ? 2 : minchoices === undefined ? 2 : minchoices === 0 ? 2 : parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
- }
- else {
- arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
- arr[i].question.max_choices = parseInt(value);
}
}
}
@@ -2249,7 +2286,7 @@ class PollNewQuestbank extends Component {
}
// if(mews ==="new"){
- if(this.state.poll_questions&&this.state.poll_questions.length===0){
+ if (this.state.poll_questions && this.state.poll_questions.length === 0) {
this.props.showNotification("至少创建1个题目");
return;
}
@@ -2330,15 +2367,15 @@ class PollNewQuestbank extends Component {
this.setState({
mysave: false,
readOnlys: "readOnly",
- storagedesc:this.state.polls_nametest,
- storagedesctwo:this.state.polls_descriptiontest,
+ storagedesc: this.state.polls_nametest,
+ storagedesctwo: this.state.polls_descriptiontest,
})
} else if (this.state.mysave === false) {
this.setState({
mysave: true,
readOnlys: "",
- storagedesc:this.state.polls_nametest,
- storagedesctwo:this.state.polls_descriptiontest,
+ storagedesc: this.state.polls_nametest,
+ storagedesctwo: this.state.polls_descriptiontest,
})
}
}
@@ -2349,16 +2386,16 @@ class PollNewQuestbank extends Component {
mysave: false,
Newedit: false,
readOnlys: "readOnly",
- polls_nametest:this.state.storagedesc,
- polls_descriptiontest:this.state.storagedesctwo,
+ polls_nametest: this.state.storagedesc,
+ polls_descriptiontest: this.state.storagedesctwo,
})
} else {
this.setState({
mysave: false,
Newedit: false,
readOnlys: "readOnly",
- polls_nametest:this.state.storagedesc,
- polls_descriptiontest:this.state.storagedesctwo,
+ polls_nametest: this.state.storagedesc,
+ polls_descriptiontest: this.state.storagedesctwo,
})
}
}
@@ -2399,41 +2436,41 @@ class PollNewQuestbank extends Component {
//
// })
// } else {
- if (this.state.polls_nametest === undefined || this.state.polls_nametest === "") {
- this.props.showNotification("请输入标题");
- return
- }
+ if (this.state.polls_nametest === undefined || this.state.polls_nametest === "") {
+ this.props.showNotification("请输入标题");
+ return
+ }
- var pollid;
- if (this.state.pollid === undefined) {
- pollid = this.props.match.params.workid;
- } else {
- pollid = this.state.pollid;
- }
+ var pollid;
+ if (this.state.pollid === undefined) {
+ pollid = this.props.match.params.workid;
+ } else {
+ pollid = this.state.pollid;
+ }
- var url = `/exercise_banks/${pollid}.json`;
- axios.put(url, {
- exercise_name: this.state.polls_nametest,
- exercise_description: this.state.polls_descriptiontest
- }).then((result) => {
- if (result !== undefined) {
- this.props.showNotification(`问卷更新成功!`);
- this.setState({
- mysave: false,
- readOnlys: "readOnly",
- })
- }
+ var url = `/exercise_banks/${pollid}.json`;
+ axios.put(url, {
+ exercise_name: this.state.polls_nametest,
+ exercise_description: this.state.polls_descriptiontest
+ }).then((result) => {
+ if (result !== undefined) {
+ this.props.showNotification(`问卷更新成功!`);
+ this.setState({
+ mysave: false,
+ readOnlys: "readOnly",
+ })
+ }
- })
+ })
// }
}
- gotohome=()=>{
+ gotohome = () => {
// const { current_user} = this.props
- if(this.state.first_category_url){
- window.location.href=this.state.first_category_url;
- }else{
+ if (this.state.first_category_url) {
+ window.location.href = this.state.first_category_url;
+ } else {
this.props.history.goBack();
}
@@ -2461,7 +2498,8 @@ class PollNewQuestbank extends Component {
readOnlys,
newoption,
cancellation,
- left_banner_id
+ left_banner_id,
+ addonAftertwo
} = this.state
//获取老师权限
// console.log("[`${maps[polls_status && polls_status]}`]]");
@@ -2491,7 +2529,7 @@ class PollNewQuestbank extends Component {
// console.log(this.state.projects===undefined?"":this.state.projects.poll_questions)
var displaymysave = (mysave === true) ? "" : "display:none;";
return (
-
+
{/*提示*/}
{Modalstype && Modalstype === true ?
: ""}
-
-
-
- this.gotohome()}>{this.props.coursedata.name}
- >
+
+ {/*
*/}
+ {/* this.gotohome()}>{this.props.coursedata.name}*/}
+ {/* >*/}
{/*{*/}
{/* this.props.match.params.news === "new"?*/}
{/* 问卷*/}
{/* :*/}
- 问卷
+ {/*问卷*/}
{/*}*/}
- >
+ {/*>*/}
{/*{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}*/}
- 编辑
+ {/* 编辑*/}
-
-
+ {/**/}
+ {/*
*/}
{/*
{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}
*/}
-
编辑
+ {/*
编辑
*/}
{/*{*/}
{/* this.props.match.params.news === "new" ?*/}
{/*
返回*/}
{/* :*/}
-
+ {/*
*/}
{/*}*/}
-
+ {/*
*/}
{/*
@@ -2622,11 +2658,12 @@ class PollNewQuestbank extends Component {
+ maxLength={100}
+ autoComplete="off" addonAfter={String(addonAftertwo)}
+ >
{
this.state.Newedit === true || this.state.mysave === true ?
@@ -2655,11 +2692,10 @@ class PollNewQuestbank extends Component {
-
:""
+
: ""
}
-
@@ -2681,7 +2717,7 @@ class PollNewQuestbank extends Component {
合计 {this.state.q_counts === undefined ? "" :this.state.q_counts} 题
+ style={{color: "#FF6800"}}>{this.state.q_counts === undefined ? "" : this.state.q_counts} 题
}
@@ -2712,11 +2748,11 @@ class PollNewQuestbank extends Component {
let resultDom;
resultDom =
- 第{index + 1}题:
+ {index + 1}、
{item.question.question_type === 1 ? "(单选题)" : item.question.question_type === 2 ? "(多选题)" : "(主观题)"}
+ className="color-grey-9 fl">{item.question.question_type === 1 ? "单选题" : item.question.question_type === 2 ? "多选题" : "主观题"}
{item.question.is_necessary === 1 ? "必答" : item.question.question_type === 2 ? "选答" : "选答"}
+ className=" ml10">{item.question.is_necessary === 1 ? "(必答)" : item.question.question_type === 2 ? "(选答)" : "(选答)"}
{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "" : item.question.min_choices === null && item.question.max_choices === null ? "" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "" : "可选" + item.question.min_choices + "-" + item.question.max_choices + "项")}
{
@@ -2747,7 +2783,11 @@ class PollNewQuestbank extends Component {
}
-
{item.question.question_title}
+
{item.question.question_title}
{/*
{item.question.question_title}
*/}
{item.question.question_type === 1 ?
@@ -2755,8 +2795,15 @@ class PollNewQuestbank extends Component {
{item.question.answers === undefined ? "" : item.question.answers.map((items, i) => {
return (
-
- {items.answer_text}
+
+ {items.answer_text}
)
@@ -2773,7 +2820,14 @@ class PollNewQuestbank extends Component {
return (
- {items.answer_text}
+ {items.answer_text}
)
})}
@@ -2783,7 +2837,8 @@ class PollNewQuestbank extends Component {
: item.question.question_type === 3 ?
// 主观题
- (
@@ -2791,37 +2846,47 @@ class PollNewQuestbank extends Component {
{/*这里是编辑和新增的地方*/}
{
- this.state.bindingid && this.state.bindingid===item.question.id?
- (this.state.Newdisplay === false?
+ this.state.bindingid && this.state.bindingid === item.question.id ?
+ (this.state.Newdisplay === false ?
-
- {this.state.adddom === undefined ? "" :this.state.adddom===undefined?"": this.state.adddom.length===0?"":item.question.id === this.state.adddom[0].question.id&&this.state.adddom.map((itemo, indexo) => {
+
+ {this.state.adddom === undefined ? "" : this.state.adddom === undefined ? "" : this.state.adddom.length === 0 ? "" : item.question.id === this.state.adddom[0].question.id && this.state.adddom.map((itemo, indexo) => {
let arrid = itemo.question.id;
let resultDomtwo;
resultDomtwo =
-
-
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
- this.OnCheckAllChange(e, indexo)}
- className="lineh-40"
- style={{"marginLeft": "20px"}}>必答
+
+
{item.question.question_number}、
+
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
+ this.OnCheckAllChange(e, indexo)}
+ className="lineh-40"
+ style={{"marginLeft": "20px"}}>必答
-
-
+ {
+ itemo.question.question_type === 3 ?
+
+ :
+
+
+ }
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return (
@@ -2837,11 +2902,11 @@ class PollNewQuestbank extends Component {
placeholder='无法编辑!将由参与答题的人手动录入'>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- itemo.question.question_type === 1?(
- indext>1?
+ itemo.question.question_type === 1 ? (
+ indext > 1 ?
{
- itemo.question.question_type === 2 ?"":
+ itemo.question.question_type === 2 ? "" :
this.Deleteentrys(arrid, indext, true)}>
+ >
- :"")
- : "":""}
+ : "")
+ : "" : ""}
) : (
this.HandleInputChanges(e, indexo, indext)}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- indext>1?
-
+ indext > 1 ?
+
this.Deleteentrys(arrid, indext, false)}>
- {
- itemo.question.answers[itemo.question.answers.length-1].answer_text === "其他"&&itemo.question.answers.length-2===indext?
+ {
+ itemo.question.answers[itemo.question.answers.length - 1].answer_text === "其他" && itemo.question.answers.length - 2 === indext ?
- this.Ewoption(itemo.question.id, itemo)}>
- : itemo.question.answers.length-1===indext?
- this.Ewoption(itemo.question.id, itemo)}>
- :
- }
+ this.Ewoption(itemo.question.id, itemo)}>
+ : itemo.question.answers.length - 1 === indext ?
+ this.Ewoption(itemo.question.id, itemo)}>
+ :
+ }
- :indext===1&&itemo.question.answers.length===2||indext===1&&itemo.question.answers.length===3? this.Ewoption(itemo.question.id, itemo)}> this.Ewoption(itemo.question.id, itemo)}>:""
+ className="color-green font-18 iconfont icon-roundaddfill"> : ""
: ""}
)}
@@ -2913,7 +2979,7 @@ class PollNewQuestbank extends Component {
{/* onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- ""
+ ""
: ""}
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
@@ -2924,11 +2990,11 @@ class PollNewQuestbank extends Component {
: ""}
this.Deleteadddom(indexo,true)}>取消
+ onClick={() => this.Deleteadddom(indexo, true)}>取消
this.Deleteadddomtwo(indexo, itemo,true)} >保存并继续
+ onClick={() => this.Deleteadddomtwo(indexo, itemo, true)}>保存并继续
this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+ onClick={() => this.Deleteadddomthree(indexo, itemo, true)}>保存并退出
@@ -2939,7 +3005,7 @@ class PollNewQuestbank extends Component {
: itemo.question.question_type === 2 ? (
//////////////////////////////////////////// 可选
-
+
--
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return (
- indext >= 1 ? : ""
+ indext >= 1 ?
+ : ""
)
})}
@@ -2977,13 +3044,14 @@ class PollNewQuestbank extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~
{/*可选最大*/}
@@ -3014,53 +3082,53 @@ class PollNewQuestbank extends Component {
{itemo.question.question_type === 2 ?
// (
- // this.state.polls_status === undefined || this.state.polls_status === 1 ?
- //
- //
- // {/*
this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
- //
- // {/* {*/}
- // {/* this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""*/}
- // {/* }*/}
- //
- // {/*
*/}
- //
- //
- //
- // this.Deleteadddom(indexo,true)}>取消
- // this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
- // this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
- //
- //
- //
- //
- // :
- //
- //
- // this.Deleteadddom(indexo,true)}>取消
- // this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
- // this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
- //
- //
- // )
-""
+ // this.state.polls_status === undefined || this.state.polls_status === 1 ?
+ //
+ //
+ // {/*
this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
+ //
+ // {/* {*/}
+ // {/* this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""*/}
+ // {/* }*/}
+ //
+ // {/*
*/}
+ //
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+ //
+ //
+ //
+ //
+ // :
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
+ //
+ //
+ // )
+ ""
: itemo.question.question_type === 3 ?
-
+
this.Deleteadddom(indexo,true)}>取消
+ onClick={() => this.Deleteadddom(indexo, true)}>取消
this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ onClick={() => this.Deleteadddomtwo(indexo, itemo, true)}>保存并继续
this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+ onClick={() => this.Deleteadddomthree(indexo, itemo, true)}>保存并退出
:
@@ -3078,43 +3146,53 @@ class PollNewQuestbank extends Component {
)
})}
-
:"")
+
: "")
:
{resultDom}
- {this.state.Newdisplay === false?
+ {this.state.Newdisplay === false ?
-
- {this.state.adddom === undefined ? "" :this.state.adddom===undefined?"": this.state.adddom.length===0?"":item.question.id === this.state.adddom[0].question.id&&this.state.adddom.map((itemo, indexo) => {
+
+ {this.state.adddom === undefined ? "" : this.state.adddom === undefined ? "" : this.state.adddom.length === 0 ? "" : item.question.id === this.state.adddom[0].question.id && this.state.adddom.map((itemo, indexo) => {
let arrid = itemo.question.id;
let resultDomtwo;
resultDomtwo =
-
-
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
- this.OnCheckAllChange(e, indexo)}
- className="lineh-40"
- style={{"marginLeft": "20px"}}>必答
+
+
{item.question.question_number}、
+
+
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
+ this.OnCheckAllChange(e, indexo)}
+ className="lineh-40"
+ style={{"marginLeft": "20px"}}>必答
-
-
-
+ {
+ itemo.question.question_type === 3 ?
+
+ :
+
+
+ }
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
console.log("chishiyong1");
- console.log( itemo.question.answers[itemo.question.answers.length - 1]);
+ console.log(itemo.question.answers[itemo.question.answers.length - 1]);
return (
{itemt.answer_text === undefined ? (
@@ -3128,10 +3206,10 @@ class PollNewQuestbank extends Component {
className="mr20 max1010 input-flex-40 TextAreainput" disabled
placeholder='无法编辑!将由参与答题的人手动录入'>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- indext>1?
-
+ indext > 1 ?
+
{
- itemo.question.question_type === 2?"":
+ itemo.question.question_type === 2 ? "" :
this.Deleteentrys(arrid, indext, true)}>
}
- {/* {*/}
- {/* itemo.question.answers.length-1=== indext?*/}
- {/* this.Ewoption(itemo.question.id, itemo)}>*/}
- {/*: */}
- {/* }*/}
+ {/* {*/}
+ {/* itemo.question.answers.length-1=== indext?*/}
+ {/* this.Ewoption(itemo.question.id, itemo)}>*/}
+ {/*: */}
+ {/* }*/}
- :""
+ : ""
: ""}
) : (
this.HandleInputChanges(e, indexo, indext)}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
- indext>1?
-
+ indext > 1 ?
+
this.Deleteentrys(arrid, indext, false)}>
- {
- itemo.question.answers[itemo.question.answers.length - 1].answer_text==="其他"&&itemo.question.answers.length - 2 === indext ?
- this.Ewoption(itemo.question.id, itemo)}>
- : itemo.question.answers.length - 1 === indext ?
- this.Ewoption(itemo.question.id, itemo)}>
- :
-
- }
+ {
+ itemo.question.answers[itemo.question.answers.length - 1].answer_text === "其他" && itemo.question.answers.length - 2 === indext ?
+ this.Ewoption(itemo.question.id, itemo)}>
+ : itemo.question.answers.length - 1 === indext ?
+ this.Ewoption(itemo.question.id, itemo)}>
+ :
+
+ }
- :indext===1&&itemo.question.answers.length===2||indext===1&&itemo.question.answers.length===3? this.Ewoption(itemo.question.id, itemo)}> this.Ewoption(itemo.question.id, itemo)}>:""
+ className="color-green font-18 iconfont icon-roundaddfill"> : ""
: ""}
)}
@@ -3221,11 +3300,11 @@ class PollNewQuestbank extends Component {
: ""}
this.Deleteadddom(indexo,true)}>取消
+ onClick={() => this.Deleteadddom(indexo, true)}>取消
this.Deleteadddomtwo(indexo, itemo,true)}>保存并继续
+ onClick={() => this.Deleteadddomtwo(indexo, itemo, true)}>保存并继续
this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+ onClick={() => this.Deleteadddomthree(indexo, itemo, true)}>保存并退出
@@ -3266,7 +3345,8 @@ class PollNewQuestbank extends Component {
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return (
- indext >= 1 ?
: ""
+ indext >= 1 ?
+
: ""
)
})}
@@ -3274,13 +3354,14 @@ class PollNewQuestbank extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~
{/*可选最大*/}
@@ -3311,58 +3392,58 @@ class PollNewQuestbank extends Component {
{itemo.question.question_type === 2 ?
- // (
- // this.state.polls_status === undefined || this.state.polls_status === 1 ?
- //
- //
- //
this.Ewoption(itemo.question.id, itemo)}>新增选项
- //
- // {
- // this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
- // }
- //
- //
- //
- //
- //
- // this.Deleteadddom(indexo,true)}>取消
- // this.Deleteadddomtwo(indexo, itemo,true)}
- // >保存并继续
- // this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
- //
- //
- //
- //
- // :
- //
- //
- // this.Deleteadddom(indexo,true)}>取消
- // this.Deleteadddomtwo(indexo, itemo,true)}
- // >保存并继续
- // this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
- //
- //
- // )
+ // (
+ // this.state.polls_status === undefined || this.state.polls_status === 1 ?
+ //
+ //
+ //
this.Ewoption(itemo.question.id, itemo)}>新增选项
+ //
+ // {
+ // this.state.newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
+ // }
+ //
+ //
+ //
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}
+ // >保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}>保存并退出
+ //
+ //
+ //
+ //
+ // :
+ //
+ //
+ // this.Deleteadddom(indexo,true)}>取消
+ // this.Deleteadddomtwo(indexo, itemo,true)}
+ // >保存并继续
+ // this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
+ //
+ //
+ // )
""
: itemo.question.question_type === 3 ?
-
+
this.Deleteadddom(indexo,true)}>取消
+ onClick={() => this.Deleteadddom(indexo, true)}>取消
this.Deleteadddomtwo(indexo, itemo,true)}
- >保存并继续
+ onClick={() => this.Deleteadddomtwo(indexo, itemo, true)}
+ >保存并继续
this.Deleteadddomthree(indexo, itemo,true)}> 保存并退出
+ onClick={() => this.Deleteadddomthree(indexo, itemo, true)}> 保存并退出
:
@@ -3379,7 +3460,7 @@ class PollNewQuestbank extends Component {
)
})}
-
:""}
+
: ""}
}
@@ -3388,11 +3469,10 @@ class PollNewQuestbank extends Component {
})}
-
{/*新建单选多选2*/}
{
- this.state.Newdisplay === true?
+ this.state.Newdisplay === true ?
{this.state.adddom === undefined ? "" : this.state.adddom.map((itemo, indexo) => {
// console.log('打印this.state.adddom')
@@ -3401,31 +3481,41 @@ class PollNewQuestbank extends Component {
let resultDomtwo;
resultDomtwo =
-
{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
- this.OnCheckAllChange(e, indexo)}
- className="lineh-40"
- style={{"marginLeft": "20px"}}>必答
+ {item.question.question_number}、
+ {itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
+ this.OnCheckAllChange(e, indexo)}
+ className="lineh-40"
+ style={{"marginLeft": "20px"}}>必答
+ {
+ itemo.question.question_type === 3 ?
+
+ :
+
+ }
-
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
console.log("ceshiyong2");
- console.log(itemo.question.answers.length-1);
+ console.log(itemo.question.answers.length - 1);
return (
{itemt.answer_text === undefined ? (
@@ -3439,10 +3529,10 @@ class PollNewQuestbank extends Component {
className="mr20 max1010 input-flex-40 TextAreainput" disabled
placeholder='无法编辑!将由参与答题的人手动录入'>
{polls_status === undefined || polls_status === 1 ?
- indext>1?
-
+ indext > 1 ?
+
{
- itemo.question.question_type === 2?""
+ itemo.question.question_type === 2 ? ""
:
this.Deleteentrys(arrid, indext, true)}>
- :""
+ : ""
: ""}
) : (
this.HandleInputChanges(e, indexo, indext)}>
{polls_status === undefined || polls_status === 1 ?
- (indext>1?
+ (indext > 1 ?
this.Deleteentrys(arrid, indext, false)}>
{
- itemo.question.answers[itemo.question.answers.length-1].answer_text==="其他"&&itemo.question.answers.length-2===indext?
+ itemo.question.answers[itemo.question.answers.length - 1].answer_text === "其他" && itemo.question.answers.length - 2 === indext ?
this.Ewoption(itemo.question.id, itemo)}>
:
itemo.question.answers.length - 1 === indext ?
- this.Ewoption(itemo.question.id, itemo)}>
- :
+ this.Ewoption(itemo.question.id, itemo)}>
+ :
-
+
}
- :indext===1&&itemo.question.answers.length===2||indext===1&&itemo.question.answers.length===3? this.Ewoption(itemo.question.id, itemo)}>:"")
+ : indext === 1 && itemo.question.answers.length === 2 || indext === 1 && itemo.question.answers.length === 3 ?
+ this.Ewoption(itemo.question.id, itemo)}> : "")
: ""}
)}
@@ -3517,7 +3608,7 @@ class PollNewQuestbank extends Component {
{/* onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项*/}
{polls_status === undefined || polls_status === 1 ?
- ""
+ ""
: ""}
{polls_status === undefined || polls_status === 1 ?
@@ -3531,7 +3622,7 @@ class PollNewQuestbank extends Component {
onClick={() => this.Deleteadddom(indexo)}>取消
this.Deleteadddomtwo(indexo, itemo)}
- > 保存并继续
+ > 保存并继续
this.Deleteadddomthree(indexo, itemo)}>保存并退出
@@ -3574,7 +3665,8 @@ class PollNewQuestbank extends Component {
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return (
- indext >= 1 ?
: ""
+ indext >= 1 ?
+
: ""
)
})}
@@ -3582,13 +3674,14 @@ class PollNewQuestbank extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~
{/*可选最大*/}
{itemo.question.question_type === 2 ?
- // (
- // polls_status === undefined || polls_status === 1 ?
- //
- //
- //
this.Ewoption(itemo.question.id, itemo)}>新增选项
- //
- // {
- // newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
- // }
- //
- //
- //
- //
- //
- // this.Deleteadddom(indexo)}>取消
- // this.Deleteadddomtwo(indexo, itemo)}
- // >保存并继续
- // this.Deleteadddomthree(indexo, itemo)}> 保存并退出
- //
- //
- //
- //
- // :
- //
- //
- // this.Deleteadddom(indexo)}>取消
- // this.Deleteadddomtwo(indexo, itemo)}
- // > 保存并继续
- // this.Deleteadddomthree(indexo, itemo)}>保存并退出
- //
- //
- // )
- ""
+ // (
+ // polls_status === undefined || polls_status === 1 ?
+ //
+ //
+ //
this.Ewoption(itemo.question.id, itemo)}>新增选项
+ //
+ // {
+ // newoption === false ?
this.Addanotheroption(itemo.question.id)}>新增其他选项 : ""
+ // }
+ //
+ //
+ //
+ //
+ //
+ // this.Deleteadddom(indexo)}>取消
+ // this.Deleteadddomtwo(indexo, itemo)}
+ // >保存并继续
+ // this.Deleteadddomthree(indexo, itemo)}> 保存并退出
+ //
+ //
+ //
+ //
+ // :
+ //
+ //
+ // this.Deleteadddom(indexo)}>取消
+ // this.Deleteadddomtwo(indexo, itemo)}
+ // > 保存并继续
+ // this.Deleteadddomthree(indexo, itemo)}>保存并退出
+ //
+ //
+ // )
+ ""
: itemo.question.question_type === 3 ?
@@ -3667,7 +3760,7 @@ class PollNewQuestbank extends Component {
onClick={() => this.Deleteadddom(indexo)}>取消
this.Deleteadddomtwo(indexo, itemo)}
- >保存并继续
+ >保存并继续
this.Deleteadddomthree(indexo, itemo)}>保存并退出
@@ -3692,8 +3785,6 @@ class PollNewQuestbank extends Component {
}
-
-
- this.toWorkDetail()}>取消
+ this.toWorkDetail()}>取消
this.submitQuestionnaire()}>提交
@@ -3719,58 +3810,109 @@ class PollNewQuestbank extends Component {
// RouteHOC()
export default PollNewQuestbank
-{/*
*/}
-{/* {*/}
-{/* this.props.match.params.news === "new" ?*/}
-{/* this.state.Newedit === false ?*/}
-{/*
*/}
-{/*
*/}
-
-{/*
*/}
-{/*
this.addmysingles()}>单选题*/}
-{/*
this.addmydoubles()}>多选题*/}
-{/*
this.addmymainsint()}>主观题*/}
-{/*
*/}
-{/*
*/}
-{/* : ""*/}
-{/* :*/}
-{/*
*/}
-{/*
*/}
-{/*
*/}
-{/*
this.addmysingles()}>单选题*/}
-{/*
this.addmydoubles()}>多选题*/}
-{/*
this.addmymainsint()}>主观题*/}
-{/*
*/}
-{/*
*/}
-{/* }*/}
-{/*
*/}
-{/*{*/}
-{/* this.props.match.params.news === "new" ?*/}
-{/* (this.state.Newedit === false ?*/}
-{/*
*/}
-
-{/* : "")*/}
-{/* :*/}
-{/* */}
-{/*}*/}
\ No newline at end of file
+{/*
*/
+}
+{/* {*/
+}
+{/* this.props.match.params.news === "new" ?*/
+}
+{/* this.state.Newedit === false ?*/
+}
+{/*
*/
+}
+{/*
*/
+}
+
+{/*
*/
+}
+{/*
this.addmysingles()}>单选题*/
+}
+{/*
this.addmydoubles()}>多选题*/
+}
+{/*
this.addmymainsint()}>主观题*/
+}
+{/*
*/
+}
+{/*
*/
+}
+{/* : ""*/
+}
+{/* :*/
+}
+{/*
*/
+}
+{/*
*/
+}
+{/*
*/
+}
+{/*
this.addmysingles()}>单选题*/
+}
+{/*
this.addmydoubles()}>多选题*/
+}
+{/*
this.addmymainsint()}>主观题*/
+}
+{/*
*/
+}
+{/*
*/
+}
+{/* }*/
+}
+{/*
*/
+}
+{/*{*/
+}
+{/* this.props.match.params.news === "new" ?*/
+}
+{/* (this.state.Newedit === false ?*/
+}
+{/*
*/
+}
+
+{/* : "")*/
+}
+{/* :*/
+}
+{/* */
+}
+{/*}*/
+}
\ No newline at end of file
From c79b7c4848ca8610aa8a668cb120e4bbe1fa0ef8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sat, 31 Aug 2019 11:12:33 +0800
Subject: [PATCH 11/22] =?UTF-8?q?=E5=90=88=E5=B9=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/poll/PollNewQuestbank.js | 42 +++++++------------
1 file changed, 14 insertions(+), 28 deletions(-)
diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js
index f86e8515d..ea49425d9 100644
--- a/public/react/src/modules/courses/poll/PollNewQuestbank.js
+++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js
@@ -2185,13 +2185,6 @@ class PollNewQuestbank extends Component {
}
//最小值
HandleGradationGroupChangee = (value, index, max, length) => {
- // console.log("最小值");
- // console.log(value);
- // console.log(index);
- // console.log(max);
- // console.log(length);
-
- // debugger
var minbool = false;
var maxbool = false;
let arr = this.state.adddom;
@@ -2228,30 +2221,24 @@ class PollNewQuestbank extends Component {
//最大值
HandleGradationGroupChangeee = (value, index, minchoices, length) => {
- // console.log("2112");
- // console.log(value);
- // console.log(minchoices);
- // console.log("最大值");
- // console.log(value);
- // console.log(index);
- // console.log(minchoices);
- // console.log(length);
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
if (index === i) {
- if (parseInt(value) === 0 && parseInt(minchoices) === 0) {
- arr[i].question.min_choices = parseInt(0);
+ if(parseInt(value)===0&&parseInt(minchoices)===0){
+ arr[i].question.min_choices= parseInt(0);
arr[i].question.max_choices = parseInt(0);
- } else if (parseInt(minchoices) === 0) {
- arr[i].question.min_choices = parseInt(2);
- arr[i].question.max_choices = parseInt(value);
- } else if (parseInt(value) === 0 && parseInt(minchoices) > 0) {
- arr[i].question.min_choices = parseInt(minchoices);
+ }else if(parseInt(minchoices)===0){
+ arr[i].question.min_choices= parseInt(2);
arr[i].question.max_choices = parseInt(value);
- } else {
- arr[i].question.min_choices = minchoices === null ? 2 : minchoices === undefined ? 2 : minchoices === 0 ? 2 : parseInt(minchoices);
+ }
+ else if(parseInt(value)===0&&parseInt(minchoices)>0){
+ arr[i].question.min_choices= parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
}
+ else {
+ arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
+ arr[i].question.max_choices = parseInt(value);
+ }
}
}
// console.log(2119);
@@ -2259,7 +2246,6 @@ class PollNewQuestbank extends Component {
this.setState({
adddom: arr
})
- // console.log(this.state.adddom);
}
//提交题目//没有就创建新的题库,新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
@@ -3044,7 +3030,7 @@ class PollNewQuestbank extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~
{/*可选最大*/}