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

dev_oauth
hjm 6 years ago
commit b461f9b895

@ -0,0 +1,25 @@
#coding=utf-8
# 执行示例 bundle exec rake public_course:student args=149,2903
# args 第一个参数是subject_id第二个参数是课程course_id
desc "同步精品课数据"
namespace :public_course do
task :student => :environment do
subject_id = ENV['args'].split(",").first
course_id = ENV['args'].split(",").last
puts "subject_id is #{subject_id}"
puts "course_id is #{course_id}"
user_ids = Myshixun.find_by_sql("select distinct(user_id) from myshixuns where shixun_id in (select shixun_id from stage_shixuns
where stage_id in (select id from stages where subject_id=#{subject_id}))").map(&:user_id)
puts user_ids
if user_ids.present?
user_ids.each do |user_id|
puts user_id
CourseMember.create!(course_id: course_id, user_id: user_id, role: 4)
end
end
end
end

@ -248,9 +248,9 @@ class CoursesBanner extends Component {
axios.post(url).then((response) => {
if(response!==undefined){
window.location.href = "/courses/" + response.data.new_course_id+"/students";
}else {
this.modalCancel();
return
}
this.modalCancel();
// window.location.href = "/courses/" + response.data.new_course_id;
}).catch(function (error) {
@ -259,19 +259,16 @@ class CoursesBanner extends Component {
console.log(error);
});
// axios.interceptors.response.use((response) => {
// if (response != undefined)
// if (response && response.data.status === -1) {
// this.setState({
// antIcon: false,
// })
//
// }
// return response;
// }, (error) => {
// //TODO 这里如果样式变了会出现css不加载的情况
//
// });
axios.interceptors.response.use((response) => {
if (response != undefined)
if (response && response.data.status === -1) {
this.modalCancel();
}
return response;
}, (error) => {
//TODO 这里如果样式变了会出现css不加载的情况
});
}
if(this.state.metype===6){

@ -153,19 +153,11 @@ class ShixunStudentWork extends Component {
}
this.setState({
data: response.data,
datalist:datas
});
}
this.setState({
datalist:datas,
lunxun:false,
})
}else{
setInterval(() => {
if(this.state.lunxun===true){
this.getupdata();
duplicatechecking:false,
});
}
}, 1000);
}
}
@ -185,7 +177,13 @@ class ShixunStudentWork extends Component {
description: response.data.message
});
}
setInterval(() => {
console.log("开始轮询了");
if(this.state.lunxun===true){
console.log("开始轮询了getupdata");
this.getupdatasysk();
}
}, 5000);
}).catch((error) => {
@ -197,6 +195,55 @@ class ShixunStudentWork extends Component {
this.setState({
shixuntypes:type[3]
})
};
getupdatasysk=(pages)=>{
let {order,b_order,page,limit,group_infolist,search}=this.state;
var homeworkid = this.props.match.params.homeworkid;
let url = "/homework_commons/" + homeworkid + "/code_review_results.json";
axios.get(url,{params:{
order:order,
sort:b_order,
page:pages===undefined?page:pages,
limit:limit,
group_ids:group_infolist,
search:search
},
paramsSerializer: function(params) {
return qs.stringify(params, {arrayFormat: 'brackets'})
}}).then((response) => {
if (response.data.status === undefined || response.data.status === 0) {
if(response.data!=undefined){
if(response.data.status!=-2){
console.log();
let datas=[];
let list=response.data.users_reviews;
for(var i=0; i<list.length; i++){
datas.push({
number:i+1,
name:list[i].username,
stduynumber:list[i].student_id,
classroom:parseInt(list[i].code_rate),
operating:list[i].user_id
})
}
this.setState({
data: response.data,
datalist:datas,
lunxun:false,
duplicatechecking:false,
});
}
}
}
}).catch((error) => {
console.log(error)
});
}
getcode_review_results=(order,b_order,page,limit,group_infolist,search)=>{

@ -370,7 +370,7 @@ class Shixunechart extends Component {
</div>
<div className="fl with65" style={{paddingLeft: "5%"}}>
<li className="mt5 mb5">{data&&data.username}</li>
<li className="mt5 mb5">{data&&data.student_id}</li>
<li className="mt5 mb5">{data!==undefined?"--":data.student_id===undefined?"--":data.student_id===null?"--":data.student_id}</li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[1]}</span></li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[0]}</span></li>
</div>
@ -396,7 +396,7 @@ class Shixunechart extends Component {
</div>
<div className="fl with65" style={{paddingLeft: "5%"}}>
<li className="mt5 mb5">{data&&data.username}</li>
<li className="mt5 mb5">{data&&data.student_id}</li>
<li className="mt5 mb5">{data!==undefined?"--":data.student_id===undefined?"--":data.student_id===null?"--":data.student_id}</li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data===undefined?"":data&&data.echart_data.myself_object[1]}</span></li>
</div>
</div>

Loading…
Cancel
Save