Merge branches 'dev_Ysm' and 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysm

dev_cs_new
杨树明 6 years ago
commit 26b315555d

@ -260,7 +260,12 @@ class FilesController < ApplicationController
return normal_status(-2, "该课程下没有id为 #{params[:id]}的资源") if @file.nil?
return normal_status(403, "您没有权限进行该操作") if @user != @file.author && !@user.teacher_of_course?(@course) && !@file.public?
@is_pdf = false
file_content_type = @file.content_type
file_ext_type = File.extname(@file.filename).strip.downcase[1..-1]
if (file_content_type.present? && file_content_type.downcase.include?("pdf")) || (file_ext_type.present? && file_ext_type.include?("pdf"))
@is_pdf = true
end
@attachment_histories = @file.attachment_histories
end

@ -1,2 +1,3 @@
json.is_pdf @is_pdf
json.partial! 'attachments/attachment_small', attachment: @file
json.partial! "attachment_histories/list", attachment_histories: @attachment_histories

@ -336,6 +336,16 @@ class ExerciseReviewAndAnswer extends Component{
}
// 选择题,切换答案
changeOption = (index,ids) =>{
//console.log(index+" "+ids);
this.setState(
(prevState) => ({
exercise_questions : update(prevState.exercise_questions, {[index]: { user_answer: {$set: ids} }}),
})
)
}
//简答题 显示和隐藏答案
changeA_flag=(index,status)=>{
this.setState(
@ -726,6 +736,7 @@ class ExerciseReviewAndAnswer extends Component{
exercise={exercise}
questionType={item}
user_exercise_status={user_exercise_status}
changeOption={(index,ids)=>this.changeOption(index,ids)}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
></Single>
@ -739,6 +750,7 @@ class ExerciseReviewAndAnswer extends Component{
exercise={exercise}
questionType={item}
user_exercise_status={user_exercise_status}
changeOption={(index,ids)=>this.changeOption(index,ids)}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}

@ -163,6 +163,10 @@ class Testpapersettinghomepage extends Component{
}
}
//打开pdf
confpdf = (url) =>{
window.open(url);
}
/// 确认是否下载
confirmysl(url,child){
let params ={}
@ -372,7 +376,7 @@ class Testpapersettinghomepage extends Component{
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`,this.child)}>学生成绩</a></li>
<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/export_exercise`,this.child)} >空白试卷</a></li>
<li><a onClick={()=>this.confpdf(`/api/exercises/${this.props.match.params.Id}/export_exercise`)} >空白试卷</a></li>
{/*<li><a onClick={()=>this.confirmysl(`/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval===null||this.state.groupyslsval===undefined?null:this.state.groupyslsval}`)}>学生答题试卷</a></li>*/}
</ul>
</li></Spin>:""}

@ -15,6 +15,7 @@ class Multiple extends Component{
saveId=(value)=>{
let question_id=this.props.questionType.question_id;
let url=`/exercise_questions/${question_id}/exercise_answers.json`;
let {index}=this.props;
axios.post((url),{
exercise_choice_id:value
}).then((result)=>{
@ -25,6 +26,7 @@ class Multiple extends Component{
}else{
k=0;
}
this.props.changeOption && this.props.changeOption(index,value);
this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,k);
}
}).catch((error)=>{
@ -42,14 +44,14 @@ class Multiple extends Component{
console.log(questionType);
return(
<div className="pl30 pr30 singleDisplay">
<Checkbox.Group disabled={ user_exercise_status == 1 ? true : false } onChange={this.saveId} defaultValue={questionType.user_answer}>
<Checkbox.Group disabled={ user_exercise_status == 1 ? true : false } onChange={this.saveId} value={questionType.user_answer}>
{
questionType.question_choices && questionType.question_choices.map((item,key)=>{
let prefix = `${tagArray[key]}.`
return(
<p className="clearfix mb15 df">
<Checkbox className="fl lineh-20 " value={item.choice_id}>{prefix}</Checkbox>
<Checkbox className="fl lineh-15 df mr8 mt2" value={item.choice_id}>{prefix}</Checkbox>
{/* <span class="fl lineh-20 mt1"></span> */}
{/* <span style={{display:"inline-block"}} className="markdown-body " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
<MarkdownToHtml content={item.choice_text} selector={'multiple_' + (this.props.index + 1) + (key + 1)}

@ -16,11 +16,13 @@ class single extends Component{
changeItem=(e)=>{
let choiceId=e.target.value;
let question_id=this.props.questionType.question_id;
let {index}=this.props;
let url=`/exercise_questions/${question_id}/exercise_answers.json`;
axios.post((url),{
exercise_choice_id:choiceId
}).then((result)=>{
if(result){
this.props.changeOption && this.props.changeOption(index,[choiceId]);
this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,1);
}
}).catch((error)=>{
@ -38,12 +40,12 @@ class single extends Component{
let isJudge = questionType.question_type == 2
return(
<div className="pl30 pr30 singleDisplay">
<Radio.Group disabled={ user_exercise_status == 1 ? true : false } defaultValue={questionType.user_answer[0]} onChange={this.changeItem}>
<Radio.Group disabled={ user_exercise_status == 1 ? true : false } value={questionType.user_answer[0]} onChange={this.changeItem}>
{
questionType.question_choices && questionType.question_choices.map((item,key)=>{
let prefix = isJudge ? undefined : `${tagArray[key]}.`
return(
<p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40"}>
<p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40 df"}>
<Radio className="fl lineh-20" value={item.choice_id}>{prefix}</Radio>
{/* <span className="fl lineh-20 mr3 "></span> */}
{/* <span style={{display:"inline-block", 'margin-top': '-1px'}} className="markdown-body fl " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}

@ -367,9 +367,9 @@ class Listofworksstudentone extends Component {
render: (text, record) => (
<span>
{
record.submitstate === "未提交" ?<span style={{ color: '#9A9A9A',cursor:"default"}}>--</span>
record.submitstate === "未提交" ?<span style={{ color: '#9A9A9A'}}>--</span>
:
<span style={{textAlign: "center",cursor:"default"}}
<span style={{textAlign: "center"}}
className="color-blue"
onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating}</span>
}
@ -691,9 +691,9 @@ class Listofworksstudentone extends Component {
align: 'center',
className:'font-14',
render: (text, record) => (
record.submitstate === "未提交" ? <span style={{ color: '#9A9A9A',cursor:"default"}}>--</span> :
record.submitstate === "未提交" ? <span style={{ color: '#9A9A9A'}}>--</span> :
<span>
<a style={{textAlign: "center",cursor:"default"}} className="color-blue"
<a style={{textAlign: "center"}} className="color-blue"
onClick={() => this.Viewstudenttraininginformationt(record)}>{record.operating}</a>
</span>
)
@ -985,9 +985,9 @@ class Listofworksstudentone extends Component {
align: 'center',
className:'font-14',
render: (text, record) => (
record.submitstate === "未提交" ? <span style={{ color: '#9A9A9A',cursor:"default"}}>--</span> :
record.submitstate === "未提交" ? <span style={{ color: '#9A9A9A'}}>--</span> :
<span>
<a style={{textAlign: "center",cursor:"default"}} className="color-blue"
<a style={{textAlign: "center"}} className="color-blue"
onClick={() => this.Viewstudenttraininginformationt(record)}>{record.operating}</a>
</span>
)

Loading…
Cancel
Save