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

dev_aliyun
caishi 5 years ago
commit 94ade003ef

@ -357,6 +357,7 @@ class ApplicationController < ActionController::Base
end
def require_login
logger.info("#########login?: #{User.current.id}")
logger.info("#########login?: #{User.current.logged?}")
logger.info("#########get?: #{request.get?}")
if !User.current.logged?

@ -9,7 +9,7 @@ class CollegesController < ApplicationController
# GET /colleges/id/home
def home
render "common/index", :layout => false
render file: 'public/react/build/index.html', :layout => false
end
# home action的数据

@ -361,8 +361,8 @@ class EcCoursesController < ApplicationController
respond_to do |format|
format.json{
courses_data = []
courses.each do |c|
courses_data << {id: c.id, name: c.name, created_at: (c.created_at).strftime('%Y-%m-%d'), end_time: c.end_date.present? ? c.end_date.strftime('%Y-%m-%d') : ''}
courses.includes(:teacher).each do |c|
courses_data << {id: c.id, name: c.name, creator_name: c.teacher.show_real_name, created_at: (c.created_at).strftime('%Y-%m-%d'), end_time: c.end_date.present? ? c.end_date.strftime('%Y-%m-%d') : ''}
end
render :json => {courses: courses_data}
}

@ -0,0 +1,47 @@
class Managements::VideoAppliesController < Managements::BaseController
before_filter :set_menu_type
def index
applies = VideoApply.order('video_applies.updated_at desc')
search = params[:search].to_s.strip
if search.present?
applies = applies.joins(:video)
.where('videos.title like :search', search: "%#{search}%")
end
applies = applies.where(status: params[:status].presence || :pending)
@video_applies = paginateHelper applies.includes(video: { user: :user_extensions })
respond_to do |format|
format.js
format.html
end
end
def agree
Videos::AgreeApplyService.new(current_video_apply, current_user).call
render json: { status: 0 }
rescue Videos::AgreeApplyService::Error => e
render json: { status: -1, message: e.message }
end
def refuse
Videos::RefuseApplyService.new(current_video_apply, current_user, reason: params[:reason]).call
render json: { status: 0 }
rescue Videos::RefuseApplyService::Error => e
render json: { status: -1, message: e.message }
end
private
def current_video_apply
@_current_video_apply ||= VideoApply.find(params[:id])
end
def set_menu_type
@menu_type = 10
@sub_type = 10
end
end

@ -5,7 +5,7 @@ class ManagementsController < ApplicationController
:editmd_template, :subject_level_system, :subject_setting_list,
:shixun_authorization, :ec_template, :codemirror_template,
:course_guide_template, :shixun_quality_score, :tech_system, :update_notice, :setting_banner,
:training_2018, :create_standard]
:create_standard]
layout 'base_management'
include ManagementsHelper
include SortHelper
@ -100,26 +100,23 @@ class ManagementsController < ApplicationController
@pay_type = params[:pay_type]
@page = params[:page] || 1
@status = params[:status]
if User.current.admin?
@trainings = Training.includes(:training_payinfo)
if params[:search] && params[:search].strip != ""
@trainings = @trainings.where("trainings.name like '%#{params[:search]}%'")
end
if params[:training_type] && params[:training_type].to_i != -1
@trainings = @trainings.where("training_type = #{params[:training_type]}")
end
if params[:pay_type] && params[:pay_type].to_i != -1
@trainings = @trainings.where("training_payinfos.pay_type = #{params[:pay_type]}")
end
if params[:status] && params[:status].to_i != -1
@trainings = @trainings.where("training_payinfos.status = #{params[:status]}")
end
@page = params[:page] || 1
@all_trainings = @trainings.reorder("trainings.created_at desc")
@trainings = paginateHelper @trainings.reorder("trainings.created_at desc"), 50
else
render_403
@trainings = Training.includes(:training_payinfo)
if params[:search] && params[:search].strip != ""
@trainings = @trainings.where("trainings.name like '%#{params[:search]}%'")
end
if params[:training_type] && params[:training_type].to_i != -1
@trainings = @trainings.where("training_type = #{params[:training_type]}")
end
if params[:pay_type] && params[:pay_type].to_i != -1
@trainings = @trainings.where("training_payinfos.pay_type = #{params[:pay_type]}")
end
if params[:status] && params[:status].to_i != -1
@trainings = @trainings.where("training_payinfos.status = #{params[:status]}")
end
@page = params[:page] || 1
@all_trainings = @trainings.reorder("trainings.created_at desc")
@trainings = paginateHelper @trainings.reorder("trainings.created_at desc"), 50
respond_to do |format|
format.js
format.html
@ -2363,6 +2360,14 @@ end
end
end
# 实践课程的金课设置
def excellent_subject_setting
if params[:subject_id]
subject = Subject.find params[:subject_id]
subject.update_attributes(:excellent => !subject.excellent)
end
end
# 已发布实训路径首页显示
def subject_homepage_show
if params[:subject_id]

@ -756,6 +756,7 @@ module ApplicationHelper
when 7 then '职业认证'
when 8 then '教学案例发布'
when 9 then '众包需求发布'
when 10 then '视频发布'
else '职业认证'
end
when 11

@ -177,7 +177,7 @@ class Course < ActiveRecord::Base
end
def member_count
Member.find_by_sql("select count(id) as count from members where course_id=#{self.id}").first.try(:count).to_i
CourseMember.find_by_sql("select count(id) as count from course_members where course_id=#{self.id}").first.try(:count).to_i
end
def self.search(query)
@ -257,7 +257,7 @@ class Course < ActiveRecord::Base
# 选出教师数不为0的答辩组
def course_graduation_group
self.graduation_groups.select{|group| group.members.count > 0}
self.graduation_groups.select{|group| group.course_members.count > 0}
end
# 课程的短描述信息
@ -420,11 +420,12 @@ class Course < ActiveRecord::Base
# 删除课程所有成员
def delete_all_members
if self.members && self.members.count > 0
me, mr = Member.table_name, MemberRole.table_name
connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})")
Member.delete_all(['course_id = ?', id])
end
CourseMember.delete_all(['course_id = ?', id])
# if self.members && self.members.count > 0
# me, mr = Member.table_name, MemberRole.table_name
# connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})")
# Member.delete_all(['course_id = ?', id])
# end
end
# 创建课程模块
@ -508,7 +509,7 @@ class Course < ActiveRecord::Base
# 课堂实训作业的评测次数
def evaluate_count
course_user_ids = self.members.map(&:user_id)
course_user_ids = self.students.map(&:user_id)
shixun_ids = self.homework_commons.joins(:homework_commons_shixuns).where(homework_type: 4).pluck(:shixun_id)
return 0 if shixun_ids.blank?
Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count)

@ -2,6 +2,7 @@ class GraduationGroup < ActiveRecord::Base
belongs_to :course
belongs_to :user
has_many :members
has_many :course_members
has_one :graduation_task_group_assignation, dependent: :destroy
has_many :graduation_work_comment_assignations, dependent: :destroy
attr_accessible :name, :user_id, :course_id

@ -10,7 +10,7 @@ class Subject < ActiveRecord::Base
belongs_to :major
# score_count 只能适合在首页使用
attr_accessible :description, :name, :status, :visits, :user_id, :course_list_id, :major_id, :learning_notes, :introduction,
:homepage_show, :score_count, :publish_time, :updated_at
:homepage_show, :score_count, :publish_time, :updated_at, :excellent
has_many :stages, :dependent => :destroy, :order => "stages.position ASC"
has_many :stage_shixuns, :dependent => :destroy

@ -0,0 +1,36 @@
class Video < ActiveRecord::Base
include AASM
belongs_to :user
has_many :video_applies, dependent: :destroy
has_one :processing_video_apply, conditions: { status: :pending }, class_name: 'VideoApply'
aasm(:status) do
state :pending, initial: true
state :processing
state :refused
state :published
event :apply_publish do
transitions from: :pending, to: :processing
end
event :refuse do
transitions from: :processing, to: :refused
end
event :publish do
transitions from: :processing, to: :published, guard: :vod_uploaded?
end
end
aasm(:vod_status, namespace: :vod) do
state :uploading, initial: true
state :uploaded
event :upload_success do
transitions from: :uploading, to: :uploaded
end
end
end

@ -0,0 +1,19 @@
class VideoApply < ActiveRecord::Base
include AASM
belongs_to :video
aasm(:status) do
state :pending, initial: true
state :refused
state :agreed
event :refuse do
transitions from: :pending, to: :refused
end
event :agree do
transitions from: :pending, to: :agreed
end
end
end

@ -0,0 +1,35 @@
class Videos::AgreeApplyService
Error = Class.new(StandardError)
attr_reader :video_apply, :video, :user
def initialize(video_apply, user)
@video_apply = video_apply
@video = video_apply.video
@user = user
end
def call
raise Error, '该状态下不能进行此操作' unless video_apply.may_agree? && video.may_publish?
ActiveRecord::Base.transaction do
video_apply.agree!
video.published_at = Time.now
video.publish
video.save!
# 将消息改为已处理
Tiding.where(container_id: video.id, container_type: 'Video', tiding_type: 'Apply', status: 0).update_all(status: 1)
notify_video_author!
end
end
private
def notify_video_author!
Tiding.create!(user_id: video.user_id, trigger_user_id: 1,
container_id: video.id, container_type: 'Video',
tiding_type: 'System', status: 1)
end
end

@ -0,0 +1,38 @@
class Videos::RefuseApplyService
Error = Class.new(StandardError)
attr_reader :video_apply, :video, :user, :params
def initialize(video_apply, user, params)
@video_apply = video_apply
@video = video_apply.video
@user = user
@params = params
end
def call
reason = params[:reason].to_s.strip
raise Error, '原因不能为空' if reason.blank?
raise Error, '该状态下不能进行此操作' unless video_apply.may_refuse?
ActiveRecord::Base.transaction do
video_apply.reason = reason
video_apply.refuse
video_apply.save!
video.refuse!
# 将消息改为已处理
Tiding.where(container_id: video.id, container_type: 'Video', tiding_type: 'Apply', status: 0).update_all(status: 1)
notify_video_author!
end
end
private
def notify_video_author!
Tiding.create!(user_id: video.user_id, trigger_user_id: 1,
container_id: video.id, container_type: 'Video',
tiding_type: 'System', status: 2, extra: video_apply.reason)
end
end

@ -73,6 +73,21 @@
link_url: 'https://keras.io/layers/about-keras-layers/'
}]
]
extra_data = [
{
name: 'C++项目',
description: "本项目的paddle/fluid/operators/optimizers目录中包含了常见的优化器MomentumAdam等等的c++实现。",
task: '标注../fluid/operators/optimizers/目录下的所有代码文件',
link_name: '官方,优化器',
link_url: 'https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_guides/low_level/optimizer.html'
},{
name: 'Python项目',
description: "本项目的python/paddle/fluid/layers/nn.py中包含了神经网络中大量常见层和操作符的python实现如fc、conv、gru等等。",
task: '标注../paddle/fluid/layers/nn.py代码文件',
link_name: '官方nn',
link_url: 'https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_cn/layers_cn/nn_cn.html'
}
]
%>
<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %>
@ -97,9 +112,9 @@
标注说明:每个小组选择一个项目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p>
<ul class="mt30">
<% first_section.competition_entries.each_with_index do |entry, j| %>
<% row_data = data[i][j] %>
<ul class="mt30 clearfix">
<% first_section.competition_entries.limit(3).each_with_index do |entry, j| %>
<% row_data = data.dig(i, j) %>
<li class="challenge_box">
<p class="challenge_b_t"><%= row_data[:name] || entry.name %></p>
<p class="enter_btn mb40 clearfix">
@ -135,6 +150,51 @@
</li>
<% end %>
</ul>
<% if index == 4 %>
<p class="break_word font-18 challenge_describe" style="margin-top: 20px;">
飞桨PaddlePaddle由百度公司开发是目前国内唯一功能完备的端到端开源深度学习平台集深度学习训练和预测框架、模型库、工具组件、服务平台为一体其兼具灵活和效率的开发机制、工业级应用效果的模型、超大规模并行深度学习能力、推理引擎一体化设计以及系统化的服务支持致力于让深度学习技术的创新与应用更简单。
</p>
<ul class="mt30 clearfix">
<% first_section.competition_entries.offset(3).each_with_index do |entry, j| %>
<% row_data = extra_data[j] %>
<li class="challenge_box">
<p class="challenge_b_t"><%= row_data[:name] || entry.name %></p>
<p class="enter_btn mb40 clearfix">
<%
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
</p>
<% if row_data.present? %>
<p class="challenge_b_d">项目简介</p>
<p class="break-word challenge_b_des" style="min-height: 80px;"><%= raw row_data[:description] %></p>
<p class="challenge_b_d">标注任务</p>
<% if index ==2 %>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 60px"><%= row_data[:task] %></p>
<% else %>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 80px"><%= row_data[:task] %></p>
<% end %>
<p class="challenge_b_d">经典算法解读:</p>
<ul class="clearfix algorithm">
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul>
<p class="enter_btn clearfix">
<a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p>
<% end %>
</li>
<% end %>
</ul>
<% end %>
</div>
</div>
<% index += 1 %>

@ -123,6 +123,7 @@
<li><%= link_to '实践课程发布', subject_authorization_managements_path %></li>
<li><%= link_to '教学案例发布', library_applies_path(status: :pending) %></li>
<li><%= link_to '众包需求发布', project_package_applies_path(status: :pending) %></li>
<li><%= link_to '视频发布', video_applies_path(status: :pending) %></li>
</ul>
</li>
<li class="fl edu-admin-nav-li edu-position"><a href="javascript:void(0);" class="edu-admin-nav-a">认证+</a>

@ -3,7 +3,7 @@
<thead>
<tr>
<th width="9%">ID</th>
<th width="20%" class="edu-txt-left">实训套件名称</th>
<th width="18%" class="edu-txt-left">实训套件名称</th>
<th width="6%">阶段</th>
<th width="10%">技术体系</th>
<th width="10%">等级体系</th>
@ -75,6 +75,10 @@
<input type="checkbox" name="homepage_show" <%= c_shixun.status == 2 ? "" : "disabled" %> value="<%= c_shixun.id %>" <%= c_shixun.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="homepage_show_<%= c_shixun.id %>">
<label style="top:0px;padding-left: 19px;" for="homepage_show_<%= c_shixun.id %>">首页</label>
</span>
<span class="fl ml5">
<input type="checkbox" name="excellent" <%= c_shixun.status == 2 ? "" : "disabled" %> value="<%= c_shixun.id %>" <%= c_shixun.excellent ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="excellent_<%= c_shixun.id %>">
<label style="top:0px;padding-left: 19px;" for="excellent_<%= c_shixun.id %>">金课</label>
</span>
</td>
</tr>
<% end %>
@ -131,7 +135,16 @@
type: 'post',
dateType: "script"
});
})
});
$("input[name='excellent']").click(function(){
var subject_id = $(this).val();
$.ajax({
url:"<%= excellent_subject_setting_managements_path %>",
data: {subject_id: subject_id},
type: 'post',
dateType: "script"
});
});
});
function select_repertoire(subject_id, rep_id){
$.ajax({

@ -5,7 +5,6 @@
<tr>
<th width="5%">ID</th>
<th width="5%">总耗时<i class="fa fa-long-arrow-down color-light-green ml5" ></i></th>
<th width="5%">作品更新</th>
<th width="5%">文件更新</th>
<th width="10%">中间层总耗时</th>
<th width="5%">pull代码</th>
@ -15,7 +14,8 @@
<th width="5%">前端轮询</th>
<th width="5%">结果存储</th>
<th width="10%">创建时间</th>
<th width="5%">最大执行时间</th>
<th width="5%">评测时最大时间</th>
<th width="5%">最新执行时间</th>
<th width="8%">唯一标识</th>
<th width="17%">实训名称</th>
</tr>
@ -26,7 +26,6 @@
<tr>
<td><%= record.id %></td>
<td><%= record.consume_time %></td>
<td><%= record.student_work %></td>
<td><%= record.file_update %></td>
<td><%= record.brige %></td>
<td><%= record.git_pull %></td>
@ -37,8 +36,9 @@
<td><%= record.test_cases %></td>
<td><%= format_time record.created_at %></td>
<% challenge = Game.find(record.game_id).challenge %>
<td><%= record.try(:exec_time) %></td>
<td><%= challenge.try(:exec_time) %></td>
<td><%= record.shixun.try(:identifier) %></td>
<td><%= record.try(:identifier) %></td>
<td><%= link_to record.shixun.try(:name), task_path(record.game), :target => "_blank", :title => "#{record.shixun.try(:name)}" %></td>
</tr>
<% end %>

@ -0,0 +1,77 @@
<% if @video_applies.present? %>
<% @video_applies.each do |apply| %>
<% user = apply.video.user %>
<% video = apply.video %>
<div class="admin-con-box apply-<%= apply.id %> clearfix">
<a href="<%= user_path(user) %>" target="_blank" class="fl with10 edu-ad-user">
<%= image_tag(url_to_avatar(user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %>
</a>
<div class="fl with90">
<ul>
<li class="clearfix mb5">
<a href="<%= user_path(user) %>" class="fl"><%= user.try(:show_real_name) %></a>
<span class="fl ml30 font-12 mt3 color-grey"><%= time_from_now(apply.created_at) %></span>
<% if apply.pending? %>
<a href="javascript:void(0);" class="fr color-orange" onclick="reject_video_authentication_reason(this);" >拒绝</a>
<a href="javascript:void(0);" class="fr mr15 color-orange" data-remote="true" onclick="video_authorization_gree('<%= apply.id %>');">同意</a>
<%= link_to('播放视频', video.file_url, class: 'fr mr15 color-orange', target: '_blank') %>
<% else %>
<a href="javascript:void(0);" class="<%= apply.agreed? ? 'task-btn-green' : '' %> task-btn fr"><%= apply.agreed? ? "已同意" : "已拒绝" %></a>
<% end %>
</li>
<li class="clearfix mb10">
<span><%= video.title %></span>
</li>
<% if apply.pending? %>
<div class="undis">
<li class="clearfix edu-form-border mb10">
<label class="edu-form-label fl">原因:</label>
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="video_submit_reject_reason('<%= apply.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="video_hide_reject_reason(this);" >取消</a>
</li>
</div>
<% else %>
<% if apply.refused? %>
<li>原因:<span class="color-orange"><%= apply.reason %></span></li>
<% end %>
<% end %>
</ul>
</div>
</div>
<% end %>
<div class="mt20 mb20" style="text-align:center;">
<div class="pages_user_show" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
<script type="text/javascript">
function video_authorization_gree(id){
$.ajax({
url: '/managements/video_applies/' + id + '/agree',
type: 'post',
success: function(data){
if (data && data.status != -1) {
$('#authentication_list .admin-con-box.apply-' + id).remove();
if($('#authentication_list .admin-con-box').length == 0){
location.reload();
}
} else {
alert(data.message);
}
}
})
}
</script>

@ -0,0 +1,120 @@
<div class="edu-class-container mb15">
<div class="edu-con-top clearfix">
<p class="ml15 fl color-grey">视频发布</p>
</div>
<div class="edu-con-bg01 mt15">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav" class="border-bottom-orange">
<li id="edu-tab-nav-1" class="new-tab-nav background-orange" onclick="HoverLi(1);">
<%= link_to "待审批", video_applies_path(status: :pending), class: 'tab_type', remote: true %>
</li>
<li id="edu-tab-nav-2" class="new-tab-nav" onclick="HoverLi(2);">
<%= link_to "已审批", video_applies_path(status: [:refused, :agreed]), class: 'tab_type', remote: true %>
</li>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1">
<div class="mt10">
<div class="edu-position fr task-form-30 mb10 mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入视频标题进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="authentication_list" class="auth_table">
<%= render :partial => "managements/video_applies/video_apply_list"%>
</div>
</div>
</div>
<div id="edu-tab-con-2" class="undis">
<div class="mt10">
<p class="fl task-form-60 mt8 ml15 clearfix">
<%= link_to "全部", video_applies_path(status: [:refused, :agreed]), :class => "edu-filter-cir-grey mr5 fl font-12 active", :id => "video_all_authentication", :remote => true %>
<%= link_to "同意", video_applies_path(status: :agreed), :class => "edu-filter-cir-grey mr5 fl font-12", :id => "video_agree_authentication", :remote => true %>
<%= link_to "拒绝", video_applies_path(status: :refused), :class => "edu-filter-cir-grey mr5 fl font-12", :id => "video_reject_authentication", :remote => true %>
</p>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入视频标题进行检索" type="text" id="video_search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="video_search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="video_authentication_list" class="auth_table">
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
<script>
/* -------------------------- 拒绝 ------------------------------------ */
function reject_video_authentication_reason(nThis){
var reason = $(nThis).parent().parent().find('div');
reason.find("input").val("");
reason.toggle();
}
/* -------------------------- 取消 ------------------------------------ */
function video_hide_reject_reason(nThis){
var reason = $(nThis).parent().parent();
reason.find("input").val("");
reason.hide();
}
/* ------------------------- 提交拒绝原因 --------------------------------- */
function video_submit_reject_reason(id, nThis){
var nReason = $(nThis).parent().parent();
var reason = nReason.find("input").val();
if (reason == '') {
alert('请输入原因');
return;
}
$.ajax({
url: '/managements/video_applies/' + id + '/refuse',
type: 'post',
data: {reason: reason},
success: function(data){
if (data && data.status != -1) {
$('#authentication_list .admin-con-box.apply-' + id).remove();
if($('#authentication_list .admin-con-box').length == 0){
location.reload();
}
} else {
alert(data.message);
}
}
});
}
/* -------------------------- 按名字进行搜索(未审批) ----------------------------- */
$("#search").live("click", function(){
var iName = $("#search_name").val();
$.ajax({
url: "/managements/video_applies",
dataType: 'script',
data: { search: iName, status: 'pending' }
});
});
/* ------------------- 按名字进行搜索(已审批)-------------------- */
$("#video_search").live("click", function(){
var iName = $("#video_search_name").val();
var id = $("#video_all_authentication").parent().find(".active").attr("id");
var status = '';
if(id == "video_all_authentication"){
status = ['refused', 'agreed'];
}else if(id=="video_agree_authentication"){
status = 'agreed';
}else{
status = 'refused';
}
$.ajax({
url: "/managements/video_applies",
dataType: 'script',
data: { search: iName, status: status}
});
});
</script>

@ -0,0 +1,30 @@
var nTabIcon_1 = $("#edu-tab-con-1");
var nTabIcon_2 = $("#edu-tab-con-2");
var nTabNav_1 = $("#edu-tab-nav-1");
var nTabNav_2 = $("#edu-tab-nav-2");
var nAudit = $("#video_all_authentication").parent();
<% if params[:status].to_s == 'pending' %>
$("#authentication_list").html("<%= j( render :partial => "managements/video_applies/video_apply_list" ) %>");
nTabNav_1.addClass("background-orange");
nTabNav_2.removeClass("background-orange");
nTabIcon_1.show();
nTabIcon_2.hide();
<% else %>
$("#video_authentication_list").html("<%= j( render :partial => "managements/video_applies/video_apply_list" ) %>");
nTabNav_1.removeClass("background-orange");
nTabNav_2.addClass("background-orange");
nTabIcon_1.hide();
nTabIcon_2.show();
/* -------------------------- 未审批(全部、同意、拒绝点击时动态样式) ------------------------------ */
if(<%= params[:status].to_s == 'agreed' %>){
nAudit.find(".active").removeClass("active");
$("#video_agree_authentication").addClass("active");
}else if(<%= params[:status].to_s == 'refused' %>){
nAudit.find(".active").removeClass("active");
$("#video_reject_authentication").addClass("active");
}else{
nAudit.find(".active").removeClass("active");
$("#video_all_authentication").addClass("active");
}
<% end %>

@ -1 +1 @@
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 8.hours, :key => '_educoder_session', :domain => :all
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 24.hours, :key => '_educoder_session', :domain => :all

@ -626,6 +626,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
post 'update_shixun_code_hidden'
get 'update_shixun_excute_time'
post 'subject_homepage_show'
post 'excellent_subject_setting'
post 'support_shixun'
post 'add_course'
match 'add_major',:via=>[:get,:post]
@ -765,6 +766,13 @@ RedmineApp::Application.routes.draw do ## oauth相关
post :refuse
end
end
resources :video_applies, only: [:index] do
member do
post :agree
post :refuse
end
end
end
end
end

@ -0,0 +1,5 @@
class AddExecTimeToEvaluateRecords < ActiveRecord::Migration
def change
add_column :evaluate_records, :exec_time, :integer
end
end

@ -0,0 +1,5 @@
class AddExcellentToSubject < ActiveRecord::Migration
def change
add_column :subjects, :excellent, :boolean, :default => false
end
end

File diff suppressed because one or more lines are too long

@ -827,8 +827,9 @@ class ecCourseEvaluations extends Component {
<div className="clearfix mt20">
<ul style={{width:'100%'}}>
<li className="column-1 fl ml60">课堂名称</li>
<li className="column-1 fl ml120">创建时间</li>
<li className="column-1 fl ml120">结束时间</li>
<li className="column-1 fl ml120">创建者</li>
<li className="column-1 fl ml60">创建时间</li>
<li className="column-1 fl ml60">结束时间</li>
</ul>
</div>
@ -840,8 +841,9 @@ class ecCourseEvaluations extends Component {
<Radio className="fl" id={item.id} checked={checkevalue===item.id?true:false} onChange={this.onChangechecked}></Radio>
<li className="column-1 fl ml5 assclasslistmidname">{item.name}</li>
</li>
<li className="column-1 fl ml18">{item.created_at}</li>
<li className="column-1 fl ml90">{item.end_time}</li>
<li className="column-1 fl ml18 assclasslistmidname" style={{width: '60px'}} >{item.creator_name}</li>
<li className="column-1 fl ml30">{item.created_at}</li>
<li className="column-1 fl ml40">{item.end_time}</li>
</ul>
)
})}

@ -242,7 +242,7 @@ class ecStudentList extends Component {
}
}
}
let url ='/ec_major_schools/'+major_id+'/academic_years/'+year_id+'/destroy_students.json'
let url ='/ec_major_schools/'+major_id+'/academic_years/'+year_id+'/destroy_students'
axios.delete(url,{data:{
all:studentall,
student_ids:newstudent_id,

@ -669,7 +669,7 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;
.second_code_2{min-height: 436px;}
.second_code_3{min-height: 1460px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_4{min-height: 1459px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_5{min-height: 1464px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_5{min-height: 2314px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_6{min-height: 1060px;}
.second_code_7{min-height: 1116px;}
.second_code_8{min-height: 711px;}

Loading…
Cancel
Save