diff --git a/app/views/competitions/_competitions_name.html.erb b/app/views/competitions/_competitions_name.html.erb index ab7f3253..fa56359d 100644 --- a/app/views/competitions/_competitions_name.html.erb +++ b/app/views/competitions/_competitions_name.html.erb @@ -12,15 +12,31 @@
+ + function competitionfun(){ + localStorage.setItem('competition_uid', true); + } + + function setcompetitionfun(){ + competitionfun(); + window.location.href="/competitions" + } + diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index c36e2bc3..692330a2 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -128,6 +128,7 @@ $("#all_status_show_value").text("用户"); <% end %> <% end %> + if (window.localStorage) { var uid = localStorage.getItem('competition_uid'); } else { diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index b69a87ec..ab5adc0e 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -93,4 +93,17 @@ var sl=-Math.max(document.body.scrollLeft,document.documentElement.scrollLeft); document.getElementById('nHeader').style.left=sl+'px'; }; + + $(function() { + if (window.localStorage) { + var uid = localStorage.getItem('competition_uid'); + } else { + var uid = false + } + if(!uid){ + var htmlvalue = "<%= escape_javascript(render :partial => 'competitions/competitions_name')%>"; + pop_box_new(htmlvalue, 500, 380); + } + }) + \ No newline at end of file diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 45be29bd..7c9e78e1 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -5,6 +5,8 @@ import PropTypes from 'prop-types'; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; +import { Modal} from 'antd'; + // import searchImg from '../../../../images/educoder/icon/search.svg' // /images/educoder/icon/search.svg @@ -134,7 +136,8 @@ class NewHeader extends Component { ImageUrl:"", ecUrl:null, project_packages_url:null, - ImageUrlType:false + ImageUrlType:false, + competitiontype:false } } componentWillMount(){ @@ -230,9 +233,30 @@ class NewHeader extends Component { }); - + if (window.localStorage) { + var uid = localStorage.getItem('competition_uid'); + } else { + var uid = false + } + if(!uid){ + this.setState({ + competitiontype:true + }) + } } + setcompetitionfun=()=>{ + this.competitionfun(); + window.location.href="/competitions" + } + + competitionfun=()=>{ + this.setState({ + competitiontype:false + }) + localStorage.setItem('competition_uid', true); + } + render() { let {careerslist,isLogin,current_user,ImageUrl,ecUrl,ImageUrlType,project_packages_url} = this.state; // const isLogin = isLogintype; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 @@ -268,6 +292,45 @@ class NewHeader extends Component { // console.log(match.path.startsWith("/ec_courses")) return (
+ + + + +
+
+ + this.competitionfun()} id="closeIcon" + style={{position: "absolute",right: "0px",top: "36px"}} + > + + + + + + this.setcompetitionfun()}> + + + +
+
+
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} @@ -464,11 +527,3 @@ class NewHeader extends Component { export default NewHeader; - -//
    -//
  • 1{/*<%= link_to "首页", home_path %>*/}
  • -//
  • 2{/*<%= link_to "精选实训", shixuns_path %>*/}
  • -//
  • 3{/*<%= link_to "实训路径", subjects_path %>*/}
  • -//
  • 4{/*<%= link_to "在线课堂", courses_path %>*/}
  • -//
  • 5{/*<%= link_to "讨论组", forums_path %>*/}
  • -//
diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index 0df8d6e8..93967795 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -1243,6 +1243,6 @@ html>body #ajax-indicator { position: fixed; } } .login_regs{ - margin-right: 35%; - width: 558px; + width: 580px !important; + cursor: pointer; } \ No newline at end of file