Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_ec
杨树林 5 years ago
commit bad129a0cc

@ -14,19 +14,15 @@ class ExerciseAnswersController < ApplicationController
else else
ea = @exercise_question.exercise_answers.search_answer_users("user_id",current_user.id) #试卷的当前用户的答案 ea = @exercise_question.exercise_answers.search_answer_users("user_id",current_user.id) #试卷的当前用户的答案
if q_type == Exercise::SINGLE || q_type == Exercise::JUDGMENT #选择题(单选)/判断题 if q_type == Exercise::SINGLE || q_type == Exercise::JUDGMENT #选择题(单选)/判断题
ea_choice = ea.search_exercise_answer("exercise_choice_id",choice_id).first if ea.exists?
ea.first.update_attribute(:exercise_choice_id,choice_id )
else
answer_option = { answer_option = {
:user_id => current_user.id, :user_id => current_user.id,
:exercise_question_id => @exercise_question.id, :exercise_question_id => @exercise_question.id,
:exercise_choice_id => choice_id, :exercise_choice_id => choice_id,
:answer_text => "" :answer_text => ""
} }
if ea_choice.present? #如果当前用户的答案存在,再次点击,即为删除
ea_choice.destroy
else
if @exercise_question.exercise_standard_answers.count <= 1 #单选题的时候
ea.first.destroy if ea.present?
end
ex_a = ExerciseAnswer.new(answer_option) ex_a = ExerciseAnswer.new(answer_option)
ex_a.save! ex_a.save!
end end

@ -123,7 +123,7 @@ class GraduationWork < ApplicationRecord
# 作品是否被评阅过 # 作品是否被评阅过
def scored? def scored?
graduation_work_scores.where.not(core: nil).exists? graduation_work_scores.where.not(score: nil).exists?
end end
def work_cross_teacher_ids def work_cross_teacher_ids

@ -13,6 +13,7 @@ end
if @task.task_type == 2 if @task.task_type == 2
json.is_leader_work @work.user_id == @commit_user_id json.is_leader_work @work.user_id == @commit_user_id
json.members @work_members do |member| json.members @work_members do |member|
json.user_id member.user_id
json.is_leader_work @work.user_id == @commit_user_id json.is_leader_work @work.user_id == @commit_user_id
json.user_name member.user.real_name json.user_name member.user.real_name
json.group_name member.course_group_name json.group_name member.course_group_name

@ -11,12 +11,12 @@ json.shixun_list do
atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/
highlights[:description]&.first&.sub!(reg, '') highlights[:description]&.first&.sub!(reg, '')
highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} highlights[:description]&.map{|des| des.gsub(atta_reg, '')}
highlights[:content]&.first&.sub!(reg, '') highlights[:content]&.first&.sub!(reg, '')
highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} highlights[:content]&.map{|des| des.gsub(atta_reg, '')}
json.title highlights.delete(:name)&.join('...') || obj.searchable_title json.title highlights.delete(:name)&.join('...') || obj.searchable_title
json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.sub!(atta_reg, '') json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.gsub(atta_reg, '')
json.content highlights json.content highlights
json.level level_to_s(obj.trainee) json.level level_to_s(obj.trainee)

@ -7,15 +7,15 @@ json.subject_list do
# 去除开头标点符号 # 去除开头标点符号
reg = /^[,。?:;‘’!“”—……、]/ reg = /^[,。?:;‘’!“”—……、]/
# 附件的替换 # 附件的替换
atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ atta_reg = /!\[.*\]\(\/api\/attachments\/\d+\)/
highlights[:description]&.first&.sub!(reg, '') highlights[:description]&.first&.sub!(reg, '')
highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} highlights[:description]&.map{|des| des.gsub(atta_reg, '')}
highlights[:content]&.first&.sub!(reg, '') highlights[:content]&.first&.sub!(reg, '')
highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} highlights[:content]&.map{|des| des.gsub(atta_reg, '')}
json.title highlights.delete(:name)&.join('...') || obj.searchable_title json.title highlights.delete(:name)&.join('...') || obj.searchable_title
json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.sub!(atta_reg, '') json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.gsub(atta_reg, '')
json.content highlights json.content highlights
end end

@ -84,9 +84,9 @@ export function initAxiosInterceptors(props) {
} }
config.url = `${proxy}${url}`; config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) { if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?debug=${debugType}` config.url = `${config.url}?debug=${debugType}`;
} else { } else {
config.url = `${config.url}&debug=${debugType}` config.url = `${config.url}&debug=${debugType}`;
} }
} else { } else {
// 加api前缀 // 加api前缀

@ -485,7 +485,7 @@ class NewShixunModel extends Component{
</span>} </span>}
{this.props.type==='shixuns'?"":<span className="fl color-grey-9 pointer mr30"> {this.props.type==='shixuns'?"":<span className="fl color-grey-9 pointer mr30">
<a className={" color-grey-6"} onClick={()=>this.updatepathlist("myshixuns_count",order)}>使用人数</a> <a className={" color-grey-6"} onClick={()=>this.updatepathlist("myshixuns_count",order)}>学习人数</a>
<sapn className="relativef ml5 " > <sapn className="relativef ml5 " >
<i className={order==="asc"&&sort==="myshixuns_count"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i> <i className={order==="asc"&&sort==="myshixuns_count"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
<i className={order==="desc"&&sort==="myshixuns_count"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i> <i className={order==="desc"&&sort==="myshixuns_count"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>

@ -523,17 +523,17 @@ class GraduationAcross extends Component{
</span> </span>
</span> </span>
</div> </div>
{ {/*{*/}
<style> {/*<style>*/}
{ {/*{*/}
` {/*`*/}
.ant-table-thead > tr > th .anticon-filter, .ant-table-thead > tr > th .ant-table-filter-icon{ {/*.ant-table-thead > tr > th .anticon-filter, .ant-table-thead > tr > th .ant-table-filter-icon{*/}
left: 40px; {/*left: 40px;*/}
} {/*}*/}
` {/*`*/}
} {/*}*/}
</style> {/*</style>*/}
} {/*}*/}
<Table rowSelection={rowSelection} columns={bindTableColumn(this)} dataSource={users} pagination={false} onChange={this.handleTableChange} loading={tableLoading}></Table> <Table rowSelection={rowSelection} columns={bindTableColumn(this)} dataSource={users} pagination={false} onChange={this.handleTableChange} loading={tableLoading}></Table>
<div className="clearfix mt20 pb30 pl30 pr30 acrossfoot"> <div className="clearfix mt20 pb30 pl30 pr30 acrossfoot">
<div className="fl"> <div className="fl">

@ -334,22 +334,27 @@ class GraduationTasksSubmitedit extends Component{
} }
delecttask_status=(id)=>{ delecttask_status=(id,student_id)=>{
let newid=id===undefined||id===null?student_id:id;
let{selectmemberslist,task_status}=this.state; let{selectmemberslist,task_status}=this.state;
let newlist=task_status; let newlist=task_status;
let selects=selectmemberslist; let selects=selectmemberslist;
for(var i=0; i<newlist.length; i++){ for(var i=0; i<newlist.length; i++){
if(newlist[i]===id){ if(newlist[i]===newid){
newlist.splice(i,1) newlist.splice(i,1)
} }
} }
for(var z=0; z<selects.length; z++){ for(var z=0; z<selects.length; z++){
if(selects[z].user_id===id){ if(selects[z].user_id===newid){
selects.splice(z,1)
}else if(selects[z].student_id===newid){
selects.splice(z,1) selects.splice(z,1)
} }
} }
console.log(newlist)
console.log(selects)
this.setState({ this.setState({
task_status:newlist, task_status:newlist,
selectmemberslist:selects selectmemberslist:selects
@ -380,10 +385,12 @@ class GraduationTasksSubmitedit extends Component{
for(var list of selectmemberslist){ for(var list of selectmemberslist){
if(list.student_id!=undefined&&list.student_id!=null){
userids.push(list.student_id)
}
if(list.user_id!=undefined&&list.user_id!=null){ if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id) userids.push(list.user_id)
} }
} }
let listid=[]; let listid=[];
@ -392,6 +399,7 @@ class GraduationTasksSubmitedit extends Component{
listid.push(list.response == undefined ? list.id : list.response.id) listid.push(list.response == undefined ? list.id : list.response.id)
} }
console.log(userids)
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
@ -401,6 +409,7 @@ class GraduationTasksSubmitedit extends Component{
// debugger // debugger
return return
} }
if(workslist.task_type===2){ if(workslist.task_type===2){
if(userids.length<workslist.min_num){ if(userids.length<workslist.min_num){
this.setState({ this.setState({
@ -460,6 +469,9 @@ class GraduationTasksSubmitedit extends Component{
// } // }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
this.setState({
spinnings:false
})
}) })
@ -785,6 +797,7 @@ class GraduationTasksSubmitedit extends Component{
<div className={"members fl autos"}> <div className={"members fl autos"}>
{selectmemberslist&&selectmemberslist.map((item,key)=>{ {selectmemberslist&&selectmemberslist.map((item,key)=>{
console.log(item)
if(item.group_name!=undefined) { if(item.group_name!=undefined) {
return ( return (
<div key={key} style={{ <div key={key} style={{
@ -799,7 +812,7 @@ class GraduationTasksSubmitedit extends Component{
{key > 0 ? {key > 0 ?
<div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9"} <div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9"}
style={{marginTop: '-4px'}} style={{marginTop: '-4px'}}
onClick={() => this.delecttask_status(item.user_id)}></i> onClick={() => this.delecttask_status(item.user_id,item.student_id)}></i>
</div> : ""} </div> : ""}
<div className={"both"}></div> <div className={"both"}></div>
</div> </div>

@ -383,7 +383,7 @@ class GraduationTasksSubmitnew extends Component{
let userids=[]; let userids=[];
for(var list of selectmemberslist){ for(var list of selectmemberslist){
debugger
if(list.user_id!=undefined&&list.user_id!=null){ if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id) userids.push(list.user_id)
} }
@ -408,6 +408,8 @@ class GraduationTasksSubmitnew extends Component{
// debugger // debugger
return return
} }
if(workslist&&workslist.task_type===2){ if(workslist&&workslist.task_type===2){
if(userids!=undefined){ if(userids!=undefined){
if(userids.length<workslist.min_num){ if(userids.length<workslist.min_num){

@ -514,6 +514,7 @@ class GraduationTaskssettinglist extends Component{
} }
showAllocationModal=(id)=>{ showAllocationModal=(id)=>{
this.setState({ this.setState({
Allocationtype:true, Allocationtype:true,
operationId:id operationId:id
@ -861,13 +862,13 @@ class GraduationTaskssettinglist extends Component{
{ {
tag.name && tag.name &&
<Tooltip key={key} placement="bottom" title={tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"指定该作品的交叉评阅人":tag.name==="调分"?<pre>调整学生最终成绩<br/>其它历史评分将全部失效</pre>:""}> <Tooltip key={key} placement="bottom" title={tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"指定该作品的交叉评阅人":tag.name==="调分"?<pre>调整学生最终成绩<br/>其它历史评分将全部失效</pre>:""}>
{tag.name==="评阅"?<p style={{color:'#4CACFF',padding:"0px 5px"}} href={"/courses/"+courseId+"/graduation_tasks/"+tag.id+"/appraise"} > {tag.name==="评阅"?<a style={{color:'#4CACFF',padding:"0px 5px"}} href={"/courses/"+courseId+"/graduation_tasks/"+tag.id+"/appraise"} >
{tag.name} {tag.name}
</p> </a>
: :
<p style={{color:tag.name==="调分"?"#000":'#4CACFF',padding:"0px 5px"}} <p style={{color:tag.name==="调分"?"#000":'#4CACFF',padding:"0px 5px"}}
onClick={tag.name==="调分"?()=>this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":()=>this.showAllocationModal(tag.id):""}> onClick={tag.name==="调分"?()=>this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":""}>
{tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":tag.name:tag.name} {tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":tag.name}
</p> </p>
} }
</Tooltip> </Tooltip>

Loading…
Cancel
Save