Merge branches 'dev_aliyun' and 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into topic_bank

dev_aliyun_beta
杨树明 5 years ago
commit e139256298

@ -0,0 +1,20 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-project-package-applies-index-page').length > 0) {
var $searchFrom = $('.project-package-applies-form');
$searchFrom.find('select[name="status"]').val('pending');
$searchFrom.on('click', '.search-form-tab', function(){
var $link = $(this);
$searchFrom.find('input[name="keyword"]').val('');
$searchFrom.find('select[name="status"]').val('all');
if($link.data('value') === 'all'){
$searchFrom.find('.status-filter').show();
} else {
$searchFrom.find('.status-filter').hide();
$searchFrom.find('select[name="status"]').val('pending');
}
});
}
})

@ -0,0 +1,20 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-video-applies-index-page').length > 0) {
var $searchFrom = $('.video-applies-form');
$searchFrom.find('select[name="status"]').val('pending');
$searchFrom.on('click', '.search-form-tab', function(){
var $link = $(this);
$searchFrom.find('input[name="keyword"]').val('');
$searchFrom.find('select[name="status"]').val('all');
if($link.data('value') === 'all'){
$searchFrom.find('.status-filter').show();
} else {
$searchFrom.find('.status-filter').hide();
$searchFrom.find('select[name="status"]').val('pending');
}
});
}
})

@ -0,0 +1,9 @@
.admins-project-package-applies-index-page {
.project-package-applies-list-container {
span {
&.apply-status-agreed { color: #28a745; }
&.apply-status-refused { color: #dc3545; }
&.apply-status-processed { color: #6c757d; }
}
}
}

@ -0,0 +1,9 @@
.admins-video-applies-index-page {
.video-applies-list-container {
span {
&.apply-status-agreed { color: #28a745; }
&.apply-status-refused { color: #dc3545; }
&.apply-status-processed { color: #6c757d; }
}
}
}

@ -0,0 +1,37 @@
class Admins::ProjectPackageAppliesController < Admins::BaseController
before_action :current_apply,only: [:agree,:refuse]
def index
params[:status] ||= 'pending'
status = params[:status]
if status == 'all'
status = %w(agreed refused)
end
package_applies = ProjectPackageApply.where(status: status)
keyword = params[:keyword].to_s.strip || ""
if keyword.present?
package_applies = package_applies.joins(:project_package).where("project_packages.title like ?","%#{keyword}%")
end
@package_applies = paginate package_applies.includes(project_package: { creator: :user_extension })
end
def agree
ProjectPackages::AgreeApplyService.new(current_apply).call
render_success_js
rescue ProjectPackages::AgreeApplyService::Error => e
render json: { status: -1, message: e.message }
end
def refuse
ProjectPackages::RefuseApplyService.new(current_apply, reason: params[:reason]).call
render_success_js
rescue ProjectPackages::RefuseApplyService::Error => e
render json: { status: -1, message: e.message }
end
private
def current_apply
@_current_apply ||= ProjectPackageApply.find(params[:id])
end
end

@ -0,0 +1,41 @@
class Admins::VideoAppliesController < Admins::BaseController
def index
params[:status] ||= 'pending'
status = params[:status]
if status == 'all'
status = %w(agreed refused)
end
applies = VideoApply.where(status: status).order('video_applies.updated_at desc')
search = params[:keyword].to_s.strip
if search.present?
applies = applies.joins(:video)
.where('videos.title like :search', search: "%#{search}%")
end
@video_applies = paginate applies.includes(video: { user: :user_extension })
end
def agree
Videos::AgreeApplyService.new(current_video_apply, current_user).call
render_success_js
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_success_js
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
end

@ -50,8 +50,8 @@ module GitCommon
Rails.logger.info(" good repo_name is #{@repo_path}") Rails.logger.info(" good repo_name is #{@repo_path}")
@content = GitService.update_file(repo_path: @repo_path, @content = GitService.update_file(repo_path: @repo_path,
file_path: @path, file_path: @path,
message: message, message: message.force_encoding('UTF-8'),
content: content, content: content.force_encoding('UTF-8'),
author_name: author_name, author_name: author_name,
author_email: author_email) author_email: author_email)
end end

@ -0,0 +1,32 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('众包需求发布') %>
<% end %>
<div class="box search-form-container flex-column mb-0 pb-0 project-package-applies-form">
<ul class="nav nav-tabs w-100 search-form-tabs">
<li class="nav-item">
<%= link_to '待审批', admins_project_package_applies_path(status: :pending), remote: true, 'data-value': 'pending',
class: "nav-link search-form-tab #{params[:status] == 'pending' ? 'active' : ''}" %>
</li>
<li class="nav-item">
<%= link_to '已审批', admins_project_package_applies_path(status: "all"), remote: true, 'data-value': 'all',
class: "nav-link search-form-tab #{params[:status] != 'pending' ? 'active' : ''}" %>
</li>
</ul>
<%= form_tag(admins_project_package_applies_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %>
<div class="form-group status-filter" style="<%= params[:status] != 'pending' ? '' : 'display: none;' %>">
<label for="status">审核状态:</label>
<% status_options = [['全部', 'all'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %>
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '需求标题检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<% end %>
</div>
<div class="box project-package-applies-list-container">
<%= render(partial: 'admins/project_package_applies/shared/list', locals: { applies: @package_applies}) %>
</div>
<%= render(partial: 'admins/shared/admin_common_refuse_modal') %>

@ -0,0 +1 @@
$('.project-package-applies-list-container').html("<%= j( render partial: 'admins/project_package_applies/shared/list', locals: { applies: @package_applies } ) %>");

@ -0,0 +1,56 @@
<% is_processed = params[:status].to_s != 'pending' %>
<table class="table table-hover text-center library_applies-list-table">
<thead class="thead-light">
<tr>
<th width="8%">头像</th>
<th width="14%">姓名</th>
<th width="26%" class="text-left">众包需求</th>
<th width="26%" class="text-left">需求描述</th>
<th width="16%">时间</th>
<% if is_processed %>
<th width="16%">拒绝原因</th>
<th width="8%">状态</th>
<% else %>
<th width="20%">操作</th>
<% end %>
</tr>
</thead>
<tbody>
<% if applies.present? %>
<% applies.each do |apply| %>
<% package = apply.project_package %>
<% user = package.creator %>
<tr class="project-package-item project-package-applies-<%= apply.id %>">
<td>
<%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
<% end %>
</td>
<td><%= user.real_name %></td>
<td class="text-left"><%= link_to package.title, "/crowdsourcing/#{package.id}", :target => "_blank" %></td>
<td class="text-left"><%= overflow_hidden_span package.content[0..50] + "..."%></td>
<td><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %></td>
<% if is_processed %>
<td class="text-secondary"><%= overflow_hidden_span apply.reason %></td>
<td><span class="apply-status-<%= apply.status %>"><%= t("admins_apply_status.status.#{apply.status}") %></span></td>
<% else %>
<td class="action-container">
<%= agree_link '同意', agree_admins_project_package_apply_path(apply, element: ".project_package_applies-#{apply.id}"), 'data-confirm': '确认审核通过?' %>
<%= javascript_void_link('拒绝', class: 'action refuse-action',
data: {
toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id,
url: refuse_admins_project_package_apply_path(apply, element: ".project_package_applies-#{apply.id}")
}) %>
</td>
<% end %>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %>

@ -59,6 +59,9 @@
<li><%= sidebar_item(admins_shixun_authorizations_path, '实训发布', icon: 'object-ungroup', controller: 'admins-shixun_authorizations') %></li> <li><%= sidebar_item(admins_shixun_authorizations_path, '实训发布', icon: 'object-ungroup', controller: 'admins-shixun_authorizations') %></li>
<li><%= sidebar_item(admins_subject_authorizations_path, '实践课程发布', icon: 'object-group', controller: 'admins-subject_authorizations') %></li> <li><%= sidebar_item(admins_subject_authorizations_path, '实践课程发布', icon: 'object-group', controller: 'admins-subject_authorizations') %></li>
<li><%= sidebar_item(admins_library_applies_path, '教学案例发布', icon: 'language', controller: 'admins-library_applies') %></li> <li><%= sidebar_item(admins_library_applies_path, '教学案例发布', icon: 'language', controller: 'admins-library_applies') %></li>
<li><%= sidebar_item(admins_project_package_applies_path, '众包需求发布', icon: 'joomla', controller: 'admins-project_package_applies') %></li>
<li><%= sidebar_item(admins_video_applies_path, '视频发布', icon: 'film', controller: 'admins-video_applies') %></li>
<% end %> <% end %>
</li> </li>

@ -0,0 +1,32 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('视频发布') %>
<% end %>
<div class="box search-form-container flex-column mb-0 pb-0 video-applies-form">
<ul class="nav nav-tabs w-100 search-form-tabs">
<li class="nav-item">
<%= link_to '待审批', admins_video_applies_path(status: :pending), remote: true, 'data-value': 'pending',
class: "nav-link search-form-tab #{params[:status] == 'pending' ? 'active' : ''}" %>
</li>
<li class="nav-item">
<%= link_to '已审批', admins_video_applies_path(status: "all"), remote: true, 'data-value': 'all',
class: "nav-link search-form-tab #{params[:status] != 'pending' ? 'active' : ''}" %>
</li>
</ul>
<%= form_tag(admins_video_applies_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %>
<div class="form-group status-filter" style="<%= params[:status] != 'pending' ? '' : 'display: none;' %>">
<label for="status">审核状态:</label>
<% status_options = [['全部', 'all'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %>
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '需求标题检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<% end %>
</div>
<div class="box video-applies-list-container">
<%= render(partial: 'admins/video_applies/shared/list', locals: { applies: @video_applies}) %>
</div>
<%= render(partial: 'admins/shared/admin_common_refuse_modal') %>

@ -0,0 +1 @@
$('.video-applies-list-container').html("<%= j( render partial: 'admins/video_applies/shared/list', locals: { applies: @video_applies } ) %>");

@ -0,0 +1,56 @@
<% is_processed = params[:status].to_s != 'pending' %>
<table class="table table-hover text-center library_applies-list-table">
<thead class="thead-light">
<tr>
<th width="8%">头像</th>
<th width="14%">姓名</th>
<th width="26%" class="text-left">视频名称</th>
<th width="26%" class="text-left">播放链接</th>
<th width="16%">时间</th>
<% if is_processed %>
<th width="16%">拒绝原因</th>
<th width="8%">状态</th>
<% else %>
<th width="20%">操作</th>
<% end %>
</tr>
</thead>
<tbody>
<% if applies.present? %>
<% applies.each do |v| %>
<% video = v.video %>
<% user = video.user %>
<tr class="video-applies-item video-applies-<%= v.id %>">
<td>
<%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
<% end %>
</td>
<td><%= user.real_name %></td>
<td class="text-left"><%= link_to video.title, video.file_url, :target => "_blank" %></td>
<td class="text-left"><%= link_to "播放视频",video.file_url, target: "_blank" %></td>
<td><%= v.updated_at.strftime('%Y-%m-%d %H:%M') %></td>
<% if is_processed %>
<td class="text-secondary"><%= overflow_hidden_span v.reason %></td>
<td><span class="apply-status-<%= v.status %>"><%= t("admins_apply_status.status.#{v.status}") %></span></td>
<% else %>
<td class="action-container">
<%= agree_link '同意', agree_admins_video_apply_path(v, element: ".video_applies-#{v.id}"), 'data-confirm': '确认审核通过?' %>
<%= javascript_void_link('拒绝', class: 'action refuse-action',
data: {
toggle: 'modal', target: '.admin-common-refuse-modal', id: v.id,
url: refuse_admins_video_apply_path(v, element: ".video_applies-#{v.id}")
}) %>
</td>
<% end %>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %>

@ -7,3 +7,10 @@ zh-CN:
button_test: 测试 button_test: 测试
button_edit: 编辑 button_edit: 编辑
button_delete: 删除 button_delete: 删除
admins_apply_status:
status:
'pending': '待审批'
'processed': '已审批'
'refused': '已拒绝'
'agreed': '已同意'

@ -810,6 +810,12 @@ Rails.application.routes.draw do
post :refuse post :refuse
end end
end end
resources :video_applies, only: [:index] do
member do
post :agree
post :refuse
end
end
resources :identity_authentications, only: [:index] do resources :identity_authentications, only: [:index] do
member do member do
post :agree post :agree

@ -16,3 +16,16 @@
# #
# t.timestamps # t.timestamps
# end # end
#
# video_p = {
# user_id: 1,
# title: "第一个测试的.mp4",
# uuid: "748fa8165062433781ccd87f1f815403",
# cover_url: "http://outin-396971199eed11e991a100163e1c7426.oss-cn-shanghai.aliyuncs.com/sv/30ec9167-16ca9111f7d/30ec9167-16ca9111f7d.mp4",
# file_url: "http://outin-396971199eed11e991a100163e1c7426.oss-cn-shanghai.aliyuncs.com/sv/30ec9167-16ca9111f7d/30ec9167-16ca9111f7d.mp4",
# status: "pending",
# vod_status: "uploaded",
# published_at: nil,
# filesize: 14877403
# }

@ -0,0 +1,171 @@
#coding=utf-8
# 执行示例 bundle exec rake public_course:student args=3,3097
# args 第一个参数是subject_id第二个参数是课程course_id
# 第一期时间2017-07-23 至2017-10-24
# 第二期时间2017-10-27 至2018-01-28
# 第三期时间2018-03-07 至2018-06-08
# 第四期时间2018-09-08 至2018-12-08
# 第五期时间2019-03-02 至2019-06-02
# 第六期时间2019-06-25 至2019-09-25#
# 这次学习很有收获,感谢老师提供这么好的资源和细心的服务🎉🎉🎉
#
desc "同步精品课数据"
namespace :public_course_zhp do
if ENV['args']
subject_id = ENV['args'].split(",")[0] # 对应课程的id
course_id = ENV['args'].split(",")[1] # 对应课堂的id
status = ENV['args'].split(",")[2] # 表示相应的期数
type = ENV['args'].split(",")[3] # 表示课程模块
end
if status.to_i == 1
start_time = '2017-07-23'
end_time = '2017-10-24'
elsif status.to_i == 2
start_time = '2017-10-27'
end_time = '2018-01-28'
elsif status.to_i == 3
start_time = '2018-03-07'
end_time = '2018-06-08'
elsif status.to_i == 4
start_time = '2018-09-08'
end_time = '2018-12-08'
elsif status.to_i == 5
start_time = '2019-03-02'
end_time = '2019-06-02'
else
# 这种情况是取所有的
start_time = '2019-06-25'
end_time = '2019-09-25'
end
task :student => :environment do
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
begin
CourseMember.create!(course_id: course_id, user_id: user_id, role: 4)
rescue Exception => e
Rails.logger(e.message)
end
end
end
end
task :test_user => :environment do
users = User.where(is_test: true)
users.find_each do |user|
puts user.id
CourseMember.create!(course_id: course_id, user_id: user.id, role: 4)
end
end
# 更新某个课程的某类时间
# 执行示例 RAILS_ENV=production bundle exec rake public_course:time args=-1,2932,1,1
task :time => :environment do
# course_id = ENV['args'].split(",")[0] # 对应课堂的id
# type = ENV['args'].split(",")[1]
course = Course.find(course_id)
case type.to_i
when 1
# 讨论区
messages = Message.where(board_id: course.boards)
messages.each do |message|
created_on = random_time start_time, end_time
puts created_on
message.update_columns(created_on: created_on, updated_on: created_on)
MessageDetail.where(message_id: message.id).each do |detail|
rand_created_on = random_time start_time, end_time
detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on)
end
end
when 2
# 作业
course.homework_commons.each do |homework|
created_at = random_time(start_time, end_time)
publish_time = random_larger_time created_at, start_time, end_time
end_time = random_larger_time publish_time, start_time, end_time
updated_at = end_time
homework.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at)
homework.homework_detail_manual.update_columns(comment_status: 6, created_at: created_at, updated_at: updated_at)
homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time)
end
when 3
# 试卷
course.exercises.each do |exercise|
created_at = random_time start_time, end_time
publish_time = random_larger_time created_at, start_time, end_time
end_time = random_larger_time publish_time, start_time, end_time
updated_at = end_time
exercise.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at, exercise_status: 3)
end
when 4
# 资源
course.attachments.each do |atta|
created_on = random_time start_time, end_time
atta.update_columns(is_publish: 1, created_on: created_on, publish_time: created_on)
end
end
end
task :create_homework_work => :environment do
course = Course.find(course_id)
course.practice_homeworks.each do |homework|
if homework.student_works.count == 0
str = ""
CourseMember.students(course).each do |student|
str += "," if str != ""
str += "(#{homework.id},#{student.user_id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
if str != ""
sql = "insert into student_works (homework_common_id, user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
end
def min_swith(time)
puts time
return time < 9 ? "0#{time}" : time
end
def random_time(start_time, end_time)
hour = (6..23).to_a.sample(1).first
min = rand(60)
sec = rand(60)
start_time = Date.parse(start_time)
end_time = Date.parse(end_time)
date = (start_time..end_time).to_a.sample(1).first
time = "#{date} #{min_swith(hour)}:#{min_swith(min)}:#{min_swith(sec)}"
puts time
time
end
def random_larger_time(time, start_time, end_time)
large_time = random_time(start_time, end_time)
while large_time <= time
large_time = random_time(start_time, end_time)
end
large_time
end
end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -128624,6 +128624,27 @@ $(document).on('turbolinks:load', function() {
} }
}) })
; ;
$(document).on('turbolinks:load', function() {
if ($('body.admins-project-package-applies-index-page').length > 0) {
var $searchFrom = $('.project-package-applies-form');
$searchFrom.find('select[name="status"]').val('pending');
$searchFrom.on('click', '.search-form-tab', function(){
var $link = $(this);
$searchFrom.find('input[name="keyword"]').val('');
$searchFrom.find('select[name="status"]').val('all');
if($link.data('value') === 'all'){
$searchFrom.find('.status-filter').show();
} else {
$searchFrom.find('.status-filter').hide();
$searchFrom.find('select[name="status"]').val('pending');
}
});
}
})
;
$(document).on('turbolinks:load', function(){ $(document).on('turbolinks:load', function(){
if ($('body.admins-school-statistics-index-page').length > 0) { if ($('body.admins-school-statistics-index-page').length > 0) {
var searchForm = $(".school-statistic-list-form .search-form"); var searchForm = $(".school-statistic-list-form .search-form");
@ -129163,6 +129184,27 @@ $(document).on('turbolinks:load', function(){
}); });
} }
}); });
$(document).on('turbolinks:load', function() {
if ($('body.admins-video-applies-index-page').length > 0) {
var $searchFrom = $('.video-applies-form');
$searchFrom.find('select[name="status"]').val('pending');
$searchFrom.on('click', '.search-form-tab', function(){
var $link = $(this);
$searchFrom.find('input[name="keyword"]').val('');
$searchFrom.find('select[name="status"]').val('all');
if($link.data('value') === 'all'){
$searchFrom.find('.status-filter').show();
} else {
$searchFrom.find('.status-filter').hide();
$searchFrom.find('select[name="status"]').val('pending');
}
});
}
})
;

@ -128624,6 +128624,27 @@ $(document).on('turbolinks:load', function() {
} }
}) })
; ;
$(document).on('turbolinks:load', function() {
if ($('body.admins-project-package-applies-index-page').length > 0) {
var $searchFrom = $('.project-package-applies-form');
$searchFrom.find('select[name="status"]').val('pending');
$searchFrom.on('click', '.search-form-tab', function(){
var $link = $(this);
$searchFrom.find('input[name="keyword"]').val('');
$searchFrom.find('select[name="status"]').val('all');
if($link.data('value') === 'all'){
$searchFrom.find('.status-filter').show();
} else {
$searchFrom.find('.status-filter').hide();
$searchFrom.find('select[name="status"]').val('pending');
}
});
}
})
;
$(document).on('turbolinks:load', function(){ $(document).on('turbolinks:load', function(){
if ($('body.admins-school-statistics-index-page').length > 0) { if ($('body.admins-school-statistics-index-page').length > 0) {
var searchForm = $(".school-statistic-list-form .search-form"); var searchForm = $(".school-statistic-list-form .search-form");
@ -129163,6 +129184,27 @@ $(document).on('turbolinks:load', function(){
}); });
} }
}); });
$(document).on('turbolinks:load', function() {
if ($('body.admins-video-applies-index-page').length > 0) {
var $searchFrom = $('.video-applies-form');
$searchFrom.find('select[name="status"]').val('pending');
$searchFrom.on('click', '.search-form-tab', function(){
var $link = $(this);
$searchFrom.find('input[name="keyword"]').val('');
$searchFrom.find('select[name="status"]').val('all');
if($link.data('value') === 'all'){
$searchFrom.find('.status-filter').show();
} else {
$searchFrom.find('.status-filter').hide();
$searchFrom.find('select[name="status"]').val('pending');
}
});
}
})
;

@ -2,89 +2,90 @@ import React, { Component } from 'react';
const $ = window.jQuery const $ = window.jQuery
const jQuery = $; const jQuery = $;
if (!$.drag) { // if () {
(function($){ // !$.drag
$.fn.dragValidator = function(options){ // (function($){
var x, drag = this, isMove = false, defaults = { // $.fn.dragValidator = function(options){
}; // var x, drag = this, isMove = false, defaults = {
var options = $.extend(defaults, options); // };
//添加背景,文字,滑块 // var options = $.extend(defaults, options);
var html = '<div class="drag_bg"></div>'+ // //添加背景,文字,滑块
'<div class="drag_text" onselectstart="return false;" unselectable="on">拖动滑块验证</div>'+ // var html = '<div class="drag_bg"></div>'+
'<div class="handler handler_bg"></div>'; // '<div class="drag_text" onselectstart="return false;" unselectable="on">拖动滑块验证</div>'+
this.append(html); // '<div class="handler handler_bg"></div>';
// this.append(html);
var handler = drag.find('.handler'); //
var drag_bg = drag.find('.drag_bg'); // var handler = drag.find('.handler');
var text = drag.find('.drag_text'); // var drag_bg = drag.find('.drag_bg');
var maxWidth = text.width() - handler.width(); //能滑动的最大间距 // var text = drag.find('.drag_text');
//鼠标按下时候的x轴的位置 // var maxWidth = text.width() - handler.width(); //能滑动的最大间距
handler.mousedown(function(e){ // //鼠标按下时候的x轴的位置
isMove = true; // handler.mousedown(function(e){
x = e.pageX - parseInt(handler.css('left'), 10); // isMove = true;
}); // x = e.pageX - parseInt(handler.css('left'), 10);
// });
//鼠标指针在上下文移动时移动距离大于0小于最大间距滑块x轴位置等于鼠标移动距离 //
$(document).mousemove(function(e){ // //鼠标指针在上下文移动时移动距离大于0小于最大间距滑块x轴位置等于鼠标移动距离
var _x = e.pageX - x; // $(document).mousemove(function(e){
var handler_offset = handler.offset(); // var _x = e.pageX - x;
var lastX = e.clientX -x; // var handler_offset = handler.offset();
lastX = Math.max(0,Math.min(maxWidth,lastX)); // var lastX = e.clientX -x;
if(isMove){ // lastX = Math.max(0,Math.min(maxWidth,lastX));
if(_x > 0 && _x <= maxWidth){ // if(isMove){
handler.css({'left': lastX}); // if(_x > 0 && _x <= maxWidth){
drag_bg.css({'width': lastX}); // handler.css({'left': lastX});
} // drag_bg.css({'width': lastX});
else if(lastX > maxWidth - 5 && lastX < maxWidth + 5 ){ //鼠标指针移动距离达到最大时清空事件 // }
dragOk(); // else if(lastX > maxWidth - 5 && lastX < maxWidth + 5 ){ //鼠标指针移动距离达到最大时清空事件
// dragOk();
} //
} // }
}); // }
handler.mouseup(function(e){ // });
isMove = false; // handler.mouseup(function(e){
var _x = e.pageX - x; // isMove = false;
if(text.text() != '验证通过' && _x < maxWidth){ //鼠标松开时,如果没有达到最大距离位置,滑块就返回初始位置 // var _x = e.pageX - x;
handler.animate({'left': 0}); // if(text.text() != '验证通过' && _x < maxWidth){ //鼠标松开时,如果没有达到最大距离位置,滑块就返回初始位置
drag_bg.animate({'width': 0}); // handler.animate({'left': 0});
} // drag_bg.animate({'width': 0});
}); // }
// });
//清空事件 //
function dragOk(){ // //清空事件
options.dragOkCallback && options.dragOkCallback() // function dragOk(){
var kuaiwidth=drag.width() - handler.width() - 2; // options.dragOkCallback && options.dragOkCallback()
handler.removeClass('handler_bg').addClass('handler_ok_bg'); // var kuaiwidth=drag.width() - handler.width() - 2;
handler.css({'left':kuaiwidth+'px'}) // handler.removeClass('handler_bg').addClass('handler_ok_bg');
text.css({'width':kuaiwidth+'px'}); // handler.css({'left':kuaiwidth+'px'})
text.text('验证通过'); // text.css({'width':kuaiwidth+'px'});
drag.css({'color': '#fff'}); // text.text('验证通过');
drag_bg.css({'width':kuaiwidth+'px'}) // drag.css({'color': '#fff'});
handler.unbind('mousedown'); // drag_bg.css({'width':kuaiwidth+'px'})
$(document).unbind('mousemove'); // handler.unbind('mousedown');
$(document).unbind('mouseup'); // $(document).unbind('mousemove');
$("#user_verification_notice").html(""); // $(document).unbind('mouseup');
$('#user_verification_notice').parent().hide(); // $("#user_verification_notice").html("");
} // $('#user_verification_notice').parent().hide();
}; // }
})(jQuery); // };
} // })(jQuery);
// }
class DragValidator extends Component { class DragValidator extends Component {
componentDidMount () { componentDidMount () {
// if($("#reg-drag").length>0 && IsPC()){ // if($("#reg-drag").length>0 && IsPC()){
$("#reg-drag").dragValidator({ // $("#reg-drag").dragValidator({
height: this.props.height, // height: this.props.height,
dragOkCallback: () => { // dragOkCallback: () => {
this.props.dragOkCallback && this.props.dragOkCallback() // this.props.dragOkCallback && this.props.dragOkCallback()
} // }
}); // });
// }else{ // }else{
// $("#reg-drag").empty(); // $("#reg-drag").empty();
// } // }
} }
empty() { empty() {
$("#reg-drag").empty(); // $("#reg-drag").empty();
} }
render() { render() {
const height = this.props.height || 45; const height = this.props.height || 45;

@ -42,7 +42,7 @@ export { SetAppModel } from './components/SetAppModel'
export { default as LinkAfterLogin } from './components/LinkAfterLogin' export { default as LinkAfterLogin } from './components/LinkAfterLogin'
export { default as Cropper } from './components/Cropper' export { default as Cropper } from './components/Cropper'
export { default as ConditionToolTip } from './components/ConditionToolTip' export { default as ConditionToolTip } from './components/ConditionToolTip'
export { default as DragValidator } from './components/DragValidator' // export { default as DragValidator } from './components/DragValidator'
export { default as PopInstruction } from './components/instruction/PopInstruction' export { default as PopInstruction } from './components/instruction/PopInstruction'

@ -6,6 +6,7 @@ import axios from 'axios';
import YslDetailCards from "./YslDetailCards.js"; import YslDetailCards from "./YslDetailCards.js";
import Jointheclass from '../../modals/Jointheclass'; import Jointheclass from '../../modals/Jointheclass';
import LoginDialog from "../../login/LoginDialog"; import LoginDialog from "../../login/LoginDialog";
import NoneData from '../../../modules/courses/coursesPublic/NoneData'
//在线学习 //在线学习
class Elearning extends Component{ class Elearning extends Component{
@ -377,14 +378,8 @@ class Elearning extends Component{
<div className=" clearfix" style={{marginTop:"20px"}}> <div className=" clearfix" style={{marginTop:"20px"}}>
{ {
stages===undefined||stages===JSON.stringify("[]")||stages.length===0? stages===undefined||stages===JSON.stringify("[]")||stages.length===0?
<div> <NoneData></NoneData>
:
<div className="alltask ">
<div className="edu-tab-con-box clearfix edu-txt-center"><img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p></div>
</div>
</div>:
<div> <div>
{/*开始学习*/} {/*开始学习*/}
<YslDetailCards {...this.state} {...this.props} Startlearningtwo={()=>this.Startlearningtwo()} Myreload={()=>this.Myreload()} Tojoinclass={()=>this.Tojoinclass()}></YslDetailCards> <YslDetailCards {...this.state} {...this.props} Startlearningtwo={()=>this.Startlearningtwo()} Myreload={()=>this.Myreload()} Tojoinclass={()=>this.Tojoinclass()}></YslDetailCards>

@ -5,6 +5,8 @@ import './myysleduinforms.css'
import axios from 'axios'; import axios from 'axios';
import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor";
import Bullsubdirectory from "./Bullsubdirectory"; import Bullsubdirectory from "./Bullsubdirectory";
import NoneData from '../../../modules/courses/coursesPublic/NoneData'
import moment from "../new/CoursesNew"; import moment from "../new/CoursesNew";
import Fileslistitem from "../Resource/Fileslistitem"; import Fileslistitem from "../Resource/Fileslistitem";
// 公告栏 // 公告栏
@ -399,11 +401,7 @@ class Eduinforms extends Component{
{ {
informs === null || informs=== undefined ||informs.length === 0 ? informs === null || informs=== undefined ||informs.length === 0 ?
this.state.yslbool===false? this.state.yslbool===false?
<div className="alltask "> <NoneData></NoneData>
<div className="edu-tab-con-box clearfix edu-txt-center"><img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p></div>
</div>
:"" :""
: :

@ -1,5 +1,5 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip} from "antd"; import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Divider } from "antd";
import ClipboardJS from 'clipboard' import ClipboardJS from 'clipboard'
import '../css/Courses.css' import '../css/Courses.css'
import '../css/members.css' import '../css/members.css'
@ -603,16 +603,22 @@ class studentsList extends Component{
width: 93px; width: 93px;
} }
.drop_down_menu li { .drop_down_menu li {
overflow: visible;
width:100%; width:100%;
box-sizing:boder-box; box-sizing:boder-box;
float:unset; float:unset;
line-height:30px!important;
flex: 0 0 30px;
} }
.drop_down_menu, .drop_down_normal { .drop_down_menu, .drop_down_normal {
padding-top: 10px; padding-top: 10px;
padding-bottom: 8px; padding-bottom: 8px;
} }
.drop_down_menu .drop_down_btn{
border-top:none;
}
.dividerStyle.ant-divider-horizontal{
margin: 0px;
}
`}</style> `}</style>
{ isAdmin && { isAdmin &&
<li className="li_line drop_down fr color-blue font-16"> <li className="li_line drop_down fr color-blue font-16">
@ -656,8 +662,10 @@ class studentsList extends Component{
</p>): </p>):
'' ''
} }
{course_group_id != 0 && <li key={0} onClick={() => this.moveToGroup({id: 0})}>未分班</li>} {
course_group_id != 0 && course_groups && course_groups.length > 0 &&
<li key={0} onClick={() => this.moveToGroup({id: 0})}>未分班</li>
}
{ course_groups.filter((item)=> { { course_groups.filter((item)=> {
return item.id != course_group_id && (!this.state.groupSearchValue || item.name.indexOf(this.state.groupSearchValue) != -1) return item.id != course_group_id && (!this.state.groupSearchValue || item.name.indexOf(this.state.groupSearchValue) != -1)
}).map( item => { }).map( item => {
@ -665,6 +673,7 @@ class studentsList extends Component{
<li key={item.id} onClick={() => this.moveToGroup(item)} title={item.name}>{item.name}</li> <li key={item.id} onClick={() => this.moveToGroup(item)} title={item.name}>{item.name}</li>
) )
}) } }) }
{ course_groups && course_groups.length > 0 && <Divider className="dividerStyle"></Divider> }
{ isAdmin && { isAdmin &&
<p className="drop_down_btn"> <p className="drop_down_btn">

@ -677,6 +677,17 @@ class studentsList extends Component{
float: none; float: none;
text-align: center; text-align: center;
} }
.drop_down_menu .drop_down_btn{
border-top:none;
}
.dividerStyle.ant-divider-horizontal{
margin: 0px;
}
.drop_down_menu li {
line-height:30px!important;
flex: 0 0 30px;
}
`}</style> `}</style>
<div className="mt20 edu-back-white padding20 teacherList"> <div className="mt20 edu-back-white padding20 teacherList">
@ -711,6 +722,7 @@ class studentsList extends Component{
) )
}) })
} }
{ groupList && groupList.graduation_groups_count > 0 && <Divider className="dividerStyle"></Divider> }
<p className="drop_down_btn"> <p className="drop_down_btn">
<a href="javascript:void(0)" className="color-grey-6" <a href="javascript:void(0)" className="color-grey-6"
onClick={() => this.refs['addGraduationGroupModal'].setVisible(true)} onClick={() => this.refs['addGraduationGroupModal'].setVisible(true)}

@ -871,7 +871,7 @@ submittojoinclass=(value)=>{
</li> </li>
{ {
this.props.Headertop && this.props.Headertop.college_identifier && this.props.Headertop && this.props.Headertop.college_identifier &&
<li><a href={`/colleges/${this.props.Headertop.college_identifier}/statistics`}>学院统计</a></li> <li><a href={`${this.props.Headertop.old_url}/colleges/${this.props.Headertop.college_identifier}/statistics`}>学院统计</a></li>
} }
<li><a href={`/account/profile`}>账号管理</a></li> <li><a href={`/account/profile`}>账号管理</a></li>

@ -41,7 +41,7 @@ class Repository extends Component {
} }
render() { render() {
let { match, author, git_url, lastest_commit, trees, commits,repositoryLoading, pathArray } = this.props; let { match, author, git_url, lastest_commit, trees, commits,repositoryLoading, pathArray , TPMRightSectionData } = this.props;
if (!author) { if (!author) {
author = {} author = {}
} }
@ -49,7 +49,6 @@ class Repository extends Component {
if(this.props.author!=undefined){ if(this.props.author!=undefined){
userauthority=this.props.author.login===""||this.props.author.user_id===""||this.props.author.login===null||this.props.author.user_id===null; userauthority=this.props.author.login===""||this.props.author.user_id===""||this.props.author.login===null||this.props.author.user_id===null;
} }
return ( return (
<React.Fragment> <React.Fragment>
{/* jfinalshop/WebRoot */} {/* jfinalshop/WebRoot */}
@ -85,7 +84,7 @@ class Repository extends Component {
<a href="/forums/2784" target="_blank" <a href="/forums/2784" target="_blank"
className=" guideBtn" >Git使用指南</a> className=" guideBtn" >Git使用指南</a>
{ {
this.props.current_user && this.props.current_user.admin ==true ? this.props.current_user && (this.props.current_user.admin ==true || (TPMRightSectionData && TPMRightSectionData.creator && TPMRightSectionData.creator.login == this.props.current_user.login)) ?
<ActionBtn style="orangeLine" className="ml20" to={`/shixuns/${match.params.shixunId}/repository/add_file`}>+添加文件</ActionBtn>:"" <ActionBtn style="orangeLine" className="ml20" to={`/shixuns/${match.params.shixunId}/repository/add_file`}>+添加文件</ActionBtn>:""
} }

@ -89,8 +89,10 @@ class RepositoryAddFile extends Component {
} }
checkPath= (rule, value, callback) =>{ checkPath= (rule, value, callback) =>{
if (value.indexOf("/") > -1 && value.length==1 ) { if (value == "/" ) {
callback('请输入正确的文件路径'); callback('请输入正确的文件路径');
}else if(!value){
callback('文件名不能为空');
}else{ }else{
callback(); callback();
} }
@ -156,7 +158,6 @@ class RepositoryAddFile extends Component {
<Form.Item label="文件名"> <Form.Item label="文件名">
{getFieldDecorator('path', { {getFieldDecorator('path', {
rules: [ rules: [
{required: true, message: "文件名不能为空"},
{ {
validator:this.checkPath validator:this.checkPath
}] }]

Loading…
Cancel
Save