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

dev_forum
杨树林 5 years ago
commit ede7ecefa6

@ -5,7 +5,7 @@ class CourseSecondCategory < ApplicationRecord
belongs_to :course_module
has_many :homework_commons
validates :name, length: { maximum: 30 }
validates :name, length: { maximum: 60 }
def category_type_str
category_type == "graduation" && name == "毕设选题" ? "graduation_topics" : (

@ -0,0 +1,15 @@
class ModifyFinalScoreForGames < ActiveRecord::Migration[5.2]
def change
grades = Grade.where(container_type: "Answer")
grades.each do |grade|
g = Game.find_by_id(grade.container_id)
if g.present?
if g.status == 2 && g.answer_open > 0 && g.final_score <= 0 && g.end_time < grade.created_at
g.update_column(:final_score, g.challenge.score)
elsif g.final_score < 0
g.update_column(:final_score, 0)
end
end
end
end
end

@ -88,11 +88,11 @@ class CoursesNew extends Component {
}
componentDidUpdate(prevProps){
if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user.user_identity==="学生"){
window.location.href ="/403"
}
}
// if(prevProps.current_user!=this.props.current_user){
// if(this.props.current_user.user_identity==="学生"){
// window.location.href ="/403"
// }
// }
}
onChangeTimepublishs = (date, dateString) => {
if(dateString===""){

@ -139,7 +139,7 @@ class PathDetailIndex extends Component{
let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json";
axios.get(url).then((result)=>{
if (result.data.status == 407) {
if (result.data.status == 407 || result.data.status == 401) {
return;
}
if(result.data.allow_visit===true){
@ -164,9 +164,11 @@ class PathDetailIndex extends Component{
let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json";
axios.get(url).then((result)=>{
if (result.data.status == 407) {
// TODO 403 让后台返回status 403 比较好
if (result.data.status == 407 || result.data.status == 401) {
return;
}
if(result.data.allow_visit===true){
this.setState({
detailInfoList:result.data,

@ -495,6 +495,7 @@ submittojoinclass=(value)=>{
}
hideshowSearchOpen=(e)=>{
debugger
let {setevaluatinghides}=this.state;
if(setevaluatinghides===true){
this.setState({
@ -519,6 +520,7 @@ submittojoinclass=(value)=>{
}
setevaluatinghides=()=>{
debugger
this.setState(
{
setevaluatinghides:true
@ -600,6 +602,7 @@ submittojoinclass=(value)=>{
// rolearr:["",""],
// console.log("618");
// console.log(user_phone_binded);
console.log(showSearchOpentype)
return (
<div className="newHeader" id="nHeader" >
@ -670,8 +673,21 @@ submittojoinclass=(value)=>{
><a href={this.props.Headertop===undefined?"":this.props.Headertop.auth}>工程认证</a></li>
</ul>
<div className="posi-search" id="posi-search">
<style>
{
`
.posi-searchs{
opacity: 1;
position: absolute;
top: -2px;
background: #fff;
z-index: 2;
right: -241px;
}
`
}
</style>
<div className="posi-searchs" >
<div className="search-all clearfix">
{/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/}
<div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}>
@ -687,7 +703,9 @@ submittojoinclass=(value)=>{
{/*<input type="text" className="search-input fl" id="search-input" */}
{/*onKeyDown={this.onKeywordSearchKeyDown} name="search_keyword" placeholder="搜索实训项目"/>*/}
{/*搜索框*/}
{showSearchOpentype===true?<div className={"HeaderSearch"} onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}>
{showSearchOpentype===true?<div
className={"HeaderSearch"}
onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}>
<Search
id={"HeaderSearchs"}
placeholder="实践课程/翻转课堂/开发社区/交流问答"
@ -902,169 +920,3 @@ submittojoinclass=(value)=>{
export default NewHeader;
// <ul id="header-nav">
// <li className="active">1{/*<%= link_to "首页", home_path %>*/}</li>
// <li>2{/*<%= link_to "精选实训", shixuns_path %>*/}</li>
// <li>3{/*<%= link_to "实训路径", subjects_path %>*/}</li>
// <li>4{/*<%= link_to "在线课堂", courses_path %>*/}</li>
// <li>5{/*<%= link_to "讨论组", forums_path %>*/}</li>
// </ul>
{/*{*/}
{/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.message_url}*/}
{/*style={{display:this.props.Headertop===undefined?"none":this.props.Headertop.new_message===true?"block":"none",position:'relative'}}*/}
{/*>*/}
{/*<span className="newslight" style={{display:user!=undefined&&user.login!=""?"block":"none"}}>*/}
{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/}
{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/}
{/*</span>*/}
{/*</a>*/}
{/*}*/}
{/*{ this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count>0 &&*/}
{/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.message_url}>*/}
{/*<span className="newslight" style={{display:user!=undefined&&user.login!=""?"block":"none"}}>*/}
{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/}
{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/}
{/*</span>*/}
{/*</a>}*/}
{/*{ this.props.Headertop===undefined?"":user && this.props.Headertop.unread_message_count>0 &&*/}
{/*<span style={{display:user!=undefined&&user.login!=""?"block":"none"}}>*/}
{/*<div className="edu-menu-list edu-txt-center" style={{width: '220px', top: '60px'}}>*/}
{/*<a className="font-14 padding10" style={{lineHeight: '35px'}} href={this.props.Headertop===undefined?"":this.props.Headertop.message_url} >您有*/}
{/*<span className="color-orange">{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}</span>*/}
{/*条新消息,点击查看</a>*/}
{/*</div>*/}
{/*</span>*/}
{/*}*/}
{/*
需求消息数量
<div className="fl mr30 edu-menu-panel headIcon">
<a href={`/users/${user.login}/user_tidings`}><img src={getImageUrl(`images/educoder/icon/bell.svg`}></a>
<em className="newslight"></em>
<div className="edu-menu-list edu-txt-center" style="width:220px;top:60px">
<a className="font-14 padding10" style="line-height: 35px;" href={`/users/${user.login}/user_tidings`}>
您有<span className="color-orange">30</span>
</a>
</div>
</div>
*/}
// function loadHeader(){
// //头部导航条的----------显示搜索框
// $("#search-open").on("click",function(e){
// $(this).hide();
// // $("#header-nav").animate({opacity:"0"},1000);
// $(".posi-search").show() // animate({opacity:"1"},1000);
// $("#header-nav").css("z-index","2");
// $(".posi-search").css("z-index","3");
// $(".HeaderSearch").show();
// $(".HeaderSearch").val("");
// $(".search-input").focus();
// $(".search-all .search-content").hide();
// e.stopPropagation();//阻止冒泡
// });
// $(".HeaderSearch").on("click",function(e){
// debugger
// e.stopPropagation();//阻止冒泡
// });
//搜索框输入内容
// $("#HeaderSearchs").blur(function(e){
// closeSearch();
// e.stopPropagation();//阻止冒泡
// });
//点击页面其它(与搜索框无关的地方)都会将搜索框隐藏,所以与搜索框有关的地方需要阻止冒泡
// $("body").on("click",function(){
// closeSearch();
// });
// $(".HeaderSearch").on("input",function(e){
// $(".search-all .search-content").show();
// e.stopPropagation();//阻止冒泡
// });
//搜索
// $("#header_keyword_search").on("click", header_search);
// $("input[name='search_keyword']").on("keydown", function(event){
// var code;
// if (!event) {
// event = window.event; //针对ie浏览器
// code = event.keyCode;
// }
// else {
// code = event.keyCode;
// }
// if(code == 13) {
// header_search();
// return false;
// }
// });
// $(".search-clear").click(function(e){e.stopPropagation();});
// //切换搜索条件
// $("#searchkey li").click(function(e){
// var key=$($(this).children("a")[0]).html();
// switch (key){
// case '实训':
// $("#search_type").val('1');
// break;
// case '课堂':
// $("#search_type").val('2');
// break;
// case '用户':
// $("#search_type").val('3');
// break;
// }
// $("#searchkey").siblings(".searchkey").html(key);
// $("#searchkey").hide();
// e.stopPropagation();//阻止冒泡
// });
// //切换选择导航条
// $("#header-nav li").click(function(){
// $("#header-nav li").removeClass("active");
// $(this).addClass("active");
// });
//
//
// $(".search_history").on("click", function(){
// $("input[name='search_keyword']").val($(this).html());
// header_search();
// });
// }
//
// function header_search(reactHeaderComponnet){
// console.log(old_url)
// var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
// window.location.href ="/search"+"?value="+keyword;
// // if (!reactHeaderComponnet) {
// // reactHeaderComponnet = window._header_componentHandler
// // }
// // if (!reactHeaderComponnet) {
// // var index = $("#search_type").val(); // 搜索课程/项目
// // keyword = encodeURIComponent(keyword);
// // // $.get('/users/search_shixuns_or_course',
// // // { search: keyword,
// // // index: index});
// // window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
// //e.stopPropagation();//阻止冒泡
// // } else {
// // window.__headSearchKeyword = keyword
// // reactHeaderComponnet.props.history.push(`/shixuns`)
// // trigger('searchKeywordChange', keyword)
// // }
// }
// //头部导航条的隐藏
// function closeSearch(){
// $('#posi-search').hide();
// $("#search-open").show();
// // $(".posi-search").animate({opacity:"0"},800);
// $(".HeaderSearch").hide();
// $("#header-nav").animate({opacity:"1"},1000);
// $(".posi-search").css("z-index","2");
// $("#header-nav").css("z-index","3");
// }

Loading…
Cancel
Save