|
|
|
@ -112,16 +112,16 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.props.match.params.news !== undefined) {
|
|
|
|
|
if (this.props.match.params.news === "new") {
|
|
|
|
|
this.state.Newedit === true;
|
|
|
|
|
this.setState({
|
|
|
|
|
Newedit: true,
|
|
|
|
|
mysave: true,
|
|
|
|
|
readOnlys: "",
|
|
|
|
|
cancellation: true,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// if (this.props.match.params.news !== undefined) {
|
|
|
|
|
// if (this.props.match.params.news === "new") {
|
|
|
|
|
// this.state.Newedit === true;
|
|
|
|
|
// this.setState({
|
|
|
|
|
// Newedit: true,
|
|
|
|
|
// mysave: true,
|
|
|
|
|
// readOnlys: "",
|
|
|
|
|
// cancellation: true,
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
this.Initializatio_data();
|
|
|
|
|
this.state.Newedit === false;
|
|
|
|
|
this.setState({
|
|
|
|
@ -129,8 +129,8 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
mysave: false,
|
|
|
|
|
readOnlys: "readOnly",
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
console.log("问卷返回");
|
|
|
|
|
console.log(this.props);
|
|
|
|
@ -185,7 +185,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
//课堂id
|
|
|
|
|
let coursesId = this.props.match.params.coursesId;
|
|
|
|
|
//时间id
|
|
|
|
|
let pollid = this.props.match.params.pollid;
|
|
|
|
|
let pollid = this.props.match.params.workid;
|
|
|
|
|
console.log(pollid);
|
|
|
|
|
// let coursesId = 557;
|
|
|
|
|
if (pollid === undefined) {
|
|
|
|
@ -241,49 +241,41 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
questionnair: false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
const url = `/polls/${pollid}/edit.json`;
|
|
|
|
|
const url = `/exercise_banks/${pollid}.json`;
|
|
|
|
|
axios.get(url).then((result) => {
|
|
|
|
|
if (result !== undefined)
|
|
|
|
|
|
|
|
|
|
// console.log("有问卷~~~")
|
|
|
|
|
// if (result.status === 200) {
|
|
|
|
|
// console.log(JSON.stringify(result.data))
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
polls_nametest: result.data.poll.polls_name,
|
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
projects: result.data,
|
|
|
|
|
pollid: pollid,
|
|
|
|
|
polls_status: result.data.poll.polls_status,
|
|
|
|
|
polls_name: result.data.poll.polls_name,
|
|
|
|
|
polls_description: result.data.poll.polls_description,
|
|
|
|
|
poll_questions: result.data.poll_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,
|
|
|
|
|
polls_nametest: result.data.poll.polls_name,
|
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
|
questionnair: true,
|
|
|
|
|
left_banner_id:result.data.left_banner_id
|
|
|
|
|
})
|
|
|
|
|
// console.log(this.state.polls_nametest)
|
|
|
|
|
// console.log(this.state.polls_descriptiontest)
|
|
|
|
|
if (result)
|
|
|
|
|
console.log("247");
|
|
|
|
|
console.log(result);
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// this.setState({
|
|
|
|
|
// projects: result.data,
|
|
|
|
|
// pollid: pollid,
|
|
|
|
|
// polls_status: result.data.poll.polls_status,
|
|
|
|
|
// polls_name: result.data.poll.polls_name,
|
|
|
|
|
// polls_description: result.data.poll.polls_description,
|
|
|
|
|
// poll_questions: result.data.poll_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,
|
|
|
|
|
// polls_nametest: result.data.poll.polls_name,
|
|
|
|
|
// polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
|
// questionnair: true,
|
|
|
|
|
// left_banner_id:result.data.left_banner_id
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
@ -297,7 +289,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
if (this.state.pollid !== undefined) {
|
|
|
|
|
pollidsy = this.state.pollid;
|
|
|
|
|
if (pollidsy === null || pollidsy === undefined) {
|
|
|
|
|
pollidsy = this.props.match.params.pollid;
|
|
|
|
|
pollidsy = this.props.match.params.workid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2195,7 +2187,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提交题目//没有就创建新的题库,新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
|
|
|
|
|
submitQuestionnaire = (mews) => {
|
|
|
|
|
submitQuestionnaire = () => {
|
|
|
|
|
// console.log("调用了submitQuestionnaire")
|
|
|
|
|
if (this.state.Newedit === true) {
|
|
|
|
|
|
|
|
|
@ -2212,7 +2204,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
}
|
|
|
|
|
var pollid;
|
|
|
|
|
if (this.state.pollid === undefined) {
|
|
|
|
|
pollid = this.props.match.params.pollid;
|
|
|
|
|
pollid = this.props.match.params.workid;
|
|
|
|
|
} else {
|
|
|
|
|
pollid = this.state.pollid;
|
|
|
|
|
}
|
|
|
|
@ -2375,7 +2367,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
var pollid;
|
|
|
|
|
if (this.state.pollid === undefined) {
|
|
|
|
|
pollid = this.props.match.params.pollid;
|
|
|
|
|
pollid = this.props.match.params.workid;
|
|
|
|
|
} else {
|
|
|
|
|
pollid = this.state.pollid;
|
|
|
|
|
}
|
|
|
|
@ -2433,7 +2425,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
// console.log([[`${maps[polls_status && polls_status]}`]] + "");
|
|
|
|
|
|
|
|
|
|
const IsAdmin = this.props.isAdmin();
|
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
|
// const {getFieldDecorator} = this.props.form;
|
|
|
|
|
const formItemLayout = {
|
|
|
|
|
labelCol: {
|
|
|
|
|
xs: {span: 24},
|
|
|
|
@ -2470,29 +2462,31 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
<p className="clearfix mb20 mt10">
|
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
|
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
|
{
|
|
|
|
|
this.props.match.params.news === "new"?
|
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue"
|
|
|
|
|
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
|
|
|
|
|
:
|
|
|
|
|
{/*{*/}
|
|
|
|
|
{/* this.props.match.params.news === "new"?*/}
|
|
|
|
|
{/* <a className=" btn colorgrey fl hovercolorblue"*/}
|
|
|
|
|
{/* href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>*/}
|
|
|
|
|
{/* :*/}
|
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue"
|
|
|
|
|
href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}>问卷</a>
|
|
|
|
|
}
|
|
|
|
|
{/*}*/}
|
|
|
|
|
|
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
|
<span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span>
|
|
|
|
|
{/*<span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span>*/}
|
|
|
|
|
<span>编辑</span>
|
|
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
<div className="clearfix mb30">
|
|
|
|
|
<p
|
|
|
|
|
className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>
|
|
|
|
|
{
|
|
|
|
|
this.props.match.params.news === "new" ?
|
|
|
|
|
<a href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}
|
|
|
|
|
className=" fr font-16">返回</a>
|
|
|
|
|
:
|
|
|
|
|
{/*<p className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>*/}
|
|
|
|
|
<p className="fl color-black summaryname mt5">编辑问卷</p>
|
|
|
|
|
{/*{*/}
|
|
|
|
|
{/* this.props.match.params.news === "new" ?*/}
|
|
|
|
|
{/* <a href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}*/}
|
|
|
|
|
{/* className=" fr font-16">返回</a>*/}
|
|
|
|
|
{/* :*/}
|
|
|
|
|
<a href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}
|
|
|
|
|
className=" fr font-16">返回</a>
|
|
|
|
|
}
|
|
|
|
|
{/*}*/}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
|
|
|
|
@ -2528,15 +2522,16 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
style={{"color": "#f5222d"}}>*</span>问卷标题
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
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.state.mysave === false ?
|
|
|
|
|
<div className="fr">
|
|
|
|
|
<span><a onClick={() => this.adddomeditit()}><Tooltip title="编辑"><i
|
|
|
|
|
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a></span>
|
|
|
|
|
</div>
|
|
|
|
|
: "")
|
|
|
|
|
:""
|
|
|
|
|
: ""
|
|
|
|
|
// )
|
|
|
|
|
// :""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
@ -3474,25 +3469,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{polls_status === undefined || polls_status === 1 ?
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
this.props.match.params.news === "new" ?
|
|
|
|
|
this.state.Newedit === false ?
|
|
|
|
|
<div>
|
|
|
|
|
<div className=" mb10"></div>
|
|
|
|
|
|
|
|
|
|
<div style={{"padding": "10px 30px 20px 30px"}}>
|
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
|
|
|
|
|
className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>
|
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmydoubles()}><i
|
|
|
|
|
className="iconfont icon-tianjiafangda font-15 mr10"></i>多选题</ActionBtn>
|
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmymainsint()}><i
|
|
|
|
|
className="iconfont icon-tianjiafangda font-15 mr10"></i>主观题</ActionBtn>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
: ""
|
|
|
|
|
:
|
|
|
|
|
<div>
|
|
|
|
|
<div>
|
|
|
|
|
<div className=" mb10"></div>
|
|
|
|
|
<div style={{"padding": "10px 30px 20px 30px"}}>
|
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
|
|
|
|
@ -3503,49 +3480,21 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
className="iconfont icon-tianjiafangda font-15 mr10"></i>主观题</ActionBtn>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
: <div></div>}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
this.props.match.params.news === "new" ?
|
|
|
|
|
(this.state.Newedit === false ?
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
"display": "flex",
|
|
|
|
|
"justify-content": "center",
|
|
|
|
|
"align-items": "center",
|
|
|
|
|
"width": "100%",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<li className="clearfix mt30 mb50">
|
|
|
|
|
<a className="defalutCancelbtn fl mr20" onClick={() => this.props.history.goBack()}>取消</a>
|
|
|
|
|
<a type="primary" className="defalutSubmitbtn fl"
|
|
|
|
|
onClick={() => this.submitQuestionnaire(this.props.match.params.news)}>提交</a>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
: "")
|
|
|
|
|
:
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
"display": "flex",
|
|
|
|
|
"justify-content": "center",
|
|
|
|
|
"align-items": "center",
|
|
|
|
|
"width": "100%",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<li className="clearfix mt30 mb50">
|
|
|
|
|
<a className="defalutCancelbtn fl mr20"onClick={() => this.props.history.goBack()}>取消</a>
|
|
|
|
|
<a type="primary" className=" defalutSubmitbtn fl"
|
|
|
|
|
onClick={() => this.submitQuestionnaire(this.props.match.params.news)}>提交</a>
|
|
|
|
|
</li>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
|
|
|
|
|
"width": "100%",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<li className="clearfix mt30 mb50 fl">
|
|
|
|
|
<a className="defalutCancelbtn fl mr20"onClick={() => this.props.history.goBack()}>取消</a>
|
|
|
|
|
<a type="primary" className=" defalutSubmitbtn fl"
|
|
|
|
|
onClick={() => this.submitQuestionnaire()}>提交</a>
|
|
|
|
|
</li>
|
|
|
|
|
</div>
|
|
|
|
|
{/*</Form>*/}
|
|
|
|
|
</div>
|
|
|
|
|
<div ref='targetElement'></div>
|
|
|
|
@ -3557,3 +3506,58 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
// RouteHOC()
|
|
|
|
|
export default PollNewQuestbank
|
|
|
|
|
{/*<div>*/}
|
|
|
|
|
{/* {*/}
|
|
|
|
|
{/* this.props.match.params.news === "new" ?*/}
|
|
|
|
|
{/* this.state.Newedit === false ?*/}
|
|
|
|
|
{/* <div>*/}
|
|
|
|
|
{/* <div className=" mb10"></div>*/}
|
|
|
|
|
|
|
|
|
|
{/* <div style={{"padding": "10px 30px 20px 30px"}}>*/}
|
|
|
|
|
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i*/}
|
|
|
|
|
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>*/}
|
|
|
|
|
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmydoubles()}><i*/}
|
|
|
|
|
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>多选题</ActionBtn>*/}
|
|
|
|
|
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmymainsint()}><i*/}
|
|
|
|
|
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>主观题</ActionBtn>*/}
|
|
|
|
|
{/* </div>*/}
|
|
|
|
|
{/* </div>*/}
|
|
|
|
|
{/* : ""*/}
|
|
|
|
|
{/* :*/}
|
|
|
|
|
{/* <div>*/}
|
|
|
|
|
{/* <div className=" mb10"></div>*/}
|
|
|
|
|
{/* <div style={{"padding": "10px 30px 20px 30px"}}>*/}
|
|
|
|
|
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i*/}
|
|
|
|
|
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>*/}
|
|
|
|
|
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmydoubles()}><i*/}
|
|
|
|
|
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>多选题</ActionBtn>*/}
|
|
|
|
|
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmymainsint()}><i*/}
|
|
|
|
|
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>主观题</ActionBtn>*/}
|
|
|
|
|
{/* </div>*/}
|
|
|
|
|
{/* </div>*/}
|
|
|
|
|
{/* }*/}
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
{/*{*/}
|
|
|
|
|
{/* this.props.match.params.news === "new" ?*/}
|
|
|
|
|
{/* (this.state.Newedit === false ?*/}
|
|
|
|
|
{/* <div*/}
|
|
|
|
|
{/* style={{*/}
|
|
|
|
|
{/* "display": "flex",*/}
|
|
|
|
|
{/* "justify-content": "center",*/}
|
|
|
|
|
{/* "align-items": "center",*/}
|
|
|
|
|
{/* "width": "100%",*/}
|
|
|
|
|
{/* }}*/}
|
|
|
|
|
{/* >*/}
|
|
|
|
|
{/* <li className="clearfix mt30 mb50">*/}
|
|
|
|
|
{/* <a className="defalutCancelbtn fl mr20" onClick={() => this.props.history.goBack()}>取消</a>*/}
|
|
|
|
|
{/* <a type="primary" className="defalutSubmitbtn fl"*/}
|
|
|
|
|
{/* onClick={() => this.submitQuestionnaire(this.props.match.params.news)}>提交</a>*/}
|
|
|
|
|
{/* </li>*/}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* </div>*/}
|
|
|
|
|
|
|
|
|
|
{/* : "")*/}
|
|
|
|
|
{/* :*/}
|
|
|
|
|
{/* */}
|
|
|
|
|
{/*}*/}
|