Merge remote-tracking branch 'origin/dev_aliyun' into dev_tj

dev_forge
tangjiang 5 years ago
commit 2512676406

@ -0,0 +1,22 @@
$(document).on('turbolinks:load', function(){
if ($('body.admins-shixun-feedback-messages-index-page').length > 0) {
var baseOptions = {
autoclose: true,
language: 'zh-CN',
format: 'yyyy-mm-dd 00:00:00',
startDate: '2017-04-01'
}
var defineDateRangeSelect = function(element){
var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, baseOptions);
$(element).datepicker(options);
$(element).find('.start-date').datepicker().on('changeDate', function(e){
$(element).find('.end-date').datepicker('setStartDate', e.date);
})
};
defineDateRangeSelect('.grow-date-input-daterange');
}
})

@ -60,7 +60,7 @@ class AccountsController < ApplicationController
ua = UserAgent.find_by_ip(ip)
ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua
successful_authentication(@user)
session[:user_id] = @user.id
# session[:user_id] = @user.id
normal_status("注册成功")
end
rescue Exception => e
@ -94,7 +94,7 @@ class AccountsController < ApplicationController
successful_authentication(@user)
login_control.clear # 重置每日密码错误次数
session[:user_id] = @user.id
# session[:user_id] = @user.id
end
# 忘记密码
@ -136,6 +136,7 @@ class AccountsController < ApplicationController
set_autologin_cookie(user)
UserAction.create(:action_id => user.try(:id), :action_type => "Login", :user_id => user.try(:id), :ip => request.remote_ip)
user.update_column(:last_login_on, Time.now)
session[:"#{default_yun_session}"] = user.id
# 注册完成后有一天的试用申请(先去掉)
# UserDayCertification.create(user_id: user.id, status: 1)
end
@ -158,7 +159,6 @@ class AccountsController < ApplicationController
def logout
UserAction.create(action_id: User.current.id, action_type: "Logout", user_id: User.current.id, :ip => request.remote_ip)
session[:user_id] = nil
logout_user
render :json => {status: 1, message: "退出成功!"}
end

@ -17,10 +17,16 @@ class Admins::LaboratorySubjectsController < Admins::BaseController
def destroy
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
current_laboratory_subject.destroy!
ActiveRecord::Base.transaction do
current_subject = current_laboratory_subject.subject
current_subject.shixuns.each do |shixun|
shixun.destroy!
end
current_subject.destroy!
render_delete_success
end
end
def homepage

@ -5,7 +5,7 @@ class Admins::SchoolsController < Admins::BaseController
schools = Admins::SchoolQuery.call(params)
@schools = paginate schools
@schools = paginate schools.includes(:user_extensions)
school_ids = @schools.map(&:id)
@department_count = Department.where(school_id: school_ids).group(:school_id).count

@ -0,0 +1,22 @@
class Admins::ShixunFeedbackMessagesController < Admins::BaseController
def index
@params_page = params[:page] || 1
if params[:keyword].present?
discusses = Discuss.joins("LEFT JOIN shixuns ON discusses.dis_id = shixuns.id AND dis_type = 'Shixun'")
.where("shixuns.name like ?", "%#{params[:keyword]}%")
else
discusses = Discuss.where(:dis_type => 'Shixun').includes(:user, :dis)
end
if params[:begin_date].present?
discusses = discusses.where("discusses.created_at > ?", params[:begin_date])
end
if params[:end_date].present?
discusses = discusses.where("discusses.created_at < ?", params[:end_date])
end
@discusses = paginate discusses.order("created_at desc")
end
end

@ -299,9 +299,11 @@ class ApplicationController < ActionController::Base
# and starts a session if needed
def find_current_user
uid_logger("user setup start: session[:user_id] is #{session[:user_id]}")
if session[:user_id]
uid_logger("0000000000000user setup start: default_yun_session is #{default_yun_session}, session[:current_user_id] is #{session[:"#{default_yun_session}"]}")
current_domain_session = session[:"#{default_yun_session}"]
if current_domain_session
# existing session
(User.active.find(session[:user_id]) rescue nil)
(User.active.find(current_domain_session) rescue nil)
elsif autologin_user = try_to_autologin
autologin_user
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
@ -313,10 +315,10 @@ class ApplicationController < ActionController::Base
def try_to_autologin
if cookies[autologin_cookie_name]
# auto-login feature starts a new session
user = User.try_to_autologin(cookies[autologin_cookie_name])
if user
start_user_session(user)
end
user = nil
Rails.logger.info("111111111111111111#{default_yun_session}, session is #{session[:"#{default_yun_session}"]} ")
user = User.try_to_autologin(cookies[autologin_cookie_name]) if session[:"#{default_yun_session}"]
start_user_session(user) if user
user
end
end
@ -402,25 +404,6 @@ class ApplicationController < ActionController::Base
end
end
# 处理返回非0就报错的请求
def interface_post(uri, params, status, message)
begin
uid_logger_dubug("--uri_exec: params is #{params}, url is #{uri}")
uri = URI.parse(URI.encode(uri.strip))
res = Net::HTTP.post_form(uri, params).body
uid_logger_dubug("--uri_exec: .....res is #{res}")
res = JSON.parse(res)
if (res && res['code'] != 0)
tip_exception(status, message)
else
res
end
rescue Exception => e
uid_logger("--uri_exec: exception #{e.message}")
raise Educoder::TipException.new("实训平台繁忙繁忙等级84")
end
end
# json格式请求
def interface_json_post(uri, params, status, message)
begin

@ -125,7 +125,7 @@ class AttachmentsController < ApplicationController
end
digest = md5_file(temp_file)
digest = "#{digest}_#{Time.now.to_i}"
digest = "#{digest}_#{(Time.now.to_f * 1000).to_i}"
local_file_path = File.join(save_path, digest) + ext
save_temp_file(temp_file, local_file_path)

@ -308,6 +308,7 @@ class ChallengesController < ApplicationController
end
def challenge_params
tip_exception("评测时间不能超过300秒") if params[:challenge][:exec_time].to_i > 300
params.require(:challenge).permit(:subject, :task_pass, :difficulty, :score, :st, :modify_time, :test_set_average,
:path, :exec_path, :show_type, :original_picture_path, :test_set_score,
:expect_picture_path, :picture_path, :web_route, :answer, :exec_time)

@ -6,6 +6,7 @@ module LaboratoryHelper
helper_method :current_laboratory
helper_method :default_setting
helper_method :default_yun_session
end
def current_laboratory
@ -23,4 +24,9 @@ module LaboratoryHelper
def setup_laboratory
Laboratory.current = current_laboratory
end
def default_yun_session
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
@_default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
end
end

@ -29,7 +29,7 @@ module LoginHelper
Rails.logger.info("id: #{user&.id} Successful authentication start: '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}")
# Valid user
self.logged_user = user
session[:"#{default_yun_session}"] = user.id
# generate a key and set cookie if autologin
set_autologin_cookie(user)
@ -47,12 +47,16 @@ module LoginHelper
User.current.delete_session_token(session[:tk])
self.logged_user = nil
end
session[:user_id] = nil
# 云上实验室退出清理当前session
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
# end
session[:"#{default_yun_session}"] = nil
end
# Sets the logged in user
def logged_user=(user)
reset_session
# reset_session
if user && user.is_a?(User)
User.current = user
start_user_session(user)
@ -73,7 +77,8 @@ module LoginHelper
# # session[:"#{request.subdomain}_user_id"] = user.id
# # end
session[:user_id] = user.id
# session[:user_id] = user.id
session[:"#{default_yun_session}"] = user.id
session[:ctime] = Time.now.utc.to_i
session[:atime] = Time.now.utc.to_i
end

@ -1,9 +1,9 @@
class HackUserLastestCodesController < ApplicationController
before_action :require_login, except: [:listen_result]
before_action :find_my_hack, only: [:show, :code_debug, :code_submit, :update_code,
:listen_result, :result, :submit_records]
:listen_result, :result, :submit_records, :restore_initial_code]
before_action :update_user_hack_status, only: [:code_debug, :code_submit]
before_action :require_auth_identity, only: [:update_code]
before_action :require_auth_identity, only: [:update_code, :restore_initial_code]
before_action :require_manager_identity, only: [:update_code]
def show
@ -12,6 +12,13 @@ class HackUserLastestCodesController < ApplicationController
def update_code
@my_hack.update_attribute(:code, params[:code])
render_ok
end
# 回复初始代码
def restore_initial_code
@my_hack.update_attribute(:code, @hack.code)
render_ok
end
# 调试代码
@ -35,7 +42,7 @@ class HackUserLastestCodesController < ApplicationController
# 提交结果显示
def result
if @my_hack.submit_status == 1
render json: {status:0, message: "正在评测中"}
render json: {status: 1, message: "正在评测中"}
else
@mode = params[:mode]
@result =
@ -105,7 +112,7 @@ class HackUserLastestCodesController < ApplicationController
else
[{input: params[:input]}]
end
testCases = Base64.urlsafe_encode64(test_sets.to_json)
testCases = Base64.encode64(test_sets.to_json)
#codeFileContent = Base64.urlsafe_encode64(@my_hack.code)
debug_params = {execMode: exec_mode,
tpiID: @my_hack.identifier,
@ -121,6 +128,7 @@ class HackUserLastestCodesController < ApplicationController
# 正则错误行数
def regular_match_error_line content, language
content = Base64.decode64(content).force_encoding("utf-8")
case language
when 'Java'
content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min

@ -1,8 +1,9 @@
class HacksController < ApplicationController
before_action :require_login, except: [:index]
before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set]
before_action :require_teacher_identity, only: [:create, :update_set]
before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set]
before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set]
# 开启编程,如果第一次开启,创建一条记录,如果已经开启过的话,直接返回标识即可
def start
@ -19,7 +20,7 @@ class HacksController < ApplicationController
@hack.hack_user_lastest_codes.create!(user_code)
user_identifier
end
render_ok(data: {identifier: identifier})
render_ok(identifier: identifier)
end
# 首页
@ -46,6 +47,8 @@ class HacksController < ApplicationController
hack.identifier = generate_identifier Hack, 8
hack.save!
# 创建测试集与代码
logger.info("hack_sets_params:#{hack_sets_params}")
logger.info("hack_code_params:#{hack_code_params}")
hack.hack_sets.create!(hack_sets_params)
hack.hack_codes.create!(hack_code_params)
end

@ -25,7 +25,16 @@ class HelpsController < ApplicationController
end
def feedback
if params[:url].blank?
content = "<p>[#{params[:question_kind]}]</p></p>#{params[:description]}"
if params[:attachment_ids]
params[:attachment_ids].each do |attachment_id|
content += "![](/api/attachments/#{attachment_id})↵"
end
end
else
content = "<p>[#{params[:question_kind]}]</p><p>问题页面网址:#{params[:url]}</p>#{params[:description]}"
end
ActiveRecord::Base.transaction do
attr = { sender_id: User.current.id, receiver_id: 1, content: content, send_time: Time.now }

@ -30,10 +30,10 @@ class HomeController < ApplicationController
@main_shixuns = Shixun.where(homepage_show: true).includes(:tag_repertoires, :challenges).limit(8)
@main_subjects = Subject.where(homepage_show: true).includes(:shixuns, :repertoire).limit(8)
if current_laboratory.main_site?
@tea_users = User.where(homepage_teacher: 1).includes(:user_extension).limit(10).order("experience desc")
@stu_users = User.where(is_test: 0).includes(:user_extension).where(user_extensions: {identity: 1}).limit(10).order("experience desc")
end
# if current_laboratory.main_site?
# @tea_users = User.where(homepage_teacher: 1).includes(:user_extension).limit(10).order("experience desc")
# @stu_users = User.where(is_test: 0).includes(:user_extension).where(user_extensions: {identity: 1}).limit(10).order("experience desc")
# end
end
def search

@ -2,6 +2,7 @@ class Oauth::BaseController < ActionController::Base
include RenderHelper
include LoginHelper
include ControllerRescueHandler
include LaboratoryHelper
skip_before_action :verify_authenticity_token
@ -12,7 +13,8 @@ class Oauth::BaseController < ActionController::Base
private
def session_user_id
session[:user_id]
# session[:user_id]
session[:"#{default_yun_session}"]
end
def current_user
@ -23,4 +25,9 @@ class Oauth::BaseController < ActionController::Base
Rails.logger.info("[OAuth2] omniauth.auth -> #{request.env['omniauth.auth'].inspect}")
request.env['omniauth.auth']
end
def default_yun_session
@_default_yun_session = "#{request.subdomain.split('.').first}_user_id"
# @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id"
end
end

@ -198,14 +198,14 @@ class PollsController < ApplicationController
def common_header
ActiveRecord::Base.transaction do
begin
@poll_status = @poll.get_poll_status(current_user)
if @user_course_identity > Course::ASSISTANT_PROFESSOR
@is_teacher_or = 0
@user_poll_answer = @poll.check_user_votes_status(current_user)
@user_poll_answer = @poll.check_user_votes_status(current_user, @poll_status)
else
@is_teacher_or = 1
@user_poll_answer = 3 #教师页面
end
@poll_status = @poll.get_poll_status(current_user)
poll_id_array = [@poll.id]
@poll_publish_count = get_user_permission_course(poll_id_array,2).count #是否存在已发布的
@poll_unpublish_count = get_user_permission_course(poll_id_array,1).count #是否存在未发布的

@ -10,7 +10,7 @@ class ShixunsController < ApplicationController
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file, :shixun_list]
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
@ -515,7 +515,7 @@ class ShixunsController < ApplicationController
end
# 添加第二仓库
if params[:is_secret_repository]
add_secret_repository
add_secret_repository if @shixun.shixun_secret_repository.blank?
else
# 如果有仓库,就要删
if @shixun.shixun_secret_repository&.repo_name
@ -990,6 +990,16 @@ class ShixunsController < ApplicationController
CreateStudentWorkJob.perform_later(homework.id)
end
# 批量发送
def batch_send_to_course
@course = Course.find_by!(id: params[:course_id])
shixuns = Shixun.where(id: params[:shixun_ids]).unhidden
shixuns.each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, nil, current_user
CreateStudentWorkJob.perform_later(homework.id)
end
end
# 二维码扫描下载
def download_file
file_path = params[:file_name]

@ -2,7 +2,7 @@ class SubjectsController < ApplicationController
before_action :require_login, :check_auth, except: [:index, :show, :right_banner]
# before_action :check_auth, except: [:index]
before_action :check_account, except: [:index, :show, :right_banner]
before_action :find_subject, except: [:index, :create, :new, :append_to_stage]
before_action :find_subject, except: [:index, :create, :new, :append_to_stage, :add_shixun_to_stage]
before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report,
:up_member_position, :down_member_position, :update_team_title]
@ -10,6 +10,7 @@ class SubjectsController < ApplicationController
include ApplicationHelper
include SubjectsHelper
include GitCommon
def index
@tech_system = current_laboratory.subject_repertoires
@ -212,6 +213,28 @@ class SubjectsController < ApplicationController
@shixuns = Shixun.where(id: params[:shixun_id]).order("id desc")
end
# 添加实训项目
def add_shixun_to_stage
identifier = generate_identifier Shixun, 8
ActiveRecord::Base.transaction do
@shixun = Shixun.create!(name: params[:name], user_id: current_user.id, identifier: identifier)
# 添加合作者
@shixun.shixun_members.create!(user_id: current_user.id, role: 1)
# 创建长字段
ShixunInfo.create!(shixun_id: @shixun.id, description: "请在此处添加实训描述")
# 创建版本库
repo_path = repo_namespace(current_user.login, identifier)
GitService.add_repository(repo_path: repo_path)
# todo: 为什么保存的时候要去除后面的.git呢??
@shixun.update_column(:repo_name, repo_path.split(".")[0])
mirror_id = MirrorRepository.find_by(type_name: 'Python3.6')&.id
if mirror_id
ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)
@shixun.shixun_service_configs.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)
end
end
end
def choose_course
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m
WHERE m.course_id = c.id AND m.role in (1,2,3)

@ -6,6 +6,7 @@ class TidingsController < ApplicationController
def index
tidings = current_user.tidings
@onclick_time = current_user.click_time
tiding_types =
case params[:type]
@ -18,11 +19,13 @@ class TidingsController < ApplicationController
end
tidings = tidings.where(tiding_type: tiding_types) if tiding_types.present?
tidings = tidings.where(container_type: 'JoinCourse') if params[:type] == 'course_apply'
@course_apply_count = tidings.where("created_at > '#{@onclick_time}'").where(container_type: 'JoinCourse').count
tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package'
@count = tidings.count
@tidings = paginate(tidings.order(created_at: :desc), per_page: 10)
@onclick_time = current_user.click_time
end
private

@ -15,6 +15,8 @@ class Weapps::CodeSessionsController < Weapps::BaseController
logged = true
else
# 根据 code没拿到 unionid
Rails.logger.info("[Weapp] session_key: #{result['session_key']}")
Rails.logger.info("[Weapp] code: #{params[:code]}")
user_info = Wechat::Weapp.decrypt(result['session_key'], params[:encrypted_data], params[:iv])
# 老用户,已绑定

@ -35,6 +35,9 @@ class Weapps::CoursesController < Weapps::BaseController
# 教师列表
def teachers
@course = current_course
@page = (params[:page] || 1).to_i
@limit = (params[:limit] || 20).to_i
search = params[:search].present? ? params[:search].strip : ""
if @course.try(:id) != 1309 || current_user.admin? || current_user.try(:id) == 15582
@teacher_list = @course.course_members.joins(:user).where("course_members.role in (1, 2, 3)")
else
@ -42,17 +45,26 @@ class Weapps::CoursesController < Weapps::BaseController
and course_members.role = 2))")
end
if search.present?
@teacher_list = @teacher_list.joins(:user).where("LOWER(CONCAT(users.lastname, users.firstname)) like ?", "%#{search}%")
end
@teacher_list_size = @teacher_list.size
@applications_size = CourseMessage.unhandled_join_course_requests_by_course(@course).size
@teacher_list = @teacher_list.preload(user: [user_extension: :school])
@teacher_list = @teacher_list.includes(user: [user_extension: :school])
# 中英文混合排序(忽略大小写)
@teacher_list = @teacher_list.sort {|x, y| Pinyin.t(x.user&.real_name, splitter: '').upcase <=> Pinyin.t(y.user&.real_name, splitter: '').upcase}
@teacher_list = @teacher_list[(@page-1)*@limit ... @page*@limit]
end
# 批量删除教师或助教
def delete_course_teachers
begin
@course = current_course
@page = (params[:page] || 1).to_i
@limit = (params[:limit] || 20).to_i
course_members = @course.course_members.where(id: params[:course_member_ids], role: %i[PROFESSOR ASSISTANT_PROFESSOR])
user_ids = course_members.pluck(:user_id)
course_members.destroy_all
@ -67,10 +79,18 @@ class Weapps::CoursesController < Weapps::BaseController
def students
@course = current_course
@page = (params[:page] || 1).to_i
@limit = (params[:limit] || 20).to_i
search = params[:search].present? ? params[:search].strip : nil
course_group_id = params[:course_group_id].present? ? params[:course_group_id].to_i : nil
@students = CourseMember.students(@course)
if search.present?
@students = @students.joins(user: :user_extension).where("LOWER(CONCAT(users.lastname, users.firstname)) like ? or
user_extensions.student_id like ?", "%#{search}%", "%#{search}%")
end
if course_group_id.present?
course_group = CourseGroup.find(course_group_id) if course_group_id != 0
@students = @students.where(course_group_id: course_group&.id.to_i)
@ -78,6 +98,9 @@ class Weapps::CoursesController < Weapps::BaseController
@students_count = @students.size
@students = @students.includes(user: :user_extension)
# 中英文混合排序(忽略大小写)
@students = @students.sort {|x, y| Pinyin.t(x.user&.real_name, splitter: '').upcase <=> Pinyin.t(y.user&.real_name, splitter: '').upcase}
@students = @students[(@page-1)*@limit ... @page*@limit]
end
# 批量修改角色

@ -48,9 +48,10 @@ class Weapps::RegistersController < Weapps::BaseController
)
end
successful_authentication(@user)
session[:user_id] = @user.id
# session[:user_id] = @user.id
session[:"#{default_yun_session}"] = @user.id
render_ok
# render_ok(user_id: @user.id)
end
private

@ -77,7 +77,7 @@ module PollsHelper
ex_pb_time = poll.get_poll_times(user.id,false)
poll_publish_time = ex_pb_time[:publish_time]
poll_end_time = ex_pb_time[:end_time]
current_status = poll.check_user_votes_status(user)
current_status = poll.check_user_votes_status(user, poll_status)
lock_icon = 0 #不显示锁图标
else
poll_users_list = poll.get_poll_exercise_users

@ -20,10 +20,10 @@ module Weapps::CoursesHelper
end
end
end
data = data.sort do |a, b|
[a[:letter]] <=> [b[:letter]]
end
data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后
# data = data.sort do |a, b|
# [a[:letter]] <=> [b[:letter]]
# end
# data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后
return data
end
@ -47,10 +47,10 @@ module Weapps::CoursesHelper
end
end
end
data = data.sort do |a, b|
[a[:letter]] <=> [b[:letter]]
end
data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后
# data = data.sort do |a, b|
# [a[:letter]] <=> [b[:letter]]
# end
# data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后
return data
end

@ -31,7 +31,9 @@ class Wechat::Weapp
cipher.padding = 0
cipher.key = session_key
cipher.iv = iv
Rails.logger.info("[Weapp] encrypted_data: #{encrypted_data}")
data = cipher.update(encrypted_data) << cipher.final
Rails.logger.info("[Weapp] data: #{data}")
result = JSON.parse(data[0...-data.last.ord])
raise Wechat::Error.new(-1, '解密错误') if result.dig('watermark', 'appid') != appid

@ -26,9 +26,11 @@ class Hack < ApplicationRecord
def code
if hack_codes.count == 1
tran_base64_decode64(hack_codes.first.code)
#tran_base64_decode64(hack_codes.first.code)
hack_codes.first.code
else
tran_base64_decode64(hack_codes.pluck(:code))
#tran_base64_decode64(hack_codes.pluck(:code))
hack_codes.pluck(:code)
end
end

@ -1,6 +1,6 @@
class HackSet < ApplicationRecord
validates :input, presence: { message: "测试集输入不能为空" }
validates :output, uniqueness: { message: "测试集输出不能为空" }
validates :output, presence: { message: "测试集输出不能为空" }
# 编程题测试集
belongs_to :hack
end

@ -128,7 +128,7 @@ class Poll < ApplicationRecord
en_time = end_time
else
poll_group_setting = poll_group_settings
user_group = course.course_members.where(user_id: user_id).select(:course_group_id)
user_group = course.students.where(user_id: user_id).select(:course_group_id)
if user_group.exists?
user_group_id = user_group.first&.course_group_id
user_p_group_setting = poll_group_setting.where(course_group_id: user_group_id).select(:publish_time,:end_time)
@ -146,12 +146,22 @@ class Poll < ApplicationRecord
end
#判断当前用户的答题状态
def check_user_votes_status(user)
def check_user_votes_status(user, poll_status)
poll_answer_user = poll_users.where(user_id: user.id).select(:start_at,:end_at,:commit_status)
user_status = 2
if poll_answer_user.exists? && (poll_answer_user.first&.start_at.present? || poll_answer_user.first&.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的
user_status = poll_answer_user.first.commit_status
end
# 问卷已截止时学生的答题状态需要考虑问卷的状态
if poll_status > 2
# 问卷如果还是继续答题状态则自动提交
if user_status == 0
poll_end_time = get_poll_times(user.id,false)[:end_time]
poll_answer_user.first.update_attributes!(:commit_status => 1, :end_at => poll_end_time)
user_status = 1
end
user_status = user_status == 1 ? 1 : 4
end
user_status
end

@ -3,5 +3,5 @@ class ShixunTagRepertoire < ApplicationRecord
belongs_to :tag_repertoire
has_many :memos, :through => :memo_tag_repertoires
has_many :memo_tag_repertoires, :dependent => :destroy
# has_many :memo_tag_repertoires, :dependent => :destroy
end

@ -329,7 +329,7 @@ class User < ApplicationRecord
# 实训路径合作者、admin
def manager_of_subject?(subject)
subject.subject_members.exists?(user_id: id, role: [1,2]) || admin?
subject.subject_members.exists?(user_id: id, role: [1,2]) || admin? || business?
end
# 实训管理员实训合作者、admin

@ -13,11 +13,10 @@ class Admins::SchoolQuery < ApplicationQuery
schools = School.all
keyword = strip_param(:keyword)
schools = schools.where('schools.name LIKE ?', "%#{keyword}%") if keyword
schools = schools.joins(:user_extensions).group(:id)
schools = schools.select('schools.*, COUNT(*) AS users_count')
Rails.logger.info("###########{keyword}")
if keyword
schools = schools.where('schools.name LIKE ?', "%#{keyword}%")
end
custom_sort schools, params[:sort_by], params[:sort_direction]
end
end

@ -3,7 +3,7 @@ wb = xlsx_package.workbook
wb.styles do |s|
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
wb.add_worksheet(name: "#{@competition.name}证书审批列表") do |sheet|
sheet.add_row %w(序号 排名 奖项 战队ID 战队名称 姓名 职业 学号 学校名称 学院名称 地区 实名认证 职业认证 手机号码 队长 签领/开户行及银行卡号 审批时间 审批人), :height => 25,:style => blue_cell
sheet.add_row %w(序号 排名 奖项 战队ID 战队名称 姓名 性别 职业 学号 学校名称 学院名称 地区 实名认证 职业认证 手机号码 队长 身份证号 签领/开户行及银行卡号 审批时间 审批人), :height => 25,:style => blue_cell
@all_prize_users.each_with_index do |prize_user, index|
user = prize_user.user
@ -14,15 +14,17 @@ wb.styles do |s|
prize_user.competition_team_id,
prize_user.competition_team.name,
user.real_name,
user.gender == 1 ? "女" : "男",
user.identity,
user.student_id,
user.student_id.present? ? (user.student_id.to_s + "\t") : "--",
user.school_name,
user.department_name,
user.location,
user.auth_status,
user.pro_status,
user.phone,
user.phone.present? ? (user.phone.to_s + "\t") : "--",
prize_user.leader? ? "是" : "-",
user.ID_number.present? ? (user.ID_number.to_s + "\t") : "--",
[prize_user.extra&.[]('bank'), prize_user.extra&.[]('second_bank'), prize_user.extra&.[]('card_no')].compact.join('/'),
prize_user.approved_at&.strftime('%Y-%m-%d %H:%M'),
prize_user.approver&.real_name

@ -31,7 +31,7 @@
<td><%= school.province %></td>
<td><%= school.city %></td>
<td class="text-left"><%= school.address %></td>
<td><%= school.users_count %></td>
<td><%= school.user_extensions.count %></td>
<td><%= @department_count.fetch(school.id, 0) %></td>
<td><%= school.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
<td>

@ -65,6 +65,12 @@
<% end %>
</li>
<li>
<%= sidebar_item_group('#comments-submenu', '消息', icon: 'comments') do %>
<li><%= sidebar_item(admins_shixun_feedback_messages_path, '实训反馈', icon: 'comment', controller: 'admins-shixun_feedback_messages') %></li>
<% end %>
</li>
<li>
<%= sidebar_item_group('#major-identification-submenu', '工程认证', icon: 'anchor') do %>
<li><%= sidebar_item(admins_major_informations_path, '本科专业目录', icon: 'outdent', controller: 'admins-major_informations') %></li>

@ -0,0 +1,23 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('实训反馈', admins_shixun_feedback_messages_path) %>
<% end %>
<div class="box search-form-container">
<%= form_tag(admins_shixun_feedback_messages_path, method: :get, class: 'form-inline search-form', remote: true) do %>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-md-4 ml-3', placeholder: '输入实训名称关键字进行搜索') %>
<div class="time-select">
<div class="form-group grow-date-container">
<div class="input-group input-daterange grow-date-input-daterange">
<%= text_field_tag :begin_date, params[:begin_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %>
<div class="input-group-prepend"><span class="input-group-text">到</span></div>
<%= text_field_tag :end_date, params[:end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %>
</div>
</div>
</div>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<% end %>
</div>
<div class="box admin-list-container shixun_feedback_messages-list-container">
<%= render(partial: 'admins/shixun_feedback_messages/shared/list', locals: {discusses: @discusses}) %>
</div>

@ -0,0 +1,2 @@
$(".shixun_feedback_messages-list-container")
.html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {discusses: @discusses} %>")

@ -0,0 +1,29 @@
<table class="table table-hover text-center">
<thead class="thead-light">
<tr>
<th width="5%">序号</th>
<th width="25%" class="text-left">实训名称</th>
<th width="50%" class="text-left">评论内容</th>
<th width="10%">评论者</th>
<th width="10%">评论时间</th>
</tr>
</thead>
<tbody>
<% if discusses.present? %>
<% discusses.each_with_index do |discuss, index| %>
<tr>
<td><%= (@params_page.to_i - 1) * 20 + index + 1 %></td>
<% identifier = Game.find_by(challenge_id: discuss.challenge_id, user_id: discuss.user_id)&.identifier %>
<td class="text-left"><%= link_to discuss.dis.name, "/tasks/#{identifier}", target: '_blank'%></td>
<td class="text-left"><%= content_safe discuss.content %></td>
<td><%= discuss.user.show_real_name %></td>
<td><%= format_time discuss.created_at %></td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: discusses } %>

@ -1,2 +1,3 @@
json.(@hack_user, :id, :status, :error_line, :error_msg, :expected_output,
:input, :output, :execute_time, :execute_memory)
json.language @hack_user.hack.language

@ -1,7 +1,12 @@
json.status 0
json.message "评测成功"
json.data do
json.(@result, :id, :status, :error_line, :error_msg,
:input, :output, :execute_time, :execute_memory)
# 提交模式多了一个预计输出
if @mode == "submit"
json.expected_output @result.expected_output
end
end

@ -1,3 +1,4 @@
json.array! @my_hack.hack_user_codes do |hack_user|
json.(hack_user, :id, :created_at, :status, :execute_time, :execute_memory)
json.language hack_user.hack.language
end

@ -1,5 +1,5 @@
# 编程内容
json.(@hack, :name, :description, :language, :code)
json.(@hack, :name, :description, :language, :difficult, :category, :time_limit, :open_or_not)
# 代码
json.language @hack.language

@ -10,12 +10,12 @@ json.subjects do
json.partial! 'subjects/subject', locals: {subjects: @subjects}
end
if current_laboratory.main_site?
json.teachers do
json.partial! 'users/user_small', users: @tea_users
end
json.students do
json.partial! 'users/user_small', users: @stu_users
end
end
# if current_laboratory.main_site?
# json.teachers do
# json.partial! 'users/user_small', users: @tea_users
# end
#
# json.students do
# json.partial! 'users/user_small', users: @stu_users
# end
# end

@ -0,0 +1,4 @@
json.status 1
json.message "发送成功"
json.course_id @course.id
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)

@ -0,0 +1,3 @@
json.shixun_identifier @shixun.identifier
json.shixun_name @shixun.name
json.shixun_id @shixun.id

@ -1,2 +1,3 @@
json.count @count
json.tidings @tidings, partial: 'tidings/tiding', as: :tiding
json.course_apply_count @course_apply_count

@ -0,0 +1,4 @@
json.status 0
json.user do
json.partial! 'weapps/shared/user', locals: { user: @user }
end

@ -42,7 +42,6 @@ Rails.application.routes.draw do
member do
post :publish
get :start
get :result
post :update_set
delete :delete_set
end
@ -57,8 +56,16 @@ Rails.application.routes.draw do
get :code_debug
get :code_submit
match :listen_result, :via => [:get, :post]
get :result
get :submit_records
post :restore_initial_code
end
collection do
get :record_detail
end
end
@ -217,6 +224,7 @@ Rails.application.routes.draw do
post :apply_shixun_mirror
get :download_file
get :shixun_lists
post :batch_send_to_course
end
member do
@ -325,6 +333,7 @@ Rails.application.routes.draw do
get 'create_subject'
get 'new_subject'
post 'append_to_stage'
post :add_shixun_to_stage
get 'search'
end
end
@ -1039,6 +1048,7 @@ Rails.application.routes.draw do
end
resources :shixuns, only: [:index,:destroy]
resources :shixun_settings, only: [:index,:update]
resources :shixun_feedback_messages, only: [:index]
resources :department_applies,only: [:index,:destroy] do
collection do
post :merge

@ -127,11 +127,12 @@
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]
}

@ -127,11 +127,13 @@
enter : [lang.buttons.enter, function() {
cm.replaceSelection(selecteds.join(" "));
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]

@ -107,12 +107,14 @@
_this.gotoLine(line);
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]

@ -19,6 +19,7 @@
exports.fn.helpDialog = function() {
var _this = this;
var lang = this.lang;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var path = settings.pluginPath + pluginName + "/";
@ -46,6 +47,7 @@
buttons : {
close : [lang.buttons.close, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]

@ -71,12 +71,12 @@
enter : [lang.buttons.enter, function() {
cm.replaceSelection(selecteds.join(" "));
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]
}

@ -89,13 +89,14 @@
cm.replaceSelection(str);
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]
}

@ -82,11 +82,13 @@
cm.replaceSelection(codeTexts);
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]

@ -98,11 +98,13 @@
cm.setValue(cm.getValue() + "\n[" + rid + "]: " + url + title + "");
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]

@ -154,12 +154,14 @@
cm.replaceSelection(table);
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

@ -80,6 +80,27 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.inner-footernav li{float: left;height: 50px;width: 80px;text-align: center}
.inner-footernav li a{width: 100%;text-align: center;line-height: 50px;color: #888}
.inner-footer_con{ width: 1200px; margin: 0 auto;}
.inner-footernavysl{ display: flex;flex-direction:initial;}
.inner-footernavysl li a {
height: 40px;
line-height: 40px;
color:#878786;
font-size: 19px;
}
.inner-footernavysl li Link {
height: 40px;
line-height: 40px;
color:#878786;
}
.intermediatecenter{
width:100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.footer_con-p{ color: #888; margin-top:10px;}
/*banner图*/
.banner{width:100%;height:345px;position: relative;overflow: hidden;border-radius: 10px;}

@ -27,7 +27,6 @@ const Search = Input.Search;
const RadioGroup = Radio.Group;
const CheckboxGroup = Checkbox.Group;
const {Option} = Select;
//学生老师页面
class Studentshavecompletedthelist extends Component {
// http://localhost:3007/courses/1309/exercises/722/exercises/student_exercise_list?debug=s
@ -317,6 +316,26 @@ class Studentshavecompletedthelist extends Component {
</a>
</Tooltip>
:
record.commit_method===5?
<Tooltip placement="bottom" title={
<div>
<div>最终调整成绩{record.efficiencyscore}</div>
</div>}>
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center"
} : parseInt(record.efficiencyscore) <= 90 ? {
color: '#FF6800',
textAlign: "center"
} : parseInt(record.efficiencyscore) <= 60 ? {
color: '#747A7F',
textAlign: "center",
} : {
color: '#747A7F',
textAlign: "center"
}}>{record.efficiencyscore}</span>
</Tooltip>
:
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center"
@ -587,6 +606,30 @@ class Studentshavecompletedthelist extends Component {
}}>--</a>
</Tooltip>
:
record.commit_method===5?
<Tooltip placement="bottom" title={
<div>
<div>最终调整成绩{record.efficiencyscore}</div>
</div>}>
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
width:"199px"
} : parseInt(record.efficiencyscore) <= 90 ? {
color: '#FF6800',
textAlign: "center",
width:"199px"
} : parseInt(record.efficiencyscore) <= 60 ? {
color: '#747A7F',
textAlign: "center",
width:"199px"
} : {
color: '#747A7F',
textAlign: "center",
width:"199px"
}}>{record.efficiencyscore}</span>
</Tooltip>
:
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
@ -845,6 +888,26 @@ class Studentshavecompletedthelist extends Component {
}}>--</a>
</Tooltip>
:
record.commit_method===5?
<Tooltip placement="bottom" title={
<div>
<div>最终调整成绩{record.efficiencyscore}</div>
</div>}>
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
} : parseInt(record.efficiencyscore) <= 90 ? {
color: '#FF6800',
textAlign: "center",
} : parseInt(record.efficiencyscore) <= 60 ? {
color: '#747A7F',
textAlign: "center",
} : {
color: '#747A7F',
textAlign: "center",
}}>{record.efficiencyscore}</span>
</Tooltip>
:
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
@ -1048,6 +1111,26 @@ class Studentshavecompletedthelist extends Component {
textAlign: "center",}}>--</a>
</Tooltip>
:
record.commit_method===5?
<Tooltip placement="bottom" title={
<div>
<div>最终调整成绩{record.efficiencyscore}</div>
</div>}>
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
} : parseInt(record.efficiencyscore) <= 90 ? {
color: '#FF6800',
textAlign: "center",
} : parseInt(record.efficiencyscore) <= 60 ? {
color: '#747A7F',
textAlign: "center",
} : {
color: '#747A7F',
textAlign: "center",
}}>{record.efficiencyscore}</span>
</Tooltip>
:
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
@ -1246,6 +1329,26 @@ class Studentshavecompletedthelist extends Component {
textAlign: "center",}}>--</a>
</Tooltip>
:
record.commit_method===5?
<Tooltip placement="bottom" title={
<div>
<div>最终调整成绩{record.efficiencyscore}</div>
</div>}>
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
} : parseInt(record.efficiencyscore) <= 90 ? {
color: '#FF6800',
textAlign: "center",
} : parseInt(record.efficiencyscore) <= 60 ? {
color: '#747A7F',
textAlign: "center",
} : {
color: '#747A7F',
textAlign: "center",
}}>{record.efficiencyscore}</span>
</Tooltip>
:
<span style={parseInt(record.efficiencyscore) > 90 ? {
color: '#DD1717',
textAlign: "center",
@ -1401,7 +1504,9 @@ class Studentshavecompletedthelist extends Component {
// //console.log("试卷学生未截止");
this.Generatenewdatas(response.data.exercise_users);
if (response.data.exercise_types.subjective === 0) {
if (this.state.noclassroom === undefined || this.state.noclassroom === "" || this.state.noclassroom === null) {
console.log("4");
var arr =[];
for(var i=0;i<this.state.columnss.length;i++){
var item = this.state.columnss[i];
@ -1423,12 +1528,15 @@ class Studentshavecompletedthelist extends Component {
})
} else {
console.log("5");
debugger
var arr =[];
for(var i=0;i<this.state.columnss.length;i++){
var item = this.state.columnss[i];
if(item.title==="客观题得分"){
}
if(item.title==="主观题得分"){
else if(item.title==="主观题得分"){
}
else if(this.props.isNotMember()===true&&item.title==="学号") {
@ -1613,6 +1721,8 @@ class Studentshavecompletedthelist extends Component {
completion: current_answer_user.objective_score === undefined ? "--" : current_answer_user.objective_score === null ? "--" : current_answer_user.objective_score === "" ? "--" : current_answer_user.objective_score,
levelscore: current_answer_user.subjective_score === undefined ? "--" : current_answer_user.subjective_score === null ? "--" : current_answer_user.subjective_score === "" ? "--" : current_answer_user.subjective_score,
score_open:exercise_types.score_open,
commit_method:current_answer_user.commit_method
})
@ -2718,6 +2828,8 @@ class Studentshavecompletedthelist extends Component {
// //console.log("this.props.Commonheadofthetestpaper.exercise_status");
// //console.log(this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status);
// //console.log(exercise_status);
console.log("Studentshavecompletedthelis123123t");
console.log(columnss);
return (
isAdmin === true ?
(

@ -460,7 +460,7 @@ class Testpapersettinghomepage extends Component{
/>
{
// 教师列表
parseInt(tab[0])==0 ? <Studentshavecompletedthelist {...this.props} {...this.state} triggerRef={this.bindRef} setcourse_groupysls={(value)=>this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper}></Studentshavecompletedthelist>:""
parseInt(tab[0])==0 ? <Studentshavecompletedthelist {...this.props} {...this.state} triggerRef={this.bindRef} setcourse_groupysls={(value)=>this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} yslstustate={[`${polls_status[Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status]}`]}></Studentshavecompletedthelist>:""
}
{/*统计结果*/}

@ -314,7 +314,7 @@ class ShixunsHome extends Component {
</div>}
{/*精选实训 改为 开发社区*/}
{shixuntype===true||homedatalist===undefined?"":homedatalist.shixuns.length===0?"":<div className="clearfix pt20 educontent pr pb20">
{shixuntype===true||homedatalist===undefined?"":homedatalist.shixuns.length===0?"":<div className="clearfix pt20 educontent pr pb20 mb20">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实训项目</p>
<p className="color-grey-cd font-12">DEVELOPMENT COMMUNITY</p>
@ -411,160 +411,160 @@ class ShixunsHome extends Component {
{/*导师排行榜*/}
{ homedatalist !== undefined && homedatalist.teachers !== undefined && (
this.props.user&&this.props.user.main_site===true?<div className="pt60 pb60 mb30 mentor-ranking">
<div className="educontent">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>导师排行榜</p>
<p className="color-grey-cd font-12">MENTOR RANKING</p>
</div>
<div className="ranking clearfix">
<ul className="grade color-dark">
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key===1){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-two.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key===0){
return(
<li className="pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key===2){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-three.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
<br />
<ul className="grade mt30">
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key>2) {
return (
<li key={key}>
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url}/>
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
</div>
</div>
</div>:""
)}
{/* { homedatalist !== undefined && homedatalist.teachers !== undefined && (*/}
{/* this.props.user&&this.props.user.main_site===true?<div className="pt60 pb60 mb30 mentor-ranking">*/}
{/* <div className="educontent">*/}
{/* <div className="edu-txt-center">*/}
{/* <p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>导师排行榜</p>*/}
{/* <p className="color-grey-cd font-12">MENTOR RANKING</p>*/}
{/* </div>*/}
{/* <div className="ranking clearfix">*/}
{/* <ul className="grade color-dark">*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{*/}
{/* if(key===1){*/}
{/* return(*/}
{/* <li className="mt35 pr" key={key}>*/}
{/* <img src={getImageUrl("images/educoder/huangguan-two.png")} className="huangguan" />*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url} />*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{*/}
{/* if(key===0){*/}
{/* return(*/}
{/* <li className="pr" key={key}>*/}
{/* <img src={getImageUrl("images/educoder/huangguan.png")} className="huangguan" />*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url} />*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{*/}
{/* if(key===2){*/}
{/* return(*/}
{/* <li className="mt35 pr" key={key}>*/}
{/* <img src={getImageUrl("images/educoder/huangguan-three.png")} className="huangguan" />*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url} />*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* </ul>*/}
{/* <br />*/}
{/* <ul className="grade mt30">*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{*/}
{/* if(key>2) {*/}
{/* return (*/}
{/* <li key={key}>*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url}/>*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* </ul>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>:""*/}
{/* )}*/}
{/*程序员排行榜*/}
{ homedatalist !== undefined && homedatalist.students !== undefined && (
this.props.user&&this.props.user.main_site===true?<div className="pt60 pb60 mb30 pro-ranking">
<div className="educontent">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>程序员排行榜</p>
<p className="color-grey-cd font-12">PROGRAMMER RANKING</p>
</div>
<div className="ranking clearfix">
<ul className="grade color-dark">
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key===1){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-two.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key===0){
return(
<li className="pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key===2){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-three.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
<br />
<ul className="grade mt30">
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key>2) {
return (
<li key={key}>
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url}/>
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
</div>
</div>
</div>:""
)}
{/*{ homedatalist !== undefined && homedatalist.students !== undefined && (*/}
{/* this.props.user&&this.props.user.main_site===true?<div className="pt60 pb60 mb30 pro-ranking">*/}
{/* <div className="educontent">*/}
{/* <div className="edu-txt-center">*/}
{/* <p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>程序员排行榜</p>*/}
{/* <p className="color-grey-cd font-12">PROGRAMMER RANKING</p>*/}
{/* </div>*/}
{/* <div className="ranking clearfix">*/}
{/* <ul className="grade color-dark">*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.students.map((item,key)=>{*/}
{/* if(key===1){*/}
{/* return(*/}
{/* <li className="mt35 pr" key={key}>*/}
{/* <img src={getImageUrl("images/educoder/huangguan-two.png")} className="huangguan" />*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url} />*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.students.map((item,key)=>{*/}
{/* if(key===0){*/}
{/* return(*/}
{/* <li className="pr" key={key}>*/}
{/* <img src={getImageUrl("images/educoder/huangguan.png")} className="huangguan" />*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url} />*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.students.map((item,key)=>{*/}
{/* if(key===2){*/}
{/* return(*/}
{/* <li className="mt35 pr" key={key}>*/}
{/* <img src={getImageUrl("images/educoder/huangguan-three.png")} className="huangguan" />*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url} />*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* </ul>*/}
{/* <br />*/}
{/* <ul className="grade mt30">*/}
{/* {*/}
{/* homedatalist===undefined?"":homedatalist.students.map((item,key)=>{*/}
{/* if(key>2) {*/}
{/* return (*/}
{/* <li key={key}>*/}
{/* <a href={"/users/"+item.login} className="color-dark">*/}
{/* <img src={'/images/'+item.image_url}/>*/}
{/* <p className="task-hide rankName mt5">{item.username}</p>*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* }*/}
{/* })}*/}
{/* </ul>*/}
{/* </div>*/}
{/* </div>*/}
{/*</div>:""*/}
{/*)}*/}
</div>
</Spin>
</div>

@ -0,0 +1,102 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal,Input} from 'antd';
class Addshixuns extends Component {
constructor(props) {
super(props);
this.state = {
shixunname:undefined,
shixunzero:false
}
}
handleChange=(e)=>{
this.setState({
shixunname:e.target.value,
})
if(e.target.value.length>0){
this.setState({
shixunzero:false
})
}
}
modalCancel=()=>{
this.setState({
shixunname:undefined,
})
this.props.modalCancel()
}
//判断是否为空
getshixunname( str ){
if ( str == "" ) return true;
var regu = "^[ ]+$";
var re = new RegExp(regu);
return re.test(str);
}
modalSave=()=>{
let {shixunname}=this.state;
if(this.getshixunname(shixunname)===true){
this.setState({
shixunzero:true
})
return
}
if(shixunname===undefined||shixunname.length===0){
this.setState({
shixunzero:true
})
return
}
this.props.Setaddshixuns(shixunname);
this.props.modalCancel();
}
render() {
return(
<Modal
className={this.props.className}
keyboard={false}
title="新建实训项目"
visible={this.props.Addshixunstype===undefined?false:this.props.Addshixunstype}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
width="530px"
>
{this.props.Addshixunstype===true?<style>
{
`
body{
overflow: hidden !important;
}
`
}
</style>:""}
<div className="task-popup-content">
<p className="task-popup-text-center font-16">
<span style={{ "line-height":"30px"}}>实训名称</span>
<span><Input style={{ width:"80%"}} className="yslzxueshisy " placeholder="请输入60字以内的实训名称" onChange={this.handleChange} addonAfter={String(this.state.shixunname===undefined?0:this.state.shixunname.length)+"/60"} maxLength={60} />
</span>
</p>
{this.state.shixunzero===true?<p className={"color-red ml85"}>请输入实训名称</p>:""}
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30 colorFFF" onClick={this.modalCancel}>取消</a>
<a className="task-btn task-btn-orange" onClick={this.modalSave}>确定</a>
</div>
</div>
</Modal>
)
}
}
export default Addshixuns;

@ -420,7 +420,35 @@ class DetailCards extends Component{
{
idsum===key&&pathCardsedittype===true?'':
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
this.props.detailInfoList===undefined?"":
this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?
<a>
<a className="fr mtf3">
{ editbuttomtype===true?'':
<Tooltip placement="bottom" title="编辑"
onClick={() => this.pathCardsedit(key, item.stage_id)}>
<i className="iconfont icon-bianjidaibeijing font-22 color-green"></i>
</Tooltip>
}
</a>
{
pathCardsList.length=== key+1?"":<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.down_path)}>
<Tooltip placement="bottom" title="向下移动">
<img src={getImageUrl("images/educoder/icon/movedown.svg")} className="fl mt2 ml4"/>
</Tooltip>
</a>
}
{key===0?"":
<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.up_path)}>
<Tooltip placement="bottom" title="向上移动">
<img src={getImageUrl("images/educoder/icon/moveup.svg")} className="fl mt2 ml4"/>
</Tooltip>
</a>}
</a>:
this.props.detailInfoList.allow_statistics===true?
<a>
<a className="fr mtf3">
{ editbuttomtype===true?'':
@ -453,7 +481,14 @@ class DetailCards extends Component{
{
idsum === key && pathCardsedittype === true ?
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
this.props.detailInfoList===undefined?"":
this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?
<a className="fr" onClick={()=>this.delectpathCardsedit(item.stage_id)}>
<Tooltip placement="bottom" title="删除">
<i className="iconfont icon-shanchu color-grey-c font-14 font-n"></i>
</Tooltip>
</a>:
this.props.detailInfoList.allow_statistics===true?
<a className="fr" onClick={()=>this.delectpathCardsedit(item.stage_id)}>
<Tooltip placement="bottom" title="删除">
<i className="iconfont icon-shanchu color-grey-c font-14 font-n"></i>
@ -471,13 +506,41 @@ class DetailCards extends Component{
<div>
{
{this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?
item.shixuns_list && item.shixuns_list.map((line,index)=>{
return(
<div className="clearfix paragraph lineh-30" onMouseEnter={()=>this.showparagraph(key,index)} onMouseLeave={this.hideparagraph}>
<li className="fl li-width63">
<span className="progressRing mr10">
{
line.complete_status === 1 ?<i className="iconfont icon-wancheng progressRing-over font-18 mt10"></i>
:<i className="iconfont icon-bofang progressRing-part font-18 mt10"></i>
}
</span>
<span className={"paragraph_name color-grey3"}>
<span className="subject_stage_shixun_index">{key+1}</span>-{index+1}&nbsp;&nbsp;{line.shixun_name}
</span>
</li>
<li className={showparagraph===false?"none":"fr status_li"}>
{
showparagraphkey===key&&showparagraphindex===index?<div>
<Link to={'/shixuns/'+line.identifier+'/challenges'} className="mr30 color-blue_4C shixun_detail pointer fl" target="_blank">查看详情</Link>
</div>:""
}
</li>
</div>)
}):item.shixuns_list && item.shixuns_list.map((line,index)=>{
return(
<div className="clearfix paragraph lineh-30" onMouseEnter={()=>this.showparagraph(key,index)} onMouseLeave={this.hideparagraph}>
<li className="fl li-width63">
<span className="progressRing mr10">
{
line.complete_status === 1 ?<i className="iconfont icon-wancheng progressRing-over font-18 mt10"></i>

@ -3,6 +3,7 @@ import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals';
import Addshixuns from './Addshixuns';
import '../ShixunPaths.css';
import axios from 'axios';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
@ -52,7 +53,8 @@ class DetailCardsEditAndAdd extends Component{
Modalsbottomval:"",
ChooseShixunListshixun_list:undefined,
stage_nametype:false,
descriptiontype:false
descriptiontype:false,
Addshixunstype:false
}
this.onDragEnd = this.onDragEnd.bind(this);
}
@ -113,9 +115,12 @@ class DetailCardsEditAndAdd extends Component{
for(var z=0; z<newshixun_lists.length; z++){
newshixuns_listedit.push(newshixun_lists[z]);
}
for(var i=0; i<newshixun_lists.length; i++){
list.push(newshixun_lists[i].shixun_id);
}
this.setState({
shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list,
@ -224,7 +229,8 @@ class DetailCardsEditAndAdd extends Component{
Modalstype:false,
Modalstopval:'',
Modalsbottomval:'',
delectfunvalue:undefined
delectfunvalue:undefined,
Addshixunstype:false
})
}
@ -308,6 +314,41 @@ class DetailCardsEditAndAdd extends Component{
})
}
Addshixuns=()=>{
this.setState({
Addshixunstype:true,
})
}
Getaddshixuns=(value)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
} = this.state
let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
name:value
}).then((response) => {
if(response){
if(response.data){
newshixuns_listedit.push(response.data);
list.push(response.data.shixun_id);
this.setState({
shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list,
patheditarry:[],
selectShixun:false,
page:1,
})
}
}
}).catch((error) => {
console.log(error)
});
}
render(){
let {selectShixun,
@ -340,6 +381,22 @@ class DetailCardsEditAndAdd extends Component{
>
</Modals>
{this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)}
{...this.props}
{...this.state}
/>:""}
<style>
{
`
.mb10 {
margin-bottom: 10px !important;
}
`
}
</style>
{ editPanel &&
<div className="lesson-edit-content mb10">
<div className="clearfix edu-back-white pt30 pb30">
@ -371,13 +428,21 @@ class DetailCardsEditAndAdd extends Component{
<div className={descriptiontype===true?"red":"none"}>描述不能超多最大限制300个字符</div>
</div>
<p className="clearfix mb30">
<a onClick={this.AddShixunBox} className="fl defalutGreyBorder color-grey-6 ml37">
<p className="clearfix mb10">
<a onClick={()=>this.Addshixuns()} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i>
选用实训项目</a>
<span id="sx_notice" className="fl ml20 color-grey-9 mt5">选择下面实训后可以通过拖拽进行排序调整</span>
新建实训项目</a>
</p>
<p className="clearfix mb10">
<a onClick={()=>this.AddShixunBox()} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i>
选用实训项目</a>
</p>
<p className="mb30">
<span id="sx_notice" className="ml37 color-grey-9 mt5 ">下面实训可以通过拖拽进行排序调整</span>
</p>
{selectShixun===true?<style>
{
`

@ -3,6 +3,7 @@ import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals';
import Addshixuns from './Addshixuns';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
import '../ShixunPaths.css';
import axios from 'axios';
@ -54,7 +55,8 @@ class DetailCardsEditAndEdit extends Component{
delectfunvalue:undefined,
ChooseShixunListshixun_list:undefined,
stage_nametype:false,
descriptiontype:false
descriptiontype:false,
Addshixunstype:false
}
this.onDragEnd = this.onDragEnd.bind(this);
}
@ -74,14 +76,13 @@ class DetailCardsEditAndEdit extends Component{
})
}
searchNameInput=(e)=>{
Addshixuns=()=>{
this.setState({
search:e.target.value
Addshixunstype:true,
})
}
shixunhomeworkedit=(list)=>{
let newpatheditarry=[];
@ -266,9 +267,11 @@ class DetailCardsEditAndEdit extends Component{
Modalstype:false,
Modalstopval:'',
Modalsbottomval:'',
delectfunvalue:undefined
delectfunvalue:undefined,
Addshixunstype:false
})
}
cardsModalsave=()=>{
this.setState({
Modalstype:false,
@ -317,6 +320,36 @@ class DetailCardsEditAndEdit extends Component{
notification.open(data);
}
Getaddshixuns=(value)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
} = this.state
let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
name:value
}).then((response) => {
if(response){
if(response.data){
newshixuns_listedit.push(response.data);
list.push(response.data.shixun_id);
this.setState({
shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list,
patheditarry:[],
selectShixun:false,
page:1,
})
}
}
}).catch((error) => {
console.log(error)
});
}
render(){
let {selectShixun,
editPanel,
@ -348,7 +381,21 @@ class DetailCardsEditAndEdit extends Component{
modalSave={delectfunvalue===undefined?()=>this.cardsModalsave():()=>this.shixunslisteditdelectfun()}
>
</Modals>
{this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)}
{...this.props}
{...this.state}
/>:""}
<style>
{
`
.mb10 {
margin-bottom: 10px !important;
}
`
}
</style>
{ this.props.idsum===this.props.keys&&this.props.pathCardsedittype===true?
<div className="lesson-edit-content mb10">
@ -381,13 +428,22 @@ class DetailCardsEditAndEdit extends Component{
></textarea>
<div className={descriptiontype===true?"red":"none"}>描述不能超多最大限制300个字符</div>
</div>
<p className="clearfix mb30">
<p className="clearfix mb10">
<a onClick={this.Addshixuns} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i>
</a>
</p>
<p className="clearfix mb10">
<a onClick={this.AddShixunBox} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i>
</a>
<span id="sx_notice" className="fl ml20 color-grey-9 mt5">选择下面实训后可以通过拖拽进行排序调整</span>
</p>
</p>
<p className="mb30">
<span id="sx_notice" className="ml37 color-grey-9 mt5 ">下面实训可以通过拖拽进行排序调整</span>
</p>
{selectShixun===true?<style>
{
`

@ -18,6 +18,22 @@ class NewFooter extends Component {
render() {
return (
<div className="newFooter edu-txt-center ">
<style>
{
`
.newFooter {
max-height: 140px !important;
padding-bottom: 20px !important;
}
p {
margin-top: 0;
margin-bottom:0px !important;
}
`
}
</style>
{/*newContainers*/}
<div className="inner-footer_con">
{this.props.user&&this.props.user.main_site===true?<div className="footercon">

@ -1290,10 +1290,12 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===false?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>}
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===false?
<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>:""
}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"":
pathstype===true?"":this.props.user&&this.props.user.main_site===true||this.props.user&&this.props.user.admin===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:""
pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:""
}
{this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""}
</ul>

@ -177,7 +177,8 @@ export default class TPManswer extends Component {
this.props.showSnackbar(response.data.message);
}
if (response.data.status == 1) {
$("html").animate({ scrollTop: 0 })
window.location.href=`/shixuns/${id}/challenges`;
// $("html").animate({ scrollTop: 0 })
}
}

@ -240,8 +240,8 @@ export default class TPMchallengesnew extends Component {
}).then((response) => {
if (response.data.status === 1) {
// $("html").animate({ scrollTop: 0 })
window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/editcheckpoint`;
//window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/editcheckpoint?tab=2`;
window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=2`;
// this.setState({
// setopen: true,
// CreatePracticesendtype:false,
@ -363,6 +363,7 @@ export default class TPMchallengesnew extends Component {
}).then((response) => {
this.props.showSnackbar(response.data.messages);
if (response.data.status === 1) {
window.location.href=`/shixuns/${id}/challenges/${checkpointId}/tab=2`;
this.setState({
setopen: true,
editPracticesendtype:false,

@ -673,6 +673,7 @@ export default class TPMevaluation extends Component {
}
).then((response) => {
this.props.showSnackbar(response.data.messages);
window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=3`;
// if(response.data.status===1){
// window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3"
// }

@ -380,31 +380,31 @@ class Challenges extends Component {
<p className="clearfix mb10 mt20">
<span className="font-16 fl">全部任务</span>
{this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?
<Link to={"/shixuns/" + id + "/challenges/new"}
className="white-btn edu-greenline-btn fr addshixuns"
// data-tip-down="新增代码编辑类型任务"
>
<Tooltip placement="bottom" title={"新增代码编辑类型任务"}>
<img src={getImageUrl("images/educoder/icon/addsmallgreen.svg")}
className="fl mr5 mt6" />
实践任务
</Tooltip>
</Link> : ""
}
{this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?
<Link to={"/shixuns/" + id + "/challenges/newquestion"}
className="white-btn edu-greenline-btn fr mr20 addshixuns"
// data-tip-down="新增选择题类型任务"
>
<Tooltip placement="bottom" title={"新增选择题类型任务"}>
<img src={getImageUrl("images/educoder/icon/addsmallgreen.svg")}
className="fl mr5 mt5" />
选择题任务
</Tooltip>
</Link> : ""
}
{/*{this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?*/}
{/*<Link to={"/shixuns/" + id + "/challenges/new"}*/}
{/*className="white-btn edu-greenline-btn fr addshixuns"*/}
{/*// data-tip-down="新增代码编辑类型任务"*/}
{/*>*/}
{/*<Tooltip placement="bottom" title={"新增代码编辑类型任务"}>*/}
{/*<img src={getImageUrl("images/educoder/icon/addsmallgreen.svg")}*/}
{/*className="fl mr5 mt6" />*/}
{/*实践任务*/}
{/*</Tooltip>*/}
{/*</Link> : ""*/}
{/*}*/}
{/*{this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ?*/}
{/*<Link to={"/shixuns/" + id + "/challenges/newquestion"}*/}
{/*className="white-btn edu-greenline-btn fr mr20 addshixuns"*/}
{/*// data-tip-down="新增选择题类型任务"*/}
{/*>*/}
{/*<Tooltip placement="bottom" title={"新增选择题类型任务"}>*/}
{/*<img src={getImageUrl("images/educoder/icon/addsmallgreen.svg")}*/}
{/*className="fl mr5 mt5" />*/}
{/*选择题任务*/}
{/*</Tooltip>*/}
{/*</Link> : ""*/}
{/*}*/}
</p>
<div className="alltask">

@ -490,6 +490,13 @@ class RealNameCertificationModal extends Component{
action: this.props.current_user ? `${getUploadActionUrl()}` : '',
className: 'idPic-uploader',
onChange: this.handleChange2,
beforeUpload: (file) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg' || file.type === 'image/bmp';
if (!isJpgOrPng) {
this.props.showNotification('请上传正确文件格式');
}
return isJpgOrPng;
},
};
// form合并了
@ -739,7 +746,9 @@ class RealNameCertificationModal extends Component{
<span className="idPic-uploader demoImg">
<img src={`${certification == 1 ? authImg : jobImg}`} alt="avatar" style={{ maxHeight: '110px'}}/>
</span>
<Dragger {...uploadProps2}>
<Dragger {...uploadProps2}
accept=".png,.jpg,.bmp,.jpeg"
>
{imageUrl2 ?
// <a href={imageUrl2} target="_blank" title="点击重新上传图片"></a>
<img src={imageUrl2} alt="avatar" style={{ maxHeight: '110px'}}/>

@ -81,10 +81,11 @@ class SearchPage extends Component{
setdatafuns =(value)=>{
this.setState({
keywords:value
keywords:value,
page:1
})
this.props.history.replace(`/search?value=${value}`)
this.getdata(this.state.page,this.state.type,value);
this.getdata(1,this.state.type,value);
}
paginationonChanges = (pageNumber) => {
this.setState({

@ -84,6 +84,27 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.inner-footernav li{float: left;height: 50px;width: 80px;text-align: center}
.inner-footernav li a{width: 100%;text-align: center;line-height: 50px;color: #888}
.inner-footer_con{ width: 1200px; margin: 0 auto;}
.inner-footernavysl{ display: flex;flex-direction:initial;}
.inner-footernavysl li a {
height: 40px;
line-height: 40px;
color:#878786;
font-size: 19px;
}
.inner-footernavysl li Link {
height: 40px;
line-height: 40px;
color:#878786;
}
.intermediatecenter{
width:100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.footer_con-p{ color: #888; margin-top:10px;}
/*banner图*/
.banner{width:100%;height:345px;position: relative;overflow: hidden;border-radius: 10px;}

Loading…
Cancel
Save