Merge branch 'develop' into educoder

project_pack
daiao 5 years ago
commit afac12b35b

@ -1481,7 +1481,7 @@ end
redirect_to departments_managements_path
end
# 改单位部门列表
# 改单位部门列表
def update_department
dep = Department.find params[:department_id]
@edit_id = params[:department_id]
@ -1498,6 +1498,22 @@ end
end
end
# 修改部门名称
def update_depart_name
@depart = Department.find(params[:depart_id])
@depart.update_attributes(:name => params[:depart_name]) if @depart.school.departments.where(name: params[:depart_name]).count == 0
end
# 检查是否存在同名的部门
def check_depart_name
depart = Department.find(params[:depart_id])
if depart.school.departments.where(name: params[:depart_name]).count == 0
render :json => {status: 0, message: ""}
else
render :json => {status: -1, message: "该名称已存在"}
end
end
def edit_departments_school
begin
dep = Department.find(params[:department_id])
@ -1511,9 +1527,10 @@ end
# ApplyAddDepartment.where(:department_id =>params[:departments]).update_all(:department_id=>department_id)
# users = UserExtensions.where("department_id = #{alt_dep.department_id}")
# users.update_all(:department_id => department.id)
apply_dep.destroy_all;
apply_dep.destroy_all
users = UserExtensions.where(:department_id => params[:alter_dep_id])
users.update_all(:department_id => dep.id)
dep.update_attributes(:identifier => alter_dep.identifier) if dep.identifier.nil? && alter_dep.identifier.present?
alter_dep.destroy
end
rescue Exception => e

@ -792,7 +792,7 @@ class ShixunsController < ApplicationController
shixun_script = modify_shixun_script @shixun, shixun_script
end
end
#@shixun.evaluate_script = shixun_script
@shixun.evaluate_script = shixun_script
ActiveRecord::Base.transaction do
begin

@ -102,9 +102,10 @@ class SourcesService
# games start ############################################
def myshixuns_index params
time = Time.parse(params[:time].to_s)
endTime = Time.parse(params[:time].to_s)
beginTime = Time.parse(params[:begin_time].to_s)
offset = ((params[:page] || 1).to_i - 1) * 50
Myshixun.select([:id, :user_id, :shixun_id]).where("created_at < ?", time).offset(offset).limit(50)
Myshixun.select([:id, :user_id, :shixun_id]).where("created_at < ? and created_at > ?", endTime, beginTime).offset(offset).limit(50)
end
def search_myshixun params

@ -4,7 +4,7 @@
<% @competition.competition_modules.where(:hidden => 0).each do |com_module| %>
<% case com_module.name %>
<% when '首页' %>
<% if params[:action] == 'show' %>
<% if params[:controller] == 'competitions' && params[:action] == 'show' %>
<li class="<%= params[:action] == 'show' ? 'active' : '' %>">
<a href="javascript:void(0)" id="jump_page1" onclick="jump_to('page1')">首页</a>
</li>
@ -19,7 +19,7 @@
<% end %>
<% when '赛事说明' %>
<li>
<% if params[:action] == 'show' %>
<% if params[:controller] == 'competitions' && params[:action] == 'show' %>
<a href="javascript:void(0)" id="jump_page3" onclick="jump_to('page3')">赛事说明</a>
<% else %>
<a href="<%= competition_path(@competition, :page => 3) %>">赛事说明</a>
@ -27,7 +27,7 @@
</li>
<% when '大赛机构' %>
<li>
<% if params[:action] == 'show' %>
<% if params[:controller] == 'competitions' && params[:action] == 'show' %>
<a href="javascript:void(0)" id="jump_page7" onclick="jump_to('page7')">大赛机构</a>
<% else %>
<a href="<%= competition_path(@competition, :page => 7) %>">大赛机构</a>

@ -21,10 +21,44 @@
<a href="<%= is_start ? first_section.competition_entries[1].url : 'javascript:void(0)'%>"
class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[1].name %></a>
</div>
<!--<a href="<%#= is_start ? first_section.competition_entries[2].url : 'javascript:void(0)'%>"-->
<!--class="ex_submit"><%#= first_section.competition_entries[2].name %></a>-->
<li class="inline">
<a href="<%= is_start ? first_section.competition_entries[2].url : 'javascript:void(0)'%>"
class="ex_submit"><%= first_section.competition_entries[2].name %></a>
<a href="javascript:void(0)" class="ex_submit team-btn"><%= first_section.competition_entries[3].name %></a>
</li>
</div>
</div>
<% index += 1 %>
<p class="second_course_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".team-btn").on("click", function(){
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
toEnrollDetail();
return;
}
var teamId = "<%= @competition.team_members.find_by_user_id(@user.id).try(:competition_team_id) %>";
location.href = "<%= competition_teams_path %>/" + teamId;
})
})
function toEnrollDetail(){
var htmlvalue = '<div class="task-popup" style="width:500px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">完成报名后即可查看</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="<%= enroll_competition_path(id: params[:id]) %>" class="task-btn task-btn-orange fr">立即报名</a></div></div>';
pop_box_new(htmlvalue, 500, 205);
}
</script>

@ -75,7 +75,7 @@
<a href="<%= url %>" class="competition-Img">
<%= image_tag(url_to_avatar(competition), :width => "100%", :height => "100%") %>
</a>
<div class="pt20 pl20 mb10 clearfix">
<div class="pt30 pb30 pl20 mt2 clearfix">
<a href="<%= url %>" style="max-width: 400px;" class="font-16 task-hide fl"><%= [competition.name, competition.sub_title.presence].compact.join('——') %></a>
<div class="fr status-orange">
<img src="/images/educoder/competition/home/orange.png" class="fl">

@ -17,7 +17,7 @@
<% @department.each_with_index do |department,index| %>
<tr id="apply_add_department_<%= department.id %>">
<td><%= (@page -1) * @limit + index + 1 %></td>
<td class="edu-txt-left"><%= department.name %></td>
<td class="edu-txt-left" id="department_name_<%= department.id %>"><%= department.name %></td>
<td class="edu-txt-left"><%= School.where(:id => department.school_id).first %></td>
<td><%= UserExtensions.where(:department_id => department.id, :school_id => department.school_id ).count %></td>
<td><%= User.where(:id => UserExtensions.where(:department_id => department.id, :school_id => department.school_id).map(&:user_id),:professional_certification => 1).count %></td>
@ -40,6 +40,7 @@
<td>
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= department_path(department) %>', '确定要删除该部门吗?')">删除&nbsp;</a>
<%= link_to '更改', update_department_managements_path(:school_id=> department.school_id,:department_id => department.id), :remote => true, :class => "application-default-link" %>
<a href="javascript:void(0)" class="application-default-link" onclick="editDepartName(<%= department.id %>);">修改</a>
</td>
</tr>
<% end %>
@ -78,4 +79,11 @@
$("#update_host_count_depart_id").val(id);
$("input[name='host_count']").val($("#depart_host_count_"+id).html().trim());
}
function editDepartName(id){
var htmlvalue = "<%= escape_javascript(render :partial => 'managements/edit_depart_name') %>";
pop_box_new(htmlvalue,400,204);
$("#update_depart_name_depart_id").val(id);
$("input[name='depart_name']").val($("#department_name_"+id).html().trim());
}
</script>

@ -0,0 +1,15 @@
<div class="task-popup" style="width:400px;">
<div class="task-popup-title clearfix task-popup-bggrey">修改</div>
<%= form_for '', :url => update_depart_name_managements_path,:html => {:id => 'update_depart_name_form', :remote => true, :method => :post} do |f| %>
<div class="task_popup_con edu-txt-center">
<input type="hidden" name="depart_id" id="update_depart_name_depart_id" value="">
<input type="text" name="depart_name" placeholder="输入新名称" maxlength="30" class="input-100-35"/>
<p class="color-red none edu-txt-left" id="update_depart_name_notice"></p>
<div class="inline mt20">
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="submit_depart_name_form();">确定</a>
<a href="javascript:void(0);" onclick="hideModal();" class="pop_close task-btn fr mr10">取消</a>
</div>
</div>
<% end %>
</div>

@ -0,0 +1 @@
$("#department_name_<%= @depart.id %>").html("<%= params[:depart_name] %>");

@ -629,6 +629,8 @@ RedmineApp::Application.routes.draw do ## oauth相关
match 'new_major', :via => [:get, :post]
post 'insert_major'
match 'update_department',:via => [:get, :post]
post 'update_depart_name'
get 'check_depart_name'
post 'edit_departments_school'
get 'create_departments'
post 'add_department'

@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Trustie 500 error</title>
<title>EduCoder 500 error</title>
<link type="text/css" rel="stylesheet" href="/stylesheets/educoder/edu-main.css" />
<link href="//at.alicdn.com/t/font_653600_rr8l5v2aaym.css" rel="stylesheet" type="text/css"/>
<script src="/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js"></script>

@ -26,6 +26,27 @@ function submit_depart_host_count(){
}
}
function submit_depart_name_form(){
if($("input[name='depart_name']").val().trim() == ""){
$("#update_depart_name_notice").html("名称不能为空").show();
} else {
$.ajax({
type: "GET",
url: '/managements/check_depart_name',
data: {depart_id: $("#update_depart_name_depart_id").val(), depart_name: $("input[name='depart_name']").val().trim()},
success: function (data) {
if(data.status == 0){
$("#update_depart_name_notice").hide();
$('#update_depart_name_form').submit();
hideModal();
} else{
$("#update_depart_name_notice").html("该名称已存在").show();
}
}
});
}
}
/*--------------------------- 用户授权全选 -------------------------------*/
$("#all_member_select").live('click', function(){
if($("#all_member_select").is(':checked')){

@ -206,6 +206,7 @@ $(function(){
// window resize
$(window).on('resize', function() {
// _resizeVNC_if_needed()
$('.CodeMirror.cm-s-railscasts').css("height", $("#games_repository_contents").height() - repositoryTabHeight);
})
@ -1182,6 +1183,7 @@ $(function(){ // 这里重新加一次事件监听,不在原有事件的基
dragging = true;
dragDom = lab;
$('#htmlIframe').css('pointer-events', 'none')
$('#can-drag').show()
return false;
}
);
@ -1202,7 +1204,10 @@ $(function(){ // 这里重新加一次事件监听,不在原有事件的基
doc.live("mouseup", function(e) {
// 在大窗口将下边测试集滚动条拖上去后,将窗口缩小,再拖下来就有这种情况 https://www.trustie.net/issues/16326
$('#can-drag').hide()
if (dragging === true) {
// _resizeVNC_if_needed()
window.editor_CodeMirror && window.editor_CodeMirror.refresh()
// 使得iframe可以继续捕获事件
$('#htmlIframe').css('pointer-events', 'inherit')
@ -1210,6 +1215,27 @@ $(function(){ // 这里重新加一次事件监听,不在原有事件的基
dragging = false;
});
})
function _resizeVNC_if_needed() {
return;
if (window.__isVNC) {
// $('#screen>div').width('1024px').height('768px')
var trueHeight = $('#game_right_contents').height();
var width = $('#game_right_contents').width()
// __rfb && __rfb.get_display().autoscale(width, trueHeight)
return;
if (trueHeight < 768) {
var width = $('#game_right_contents').width()
var _left = width - $('#screen').width() / 2
var scale = (trueHeight / 768).toFixed(5)
// _left
$('#screen').css('transform', 'scale(' + scale + ', ' + scale +')').css('transform-origin', 0 + 'px 0px')
} else {
$('#screen').css('transform', 'scale(' + 1 + ', ' + 1 +')')
}
}
}
// ---------------------------------------------------------------------------------------------
/**

@ -47,6 +47,7 @@ class MainContent extends Component {
games_repository_contents_style = {overflow: 'hidden', height: '445px'}
}
const showIframeContent = shixun && shixun.vnc == true
// window.__isVNC = showIframeContent && !!vnc_url
return (
<div className="page--body -margin-t-64 -flex">
<div className="-layout -stretch -fit labelN" id="game_show_content">
@ -55,6 +56,18 @@ class MainContent extends Component {
{/* 左侧任务说明等功能的区域 */}
<LeftViewContainer {...this.props}></LeftViewContainer>
</div>
<style>{`
.can-drag {
width: 100%;
height: 100%;
z-index: 100;
position: fixed;
cursor: col-resize;
top: 0px;
}
`}</style>
{showIframeContent && vnc_url && <div id="can-drag" className="can-drag" style={{display: 'none'}}></div>}
<div className="b-label -layout" style={{left: '687px'}}>
<div className="resize-helper ">

@ -13,6 +13,7 @@ class VNCDisplay extends Component {
// When this function is called we have
// successfully connected to a server
function connectedToServer(e) {
$('#top_bar').hide()
status("Connected to " + desktopName);
}
// This function is called when we are disconnected
@ -109,6 +110,8 @@ class VNCDisplay extends Component {
// Set parameters that can be changed on an active connection
rfb.viewOnly = readQueryVariable('view_only', false);
rfb.scaleViewport = readQueryVariable('scale', false);
rfb.resizeSession = true
window.__rfb = rfb;
}
render() {
@ -116,7 +119,7 @@ class VNCDisplay extends Component {
return (
<div className="">
<div className="" style={{height: '100%'}}>
<style>{`
#top_bar {
background-color: #6e84a3;
@ -137,6 +140,7 @@ class VNCDisplay extends Component {
cursor: pointer;
}
#screen {
height: 100%;
flex: 1; /* fill remaining space */
overflow: hidden;
}

@ -642,7 +642,7 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;
.position-shixun{position: absolute;z-index: 2;bottom: 40px;text-align: center;width: 100%}
.ccf-position-shixun .shixun-btn,.position-shixun .shixun-btn,.ccf-position-shixun-2 .shixun-btn{display: block;float: left;width: 160px;text-align:center;letter-spacing: 1px;height: 40px;line-height: 40px;color:#fff!important;margin:0px 20px;background: linear-gradient(to right, #ff8634 , #ff9d5b);box-shadow: 6px 4px 11px #f7ece4;}
/*第二次竞赛-全国*/
.second_1{min-height: 832px;}
.second_1{min-height: 825px;}
.second_2{min-height: 446px;}
.second_3{min-height: 766px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_3_small{min-height: 595px;padding-top: 190px;box-sizing: border-box;position: relative}
@ -722,11 +722,11 @@ li.challenge_box:last-child{
.second_course_2{min-height: 823px;}
.second_course_3{min-height: 690px;}
.second_course_4{min-height: 514px;}
.second_course_5{min-height: 627px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_course_6{min-height: 1225px;}
.second_course_5{min-height: 657px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_course_6{min-height: 1199px;}
.course_competition_panel{
margin:30px 40px 40px;border:1px solid #ABDCF1;background: #F1F8FD;justify-content: center;align-items: center;display: -webkit-flex;
height: 282px;text-align: center;
height: 220px;text-align: center;
}
.course_competition_panel a{
width: 320px;height: 60px;line-height: 60px;float: left;margin:0px 100px;background: #ccc;color: #fff!important;
@ -737,7 +737,7 @@ li.challenge_box:last-child{
}
.ex_submit{
width: 360px;height: 70px;background: #2CDAD4;color: #fff!important;font-size: 30px;line-height: 70px;text-align: center;
margin:0px auto;display: block;
margin:0px auto;display: block;float: left;margin:0px 35px;
}
table.tBodyScroll tbody tr td{
padding:6px 5px;box-sizing: border-box;font-size: 16px;color: #05101A;font-weight: normal;
@ -898,7 +898,7 @@ table.tBodyScroll thead th{
.homePageBtn{position: absolute;width: 100%;top: 510px;}
.homeBtn{display: block;float: left;border-radius: 30px;width: 168px;height: 60px;line-height: 60px;background-color: #21B351;font-size: 30px;color: #fff!important;text-align: center}
.competitionsList-item{width: 50%;float: left;box-sizing: border-box;position: relative}
.competitionsList-item{width: 50%;float: left;box-sizing: border-box;position: relative;height: 463px}
.competitionsList-item:nth-of-type(odd){padding-right: 10px;}
.competitionsList-item:nth-of-type(even){padding-left: 10px;}
.competitionsList-item-tip{

Loading…
Cancel
Save