|
|
|
@ -243,39 +243,51 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
} else {
|
|
|
|
|
const url = `/exercise_banks/${pollid}.json`;
|
|
|
|
|
axios.get(url).then((result) => {
|
|
|
|
|
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
|
|
|
|
|
// })
|
|
|
|
|
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: 1,
|
|
|
|
|
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){
|
|
|
|
|
this.setState({
|
|
|
|
|
addonAfter:result.data.poll.name.length,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
@ -300,26 +312,40 @@ 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: 1,
|
|
|
|
|
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){
|
|
|
|
|
this.setState({
|
|
|
|
|
addonAfter:result.data.poll.name.length,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// console.log("有问卷~~~")
|
|
|
|
|
|
|
|
|
|
// this.setState({
|
|
|
|
|
// projects: result.data,
|
|
|
|
|
// pollid: pollidsy,
|
|
|
|
|
// 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,
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
}).catch((error) => {
|
|
|
|
@ -2326,41 +2352,41 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
}
|
|
|
|
|
// 创建问卷
|
|
|
|
|
onSaveExercise = () => {
|
|
|
|
|
if (this.state.Newedit === true) {
|
|
|
|
|
|
|
|
|
|
if (this.state.polls_nametest === undefined || this.state.polls_nametest === "") {
|
|
|
|
|
this.props.showNotification(`请输入标题`);
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let coursesId = this.props.match.params.coursesId;
|
|
|
|
|
const urlls = `/courses/${coursesId}/polls.json`
|
|
|
|
|
axios.post(urlls, {
|
|
|
|
|
polls_name: this.state.polls_nametest,
|
|
|
|
|
polls_description: this.state.polls_descriptiontest
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
if (result === undefined) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.state.Newedit === false;
|
|
|
|
|
this.props.showNotification(`问卷创建成功!`);
|
|
|
|
|
this.setState({
|
|
|
|
|
pollid: result.data.data.id,
|
|
|
|
|
Newedit: false,
|
|
|
|
|
mysave: false,
|
|
|
|
|
readOnlys: "readOnly",
|
|
|
|
|
cancellation: false,
|
|
|
|
|
});
|
|
|
|
|
// var currenturl = window.location.href;
|
|
|
|
|
// var newUrl = (currenturl.split("?"))[0];
|
|
|
|
|
// var newr=(newUrl.slice("new"))[0];
|
|
|
|
|
// console.log(newUrl);
|
|
|
|
|
// console.log("2301");
|
|
|
|
|
// console.log(newr);
|
|
|
|
|
// window.history.pushState('','',newUrl+'?tab='+e);
|
|
|
|
|
window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`;
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// if (this.state.Newedit === true) {
|
|
|
|
|
//
|
|
|
|
|
// if (this.state.polls_nametest === undefined || this.state.polls_nametest === "") {
|
|
|
|
|
// this.props.showNotification(`请输入标题`);
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// let coursesId = this.props.match.params.coursesId;
|
|
|
|
|
// const urlls = `/courses/${coursesId}/polls.json`
|
|
|
|
|
// axios.post(urlls, {
|
|
|
|
|
// polls_name: this.state.polls_nametest,
|
|
|
|
|
// polls_description: this.state.polls_descriptiontest
|
|
|
|
|
// }).then((result) => {
|
|
|
|
|
// if (result === undefined) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// this.state.Newedit === false;
|
|
|
|
|
// this.props.showNotification(`问卷创建成功!`);
|
|
|
|
|
// this.setState({
|
|
|
|
|
// pollid: result.data.data.id,
|
|
|
|
|
// Newedit: false,
|
|
|
|
|
// mysave: false,
|
|
|
|
|
// readOnlys: "readOnly",
|
|
|
|
|
// cancellation: false,
|
|
|
|
|
// });
|
|
|
|
|
// // var currenturl = window.location.href;
|
|
|
|
|
// // var newUrl = (currenturl.split("?"))[0];
|
|
|
|
|
// // var newr=(newUrl.slice("new"))[0];
|
|
|
|
|
// // console.log(newUrl);
|
|
|
|
|
// // console.log("2301");
|
|
|
|
|
// // console.log(newr);
|
|
|
|
|
// // window.history.pushState('','',newUrl+'?tab='+e);
|
|
|
|
|
// // window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`;
|
|
|
|
|
//
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
if (this.state.polls_nametest === undefined || this.state.polls_nametest === "") {
|
|
|
|
|
this.props.showNotification("请输入标题");
|
|
|
|
|
return
|
|
|
|
@ -2374,10 +2400,10 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var url = `/polls/${pollid}.json`;
|
|
|
|
|
var url = `/exercise_banks/${pollid}.json`;
|
|
|
|
|
axios.put(url, {
|
|
|
|
|
polls_name: this.state.polls_nametest,
|
|
|
|
|
polls_description: this.state.polls_descriptiontest
|
|
|
|
|
exercise_name: this.state.polls_nametest,
|
|
|
|
|
exercise_description: this.state.polls_descriptiontest
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
if (result !== undefined) {
|
|
|
|
|
this.props.showNotification(`问卷更新成功!`);
|
|
|
|
@ -2388,7 +2414,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
gotohome=()=>{
|
|
|
|
@ -2449,7 +2475,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
// console.log(this.state.projects===undefined?"":this.state.projects.poll_questions)
|
|
|
|
|
var displaymysave = (mysave === true) ? "" : "display:none;";
|
|
|
|
|
return (
|
|
|
|
|
<div className="newMain">
|
|
|
|
|
<div className=" clearfix">
|
|
|
|
|
{/*提示*/}
|
|
|
|
|
{Modalstype && Modalstype === true ? <Modals
|
|
|
|
|
modalsType={this.state.Modalstype}
|
|
|
|
@ -2459,7 +2485,14 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
modalsBottomval={this.state.ModalsBottomval}
|
|
|
|
|
loadtype={this.state.Loadtype}
|
|
|
|
|
/> : ""}
|
|
|
|
|
<div className="educontent mb50">
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
.newMains{ margin: 0 auto; padding-bottom: 235px !important; min-width:1200px; min-height: 800px !important;}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<div className="educontent newMains">
|
|
|
|
|
<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>
|
|
|
|
@ -2479,21 +2512,21 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
</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>*/}
|
|
|
|
|
<p className="fl color-black summaryname mt5">编辑问卷</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>
|
|
|
|
|
className=" fr font-16"></a>
|
|
|
|
|
{/*}*/}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
|
|
|
|
|
{
|
|
|
|
|
this.state.mysave === false ?
|
|
|
|
|
<div className="padding20-30 " style={{ background: '#fff', minHeight: "75px"}}>
|
|
|
|
|
<div style={{ background: '#fff', minHeight: "75px",padding: "30px"}}>
|
|
|
|
|
<div className="displayTitle font-16">
|
|
|
|
|
<span>{this.state.polls_nametest}</span>
|
|
|
|
|
|
|
|
|
@ -2558,7 +2591,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{
|
|
|
|
|
"padding": "20px 30px 50px",
|
|
|
|
|
"padding": "30px 30px 70px",
|
|
|
|
|
"position": "relative",
|
|
|
|
|
"border-bottom": "1px solid #EDEDED",
|
|
|
|
|
"margin-bottom": " 0px"
|
|
|
|
@ -2632,7 +2665,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span className="fr">合计 <span
|
|
|
|
|
className="color-blue">{this.state.mysingles === undefined ? "" : this.state.mydoubles === undefined ? "" : this.state.mymainsint === undefined ? "" : this.state.mysingles + this.state.mydoubles + this.state.mymainsint}</span> 题</span>
|
|
|
|
|
style={{color:"#FF6800"}}>{this.state.q_counts === undefined ? "" :this.state.q_counts}</span> 题</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -2641,7 +2674,6 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
{polls_status === undefined || polls_status === 1 ?
|
|
|
|
|
<div className="edu-back-white bor-bottom-greyE">
|
|
|
|
|
<div className=" mb10"></div>
|
|
|
|
|
<div style={{"padding": "20px 30px 20px 30px"}}>
|
|
|
|
|
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
|
|
|
|
|
className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>
|
|
|
|
|