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

dev_oauth
daiao 6 years ago
commit 0dbed67fd0

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

@ -153,19 +153,11 @@ class ShixunStudentWork extends Component {
} }
this.setState({ this.setState({
data: response.data, data: response.data,
datalist:datas datalist:datas,
lunxun:false,
duplicatechecking:false,
}); });
} }
this.setState({
lunxun:false,
})
}else{
setInterval(() => {
if(this.state.lunxun===true){
this.getupdata();
}
}, 1000);
} }
} }
@ -185,7 +177,13 @@ class ShixunStudentWork extends Component {
description: response.data.message description: response.data.message
}); });
} }
setInterval(() => {
console.log("开始轮询了");
if(this.state.lunxun===true){
console.log("开始轮询了getupdata");
this.getupdatasysk();
}
}, 5000);
}).catch((error) => { }).catch((error) => {
@ -197,6 +195,55 @@ class ShixunStudentWork extends Component {
this.setState({ this.setState({
shixuntypes:type[3] 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)=>{ getcode_review_results=(order,b_order,page,limit,group_infolist,search)=>{

@ -370,7 +370,7 @@ class Shixunechart extends Component {
</div> </div>
<div className="fl with65" style={{paddingLeft: "5%"}}> <div className="fl with65" style={{paddingLeft: "5%"}}>
<li className="mt5 mb5">{data&&data.username}</li> <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[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> <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> </div>
@ -396,7 +396,7 @@ class Shixunechart extends Component {
</div> </div>
<div className="fl with65" style={{paddingLeft: "5%"}}> <div className="fl with65" style={{paddingLeft: "5%"}}>
<li className="mt5 mb5">{data&&data.username}</li> <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> <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>
</div> </div>

@ -209,7 +209,7 @@ class DetailTop extends Component{
>删除路径</a>:""} >删除路径</a>:""}
{ {
detailInfoList.publish_status===0&&detailInfoList.allow_statistics===true? detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true?
<a className="user_default_btn user_bluebg_btn font-18 fl ml40 userbluebgfont" <a className="user_default_btn user_bluebg_btn font-18 fl ml40 userbluebgfont"
onClick={this.applyissuePath} onClick={this.applyissuePath}
>申请发布</a>:"" >申请发布</a>:""

@ -252,6 +252,10 @@ class PathDetailIndex extends Component{
let param={user_id:user_id}; let param={user_id:user_id};
axios.delete(url,{data:param}).then((response) => { axios.delete(url,{data:param}).then((response) => {
if(response.data.status===1){ if(response.data.status===1){
if (this.props.current_user.user_id == user_id) {
this.props.history.push('/paths')
return;
}
this.props.showNotification(response.data.message) this.props.showNotification(response.data.message)
this.setState({ this.setState({
Modalstype:false, Modalstype:false,

@ -329,6 +329,10 @@ class Collaborators extends Component {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/collaborators_delete.json?user_id=" + collaborators_deletevalue; let url = "/shixuns/" + id + "/collaborators_delete.json?user_id=" + collaborators_deletevalue;
axios.delete(url).then((response) => { axios.delete(url).then((response) => {
if (this.props.current_user.user_id == collaborators_deletevalue) {
this.props.history.push('/shixuns')
return;
}
this.props.showSnackbar(response.data.message); this.props.showSnackbar(response.data.message);
this.updatacomponentDiddata(); this.updatacomponentDiddata();
this.setState({ this.setState({

Loading…
Cancel
Save