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
# 忘记密码
@ -127,7 +127,7 @@ class AccountsController < ApplicationController
end
end
def successful_authentication(user)
def successful_authentication(user)
uid_logger("Successful authentication start: '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}")
# Valid user
self.logged_user = user
@ -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,9 +17,15 @@ class Admins::LaboratorySubjectsController < Admins::BaseController
def destroy
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
current_laboratory_subject.destroy!
render_delete_success
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

@ -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
content = "<p>[#{params[:question_kind]}]</p><p>问题页面网址:#{params[:url]}</p>#{params[:description]}"
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)
:input, :output, :execute_time, :execute_memory)
json.language @hack_user.hack.language

@ -1,7 +1,12 @@
json.(@result, :id, :status, :error_line, :error_msg,
:input, :output, :execute_time, :execute_memory)
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
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

@ -1,237 +1,238 @@
/*!
* Code block dialog plugin for Editor.md
*
* @file code-block-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-07
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var cmEditor;
var pluginName = "code-block-dialog";
// for CodeBlock dialog select
var codeLanguages = exports.codeLanguages = {
asp : ["ASP", "vbscript"],
actionscript : ["ActionScript(3.0)/Flash/Flex", "clike"],
bash : ["Bash/Bat", "shell"],
css : ["CSS", "css"],
c : ["C", "clike"],
cpp : ["C++", "clike"],
csharp : ["C#", "clike"],
coffeescript : ["CoffeeScript", "coffeescript"],
d : ["D", "d"],
dart : ["Dart", "dart"],
delphi : ["Delphi/Pascal", "pascal"],
erlang : ["Erlang", "erlang"],
go : ["Golang", "go"],
groovy : ["Groovy", "groovy"],
html : ["HTML", "text/html"],
java : ["Java", "clike"],
json : ["JSON", "text/json"],
javascript : ["Javascript", "javascript"],
lua : ["Lua", "lua"],
less : ["LESS", "css"],
markdown : ["Markdown", "gfm"],
"objective-c" : ["Objective-C", "clike"],
php : ["PHP", "php"],
perl : ["Perl", "perl"],
python : ["Python", "python"],
r : ["R", "r"],
rst : ["reStructedText", "rst"],
ruby : ["Ruby", "ruby"],
sql : ["SQL", "sql"],
sass : ["SASS/SCSS", "sass"],
shell : ["Shell", "shell"],
scala : ["Scala", "clike"],
swift : ["Swift", "clike"],
vb : ["VB/VBScript", "vb"],
xml : ["XML", "text/xml"],
yaml : ["YAML", "yaml"]
};
exports.fn.codeBlockDialog = function() {
var _this = this;
var cm = this.cm;
var lang = this.lang;
var editor = this.editor;
var settings = this.settings;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.codeBlock;
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
dialog.find("option:first").attr("selected", "selected");
dialog.find("textarea").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
var dialogHTML = "<div class=\"" + classPrefix + "code-toolbar\">" +
dialogLang.selectLabel + "<select><option selected=\"selected\" value=\"\">" + dialogLang.selectDefaultText + "</option></select>" +
"</div>" +
"<textarea placeholder=\"coding now....\" style=\"display:none;\">" + selection + "</textarea>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 780,
height : 565,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogHTML,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var codeTexts = this.find("textarea").val();
var langName = this.find("select").val();
if (langName === "")
{
alert(lang.dialog.codeBlock.unselectedLanguageAlert);
return false;
}
if (codeTexts === "")
{
alert(lang.dialog.codeBlock.codeEmptyAlert);
return false;
}
langName = (langName === "other") ? "" : langName;
cm.replaceSelection(["```" + langName, codeTexts, "```"].join("\n"));
if (langName === "") {
cm.setCursor(cursor.line, cursor.ch + 3);
}
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var langSelect = dialog.find("select");
if (langSelect.find("option").length === 1)
{
for (var key in codeLanguages)
{
var codeLang = codeLanguages[key];
langSelect.append("<option value=\"" + key + "\" mode=\"" + codeLang[1] + "\">" + codeLang[0] + "</option>");
}
langSelect.append("<option value=\"other\">" + dialogLang.otherLanguage + "</option>");
}
var mode = langSelect.find("option:selected").attr("mode");
var cmConfig = {
mode : (mode) ? mode : "text/html",
theme : settings.theme,
tabSize : 4,
autofocus : true,
autoCloseTags : true,
indentUnit : 4,
lineNumbers : true,
lineWrapping : true,
extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
foldGutter : true,
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets : true,
indentWithTabs : true,
styleActiveLine : true,
styleSelectedText : true,
autoCloseBrackets : true,
showTrailingSpace : true,
highlightSelectionMatches : true
};
var textarea = dialog.find("textarea");
var cmObj = dialog.find(".CodeMirror");
if (dialog.find(".CodeMirror").length < 1)
{
cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig);
cmObj = dialog.find(".CodeMirror");
cmObj.css({
"float" : "none",
margin : "8px 0",
border : "1px solid #ddd",
fontSize : settings.fontSize,
width : "100%",
height : "390px"
});
cmEditor.on("change", function(cm) {
textarea.val(cm.getValue());
});
}
else
{
cmEditor.setValue(cm.getSelection());
}
langSelect.change(function(){
var _mode = $(this).find("option:selected").attr("mode");
cmEditor.setOption("mode", _mode);
});
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Code block dialog plugin for Editor.md
*
* @file code-block-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-07
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var cmEditor;
var pluginName = "code-block-dialog";
// for CodeBlock dialog select
var codeLanguages = exports.codeLanguages = {
asp : ["ASP", "vbscript"],
actionscript : ["ActionScript(3.0)/Flash/Flex", "clike"],
bash : ["Bash/Bat", "shell"],
css : ["CSS", "css"],
c : ["C", "clike"],
cpp : ["C++", "clike"],
csharp : ["C#", "clike"],
coffeescript : ["CoffeeScript", "coffeescript"],
d : ["D", "d"],
dart : ["Dart", "dart"],
delphi : ["Delphi/Pascal", "pascal"],
erlang : ["Erlang", "erlang"],
go : ["Golang", "go"],
groovy : ["Groovy", "groovy"],
html : ["HTML", "text/html"],
java : ["Java", "clike"],
json : ["JSON", "text/json"],
javascript : ["Javascript", "javascript"],
lua : ["Lua", "lua"],
less : ["LESS", "css"],
markdown : ["Markdown", "gfm"],
"objective-c" : ["Objective-C", "clike"],
php : ["PHP", "php"],
perl : ["Perl", "perl"],
python : ["Python", "python"],
r : ["R", "r"],
rst : ["reStructedText", "rst"],
ruby : ["Ruby", "ruby"],
sql : ["SQL", "sql"],
sass : ["SASS/SCSS", "sass"],
shell : ["Shell", "shell"],
scala : ["Scala", "clike"],
swift : ["Swift", "clike"],
vb : ["VB/VBScript", "vb"],
xml : ["XML", "text/xml"],
yaml : ["YAML", "yaml"]
};
exports.fn.codeBlockDialog = function() {
var _this = this;
var cm = this.cm;
var lang = this.lang;
var editor = this.editor;
var settings = this.settings;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.codeBlock;
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
dialog.find("option:first").attr("selected", "selected");
dialog.find("textarea").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
var dialogHTML = "<div class=\"" + classPrefix + "code-toolbar\">" +
dialogLang.selectLabel + "<select><option selected=\"selected\" value=\"\">" + dialogLang.selectDefaultText + "</option></select>" +
"</div>" +
"<textarea placeholder=\"coding now....\" style=\"display:none;\">" + selection + "</textarea>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 780,
height : 565,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogHTML,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var codeTexts = this.find("textarea").val();
var langName = this.find("select").val();
if (langName === "")
{
alert(lang.dialog.codeBlock.unselectedLanguageAlert);
return false;
}
if (codeTexts === "")
{
alert(lang.dialog.codeBlock.codeEmptyAlert);
return false;
}
langName = (langName === "other") ? "" : langName;
cm.replaceSelection(["```" + langName, codeTexts, "```"].join("\n"));
if (langName === "") {
cm.setCursor(cursor.line, cursor.ch + 3);
}
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;
}]
}
});
}
var langSelect = dialog.find("select");
if (langSelect.find("option").length === 1)
{
for (var key in codeLanguages)
{
var codeLang = codeLanguages[key];
langSelect.append("<option value=\"" + key + "\" mode=\"" + codeLang[1] + "\">" + codeLang[0] + "</option>");
}
langSelect.append("<option value=\"other\">" + dialogLang.otherLanguage + "</option>");
}
var mode = langSelect.find("option:selected").attr("mode");
var cmConfig = {
mode : (mode) ? mode : "text/html",
theme : settings.theme,
tabSize : 4,
autofocus : true,
autoCloseTags : true,
indentUnit : 4,
lineNumbers : true,
lineWrapping : true,
extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
foldGutter : true,
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets : true,
indentWithTabs : true,
styleActiveLine : true,
styleSelectedText : true,
autoCloseBrackets : true,
showTrailingSpace : true,
highlightSelectionMatches : true
};
var textarea = dialog.find("textarea");
var cmObj = dialog.find(".CodeMirror");
if (dialog.find(".CodeMirror").length < 1)
{
cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig);
cmObj = dialog.find(".CodeMirror");
cmObj.css({
"float" : "none",
margin : "8px 0",
border : "1px solid #ddd",
fontSize : settings.fontSize,
width : "100%",
height : "390px"
});
cmEditor.on("change", function(cm) {
textarea.val(cm.getValue());
});
}
else
{
cmEditor.setValue(cm.getSelection());
}
langSelect.change(function(){
var _mode = $(this).find("option:selected").attr("mode");
cmEditor.setOption("mode", _mode);
});
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,327 +1,329 @@
/*!
* Emoji dialog plugin for Editor.md
*
* @file emoji-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "emoji-dialog";
var emojiTabIndex = 0;
var emojiData = [];
var selecteds = [];
var logoPrefix = "editormd-logo";
var logos = [
logoPrefix,
logoPrefix + "-1x",
logoPrefix + "-2x",
logoPrefix + "-3x",
logoPrefix + "-4x",
logoPrefix + "-5x",
logoPrefix + "-6x",
logoPrefix + "-7x",
logoPrefix + "-8x"
];
var langs = {
"zh-cn" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"zh-tw" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"en" : {
toolbar : {
emoji : "Emoji"
},
dialog : {
emoji : {
title : "Emoji"
}
}
}
};
exports.fn.emojiDialog = function() {
var _this = this;
var cm = this.cm;
var settings = _this.settings;
if (!settings.emoji)
{
alert("settings.emoji == false");
return ;
}
var path = settings.pluginPath + pluginName + "/";
var editor = this.editor;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.emoji;
var dialogContent = [
"<div class=\"" + classPrefix + "emoji-dialog-box\" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;\">",
"<div class=\"" + classPrefix + "tab\"></div>",
"</div>",
].join("\n");
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
selecteds = [];
dialog.find("a").removeClass("selected");
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 800,
height : 475,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
cm.replaceSelection(selecteds.join(" "));
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var category = ["Github emoji", "Twemoji", "Font awesome", "Editor.md logo"];
var tab = dialog.find("." + classPrefix + "tab");
if (tab.html() === "")
{
var head = "<ul class=\"" + classPrefix + "tab-head\">";
for (var i = 0; i<4; i++) {
var active = (i === 0) ? " class=\"active\"" : "";
head += "<li" + active + "><a href=\"javascript:;\">" + category[i] + "</a></li>";
}
head += "</ul>";
tab.append(head);
var container = "<div class=\"" + classPrefix + "tab-container\">";
for (var x = 0; x < 4; x++)
{
var display = (x === 0) ? "" : "display:none;";
container += "<div class=\"" + classPrefix + "tab-box\" style=\"height: 260px;overflow: hidden;overflow-y: auto;" + display + "\"></div>";
}
container += "</div>";
tab.append(container);
}
var tabBoxs = tab.find("." + classPrefix + "tab-box");
var emojiCategories = ["github-emoji", "twemoji", "font-awesome", logoPrefix];
var drawTable = function() {
var cname = emojiCategories[emojiTabIndex];
var $data = emojiData[cname];
var $tab = tabBoxs.eq(emojiTabIndex);
if ($tab.html() !== "") {
//console.log("break =>", cname);
return ;
}
var pagination = function(data, type) {
var rowNumber = (type === "editormd-logo") ? "5" : 20;
var pageTotal = Math.ceil(data.length / rowNumber);
var table = "<div class=\"" + classPrefix + "grid-table\">";
for (var i = 0; i < pageTotal; i++)
{
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
for (var x = 0; x < rowNumber; x++)
{
var emoji = $.trim(data[(i * rowNumber) + x]);
if (typeof emoji !== "undefined" && emoji !== "")
{
var img = "", icon = "";
if (type === "github-emoji")
{
var src = (emoji === "+1") ? "plus1" : emoji;
src = (src === "black_large_square") ? "black_square" : src;
src = (src === "moon") ? "waxing_gibbous_moon" : src;
src = exports.emoji.path + src + exports.emoji.ext;
img = "<img src=\"" + src + "\" width=\"24\" class=\"emoji\" title=\"&#58;" + emoji + "&#58;\" alt=\"&#58;" + emoji + "&#58;\" />";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
}
else if (type === "twemoji")
{
var twemojiSrc = exports.twemoji.path + emoji + exports.twemoji.ext;
img = "<img src=\"" + twemojiSrc + "\" width=\"24\" title=\"twemoji-" + emoji + "\" alt=\"twemoji-" + emoji + "\" class=\"emoji twemoji\" />";
row += "<a href=\"javascript:;\" value=\":tw-" + emoji + ":\" title=\":tw-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
}
else if (type === "font-awesome")
{
icon = "<i class=\"fa fa-" + emoji + " fa-emoji\" title=\"" + emoji + "\"></i>";
row += "<a href=\"javascript:;\" value=\":fa-" + emoji + ":\" title=\":fa-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
}
else if (type === "editormd-logo")
{
icon = "<i class=\"" + emoji + "\" title=\"Editor.md logo (" + emoji + ")\"></i>";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" style=\"width:20%;\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
}
}
else
{
row += "<a href=\"javascript:;\" value=\"\"></a>";
}
}
row += "</div>";
table += row;
}
table += "</div>";
return table;
};
if (emojiTabIndex === 0)
{
for (var i = 0, len = $data.length; i < len; i++)
{
var h4Style = (i === 0) ? " style=\"margin: 0 0 10px;\"" : " style=\"margin: 10px 0;\"";
$tab.append("<h4" + h4Style + ">" + $data[i].category + "</h4>");
$tab.append(pagination($data[i].list, cname));
}
}
else
{
$tab.append(pagination($data, cname));
}
$tab.find("." + classPrefix + "emoji-btn").bind(exports.mouseOrTouch("click", "touchend"), function() {
$(this).toggleClass("selected");
if ($(this).hasClass("selected"))
{
selecteds.push($(this).attr("value"));
}
});
};
if (emojiData.length < 1)
{
if (typeof dialog.loading === "function") {
dialog.loading(true);
}
$.getJSON(path + "emoji.json?temp=" + Math.random(), function(json) {
if (typeof dialog.loading === "function") {
dialog.loading(false);
}
emojiData = json;
emojiData[logoPrefix] = logos;
drawTable();
});
}
else
{
drawTable();
}
tab.find("li").bind(exports.mouseOrTouch("click", "touchend"), function() {
var $this = $(this);
emojiTabIndex = $this.index();
$this.addClass("active").siblings().removeClass("active");
tabBoxs.eq(emojiTabIndex).show().siblings().hide();
drawTable();
});
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Emoji dialog plugin for Editor.md
*
* @file emoji-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "emoji-dialog";
var emojiTabIndex = 0;
var emojiData = [];
var selecteds = [];
var logoPrefix = "editormd-logo";
var logos = [
logoPrefix,
logoPrefix + "-1x",
logoPrefix + "-2x",
logoPrefix + "-3x",
logoPrefix + "-4x",
logoPrefix + "-5x",
logoPrefix + "-6x",
logoPrefix + "-7x",
logoPrefix + "-8x"
];
var langs = {
"zh-cn" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"zh-tw" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"en" : {
toolbar : {
emoji : "Emoji"
},
dialog : {
emoji : {
title : "Emoji"
}
}
}
};
exports.fn.emojiDialog = function() {
var _this = this;
var cm = this.cm;
var settings = _this.settings;
if (!settings.emoji)
{
alert("settings.emoji == false");
return ;
}
var path = settings.pluginPath + pluginName + "/";
var editor = this.editor;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.emoji;
var dialogContent = [
"<div class=\"" + classPrefix + "emoji-dialog-box\" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;\">",
"<div class=\"" + classPrefix + "tab\"></div>",
"</div>",
].join("\n");
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
selecteds = [];
dialog.find("a").removeClass("selected");
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 800,
height : 475,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
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;
}]
}
});
}
var category = ["Github emoji", "Twemoji", "Font awesome", "Editor.md logo"];
var tab = dialog.find("." + classPrefix + "tab");
if (tab.html() === "")
{
var head = "<ul class=\"" + classPrefix + "tab-head\">";
for (var i = 0; i<4; i++) {
var active = (i === 0) ? " class=\"active\"" : "";
head += "<li" + active + "><a href=\"javascript:;\">" + category[i] + "</a></li>";
}
head += "</ul>";
tab.append(head);
var container = "<div class=\"" + classPrefix + "tab-container\">";
for (var x = 0; x < 4; x++)
{
var display = (x === 0) ? "" : "display:none;";
container += "<div class=\"" + classPrefix + "tab-box\" style=\"height: 260px;overflow: hidden;overflow-y: auto;" + display + "\"></div>";
}
container += "</div>";
tab.append(container);
}
var tabBoxs = tab.find("." + classPrefix + "tab-box");
var emojiCategories = ["github-emoji", "twemoji", "font-awesome", logoPrefix];
var drawTable = function() {
var cname = emojiCategories[emojiTabIndex];
var $data = emojiData[cname];
var $tab = tabBoxs.eq(emojiTabIndex);
if ($tab.html() !== "") {
//console.log("break =>", cname);
return ;
}
var pagination = function(data, type) {
var rowNumber = (type === "editormd-logo") ? "5" : 20;
var pageTotal = Math.ceil(data.length / rowNumber);
var table = "<div class=\"" + classPrefix + "grid-table\">";
for (var i = 0; i < pageTotal; i++)
{
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
for (var x = 0; x < rowNumber; x++)
{
var emoji = $.trim(data[(i * rowNumber) + x]);
if (typeof emoji !== "undefined" && emoji !== "")
{
var img = "", icon = "";
if (type === "github-emoji")
{
var src = (emoji === "+1") ? "plus1" : emoji;
src = (src === "black_large_square") ? "black_square" : src;
src = (src === "moon") ? "waxing_gibbous_moon" : src;
src = exports.emoji.path + src + exports.emoji.ext;
img = "<img src=\"" + src + "\" width=\"24\" class=\"emoji\" title=\"&#58;" + emoji + "&#58;\" alt=\"&#58;" + emoji + "&#58;\" />";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
}
else if (type === "twemoji")
{
var twemojiSrc = exports.twemoji.path + emoji + exports.twemoji.ext;
img = "<img src=\"" + twemojiSrc + "\" width=\"24\" title=\"twemoji-" + emoji + "\" alt=\"twemoji-" + emoji + "\" class=\"emoji twemoji\" />";
row += "<a href=\"javascript:;\" value=\":tw-" + emoji + ":\" title=\":tw-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
}
else if (type === "font-awesome")
{
icon = "<i class=\"fa fa-" + emoji + " fa-emoji\" title=\"" + emoji + "\"></i>";
row += "<a href=\"javascript:;\" value=\":fa-" + emoji + ":\" title=\":fa-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
}
else if (type === "editormd-logo")
{
icon = "<i class=\"" + emoji + "\" title=\"Editor.md logo (" + emoji + ")\"></i>";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" style=\"width:20%;\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
}
}
else
{
row += "<a href=\"javascript:;\" value=\"\"></a>";
}
}
row += "</div>";
table += row;
}
table += "</div>";
return table;
};
if (emojiTabIndex === 0)
{
for (var i = 0, len = $data.length; i < len; i++)
{
var h4Style = (i === 0) ? " style=\"margin: 0 0 10px;\"" : " style=\"margin: 10px 0;\"";
$tab.append("<h4" + h4Style + ">" + $data[i].category + "</h4>");
$tab.append(pagination($data[i].list, cname));
}
}
else
{
$tab.append(pagination($data, cname));
}
$tab.find("." + classPrefix + "emoji-btn").bind(exports.mouseOrTouch("click", "touchend"), function() {
$(this).toggleClass("selected");
if ($(this).hasClass("selected"))
{
selecteds.push($(this).attr("value"));
}
});
};
if (emojiData.length < 1)
{
if (typeof dialog.loading === "function") {
dialog.loading(true);
}
$.getJSON(path + "emoji.json?temp=" + Math.random(), function(json) {
if (typeof dialog.loading === "function") {
dialog.loading(false);
}
emojiData = json;
emojiData[logoPrefix] = logos;
drawTable();
});
}
else
{
drawTable();
}
tab.find("li").bind(exports.mouseOrTouch("click", "touchend"), function() {
var $this = $(this);
emojiTabIndex = $this.index();
$this.addClass("active").siblings().removeClass("active");
tabBoxs.eq(emojiTabIndex).show().siblings().hide();
drawTable();
});
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,157 +1,159 @@
/*!
* Goto line dialog plugin for Editor.md
*
* @file goto-line-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "goto-line-dialog";
var langs = {
"zh-cn" : {
toolbar : {
"goto-line" : "跳转到行"
},
dialog : {
"goto-line" : {
title : "跳转到行",
label : "请输入行号",
error : "错误:"
}
}
},
"zh-tw" : {
toolbar : {
"goto-line" : "跳轉到行"
},
dialog : {
"goto-line" : {
title : "跳轉到行",
label : "請輸入行號",
error : "錯誤:"
}
}
},
"en" : {
toolbar : {
"goto-line" : "Goto line"
},
dialog : {
"goto-line" : {
title : "Goto line",
label : "Enter a line number, range ",
error : "Error: "
}
}
}
};
exports.fn.gotoLineDialog = function() {
var _this = this;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var path = settings.pluginPath + pluginName +"/";
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogLang = lang.dialog["goto-line"];
var lineCount = cm.lineCount();
dialogLang.error += dialogLang.label + " 1-" + lineCount;
if (editor.find("." + dialogName).length < 1)
{
var dialogContent = [
"<div class=\"editormd-form\" style=\"padding: 10px 0;\">",
"<p style=\"margin: 0;\">" + dialogLang.label + " 1-" + lineCount +"&nbsp;&nbsp;&nbsp;<input type=\"number\" class=\"number-input\" style=\"width: 60px;\" value=\"1\" max=\"" + lineCount + "\" min=\"1\" data-line-number /></p>",
"</div>"
].join("\n");
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 400,
height : 180,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var line = parseInt(this.find("[data-line-number]").val());
if (line < 1 || line > lineCount) {
alert(dialogLang.error);
return false;
}
_this.gotoLine(line);
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
dialog = editor.find("." + dialogName);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Goto line dialog plugin for Editor.md
*
* @file goto-line-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "goto-line-dialog";
var langs = {
"zh-cn" : {
toolbar : {
"goto-line" : "跳转到行"
},
dialog : {
"goto-line" : {
title : "跳转到行",
label : "请输入行号",
error : "错误:"
}
}
},
"zh-tw" : {
toolbar : {
"goto-line" : "跳轉到行"
},
dialog : {
"goto-line" : {
title : "跳轉到行",
label : "請輸入行號",
error : "錯誤:"
}
}
},
"en" : {
toolbar : {
"goto-line" : "Goto line"
},
dialog : {
"goto-line" : {
title : "Goto line",
label : "Enter a line number, range ",
error : "Error: "
}
}
}
};
exports.fn.gotoLineDialog = function() {
var _this = this;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var path = settings.pluginPath + pluginName +"/";
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogLang = lang.dialog["goto-line"];
var lineCount = cm.lineCount();
dialogLang.error += dialogLang.label + " 1-" + lineCount;
if (editor.find("." + dialogName).length < 1)
{
var dialogContent = [
"<div class=\"editormd-form\" style=\"padding: 10px 0;\">",
"<p style=\"margin: 0;\">" + dialogLang.label + " 1-" + lineCount +"&nbsp;&nbsp;&nbsp;<input type=\"number\" class=\"number-input\" style=\"width: 60px;\" value=\"1\" max=\"" + lineCount + "\" min=\"1\" data-line-number /></p>",
"</div>"
].join("\n");
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 400,
height : 180,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var line = parseInt(this.find("[data-line-number]").val());
if (line < 1 || line > lineCount) {
alert(dialogLang.error);
return false;
}
_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;
}]
}
});
}
dialog = editor.find("." + dialogName);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,102 +1,104 @@
/*!
* Help dialog plugin for Editor.md
*
* @file help-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "help-dialog";
exports.fn.helpDialog = function() {
var _this = this;
var lang = this.lang;
var editor = this.editor;
var settings = this.settings;
var path = settings.pluginPath + pluginName + "/";
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.help;
if (editor.find("." + dialogName).length < 1)
{
var dialogContent = "<div class=\"markdown-body\" style=\"font-family:微软雅黑, Helvetica, Tahoma, STXihei,Arial;height:390px;overflow:auto;font-size:14px;border-bottom:1px solid #ddd;padding:0 20px 20px 0;\"></div>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 840,
height : 540,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
close : [lang.buttons.close, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
dialog = editor.find("." + dialogName);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
var helpContent = dialog.find(".markdown-body");
if (helpContent.html() === "")
{
$.get(path + "help.md", function(text) {
var md = exports.$marked(text);
helpContent.html(md);
helpContent.find("a").attr("target", "_blank");
});
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Help dialog plugin for Editor.md
*
* @file help-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "help-dialog";
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 + "/";
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.help;
if (editor.find("." + dialogName).length < 1)
{
var dialogContent = "<div class=\"markdown-body\" style=\"font-family:微软雅黑, Helvetica, Tahoma, STXihei,Arial;height:390px;overflow:auto;font-size:14px;border-bottom:1px solid #ddd;padding:0 20px 20px 0;\"></div>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 840,
height : 540,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
close : [lang.buttons.close, function() {
this.hide().lockScreen(false).hideMask();
cm.focus && cm.focus();
return false;
}]
}
});
}
dialog = editor.find("." + dialogName);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
var helpContent = dialog.find(".markdown-body");
if (helpContent.html() === "")
{
$.get(path + "help.md", function(text) {
var md = exports.$marked(text);
helpContent.html(md);
helpContent.find("a").attr("target", "_blank");
});
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,173 +1,173 @@
/*!
* HTML entities dialog plugin for Editor.md
*
* @file html-entities-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "html-entities-dialog";
var selecteds = [];
var entitiesData = [];
exports.fn.htmlEntitiesDialog = function() {
var _this = this;
var cm = this.cm;
var lang = _this.lang;
var settings = _this.settings;
var path = settings.pluginPath + pluginName + "/";
var editor = this.editor;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = _this.classPrefix;
var dialogName = classPrefix + "dialog-" + pluginName, dialog;
var dialogLang = lang.dialog.htmlEntities;
var dialogContent = [
'<div class="' + classPrefix + 'html-entities-box" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;overflow-y: auto;\">',
'<div class="' + classPrefix + 'grid-table">',
'</div>',
'</div>',
].join("\r\n");
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
selecteds = [];
dialog.find("a").removeClass("selected");
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 800,
height : 475,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
cm.replaceSelection(selecteds.join(" "));
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var table = dialog.find("." + classPrefix + "grid-table");
var drawTable = function() {
if (entitiesData.length < 1) return ;
var rowNumber = 20;
var pageTotal = Math.ceil(entitiesData.length / rowNumber);
table.html("");
for (var i = 0; i < pageTotal; i++)
{
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
for (var x = 0; x < rowNumber; x++)
{
var entity = entitiesData[(i * rowNumber) + x];
if (typeof entity !== "undefined")
{
var name = entity.name.replace("&amp;", "&");
row += "<a href=\"javascript:;\" value=\"" + entity.name + "\" title=\"" + name + "\" class=\"" + classPrefix + "html-entity-btn\">" + name + "</a>";
}
}
row += "</div>";
table.append(row);
}
dialog.find("." + classPrefix + "html-entity-btn").bind(exports.mouseOrTouch("click", "touchend"), function() {
$(this).toggleClass("selected");
if ($(this).hasClass("selected"))
{
selecteds.push($(this).attr("value"));
}
});
};
if (entitiesData.length < 1)
{
if (typeof (dialog.loading) == "function") dialog.loading(true);
$.getJSON(path + pluginName.replace("-dialog", "") + ".json", function(json) {
if (typeof (dialog.loading) == "function") dialog.loading(false);
entitiesData = json;
drawTable();
});
}
else
{
drawTable();
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* HTML entities dialog plugin for Editor.md
*
* @file html-entities-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "html-entities-dialog";
var selecteds = [];
var entitiesData = [];
exports.fn.htmlEntitiesDialog = function() {
var _this = this;
var cm = this.cm;
var lang = _this.lang;
var settings = _this.settings;
var path = settings.pluginPath + pluginName + "/";
var editor = this.editor;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = _this.classPrefix;
var dialogName = classPrefix + "dialog-" + pluginName, dialog;
var dialogLang = lang.dialog.htmlEntities;
var dialogContent = [
'<div class="' + classPrefix + 'html-entities-box" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;overflow-y: auto;\">',
'<div class="' + classPrefix + 'grid-table">',
'</div>',
'</div>',
].join("\r\n");
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
selecteds = [];
dialog.find("a").removeClass("selected");
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 800,
height : 475,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
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;
}]
}
});
}
var table = dialog.find("." + classPrefix + "grid-table");
var drawTable = function() {
if (entitiesData.length < 1) return ;
var rowNumber = 20;
var pageTotal = Math.ceil(entitiesData.length / rowNumber);
table.html("");
for (var i = 0; i < pageTotal; i++)
{
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
for (var x = 0; x < rowNumber; x++)
{
var entity = entitiesData[(i * rowNumber) + x];
if (typeof entity !== "undefined")
{
var name = entity.name.replace("&amp;", "&");
row += "<a href=\"javascript:;\" value=\"" + entity.name + "\" title=\"" + name + "\" class=\"" + classPrefix + "html-entity-btn\">" + name + "</a>";
}
}
row += "</div>";
table.append(row);
}
dialog.find("." + classPrefix + "html-entity-btn").bind(exports.mouseOrTouch("click", "touchend"), function() {
$(this).toggleClass("selected");
if ($(this).hasClass("selected"))
{
selecteds.push($(this).attr("value"));
}
});
};
if (entitiesData.length < 1)
{
if (typeof (dialog.loading) == "function") dialog.loading(true);
$.getJSON(path + pluginName.replace("-dialog", "") + ".json", function(json) {
if (typeof (dialog.loading) == "function") dialog.loading(false);
entitiesData = json;
drawTable();
});
}
else
{
drawTable();
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,133 +1,134 @@
/*!
* Link dialog plugin for Editor.md
*
* @file link-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var pluginName = "link-dialog";
exports.fn.linkDialog = function() {
var _this = this;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var selection = cm.getSelection();
var lang = this.lang;
var linkLang = lang.dialog.link;
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
dialog.find("[data-url]").val("http://");
dialog.find("[data-title]").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
var dialogHTML = "<div class=\"" + classPrefix + "form\">" +
"<label>" + linkLang.url + "</label>" +
"<input type=\"text\" value=\"http://\" data-url />" +
"<br/>" +
"<label>" + linkLang.urlTitle + "</label>" +
"<input type=\"text\" value=\"" + selection + "\" data-title />" +
"<br/>" +
"</div>";
dialog = this.createDialog({
title : linkLang.title,
width : 380,
height : 211,
content : dialogHTML,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var url = this.find("[data-url]").val();
var title = this.find("[data-title]").val();
if (url === "http://" || url === "")
{
alert(linkLang.urlEmpty);
return false;
}
/*if (title === "")
{
alert(linkLang.titleEmpty);
return false;
}*/
var str = "[" + title + "](" + url + " \"" + title + "\")";
if (title == "")
{
str = "[" + url + "](" + url + ")";
}
cm.replaceSelection(str);
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Link dialog plugin for Editor.md
*
* @file link-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var pluginName = "link-dialog";
exports.fn.linkDialog = function() {
var _this = this;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var selection = cm.getSelection();
var lang = this.lang;
var linkLang = lang.dialog.link;
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
dialog.find("[data-url]").val("http://");
dialog.find("[data-title]").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
var dialogHTML = "<div class=\"" + classPrefix + "form\">" +
"<label>" + linkLang.url + "</label>" +
"<input type=\"text\" value=\"http://\" data-url />" +
"<br/>" +
"<label>" + linkLang.urlTitle + "</label>" +
"<input type=\"text\" value=\"" + selection + "\" data-title />" +
"<br/>" +
"</div>";
dialog = this.createDialog({
title : linkLang.title,
width : 380,
height : 211,
content : dialogHTML,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var url = this.find("[data-url]").val();
var title = this.find("[data-title]").val();
if (url === "http://" || url === "")
{
alert(linkLang.urlEmpty);
return false;
}
/*if (title === "")
{
alert(linkLang.titleEmpty);
return false;
}*/
var str = "[" + title + "](" + url + " \"" + title + "\")";
if (title == "")
{
str = "[" + url + "](" + url + ")";
}
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;
}]
}
});
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,172 +1,174 @@
/*!
* Preformatted text dialog plugin for Editor.md
*
* @file preformatted-text-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-07
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var cmEditor;
var pluginName = "preformatted-text-dialog";
exports.fn.preformattedTextDialog = function() {
var _this = this;
var cm = this.cm;
var lang = this.lang;
var editor = this.editor;
var settings = this.settings;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
var dialogLang = lang.dialog.preformattedText;
var dialogName = classPrefix + pluginName, dialog;
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
dialog.find("textarea").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
var dialogContent = "<textarea placeholder=\"coding now....\" style=\"display:none;\">" + selection + "</textarea>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 780,
height : 540,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var codeTexts = this.find("textarea").val();
if (codeTexts === "")
{
alert(dialogLang.emptyAlert);
return false;
}
codeTexts = codeTexts.split("\n");
for (var i in codeTexts)
{
codeTexts[i] = " " + codeTexts[i];
}
codeTexts = codeTexts.join("\n");
if (cursor.ch !== 0) {
codeTexts = "\r\n\r\n" + codeTexts;
}
cm.replaceSelection(codeTexts);
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var cmConfig = {
mode : "text/html",
theme : settings.theme,
tabSize : 4,
autofocus : true,
autoCloseTags : true,
indentUnit : 4,
lineNumbers : true,
lineWrapping : true,
extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
foldGutter : true,
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets : true,
indentWithTabs : true,
styleActiveLine : true,
styleSelectedText : true,
autoCloseBrackets : true,
showTrailingSpace : true,
highlightSelectionMatches : true
};
var textarea = dialog.find("textarea");
var cmObj = dialog.find(".CodeMirror");
if (dialog.find(".CodeMirror").length < 1)
{
cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig);
cmObj = dialog.find(".CodeMirror");
cmObj.css({
"float" : "none",
margin : "0 0 5px",
border : "1px solid #ddd",
fontSize : settings.fontSize,
width : "100%",
height : "410px"
});
cmEditor.on("change", function(cm) {
textarea.val(cm.getValue());
});
}
else
{
cmEditor.setValue(cm.getSelection());
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Preformatted text dialog plugin for Editor.md
*
* @file preformatted-text-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-07
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var cmEditor;
var pluginName = "preformatted-text-dialog";
exports.fn.preformattedTextDialog = function() {
var _this = this;
var cm = this.cm;
var lang = this.lang;
var editor = this.editor;
var settings = this.settings;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
var dialogLang = lang.dialog.preformattedText;
var dialogName = classPrefix + pluginName, dialog;
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
dialog.find("textarea").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
var dialogContent = "<textarea placeholder=\"coding now....\" style=\"display:none;\">" + selection + "</textarea>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 780,
height : 540,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var codeTexts = this.find("textarea").val();
if (codeTexts === "")
{
alert(dialogLang.emptyAlert);
return false;
}
codeTexts = codeTexts.split("\n");
for (var i in codeTexts)
{
codeTexts[i] = " " + codeTexts[i];
}
codeTexts = codeTexts.join("\n");
if (cursor.ch !== 0) {
codeTexts = "\r\n\r\n" + codeTexts;
}
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;
}]
}
});
}
var cmConfig = {
mode : "text/html",
theme : settings.theme,
tabSize : 4,
autofocus : true,
autoCloseTags : true,
indentUnit : 4,
lineNumbers : true,
lineWrapping : true,
extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
foldGutter : true,
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets : true,
indentWithTabs : true,
styleActiveLine : true,
styleSelectedText : true,
autoCloseBrackets : true,
showTrailingSpace : true,
highlightSelectionMatches : true
};
var textarea = dialog.find("textarea");
var cmObj = dialog.find(".CodeMirror");
if (dialog.find(".CodeMirror").length < 1)
{
cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig);
cmObj = dialog.find(".CodeMirror");
cmObj.css({
"float" : "none",
margin : "0 0 5px",
border : "1px solid #ddd",
fontSize : settings.fontSize,
width : "100%",
height : "410px"
});
cmEditor.on("change", function(cm) {
textarea.val(cm.getValue());
});
}
else
{
cmEditor.setValue(cm.getSelection());
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,153 +1,155 @@
/*!
* Reference link dialog plugin for Editor.md
*
* @file reference-link-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var pluginName = "reference-link-dialog";
var ReLinkId = 1;
exports.fn.referenceLinkDialog = function() {
var _this = this;
var cm = this.cm;
var lang = this.lang;
var editor = this.editor;
var settings = this.settings;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var dialogLang = lang.dialog.referenceLink;
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
cm.focus();
if (editor.find("." + dialogName).length < 1)
{
var dialogHTML = "<div class=\"" + classPrefix + "form\">" +
"<label>" + dialogLang.name + "</label>" +
"<input type=\"text\" value=\"[" + ReLinkId + "]\" data-name />" +
"<br/>" +
"<label>" + dialogLang.urlId + "</label>" +
"<input type=\"text\" data-url-id />" +
"<br/>" +
"<label>" + dialogLang.url + "</label>" +
"<input type=\"text\" value=\"http://\" data-url />" +
"<br/>" +
"<label>" + dialogLang.urlTitle + "</label>" +
"<input type=\"text\" value=\"" + selection + "\" data-title />" +
"<br/>" +
"</div>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 380,
height : 296,
content : dialogHTML,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var name = this.find("[data-name]").val();
var url = this.find("[data-url]").val();
var rid = this.find("[data-url-id]").val();
var title = this.find("[data-title]").val();
if (name === "")
{
alert(dialogLang.nameEmpty);
return false;
}
if (rid === "")
{
alert(dialogLang.idEmpty);
return false;
}
if (url === "http://" || url === "")
{
alert(dialogLang.urlEmpty);
return false;
}
//cm.replaceSelection("[" + title + "][" + name + "]\n[" + name + "]: " + url + "");
cm.replaceSelection("[" + name + "][" + rid + "]");
if (selection === "") {
cm.setCursor(cursor.line, cursor.ch + 1);
}
title = (title === "") ? "" : " \"" + title + "\"";
cm.setValue(cm.getValue() + "\n[" + rid + "]: " + url + title + "");
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
dialog = editor.find("." + dialogName);
dialog.find("[data-name]").val("[" + ReLinkId + "]");
dialog.find("[data-url-id]").val("");
dialog.find("[data-url]").val("http://");
dialog.find("[data-title]").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
ReLinkId++;
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Reference link dialog plugin for Editor.md
*
* @file reference-link-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var pluginName = "reference-link-dialog";
var ReLinkId = 1;
exports.fn.referenceLinkDialog = function() {
var _this = this;
var cm = this.cm;
var lang = this.lang;
var editor = this.editor;
var settings = this.settings;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var dialogLang = lang.dialog.referenceLink;
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
cm.focus();
if (editor.find("." + dialogName).length < 1)
{
var dialogHTML = "<div class=\"" + classPrefix + "form\">" +
"<label>" + dialogLang.name + "</label>" +
"<input type=\"text\" value=\"[" + ReLinkId + "]\" data-name />" +
"<br/>" +
"<label>" + dialogLang.urlId + "</label>" +
"<input type=\"text\" data-url-id />" +
"<br/>" +
"<label>" + dialogLang.url + "</label>" +
"<input type=\"text\" value=\"http://\" data-url />" +
"<br/>" +
"<label>" + dialogLang.urlTitle + "</label>" +
"<input type=\"text\" value=\"" + selection + "\" data-title />" +
"<br/>" +
"</div>";
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 380,
height : 296,
content : dialogHTML,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var name = this.find("[data-name]").val();
var url = this.find("[data-url]").val();
var rid = this.find("[data-url-id]").val();
var title = this.find("[data-title]").val();
if (name === "")
{
alert(dialogLang.nameEmpty);
return false;
}
if (rid === "")
{
alert(dialogLang.idEmpty);
return false;
}
if (url === "http://" || url === "")
{
alert(dialogLang.urlEmpty);
return false;
}
//cm.replaceSelection("[" + title + "][" + name + "]\n[" + name + "]: " + url + "");
cm.replaceSelection("[" + name + "][" + rid + "]");
if (selection === "") {
cm.setCursor(cursor.line, cursor.ch + 1);
}
title = (title === "") ? "" : " \"" + title + "\"";
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;
}]
}
});
}
dialog = editor.find("." + dialogName);
dialog.find("[data-name]").val("[" + ReLinkId + "]");
dialog.find("[data-url-id]").val("");
dialog.find("[data-url]").val("http://");
dialog.find("[data-title]").val(selection);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
ReLinkId++;
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

@ -1,218 +1,220 @@
/*!
* Table dialog plugin for Editor.md
*
* @file table-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "table-dialog";
var langs = {
"zh-cn" : {
toolbar : {
table : "表格"
},
dialog : {
table : {
title : "添加表格",
cellsLabel : "单元格数",
alignLabel : "对齐方式",
rows : "行数",
cols : "列数",
aligns : ["默认", "左对齐", "居中对齐", "右对齐"]
}
}
},
"zh-tw" : {
toolbar : {
table : "添加表格"
},
dialog : {
table : {
title : "添加表格",
cellsLabel : "單元格數",
alignLabel : "對齊方式",
rows : "行數",
cols : "列數",
aligns : ["默認", "左對齊", "居中對齊", "右對齊"]
}
}
},
"en" : {
toolbar : {
table : "Tables"
},
dialog : {
table : {
title : "Tables",
cellsLabel : "Cells",
alignLabel : "Align",
rows : "Rows",
cols : "Cols",
aligns : ["Default", "Left align", "Center align", "Right align"]
}
}
}
};
exports.fn.tableDialog = function() {
var _this = this;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var path = settings.path + "../plugins/" + pluginName +"/";
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogLang = lang.dialog.table;
var dialogContent = [
"<div class=\"editormd-form\" style=\"padding: 13px 0;\">",
"<label>" + dialogLang.cellsLabel + "</label>",
dialogLang.rows + " <input type=\"number\" value=\"3\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"2\" data-rows />&nbsp;&nbsp;",
dialogLang.cols + " <input type=\"number\" value=\"2\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"1\" data-cols /><br/>",
"<label>" + dialogLang.alignLabel + "</label>",
"<div class=\"fa-btns\"></div>",
"</div>"
].join("\n");
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 360,
height : 244,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var rows = parseInt(this.find("[data-rows]").val());
var cols = parseInt(this.find("[data-cols]").val());
var align = this.find("[name=\"table-align\"]:checked").val();
var table = "";
var hrLine = "------------";
var alignSign = {
_default : hrLine,
left : ":" + hrLine,
center : ":" + hrLine + ":",
right : hrLine + ":"
};
if ( rows > 1 && cols > 0)
{
for (var r = 0, len = rows; r < len; r++)
{
var row = [];
var head = [];
for (var c = 0, len2 = cols; c < len2; c++)
{
if (r === 1) {
head.push(alignSign[align]);
}
row.push(" ");
}
if (r === 1) {
table += "| " + head.join(" | ") + " |" + "\n";
}
table += "| " + row.join( (cols === 1) ? "" : " | " ) + " |" + "\n";
}
}
cm.replaceSelection(table);
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var faBtns = dialog.find(".fa-btns");
if (faBtns.html() === "")
{
var icons = ["align-justify", "align-left", "align-center", "align-right"];
var _lang = dialogLang.aligns;
var values = ["_default", "left", "center", "right"];
for (var i = 0, len = icons.length; i < len; i++)
{
var checked = (i === 0) ? " checked=\"checked\"" : "";
var btn = "<a href=\"javascript:;\"><label for=\"editormd-table-dialog-radio"+i+"\" title=\"" + _lang[i] + "\">";
btn += "<input type=\"radio\" name=\"table-align\" id=\"editormd-table-dialog-radio"+i+"\" value=\"" + values[i] + "\"" +checked + " />&nbsp;";
btn += "<i class=\"fa fa-" + icons[i] + "\"></i>";
btn += "</label></a>";
faBtns.append(btn);
}
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Table dialog plugin for Editor.md
*
* @file table-dialog.js
* @author pandao
* @version 1.2.1
* @updateTime 2015-06-09
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "table-dialog";
var langs = {
"zh-cn" : {
toolbar : {
table : "表格"
},
dialog : {
table : {
title : "添加表格",
cellsLabel : "单元格数",
alignLabel : "对齐方式",
rows : "行数",
cols : "列数",
aligns : ["默认", "左对齐", "居中对齐", "右对齐"]
}
}
},
"zh-tw" : {
toolbar : {
table : "添加表格"
},
dialog : {
table : {
title : "添加表格",
cellsLabel : "單元格數",
alignLabel : "對齊方式",
rows : "行數",
cols : "列數",
aligns : ["默認", "左對齊", "居中對齊", "右對齊"]
}
}
},
"en" : {
toolbar : {
table : "Tables"
},
dialog : {
table : {
title : "Tables",
cellsLabel : "Cells",
alignLabel : "Align",
rows : "Rows",
cols : "Cols",
aligns : ["Default", "Left align", "Center align", "Right align"]
}
}
}
};
exports.fn.tableDialog = function() {
var _this = this;
var cm = this.cm;
var editor = this.editor;
var settings = this.settings;
var path = settings.path + "../plugins/" + pluginName +"/";
var classPrefix = this.classPrefix;
var dialogName = classPrefix + pluginName, dialog;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogLang = lang.dialog.table;
var dialogContent = [
"<div class=\"editormd-form\" style=\"padding: 13px 0;\">",
"<label>" + dialogLang.cellsLabel + "</label>",
dialogLang.rows + " <input type=\"number\" value=\"3\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"2\" data-rows />&nbsp;&nbsp;",
dialogLang.cols + " <input type=\"number\" value=\"2\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"1\" data-cols /><br/>",
"<label>" + dialogLang.alignLabel + "</label>",
"<div class=\"fa-btns\"></div>",
"</div>"
].join("\n");
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 360,
height : 244,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
var rows = parseInt(this.find("[data-rows]").val());
var cols = parseInt(this.find("[data-cols]").val());
var align = this.find("[name=\"table-align\"]:checked").val();
var table = "";
var hrLine = "------------";
var alignSign = {
_default : hrLine,
left : ":" + hrLine,
center : ":" + hrLine + ":",
right : hrLine + ":"
};
if ( rows > 1 && cols > 0)
{
for (var r = 0, len = rows; r < len; r++)
{
var row = [];
var head = [];
for (var c = 0, len2 = cols; c < len2; c++)
{
if (r === 1) {
head.push(alignSign[align]);
}
row.push(" ");
}
if (r === 1) {
table += "| " + head.join(" | ") + " |" + "\n";
}
table += "| " + row.join( (cols === 1) ? "" : " | " ) + " |" + "\n";
}
}
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;
}]
}
});
}
var faBtns = dialog.find(".fa-btns");
if (faBtns.html() === "")
{
var icons = ["align-justify", "align-left", "align-center", "align-right"];
var _lang = dialogLang.aligns;
var values = ["_default", "left", "center", "right"];
for (var i = 0, len = icons.length; i < len; i++)
{
var checked = (i === 0) ? " checked=\"checked\"" : "";
var btn = "<a href=\"javascript:;\"><label for=\"editormd-table-dialog-radio"+i+"\" title=\"" + _lang[i] + "\">";
btn += "<input type=\"radio\" name=\"table-align\" id=\"editormd-table-dialog-radio"+i+"\" value=\"" + values[i] + "\"" +checked + " />&nbsp;";
btn += "<i class=\"fa fa-" + icons[i] + "\"></i>";
btn += "</label></a>";
faBtns.append(btn);
}
}
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();

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,8 +506,36 @@ class DetailCards extends Component{
<div>
{
item.shixuns_list && item.shixuns_list.map((line,index)=>{
{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}>

@ -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>
{
`
@ -677,4 +742,4 @@ export default DetailCardsEditAndAdd;
// }).catch((error)=>{
// console.log(error);
// })
// }
// }

@ -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,12 +76,11 @@ class DetailCardsEditAndEdit extends Component{
})
}
searchNameInput=(e)=>{
this.setState({
search:e.target.value
})
}
Addshixuns=()=>{
this.setState({
Addshixunstype:true,
})
}
shixunhomeworkedit=(list)=>{
@ -266,9 +267,11 @@ class DetailCardsEditAndEdit extends Component{
Modalstype:false,
Modalstopval:'',
Modalsbottomval:'',
delectfunvalue:undefined
delectfunvalue:undefined,
Addshixunstype:false
})
}
cardsModalsave=()=>{
this.setState({
Modalstype:false,
@ -317,7 +320,37 @@ class DetailCardsEditAndEdit extends Component{
notification.open(data);
}
render(){
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,
ChooseShixunList,
@ -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">
<a onClick={this.AddShixunBox} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i>
<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>
</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>
{
`
@ -733,4 +789,4 @@ export default DetailCardsEditAndEdit;
//
// }
//
// }
// }

@ -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;}
@ -3773,4 +3794,4 @@ a.singlepublishtwo{
.fontweightbold{
font-weight: bold !important;
}
}

Loading…
Cancel
Save