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

dev_winse
daiao 6 years ago
commit b7e5d718d7

@ -171,6 +171,14 @@ class HomeworkCommonsController < ApplicationController
@student_works = @student_works.where(user_id: group_user_ids) @student_works = @student_works.where(user_id: group_user_ids)
end end
if @homework.homework_type == "group" && !params[:member_work].blank?
if params[:member_work].to_i == 1
@student_works = @student_works.where("user_id = commit_user_id")
elsif params[:member_work].to_i == 0
@student_works = @student_works.where("user_id != commit_user_id")
end
end
# 输入姓名和学号搜索 # 输入姓名和学号搜索
# TODO user_extension 如果修改 请调整 # TODO user_extension 如果修改 请调整
unless params[:search].blank? unless params[:search].blank?

@ -61,18 +61,23 @@ class StudentWorksController < ApplicationController
end end
def delete_work def delete_work
ActiveRecord::Base.transaction do
begin begin
work = @homework.student_works.find_by!(user_id: params[:user_id]) work = @homework.student_works.find_by!(user_id: params[:user_id])
tip_exception("只有组长才能删除组员") if work.commit_user_id != current_user.id
work.update_attributes(description: nil, project_id: 0, work.update_attributes(description: nil, project_id: 0,
late_penalty: 0, work_status: 0, late_penalty: 0, work_status: 0,
commit_time: nil, update_time: nil, group_id: 0, commit_time: nil, update_time: nil, group_id: 0,
commit_user_id: nil, final_score: nil, work_score: nil, teacher_score: nil, teaching_asistant_score: nil) commit_user_id: nil, final_score: nil, work_score: nil, teacher_score: nil, teaching_asistant_score: nil)
work.attachments.destroy_all
work.tidings.destroy_all
normal_status("删除成功") normal_status("删除成功")
rescue Exception => e rescue Exception => e
uid_logger(e.message) uid_logger(e.message)
tip_exception(e.message) tip_exception(e.message)
end end
end end
end
def create def create
student_work = @homework.student_works.find_or_create_by(user_id: current_user.id) student_work = @homework.student_works.find_or_create_by(user_id: current_user.id)
@ -137,8 +142,9 @@ class StudentWorksController < ApplicationController
@current_user = current_user @current_user = current_user
if @homework.homework_type == "group" if @homework.homework_type == "group"
# todo user_extension # todo user_extension
@commit_user_id = @work.commit_user_id
@work_members = @course.students.where(user_id: @homework.student_works.where(group_id: @work.group_id).pluck(:user_id)). @work_members = @course.students.where(user_id: @homework.student_works.where(group_id: @work.group_id).pluck(:user_id)).
order("course_members.id=#{@work.user_id} desc").includes(:course_group, user: :user_extension) order("course_members.user_id=#{@work.commit_user_id} desc").includes(:course_group, user: :user_extension)
end end
end end
@ -150,7 +156,7 @@ class StudentWorksController < ApplicationController
begin begin
@work.description = params[:description] @work.description = params[:description]
@work.update_time = Time.now @work.update_time = Time.now
@work.commit_user_id = current_user.id # @work.commit_user_id = current_user.id
if @work.save! if @work.save!
Attachment.associate_container(params[:attachment_ids], @work.id, @work.class) Attachment.associate_container(params[:attachment_ids], @work.id, @work.class)
@ -165,7 +171,8 @@ class StudentWorksController < ApplicationController
# 原成员更新描述、更新时间以及附件 # 原成员更新描述、更新时间以及附件
@homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work| @homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work|
work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id) # work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id)
work.update_attributes(update_time: Time.now, description: @work.description)
work.attachments.destroy_all work.attachments.destroy_all
@work.attachments.each do |attachment| @work.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
@ -193,7 +200,7 @@ class StudentWorksController < ApplicationController
stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id, stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id,
project_id: @work.project_id, late_penalty: @work.late_penalty, project_id: @work.project_id, late_penalty: @work.late_penalty,
work_status: @work.work_status, commit_time: Time.now, update_time: Time.now, work_status: @work.work_status, commit_time: Time.now, update_time: Time.now,
group_id: @work.group_id, commit_user_id: current_user.id) group_id: @work.group_id, commit_user_id: @work.commit_user_id)
@work.attachments.each do |attachment| @work.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
att.author_id = attachment.author_id att.author_id = attachment.author_id

@ -69,6 +69,7 @@ elsif @user_course_identity == Course::STUDENT
json.project_info project_info @work, @current_user, @user_course_identity json.project_info project_info @work, @current_user, @user_course_identity
end end
json.work_group @work.work_group_name json.work_group @work.work_group_name
json.is_leader @work.user_id == @work.commit_user_id
end end
end end
@ -140,6 +141,7 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal"
if @homework.homework_detail_group.base_on_project if @homework.homework_detail_group.base_on_project
json.project_info project_info work, @current_user, @user_course_identity json.project_info project_info work, @current_user, @user_course_identity
end end
json.is_leader work.user_id == work.commit_user_id
json.work_group work.work_group_name json.work_group work.work_group_name
end end

@ -1,12 +1,14 @@
json.partial! "homework_commons/homework_public_navigation", locals: {homework: @homework, course: @course, user: @current_user} json.partial! "homework_commons/homework_public_navigation", locals: {homework: @homework, course: @course, user: @current_user}
json.work_id @work.id json.work_id @work.id
json.description @work.description json.description @work.description
json.
json.attachments @work.attachments do |atta| json.attachments @work.attachments do |atta|
json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: @work.delete_atta(atta)} json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: @work.delete_atta(atta)}
end end
if @homework.homework_type == "group" if @homework.homework_type == "group"
json.is_leader_work @work.user_id == @commit_user_id
json.min_num @homework.homework_detail_group.try(:min_num) json.min_num @homework.homework_detail_group.try(:min_num)
json.max_num @homework.homework_detail_group.try(:max_num) json.max_num @homework.homework_detail_group.try(:max_num)
@ -15,5 +17,6 @@ if @homework.homework_type == "group"
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
json.student_id member.user.student_id json.student_id member.user.student_id
json.is_leader member.user_id == @commit_user_id
end end
end end

@ -3,6 +3,7 @@ json.(@work, :description, :commit_time, :update_time)
json.is_evaluation @is_evaluation json.is_evaluation @is_evaluation
json.author_name @is_evaluation ? "匿名" : @work.user.real_name json.author_name @is_evaluation ? "匿名" : @work.user.real_name
json.is_leader_work @work.user_id == @work.commit_user_id if @homework.homework_type == "group"
json.is_author @is_author json.is_author @is_author
json.update_user_name @is_evaluation ? "匿名" : @work.commit_user.try(:real_name) json.update_user_name @is_evaluation ? "匿名" : @work.commit_user.try(:real_name)
@ -17,8 +18,10 @@ unless @is_evaluation
json.project_info project_info @work, @current_user, @user_course_identity json.project_info project_info @work, @current_user, @user_course_identity
end end
json.work_members @work_members.each do |member| json.work_members @work_members.each do |work|
json.user_name member.user.real_name json.user_name work.user.real_name
json.user_login member.user.login json.user_login work.user.login
json.work_id work.id
json.is_leader work.user_id == work.commit_user_id
end end
end end

@ -10,6 +10,7 @@ broadcastChannelOnmessage('refreshPage', () => {
}) })
function locationurl(list){ function locationurl(list){
debugger
if (window.location.port === "3007") { if (window.location.port === "3007") {
} else { } else {
@ -158,6 +159,7 @@ export function initAxiosInterceptors(props) {
// console.log("401401401") // console.log("401401401")
// } // }
if (response.data.status === 403||response.data.status === "403") { if (response.data.status === 403||response.data.status === "403") {
locationurl('/403'); locationurl('/403');
} }

@ -683,7 +683,7 @@ class Coursesleftnav extends Component{
}else if(result.source.droppableId==="course_group"){ }else if(result.source.droppableId==="course_group"){
let url ="/course_groups/"+result.draggableId+"/move_category.json" let url ="/course_groups/"+result.draggableId+"/move_category.json"
this.droppablepost(url,result.destination.index) this.droppablepost(url,result.destination.index+1)
} }
@ -837,7 +837,7 @@ class Coursesleftnav extends Component{
.droppableul{ .droppableul{
max-height: 500px; max-height: 500px;
overflow-y:auto; overflow-y:auto;
overflow:hidden auto; overflow-x:hidden;
} }
.mr13{ .mr13{
@ -928,8 +928,9 @@ class Coursesleftnav extends Component{
<a className="fl pl46 pd0 Draggablelichild"> <a className="fl pl46 pd0 Draggablelichild">
<span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth155 task-hide Draggablelichild":"fl ml38 maxwidth155 task-hide Draggablelichild"}>{iem.category_name}</span> <span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth155 task-hide Draggablelichild":"fl ml38 maxwidth155 task-hide Draggablelichild"}>{iem.category_name}</span>
<span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14":item.type===twosandiantypes&&twosandiantype===index?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span> <span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14":item.type===twosandiantypes&&twosandiantype===index&&iem.category_name!="未分班"?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span>
{item.type===twosandiantypes&&twosandiantype===index? {item.type===twosandiantypes&&twosandiantype===index?
iem.category_name==="未分班"?"":
iem.category_type==="graduation_topics"||iem.category_type==="graduation_tasks"? iem.category_type==="graduation_topics"||iem.category_type==="graduation_tasks"?
<span className={"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span> <span className={"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span>
:<Popover placement="right" content={this.content(item,iem,index)} trigger="hover" key={index}> :<Popover placement="right" content={this.content(item,iem,index)} trigger="hover" key={index}>

@ -163,6 +163,10 @@ class Testpapersettinghomepage extends Component{
} }
} }
//打开pdf
confpdf = (url) =>{
window.open(url);
}
/// 确认是否下载 /// 确认是否下载
confirmysl(url,child){ confirmysl(url,child){
let params ={} let params ={}
@ -372,7 +376,7 @@ class Testpapersettinghomepage extends Component{
导出<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":"-34px","left":"unset","height":"auto"}}> <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}/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>*/} {/*<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> </ul>
</li></Spin>:""} </li></Spin>:""}

@ -472,6 +472,9 @@ class GraduationTasksSubmitnew extends Component{
// } // }
// } // }
}).catch((error) => { }).catch((error) => {
this.setState({
spinnings:false
});
console.log(error) console.log(error)
}) })

@ -179,8 +179,13 @@ class GraduationTasks extends Component{
}) })
.then((result)=>{ .then((result)=>{
if(result.data.status==0){ if(result.data.status==0){
this.props.showNotification(`${result.data.message}`); this.setState({
checkBoxValues:[],
checkAllValue:false
})
this.fetchAll(search,page,order,15) this.fetchAll(search,page,order,15)
this.props.showNotification(`${result.data.message}`);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -557,6 +562,7 @@ class GraduationTasks extends Component{
//debugger //debugger
let {search,page,order,all_count} = this.state; let {search,page,order,all_count} = this.state;
this.fetchAll(search,page,order,all_count) this.fetchAll(search,page,order,all_count)
} }
getcourse_groupslist=(id)=>{ getcourse_groupslist=(id)=>{
this.setState({ this.setState({
@ -651,7 +657,7 @@ class GraduationTasks extends Component{
</Link> </Link>
</WordsBtn> : ""} </WordsBtn> : ""}
{this.props.isAdmin() ?<UseBank {...this.props} {...this.state} object_type={"gtask"} useBankSuccess={(checkBoxValues,object_ids)=>this.useBankSuccess=(checkBoxValues,object_ids)}></UseBank>:""} {this.props.isAdmin() ?<UseBank {...this.props} {...this.state} object_type={"gtask"} useBankSuccess={(checkBoxValues,object_ids)=>this.useBankSuccess(checkBoxValues,object_ids)}></UseBank>:""}
</React.Fragment> </React.Fragment>
} }

@ -355,6 +355,13 @@ onBoardsNew=()=>{
DownloadMessageval:undefined DownloadMessageval:undefined
}) })
} }
// 题库选用成功后刷新页面
useBankSuccess=(checkBoxValues,object_ids)=>{
//debugger
let {searchValue,page,status} =this.state
this.fetchAll(searchValue,page,status);
}
render(){ render(){
let { let {
searchValue, searchValue,

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

@ -500,8 +500,8 @@ class PathDetailIndex extends Component{
</div> </div>
{ {
detailInfoList===undefined?"":detailInfoList.allow_add_member===true? <div> detailInfoList===undefined?"":detailInfoList.allow_add_member===true? <div>
<div className="fr ml15 flex1"><a onClick={()=>this.moveup(item)}><Tooltip title="上移"><i className="color-green font-18 iconfont icon-xiangshangyi"></i></Tooltip></a></div> {key!=0?<div className="fr ml15 flex1"><a onClick={()=>this.moveup(item)}><Tooltip title="上移"><i className="color-green font-18 iconfont icon-xiangshangyi"></i></Tooltip></a></div>:""}
<div className="fr ml15 flex1 "><a onClick={()=>this.movedown(item)}><Tooltip title="下移"><i className="color-green font-18 iconfont icon-xiangxiayi"></i></Tooltip></a></div> {key+1!=detailInfoList.members.length?<div className="fr ml15 flex1 "><a onClick={()=>this.movedown(item)}><Tooltip title="下移"><i className="color-green font-18 iconfont icon-xiangxiayi"></i></Tooltip></a></div>:""}
</div> </div>
:"" :""
} }

@ -826,6 +826,9 @@ submittojoinclass=(value)=>{
{/* p 老师 l 学生 */} {/* p 老师 l 学生 */}
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实践课程</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实践课程</Link></li>
<li style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.customer_management_url===null || this.props.Headertop.customer_management_url===""? 'none' : 'block'}}>
<a href={this.props.Headertop === undefined ? '' : this.props.Headertop.customer_management_url}>客户管理</a>
</li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的项目</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的项目</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/package`}>我的众包</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/package`}>我的众包</Link></li>
<li><a href={`/account/profile`}>账号管理</a></li> <li><a href={`/account/profile`}>账号管理</a></li>

@ -362,6 +362,7 @@ export function TPMIndexHOC(WrappedComponent) {
overflow: hidden; overflow: hidden;
} }
.newHeaders{ .newHeaders{
// position: fixed;
max-width: unset; max-width: unset;
background: #24292D !important; background: #24292D !important;
width: 100%; width: 100%;

Loading…
Cancel
Save