dev_aliyun_beta
杨树明 6 years ago
commit 62447ca824

@ -901,9 +901,9 @@ class PollsController < ApplicationController
error_question = [] error_question = []
@poll_multi_questions.each do |q| @poll_multi_questions.each do |q|
poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size
if q.max_choices.present? && (poll_user_votes > q.max_choices) if q.max_choices.present? && (q.max_choices > 0) && (poll_user_votes > q.max_choices)
error_messages = "#{q.question_number}题:超过最大选项限制" error_messages = "#{q.question_number}题:超过最大选项限制"
elsif q.min_choices.present? && (poll_user_votes < q.min_choices) elsif q.min_choices.present? && (q.min_choices > 0)&& (poll_user_votes < q.min_choices)
error_messages = "#{q.question_number}题:不得少于最小选项限制" error_messages = "#{q.question_number}题:不得少于最小选项限制"
else else
error_messages = nil error_messages = nil
@ -936,7 +936,7 @@ class PollsController < ApplicationController
def commit_result def commit_result
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@poll_users = @poll.all_poll_users(current_user.id) @poll_users = @poll.all_poll_users(current_user.id).where(commit_status:1) # 问卷已提交的用户
@poll_commit_ids = @poll_users.commit_by_status(1).pluck(:user_id) #问卷提交用户的id @poll_commit_ids = @poll_users.commit_by_status(1).pluck(:user_id) #问卷提交用户的id
@page = params[:page] || 1 @page = params[:page] || 1
@limit = params[:limit] || 10 @limit = params[:limit] || 10

@ -18,8 +18,8 @@ class Users::QuestionBanksController < Users::BaseController
def load_question_banks_solve_count def load_question_banks_solve_count
question_bank_ids = @question_banks.map(&:id) question_bank_ids = @question_banks.map(&:id)
@solve_count_map = @solve_count_map =
case params[:category] case params[:object_type]
when 'common', 'group' then when 'normal', 'group' then
StudentWork.where(is_delete: false, work_status: [1, 2, 3]).joins(:homework_common) StudentWork.where(is_delete: false, work_status: [1, 2, 3]).joins(:homework_common)
.where(homework_commons: { homework_bank_id: question_bank_ids }) .where(homework_commons: { homework_bank_id: question_bank_ids })
.group('homework_commons.homework_bank_id').count .group('homework_commons.homework_bank_id').count
@ -42,14 +42,14 @@ class Users::QuestionBanksController < Users::BaseController
end end
def query_params def query_params
params.permit(:type, :category, :course_list_id, :sort_by, :sort_direction) params.permit(:type, :object_type, :course_list_id, :sort_by, :sort_direction)
end end
def check_query_params! def check_query_params!
params[:type] = 'personal' if params[:type].blank? || !%w(personal publicly).include?(params[:type]) params[:type] = 'personal' if params[:type].blank? || !%w(personal publicly).include?(params[:type])
if params[:category].blank? || !%w(common group exercise poll gtask gtopic).include?(params[:category]) if params[:object_type].blank? || !%w(normal group exercise poll gtask gtopic).include?(params[:object_type])
params[:category] = 'common' params[:object_type] = 'normal'
end end
if params[:sort_by].blank? || !%w(updated_at name contributor).include?(params[:sort_by]) if params[:sort_by].blank? || !%w(updated_at name contributor).include?(params[:sort_by])

@ -22,8 +22,8 @@ class Users::QuestionBankService
course_lists = CourseList.joins(relation_name).where.not(relation_name => { id: nil }) course_lists = CourseList.joins(relation_name).where.not(relation_name => { id: nil })
category_condition = category_condition =
case params[:category] case params[:object_type]
when 'common' then { homework_type: 1 } when 'normal' then { homework_type: 1 }
when 'group' then { homework_type: 3 } when 'group' then { homework_type: 3 }
when 'exercise' then { container_type: 'Exercise' } when 'exercise' then { container_type: 'Exercise' }
when 'poll' then { container_type: 'Poll' } when 'poll' then { container_type: 'Poll' }
@ -47,8 +47,8 @@ class Users::QuestionBankService
def class_name def class_name
@_class_name ||= begin @_class_name ||= begin
case params[:category] case params[:object_type]
when 'common', 'group' then 'HomeworkBank' when 'normal', 'group' then 'HomeworkBank'
when 'exercise', 'poll' then 'ExerciseBank' when 'exercise', 'poll' then 'ExerciseBank'
when 'gtask' then 'GtaskBank' when 'gtask' then 'GtaskBank'
when 'gtopic' then 'GtopicBank' when 'gtopic' then 'GtopicBank'
@ -58,8 +58,8 @@ class Users::QuestionBankService
end end
def category_filter(relations) def category_filter(relations)
case params[:category] case params[:object_type]
when 'common' then when 'normal' then
relations.where(homework_type: 1) relations.where(homework_type: 1)
when 'group' then when 'group' then
relations.where(homework_type: 3) relations.where(homework_type: 3)

@ -31,6 +31,11 @@ else
json.question_status @question_status json.question_status @question_status
end end
exercise_type = 3
if @t_user_exercise_status == 3 && @exercise.answer_open
exercise_type = 4
end
json.partial! "exercises/exercise_scores" json.partial! "exercises/exercise_scores"
json.exercise_questions do json.exercise_questions do
@ -57,7 +62,7 @@ json.exercise_questions do
shixun_challenges: question.exercise_shixun_challenges, shixun_challenges: question.exercise_shixun_challenges,
user_answer: question_info[:answered_content], user_answer: question_info[:answered_content],
choices:question.exercise_choices, choices:question.exercise_choices,
exercise_type:3, exercise_type:exercise_type,
shixun_type:question_info[:shixun_type], shixun_type:question_info[:shixun_type],
ques_position: q[:ques_number], ques_position: q[:ques_number],
edit_type:nil edit_type:nil

@ -14,7 +14,7 @@ if @poll_questions_count > 0
json.array! @poll_questions do |question| json.array! @poll_questions do |question|
json.partial! "polls/commit_answers_result", question: question, json.partial! "polls/commit_answers_result", question: question,
answers:question.poll_answers, answers:question.poll_answers,
question_votes:question.poll_votes #问题的全部答案 question_votes:question.poll_votes.where(user_id:@poll_commit_ids) #问题的全部答案
end end
end end
else else

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -55,6 +55,9 @@ html, body {
.markdown-body p { .markdown-body p {
white-space: pre-wrap; white-space: pre-wrap;
} }
.markdown-body > p {
line-height: 25px;
}
/* https://www.educoder.net/courses/2346/group_homeworks/34405/question */ /* https://www.educoder.net/courses/2346/group_homeworks/34405/question */
.renderAsHtml.markdown-body p { .renderAsHtml.markdown-body p {
white-space: inherit; white-space: inherit;

@ -129,7 +129,7 @@ class fillEmpty extends Component{
} }
{ {
// 答案公开,且试卷已经截止 // 答案公开,且试卷已经截止
isAdmin && questionType.standard_answer &&
<div> <div>
<p className="bor-top-greyE pt20 mt20 font-16 mb10">参考答案</p> <p className="bor-top-greyE pt20 mt20 font-16 mb10">参考答案</p>
{ questionType.standard_answer && questionType.standard_answer.map((item,k)=>{ { questionType.standard_answer && questionType.standard_answer.map((item,k)=>{

@ -85,9 +85,9 @@ class simpleAnswer extends Component{
</div> </div>
} }
{ {
isStudent && exercise.answer_open==true && exercise.exercise_status == 3 ? isStudent && questionType.standard_answer ?
<div className="bor-top-greyE pt20 mt20 standardAnswer"> <div className="bor-top-greyE pt20 mt20 standardAnswer">
<p>参考答案</p> <p className="mb10 font-16">参考答案</p>
{/* <li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.standard_answer && questionType.standard_answer[0])}}></li> */} {/* <li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.standard_answer && questionType.standard_answer[0])}}></li> */}
<MarkdownToHtml content={questionType.standard_answer && questionType.standard_answer[0]} selector={'simgle_standard2_' + (this.props.index + 1)} <MarkdownToHtml content={questionType.standard_answer && questionType.standard_answer[0]} selector={'simgle_standard2_' + (this.props.index + 1)}
className="answerStyle" className="answerStyle"

@ -125,7 +125,6 @@ class studentsList extends Component{
isSpin:false, isSpin:false,
DownloadType:false, DownloadType:false,
DownloadMessageval:undefined, DownloadMessageval:undefined,
donwloading:false,
} }
} }
/// 确认是否下载 /// 确认是否下载
@ -153,21 +152,16 @@ class studentsList extends Component{
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); window.open("/api"+url, '_blank');
this.setState({ donwloading: true }) // downloadFile({
downloadFile({ // url: url,
url: url, // successCallback: (url) => {
successCallback: (url) => { // console.log('successCallback')
console.log('successCallback') // },
this.setState({ donwloading: false }) // failCallback: (responseHtml, url) => {
// console.log('failCallback')
}, // }
failCallback: (responseHtml, url) => { // })
console.log('failCallback')
this.setState({ donwloading: false })
}
})
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -609,22 +603,20 @@ class studentsList extends Component{
`}</style> `}</style>
{ isAdmin && { isAdmin &&
<Spin spinning={this.state.donwloading} style={{ }}>
<li className="li_line drop_down fr color-blue font-16"> <li className="li_line drop_down fr color-blue font-16">
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-20px", "left": "unset", "height": "auto"}}> <ul className="drop_down_menu" style={{"right": "-20px", "left": "unset", "height": "auto"}}>
<li onClick={(i) => this.confirmysl(exportUrltwo)}><a <li><a
onClick={(i) => this.confirmysl(exportUrltwo)}>课堂信息</a> onClick={(i) => this.confirmysl(exportUrltwo)}>课堂信息</a>
</li> </li>
<li onClick={(i) => this.confirmysl(exportUrlthree)}><a <li><a
onClick={(i) => this.confirmysl(exportUrlthree)}>活跃度</a> onClick={(i) => this.confirmysl(exportUrlthree)}>活跃度</a>
</li> </li>
<li onClick={(i) => this.confirmysl(exportUrl)}><a <li><a
onClick={(i) => this.confirmysl(exportUrl)}>总成绩</a> onClick={(i) => this.confirmysl(exportUrl)}>总成绩</a>
</li> </li>
</ul> </ul>
</li> </li>
</Spin>
} }
{/*<WordsBtn style="blue" className="" onClick={(url)=>this.confirmysl(exportUrl)} >导出成绩</WordsBtn>*/} {/*<WordsBtn style="blue" className="" onClick={(url)=>this.confirmysl(exportUrl)} >导出成绩</WordsBtn>*/}
{/* */} {/* */}

@ -679,7 +679,7 @@ class CoursesNew extends Component {
} }
.yslzxueshiskmc .ant-input-group{ .yslzxueshiskmc .ant-input-group{
width: 720px !important; width: 704px !important;
} }
.yslzxueshisy span .ant-input-group-addon{ .yslzxueshisy span .ant-input-group-addon{
width: 65px !important; width: 65px !important;
@ -690,10 +690,10 @@ class CoursesNew extends Component {
background-color: #fafafa!important; background-color: #fafafa!important;
} }
.yslzxueshiskmc .ant-input-group-wrapper{ .yslzxueshiskmc .ant-input-group-wrapper{
width: 720px !important; width: 704px !important;
} }
.yslzxueshiskmcs .ant-input-group-wrapper{ .yslzxueshiskmcs .ant-input-group-wrapper{
width: 720px !important; width: 704px !important;
} }
` `
}</style> }</style>

@ -35,102 +35,106 @@ class PollDetailTabThird extends Component{
render(){ render(){
let {pollDetail}=this.state; let {pollDetail}=this.state;
return( return(
<div className="edu-back-white"> <div>
{ {
pollDetail && pollDetail.poll.polls_description && pollDetail && pollDetail.poll.polls_description &&
<p style={{whiteSpace:"pre-wrap"}} className="color-grey-9 padding20-30 edu-back-white">{ pollDetail.poll.polls_description }</p> <p style={{backgroundColor:"#F2F9FF",whiteSpace:"pre-wrap"}} className="color-blue pt15 pb15 pl30 pr30">{ pollDetail.poll.polls_description }</p>
} }
<p className="padding20-30 clearfix edu-txt-left" style={{background:'#FAFAFA'}}> <div className="edu-back-white">
{ pollDetail && pollDetail.question_types.q_counts===0 ? "" : <p className="padding20-30 clearfix bor-bottom-greyE edu-txt-left">
<span className="color-grey-3"> { pollDetail && pollDetail.question_types.q_counts===0 ? "" :
{ <span className="color-grey-3">
pollDetail && pollDetail.question_types.q_counts > 0 &&
<span>合计{pollDetail.question_types.q_counts}</span>
}
{
pollDetail && pollDetail.question_types.q_singles > 0 &&
<span className="mr15 color-grey-9">单选题{pollDetail.question_types.q_singles}</span>
}
{
pollDetail && pollDetail.question_types.q_doubles > 0 &&
<span className="mr15 color-grey-9">多选题{pollDetail.question_types.q_doubles}</span>
}
{
pollDetail && pollDetail.question_types.q_mains > 0 &&
<span className="color-grey-9">主观题{pollDetail.question_types.q_mains}</span>
}
</span>
}
</p>
{
pollDetail && pollDetail.questions.map((item,key)=>{
return(
<div className="previewList">
<p className="pl30 pr30 pt30 pb15 font-16 clearfix">
<span className="color-blue mr8 fl">{item.question.question_number}{map[item.question.question_type]}</span>
{ item.question.is_necessary==1 ? <span className="mustAnswer fl ml10 mr10">必答</span>:<span className="mustAnswer fl ml10 mr10"></span> }
{ item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ?
<span className="color-grey-9 font-14 fl mt2">
{
item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" :
"可选"+item.question.min_choices+"-"+item.question.max_choices+"项"
}
</span>:""
}
</p>
<li className="pl30 pr30 pb15">{item.question.question_title}</li>
{ {
// 单选题 pollDetail && pollDetail.question_types.q_counts > 0 &&
item.question.question_type==1 && <span>合计{pollDetail.question_types.q_counts}</span>
<Radio.Group className="answerList" disabled>
{
item.question.answers.map((index,k)=>{
return(
<li className="df">
<Radio className="fl" value={index.answer_id}></Radio>
<span className={index.answer_text=="其他"?"break-word":"break-word flex1"}>{index.answer_text}</span>
{
index.answer_text=="其他" ? <p className="textLine"></p>:""
}
</li>
)
})
}
</Radio.Group>
} }
{ {
// 多选题 pollDetail && pollDetail.question_types.q_singles > 0 &&
item.question.question_type==2 && <span className="mr15 color-grey-9">单选题{pollDetail.question_types.q_singles}</span>
<Checkbox.Group className="answerList" disabled>
{
item.question.answers.map((index,k)=>{
return(
<li className="df" key={k}>
<Checkbox className="fl mr8" value={index.answer_id} key={index.answer_id}></Checkbox>
<span className={index.answer_text=="其他"?"break-word":"break-word flex1"}>{index.answer_text}</span>
{
index.answer_text=="其他" ? <p className="textLine"></p>:""
}
</li>
)
})
}
</Checkbox.Group>
} }
{ {
// 主观题 pollDetail && pollDetail.question_types.q_doubles > 0 &&
item.question.question_type == 3 && <span className="mr15 color-grey-9">多选题{pollDetail.question_types.q_doubles}</span>
<div className="mt10 pl30 pr30 pb20">
<textarea placeholder="在此填入答案" readOnly className="winput-100-130"></textarea>
</div>
} }
{
</div> pollDetail && pollDetail.question_types.q_mains > 0 &&
) <span className="color-grey-9">主观题{pollDetail.question_types.q_mains}</span>
}) }
} </span>
}
</p>
{
pollDetail && pollDetail.questions.map((item,key)=>{
console.log("ddd");
console.log(item.question.min_choices);
return(
<div className="previewList">
<p className="pl30 pr30 pt30 pb15 font-16 clearfix">
<span className="color-blue mr8 fl">{item.question.question_number}{map[item.question.question_type]}</span>
{ item.question.is_necessary==1 ? <span className="mustAnswer fl ml10 mr10">必答</span>:<span className="mustAnswer fl ml10 mr10"></span> }
{ item.question.question_type == 2 && item.question.min_choices != undefined && item.question.min_choices != null && item.question.max_choices != undefined && item.question.max_choices != null ?
<span className="color-grey-9 font-14 fl mt2">
{
item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" :
"可选"+item.question.min_choices+"-"+item.question.max_choices+"项"
}
</span>:""
}
</p>
<li className="pl30 pr30 pb15">{item.question.question_title}</li>
{
// 单选题
item.question.question_type==1 &&
<Radio.Group className="answerList" disabled>
{
item.question.answers.map((index,k)=>{
return(
<li className="df">
<Radio className="fl" value={index.answer_id}></Radio>
<span className={index.answer_text=="其他"?"break-word":"break-word flex1"}>{index.answer_text}</span>
{
index.answer_text=="其他" ? <p className="textLine"></p>:""
}
</li>
)
})
}
</Radio.Group>
}
{
// 多选题
item.question.question_type==2 &&
<Checkbox.Group className="answerList" disabled>
{
item.question.answers.map((index,k)=>{
return(
<li className="df" key={k}>
<Checkbox className="fl mr8" value={index.answer_id} key={index.answer_id}></Checkbox>
<span className={index.answer_text=="其他"?"break-word":"break-word flex1"}>{index.answer_text}</span>
{
index.answer_text=="其他" ? <p className="textLine"></p>:""
}
</li>
)
})
}
</Checkbox.Group>
}
{
// 主观题
item.question.question_type == 3 &&
<div className="mt10 pl30 pr30 pb20">
<textarea placeholder="在此填入答案" readOnly className="winput-100-130"></textarea>
</div>
}
</div>
)
})
}
</div>
</div> </div>
) )
} }

@ -54,7 +54,7 @@ class PollListItem extends Component{
} }
</p> </p>
<p className="color-grey-9 clearfix"> <p className="color-grey-9 clearfix">
{ item.author && <span className="mr20 fl">{item.author}</span> } { item.author && <span className="mr20 fl mt3">{item.author}</span> }
{ {
item.polls_status !=1 && item.polls_status !=1 &&
<span className="fl mt3"> <span className="fl mt3">

@ -2123,7 +2123,7 @@ class PollNew extends Component {
//最小值 //最小值
HandleGradationGroupChangee = (value, index, max, length) => { HandleGradationGroupChangee = (value, index, max, length) => {
// debugger
var minbool = false; var minbool = false;
var maxbool = false; var maxbool = false;
let arr = this.state.adddom; let arr = this.state.adddom;

Loading…
Cancel
Save