diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 324e5bde3..d1357d43f 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -125,8 +125,8 @@ 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) - # 注册完成后有一天的试用申请 - UserDayCertification.create(user_id: user.id, status: 1) + # 注册完成后有一天的试用申请(先去掉) + # UserDayCertification.create(user_id: user.id, status: 1) end def set_autologin_cookie(user) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bf8a0651e..f01ad4b6b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -185,21 +185,29 @@ class ApplicationController < ActionController::Base render :json => { status: status, message: message } end - # 系统全局认证 - def check_auth - day_cer = UserDayCertification.find_by(user_id: current_user.id) - # 如果注册超过24小时则需要完善资料及授权 - if (Time.now.to_i - day_cer.try(:created_at).to_i) > 86400 - if !current_user.profile_completed? - info_url = '/account/profile' - tip_exception(402, info_url) - elsif current_user.certification != 1 - if current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) - tip_exception(408, "您的试用申请正在审核中,请耐心等待") - end - tip_exception(407, "系统未授权") - end + # 资料是否完善 + def check_account + if !current_user.profile_completed? + info_url = '/account/profile' + tip_exception(402, info_url) end + end + + # 系统全局认证(暂时隐藏试用申请的判断) + def check_auth + # day_cer = UserDayCertification.find_by(user_id: current_user.id) + # # 如果注册超过24小时则需要完善资料及授权 + # if (Time.now.to_i - day_cer.try(:created_at).to_i) > 86400 + # if !current_user.profile_completed? + # info_url = '/account/profile' + # tip_exception(402, info_url) + # elsif current_user.certification != 1 + # if current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) + # tip_exception(408, "您的试用申请正在审核中,请耐心等待") + # end + # tip_exception(407, "系统未授权") + # end + # end # if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) @@ -434,12 +442,18 @@ class ApplicationController < ActionController::Base shixun.shixun_service_configs.each do |config| mirror = config.mirror_repository if mirror.name.present? + # 资源限制没有就传默认值。 + cpu_limit = config.cpu_limit.presence || 1 + cpu_request = config.lower_cpu_limit.presence || 0.1 + memory_limit = config.memory_limit.presence || 1024 + request_limit = config.resource_limit.presence || 10 + resource_limit = config.resource_limit.presence || 10000 container << {:image => mirror.name, - :cpuLimit => config.cpu_limit, - :cpuRequest => config.lower_cpu_limit, - :memoryLimit => "#{config.memory_limit}M", - :memoryRequest => "#{config.request_limit}M", - :resourceLimit => "#{config.resource_limit}K", + :cpuLimit => cpu_limit, + :cpuRequest => cpu_request, + :memoryLimit => "#{memory_limit}M", + :memoryRequest => "#{request_limit}M", + :resourceLimit => "#{resource_limit}K", :type => mirror.try(:main_type) == "1" ? "main" : "sub"} end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index faad02173..bdb367111 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -13,6 +13,7 @@ class CoursesController < ApplicationController before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner] + before_action :check_account, only: [:new, :create, :apply_to_join_course] before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner, :apply_to_join_course, :exit_course] before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt, @@ -116,6 +117,7 @@ class CoursesController < ApplicationController # GET /courses/new def new @course = Course.new + normal_status("成功") end # Get /courses/:id/settings @@ -926,12 +928,12 @@ class CoursesController < ApplicationController role = course_message.content == 2 ? '7' : '9' # 7:助教 9:教师 ApplyTeacherRoleJoinCourseNotifyJob.perform_later(current_user.id, course.id, role) - teacher_role = 1 message = "#{course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核" else message = "#{existing_course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核" end end + teacher_role = 1 end if teacher_role && current_user.student_of_course?(course) @@ -1219,7 +1221,7 @@ class CoursesController < ApplicationController @user_activity_level = [] course_user_level = [] course_activity_title = "课堂活跃度统计" - user_cell_head = %w(排名 真实姓名 登录名 邮箱 学号 分班 作业完成数(*10) 试卷完成数(*10) 问卷完成数(*7) 资源发布数(*5) 帖子发布数(*2) 帖子回复数(*1) 作业回复数(*1) 活跃度) + user_cell_head = %w(排名 真实姓名 登录名 邮箱 学号 学校 分班 作业完成数(*10) 试卷完成数(*10) 问卷完成数(*7) 资源发布数(*5) 帖子发布数(*2) 帖子回复数(*1) 作业回复数(*1) 活跃度) all_members.each do |u| #用户的基本信息 user = u.user @@ -1227,8 +1229,9 @@ class CoursesController < ApplicationController user_name = user.real_name user_mail = user.mail user_stu_id = u.student_id.present? ? (u.student_id.to_s + "\t") : "--" + user_school = user.school_name user_course_group = u.course_group_name - user_info_array = [user_login,user_name,user_mail,user_stu_id,user_course_group] #用户的信息集合 + user_info_array = [user_login,user_name,user_mail,user_stu_id,user_school,user_course_group] #用户的信息集合 user_work_scores = [] #课堂活跃度统计 @@ -1252,15 +1255,16 @@ class CoursesController < ApplicationController u_2: user_login, u_2_1: user_mail, u_3: user_stu_id, - u_4: user_course_group, - u_5: c_works_num, - u_6: c_exercise_num, - u_7: c_poll_num, - u_8: c_file_num, - u_9: c_message_num, - u_10: c_reply_num, - u_11: user_work_reply_num, - u_12: user_activity_levels + u_4: user_school, + u_5: user_course_group, + u_6: c_works_num, + u_7: c_exercise_num, + u_8: c_poll_num, + u_9: c_file_num, + u_10: c_message_num, + u_11: c_reply_num, + u_12: user_work_reply_num, + u_13: user_activity_levels } course_user_level.push(user_ac_level) @@ -1370,7 +1374,7 @@ class CoursesController < ApplicationController course_user_score_title = "学生总成绩" score_title_cells = shixun_titles + common_titles + group_titles + task_titles + exercise_titles score_title_counts = [shixun_titles.count,common_titles.count,group_titles.count,task_titles.count,exercise_titles.count] - score_cell_head = %w(序号 真实姓名 登录名 邮箱 学号 分班) + score_title_cells + ["个人总成绩"] + score_cell_head = %w(序号 真实姓名 登录名 邮箱 学号 学校 分班) + score_title_cells + ["个人总成绩"] @course_user_scores = [course_user_score_title,score_cell_head,score_title_counts,total_user_score_array] #作业的全部集合 diff --git a/app/controllers/edu_settings_controller.rb b/app/controllers/edu_settings_controller.rb index 0d80cbf3d..6baf38e5b 100644 --- a/app/controllers/edu_settings_controller.rb +++ b/app/controllers/edu_settings_controller.rb @@ -1,5 +1,5 @@ class EduSettingsController < ApplicationController - # before_action :require_admin + before_action :require_admin before_action :set_edu_setting, only: [:show, :edit, :update, :destroy] # GET /edu_settings diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index a51dccb6f..b2de6dcad 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -37,7 +37,8 @@ class GamesController < ApplicationController # 上一关、下一关 prev_game = @game.prev_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) - next_game = @game.next_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) + #next_game = @game.next_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) + next_game = user_next_game(@shixun, game_challenge, @game, @identity) # 关卡点赞数, praise_or_tread = 1则表示赞过 praise_count = game_challenge.praises_count @@ -962,4 +963,14 @@ class GamesController < ApplicationController @identity = current_user.game_identity(@game) raise Educoder::TipException.new(403, "..") if @identity > User::EDU_GAME_MANAGER end + # identity用户身份 + def user_next_game(shixun, challenge, game, identity) + next_game = game.next_of_current_game(shixun.id, game.myshixun_id, challenge.position) + # 实训允许跳关 、 当前关卡已经通关、 用户是已认证的老师以上权限的人,允许跳关 + if shixun.task_pass || game.status == 2 || identity <= User::EDU_CERTIFICATION_TEACHER + next_game + else + nil + end + end end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index f92ed8e2e..29f270a34 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -113,6 +113,15 @@ class HomeworkCommonsController < ApplicationController else if @user_course_identity == Course::STUDENT @work = @homework.user_work(current_user.id) + # 学生访问列表时计算个人成绩 + if @homework.homework_type == "practice" + myshixun = Myshixun.find_by(shixun_id: @shixun.id, user_id: current_user.id) + if @work && myshixun + challenge_settings = @homework.homework_challenge_settings + games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) + HomeworksService.new.update_myshixun_work_score @work, myshixun, games, @homework, challenge_settings + end + end # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段 if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) && diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index cdeca4871..fa47fd7f6 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -7,9 +7,9 @@ class MyshixunsController < ApplicationController ## TPI关卡列表 def challenges # @challenges = Challenge.where(shixun_id: params[:shixun_id]) - - @shixun_status = @myshixun.shixun.status + @shixun = @myshixun.shixun @games = @myshixun.games.includes(:challenge).reorder("challenges.position") + @identity = current_user.game_identity(@games.first) end @@ -42,7 +42,7 @@ class MyshixunsController < ApplicationController if e.message != "ActiveRecord::RecordInvalid" logger.error("######delete_repository_error:#{e.message}") end - raise ActiveRecord::Rollback + raise "delete_repository_error:#{e.message}" end end diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index f5003a0c7..4348b3bfc 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -896,13 +896,31 @@ class PollsController < ApplicationController def commit_poll ActiveRecord::Base.transaction do begin - poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first - poll_user_params = { - :commit_status => 1, - :end_at => Time.now - } - poll_user_current.update_attributes(poll_user_params) - normal_status(0, "问卷提交成功!") + @poll_multi_questions = @poll.poll_questions.where(question_type:2).select(:id,:max_choices,:min_choices,:question_number) + error_question = [] + @poll_multi_questions.each do |q| + poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size + if q.max_choices.present? && (poll_user_votes > q.max_choices) + error_messages = "第#{q.question_number}题:超过最大选项限制" + elsif q.min_choices.present? && (poll_user_votes < q.min_choices) + error_messages = "第#{q.question_number}题:不得少于最小选项限制" + else + error_messages = nil + end + error_question.push(error_messages) + end + error_question = error_question.reject(&:blank?) + if error_question.reject(&:blank?).length > 0 + normal_status(-1, "#{error_question.join(";")}") + else + poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first + poll_user_params = { + :commit_status => 1, + :end_at => Time.now + } + poll_user_current.update_attributes(poll_user_params) + normal_status(0, "问卷提交成功!") + end ## 需添加发送消息的接口,稍后添加 rescue Exception => e uid_logger_error(e.message) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 99cee4185..1c272e02d 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -3,6 +3,8 @@ class ShixunsController < ApplicationController include ApplicationHelper before_action :require_login, :check_auth, except: [:download_file, :index, :menus] + before_action :check_account, only: [:new, :create, :shixun_exec] + before_action :check_auth, except: [:download_file, :index, :menus] before_action :find_shixun, :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, @@ -716,7 +718,7 @@ class ShixunsController < ApplicationController logger.error("##########project_fork error #{e.message}") @current_task.destroy! end - raise ActiveRecord::Rollback + raise "实训云平台繁忙(繁忙等级:81)" end end end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 5cbb2a462..bc5b0a607 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,6 +1,7 @@ class SubjectsController < ApplicationController before_action :require_login, :check_auth, except: [:index] # before_action :check_auth, except: [:index] + before_action :check_account, only: [:new, :create] before_action :find_subject, except: [:index, :create, :new, :append_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, diff --git a/app/helpers/myshixuns_helper.rb b/app/helpers/myshixuns_helper.rb index 650f32f40..2a487e361 100644 --- a/app/helpers/myshixuns_helper.rb +++ b/app/helpers/myshixuns_helper.rb @@ -1,2 +1,14 @@ module MyshixunsHelper + + # 获取tpi的identifier, + # identity表示用户关卡的身份 + # task_pass: 实训是否允许跳关 + def get_game_identifier task_pass, game, game_identity + # 允许跳关、 关卡已经开启、 用户是已认证老师以上的身份 + if task_pass || game.status != 3 || game_identity <= User::EDU_CERTIFICATION_TEACHER + game.identifier + else + nil + end + end end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index ac64b92c1..9aa4a8fe1 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -35,7 +35,7 @@ class HomeworkCommon < ApplicationRecord has_many :homework_review_results, :dependent => :destroy validates :name, length: { maximum: 60 } - validates :description, length: { maximum: 5000 } + validates :description, length: { maximum: 15000 } validates :reference_answer, length: { maximum: 5000 } # after_update :update_activity diff --git a/app/models/shixun.rb b/app/models/shixun.rb index e35f9f1a6..82f689e3f 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -4,6 +4,7 @@ class Shixun < ApplicationRecord # status: 0:编辑 1:申请发布 2:正式发布 3:关闭 -1:软删除 # hide_code: 隐藏代码窗口 # code_hidden: 隐藏代码目录 + # task_pass: 跳关 has_many :challenges, dependent: :destroy has_many :challenge_tags, through: :challenges has_many :myshixuns, :dependent => :destroy diff --git a/app/views/courses/export_member_scores_excel.xlsx.axlsx b/app/views/courses/export_member_scores_excel.xlsx.axlsx index 5b226a09c..db4f06ab1 100644 --- a/app/views/courses/export_member_scores_excel.xlsx.axlsx +++ b/app/views/courses/export_member_scores_excel.xlsx.axlsx @@ -59,18 +59,19 @@ wb.styles do |s| sheet.merge_cells("D1:D2") sheet.merge_cells("E1:E2") sheet.merge_cells("F1:F2") + sheet.merge_cells("G1:G2") sheet.merge_cells (Axlsx::cell_r(sheet_length-1,0) + ':' + Axlsx::cell_r(sheet_length-1,1)) #最后一行的合并 sheet_first = sheet.rows.first #第一行 sheet_second = sheet.rows.second #第二行 work_head_title = %w(实训作业 普通作业 分组作业 毕设任务 试卷) (0..(sheet_length-1)).each do |i| - if i <= 5 || i == sheet_length-1 + if i <= 6 || i == sheet_length-1 sheet_first.cells[i].value = sheet_title[i] else sheet_second.cells[i].value = sheet_title[i] end end - st_col = 6 + st_col = 7 sheet_title_counts.each_with_index do |c,index| end_col = (st_col + c - 1) sheet.merge_cells sheet_first.cells[(st_col..end_col)] diff --git a/app/views/courses/search_users.json.jbuilder b/app/views/courses/search_users.json.jbuilder index d735de970..ac826fdf2 100644 --- a/app/views/courses/search_users.json.jbuilder +++ b/app/views/courses/search_users.json.jbuilder @@ -2,8 +2,8 @@ json.users do json.array! @users do |user| json.id user.id json.name user.real_name - json.student_id user.user_extension.try(:student_id) - json.school_name user.user_extension.school.name + json.student_id user&.student_id + json.school_name user&.school_name json.added @course.course_member?(user.id, 4) end end diff --git a/app/views/myshixuns/challenges.json.jbuilder b/app/views/myshixuns/challenges.json.jbuilder index 802c2b561..0be94d9fd 100644 --- a/app/views/myshixuns/challenges.json.jbuilder +++ b/app/views/myshixuns/challenges.json.jbuilder @@ -3,7 +3,7 @@ json.array! @games do |game| json.partial! 'challenges/challenge', locals: { challenge: challenge } json.status game.status json.star game.star - json.identifier game.identifier - json.get_gold game.user_get_gold_and_experience(@shixun_status, challenge)[0] - json.get_experience game.user_get_gold_and_experience(@shixun_status, challenge)[1] + json.identifier get_game_identifier(@shixun.task_pass, game, @identity) + json.get_gold game.user_get_gold_and_experience(@shixun.status, challenge)[0] + json.get_experience game.user_get_gold_and_experience(@shixun.status, challenge)[1] end \ No newline at end of file diff --git a/app/views/users/get_user_info.json.jbuilder b/app/views/users/get_user_info.json.jbuilder index 164c943d0..d9eb736ad 100644 --- a/app/views/users/get_user_info.json.jbuilder +++ b/app/views/users/get_user_info.json.jbuilder @@ -7,6 +7,7 @@ json.is_teacher @user.user_extension&.teacher? json.user_identity @user.identity json.tidding_count 0 json.user_phone_binded @user.phone.present? +json.profile_completed @user.profile_completed? if @course json.course_identity @course_identity json.course_name @course.name diff --git a/db/migrate/20190726082937_add_is_md_for_homeworks.rb b/db/migrate/20190726082937_add_is_md_for_homeworks.rb new file mode 100644 index 000000000..0b25dde97 --- /dev/null +++ b/db/migrate/20190726082937_add_is_md_for_homeworks.rb @@ -0,0 +1,12 @@ +class AddIsMdForHomeworks < ActiveRecord::Migration[5.2] + def change + # add_column :homework_commons, :is_md, :boolean, :default => true + # add_column :homework_banks, :is_md, :boolean, :default => true + # + # + # add_column :exercise_questions,:is_md, :boolean, :default => true + # add_column :poll_questions,:is_md, :boolean, :default => true + # + # add_column :exercise_bank_questions, :is_md, :boolean, :default => true + end +end diff --git a/db/migrate/20190726083814_migrate_course_is_md.rb b/db/migrate/20190726083814_migrate_course_is_md.rb new file mode 100644 index 000000000..6988db14a --- /dev/null +++ b/db/migrate/20190726083814_migrate_course_is_md.rb @@ -0,0 +1,14 @@ +class MigrateCourseIsMd < ActiveRecord::Migration[5.2] + def change + # HomeworkCommon.where(homework_type: [1, 3]).where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) + # HomeworkBank.where(homework_type: [1, 3]).where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) + # + # HomeworkCommon.where(homework_type: [1, 3]).where("created_at >= '2019-07-21 00:00:00' and homework_bank_id is not null").each do |homework| + # + # end + # + # ExerciseQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) + # PollQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) + # ExerciseBankQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) + end +end diff --git a/public/react/src/App.js b/public/react/src/App.js index 191b0f0c8..49dac07cd 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -18,6 +18,9 @@ import Notcompletedysl from './modules/user/Notcompletedysl'; import Trialapplicationysl from './modules/login/Trialapplicationysl'; import Trialapplicationreview from './modules/user/Trialapplicationreview'; import Addcourses from "./modules/courses/coursesPublic/Addcourses"; +import AccountProfile from"./modules/user/AccountProfile"; + + import Trialapplication from './modules/login/Trialapplication' import NotFoundPage from './NotFoundPage' @@ -278,6 +281,7 @@ class App extends Component { + {/*{*/} {/* isRender === true?*/} {/* : ""*/} diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index bd524c4a9..82a848cac 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -6,28 +6,30 @@ export function isImageExtension(fileName) { export function markdownToHTML(oldContent, selector) { window.$('#md_div').html('') // markdown to html - try { + if (selector && oldContent && oldContent.startsWith(' { + if (this.props.delay == true) { + (function(content, selector) { + // console.log('selector: ', selector) + setTimeout(() => { + markdownToHTML(content, selector) + }, 600) + })(content, selector) + } else { + markdownToHTML(content, selector) + } + } componentDidUpdate = (prevProps) => { if (this.props.content) { if ( prevProps.content != this.props.content ) { - markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`) + this._markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`) } } } componentDidMount () { - this.props.content && markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`) + this.props.content && this._markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`) } render(){ - + const { style, className } = this.props return( -
) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 8d9db7c3f..7c48d372b 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -297,6 +297,7 @@ class BoardsNew extends Component{ .courseForm .noBorder { border-bottom: none; } + `}
- + { attachments && attachments.map((item) => { return (
diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 2519f95e2..164b3f61e 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -370,7 +370,7 @@ class NewWork extends Component{ {pageType==="new"?"新建":"编辑"}

*/}
{/* onSubmit={this.handleSubmit} */} -
+ { - const data = { - message, - description - } - if (icon) { - data.icon = icon; - } - notification.open(data); + // const data = { + // message, + // description + // } + // if (icon) { + // data.icon = icon; + // } + // notification.open(data); + + notification.open({ + message:message, + description: description, + style: { + zIndex: 99999999 + }, + }); } bytesToSize = (bytes) => { diff --git a/public/react/src/modules/courses/common/ModalWrapper.js b/public/react/src/modules/courses/common/ModalWrapper.js index b998061eb..9fff8d928 100644 --- a/public/react/src/modules/courses/common/ModalWrapper.js +++ b/public/react/src/modules/courses/common/ModalWrapper.js @@ -36,6 +36,17 @@ class ModalWrapper extends Component{ className={className || ''} keyboard={false} > + { + visible == true ? :"" + }
{this.props.children} {this.props.checkBoxValuestype===true?
diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index cc3646b9d..afe7b606a 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -4,6 +4,7 @@ import axios from 'axios'; import {getImageUrl, trigger, on, off} from 'educoder'; import { Tooltip, message,Popover} from 'antd'; import CoursesListType from '../coursesPublic/CoursesListType'; +import AccountProfile from"../../user/AccountProfile"; import Addcourses from '../coursesPublic/Addcourses'; import '../css/Courses.css'; import Modals from "../../modals/Modals"; @@ -88,6 +89,13 @@ class CoursesBanner extends Component { } tojoinclass = (val) => { + if(this.props.current_user&&this.props.current_user.profile_completed===false){ + this.setState({ + AccountProfiletype:true + }) + return + } + if (val === 1) { this.setState({ Addcoursestypes: true, @@ -326,15 +334,30 @@ class CoursesBanner extends Component { postsettings=()=>{ window.location.href = "/courses/" + this.props.match.params.coursesId + "/settings"; } + + + hideAccountProfile=()=>{ + this.setState({ + AccountProfiletype:false + }) + } + render() { - let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide} = this.state; + let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype} = this.state; return (
{ is_guide && } - + + {AccountProfiletype===true?this.hideAccountProfile()} + {...this.state} + {...this.props} + />:""} + + { coursedata === undefined || coursedata.status===401?
:
diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index 922c68650..8225907b8 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -38,7 +38,6 @@ class Addcourses extends Component{ } return response; }, (error) => { - //TODO 这里如果样式变了会出现css不加载的情况 }); diff --git a/public/react/src/modules/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index e214bd81d..2408e95bb 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -984,6 +984,26 @@ samp { line-height: 40px; } +.courseForm .ant-input-group > .ant-input:first-child, .ant-input-group-addon:first-child { + height: 40px; +} +.courseForm .ant-select-selection, .courseForm .ant-select-selection-selected-value { + height: 40px; + line-height: 40px; +} +.courseForm .ant-input-affix-wrapper .ant-input { + height: 40px; +} +.courseForm .ant-select-auto-complete.ant-select .ant-input { + height: 40px; +} + +.courseForm .ant-select-auto-complete.ant-select .ant-select-selection__rendered { + line-height: 40px; +} +.courseForm .ant-select-auto-complete.ant-select .ant-input { + height: 40px; +} /*新建课堂*/ @@ -1560,9 +1580,28 @@ input.ant-input-number-input:focus { border-radius: 5px; } -.ant-modal-wrap{ - overflow: hidden; +@media screen and (min-width: 1400px) { + .ant-modal-wrap{ + overflow: hidden; + } } +/* 设置了浏览器宽度不小于1201px时 abc 显示1200px宽度 */ + +@media screen and (max-width: 1400px) { + +} +/* 设置了浏览器宽度不大于1200px时 abc 显示900px宽度 */ + +@media screen and (max-width: 900px) { + +} +/* 设置了浏览器宽度不大于900px时 abc 显示200px宽度 */ + +@media screen and (max-width: 500px) { + +} +/* 设置了浏览器宽度不大于500px时 abc 显示100px宽度 */ + /* 试卷答题 */ .stageTable .ant-table-tbody tr:last-child td,.stageTable .ant-table-thead > tr > th{ diff --git a/public/react/src/modules/courses/exercise/new/MainDisplay.js b/public/react/src/modules/courses/exercise/new/MainDisplay.js index 73e5864d6..0581865d7 100644 --- a/public/react/src/modules/courses/exercise/new/MainDisplay.js +++ b/public/react/src/modules/courses/exercise/new/MainDisplay.js @@ -7,7 +7,7 @@ import { } from 'antd'; import axios from 'axios' import { qNameArray } from './common' -import {getUrl, ActionBtn, markdownToHTML} from 'educoder'; +import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder'; import QestionDisplayHeader from './QestionDisplayHeader' const { TextArea } = Input; const confirm = Modal.confirm; @@ -68,10 +68,14 @@ class MainDisplay extends Component{ { standard_answer[0] &&
参考答案:
-
+ {/*
-
+
*/}
} diff --git a/public/react/src/modules/courses/exercise/new/NullDisplay.js b/public/react/src/modules/courses/exercise/new/NullDisplay.js index e61c1d2f7..eade97474 100644 --- a/public/react/src/modules/courses/exercise/new/NullDisplay.js +++ b/public/react/src/modules/courses/exercise/new/NullDisplay.js @@ -7,7 +7,7 @@ import { } from 'antd'; import axios from 'axios' import { qNameArray } from './common' -import {getUrl, ActionBtn, markdownToHTML} from 'educoder'; +import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder'; import QestionDisplayHeader from './QestionDisplayHeader' const { TextArea } = Input; const confirm = Modal.confirm; @@ -108,8 +108,12 @@ class NullDisplay extends Component{ 答案(填空{index+1}):
{ answers.answer_text.map((item, itemIndex) => { - return {item} + return })} + {/* {item} */}
}) diff --git a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js index d4a827a68..7b82b14b6 100644 --- a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js +++ b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js @@ -7,7 +7,7 @@ import { } from 'antd'; import axios from 'axios' import { qNameArray } from './common' -import {getUrl, ActionBtn, markdownToHTML} from 'educoder'; +import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder'; const { TextArea } = Input; const confirm = Modal.confirm; const $ = window.$ @@ -80,8 +80,13 @@ class QestionDisplayHeader extends Component{ }
- + { question_title && + + //
+ } ) } diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js index 13d1e838c..cbb6da827 100644 --- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js +++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js @@ -7,7 +7,7 @@ import { } from 'antd'; import axios from 'axios' import QestionDisplayHeader from './QestionDisplayHeader' -import {getUrl, ActionBtn, markdownToHTML} from 'educoder'; +import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder'; const { TextArea } = Input; const confirm = Modal.confirm; const $ = window.$ @@ -100,16 +100,22 @@ class SingleDisplay extends Component{ return (
{prefix} - + + {/* */}
) } else { return (
{prefix} - + + {/* */}
) } })} diff --git a/public/react/src/modules/courses/exercise/question/shixunAnswer.js b/public/react/src/modules/courses/exercise/question/shixunAnswer.js index 5897ebd79..f1fb09227 100644 --- a/public/react/src/modules/courses/exercise/question/shixunAnswer.js +++ b/public/react/src/modules/courses/exercise/question/shixunAnswer.js @@ -135,8 +135,8 @@ class shixunAnswer extends Component{ let url=`/exercise_questions/${this.props.questionType.question_id}/adjust_score.json` const list = Object.assign({}, this.state.dataCopy[key]) - console.log("111111111111111111111111"); - console.log(this.props); + // console.log("111111111111111111111111"); + // console.log(this.props); // 调分值为0,且和第一次的数据相同则不修改 if(parseInt(e.target.value)==parseInt(list.my_score)){ return; diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js index 569c76331..43a0e31f5 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js @@ -1,614 +1,614 @@ -import React,{ Component } from "react"; - -import { - Form, Input, InputNumber, Switch, Radio, - Slider, Button, Upload, Icon, Rate, Checkbox, message, - Row, Col, Select, Modal,Cascader -} from 'antd'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import axios from 'axios' -import {getUrl} from 'educoder'; -import "../../common/formCommon.css" -import '../style.css' -import '../../css/Courses.css' -import { WordsBtn, City } from 'educoder' -// import City from './City' - -// import './board.css' -// import { RouteHOC } from './common.js' - -const confirm = Modal.confirm; -const $ = window.$ -const { Option } = Select; -// 新建毕设选题 -// https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c -class GraduateTopicNew extends Component{ - constructor(props){ - super(props); - - this.mdRef = React.createRef(); - - this.state = { - fileList: [], - boards: [], - teacherList:[], - topic_property_first:[], - topic_property_second:[], - topic_repeat:[], - topic_source:[], - topic_type:[], - attachments:undefined, - addonAfter:60, - left_banner_id:undefined, - course_name:undefined - } - } - // 获取老师列表 - getTeacherList=()=>{ - const cid = this.props.match.params.coursesId - let url=`/courses/${cid}/graduation_topics/new.json`; - axios.get((url)).then((result)=>{ - if(result.status==200){ - this.setState({ - teacherList:result.data.teacher_list, - left_banner_id:result.data.left_banner_id, - course_name:result.data.course_name, - left_banner_name:result.data.left_banner_name, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type - }) - console.log("sdfds"); - console.log(this.props.current_user && this.props.current_user.user_id); - this.props.form.setFieldsValue({ - tea_id:this.props.current_user && this.props.current_user.user_id - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - componentDidMount = () => { - //新建or编辑 - let topicId=this.props.match.params.topicId; - - if(topicId==undefined){ - this.getTeacherList(); - }else{ - this.getEditInfo(); - - } - } - //编辑,信息显示 - getEditInfo=()=>{ - const cid = this.props.match.params.coursesId - let topicId=this.props.match.params.topicId - let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`; - axios.get((url)).then((result)=>{ - if(result){ - this.setState({ - left_banner_id:result.data.left_banner_id, - course_name:result.data.course_name, - left_banner_name:result.data.left_banner_name, - teacherList:result.data.teacher_list, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type, - attachments:result.data.attachments, - addonAfter:20-parseInt(result.data.selected_data.name.length) - }) - this.props.form.setFieldsValue({ - tea_id:result.data.selected_data.tea_id, - name:result.data.selected_data.name, - city: [result.data.selected_data.province,result.data.selected_data.city], - topic_type:result.data.selected_data.topic_type || undefined, - topic_source:result.data.selected_data.topic_source || undefined, - topic_property_first:result.data.selected_data.topic_property_first || undefined, - topic_property_second:result.data.selected_data.topic_property_second || undefined, - source_unit:result.data.selected_data.source_unit, - topic_repeat:result.data.selected_data.topic_repeat || undefined - }); - this.mdRef.current.setValue(result.data.selected_data.description) - const _fileList = result.data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: item.title, - url: item.url, - status: 'done' - } - }) - this.setState({ fileList: _fileList, cityDefaultValue: [result.data.selected_data.province,result.data.selected_data.city] }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - handleSubmit = (e) => { - e.preventDefault(); - const cid = this.props.match.params.coursesId - const topicId = this.props.match.params.topicId - console.log(this.props); - - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - console.log('Received values of form: ', values); - if (topicId !=undefined) { - const editTopic = this.editTopic - const editUrl = `/courses/${cid}/graduation_topics/${topicId}.json` - - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - } - axios.put(editUrl, { - graduation_topic:{ - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - }, - attachment_ids - }).then((response) => { - if (response.status == 200) { - const { id } = response.data; - if (id) { - this.props.showNotification('保存成功!'); - this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); - } - } - }).catch(function (error) { - console.log(error); - }); - } else { - const url = `/courses/${cid}/graduation_topics.json` - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response.id - }) - } - - axios.post(url, { - graduation_topic:{ - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - }, - attachment_ids, - }).then((response) => { - if (response.data) { - const { id } = response.data; - if (id) { - this.props.showNotification('提交成功!'); - this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - } else { - $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) - } - }); - } - - // 选择省市 - ChangeCity=(value, selectedOptions)=>{ - console.log(selectedOptions); - } - - // 附件相关 START - handleChange = (info) => { - let fileList = info.fileList; - this.setState({ fileList }); - } - onAttachmentRemove = (file) => { - confirm({ - title: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, - }); - return false; - } - deleteAttachment = (file) => { - console.log(file); - let id=file.response ==undefined ? file.id : file.response.id - const url = `/attachments/${id}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - // 附件相关 ------------ END - - changeTopicName=(e)=>{ - let num= 60 - parseInt(e.target.value.length); - this.setState({ - addonAfter:num < 0 ? 0 : num - }) - } - render() { - let { - fileList, - teacherList, - topic_property_first, - topic_property_second, - topic_repeat, - topic_source, - topic_type, - addonAfter, - left_banner_id, - course_name, - left_banner_name - } = this.state; - const { current_user } = this.props - const { getFieldDecorator } = this.props.form; - let{ topicId,coursesId }=this.props.match.params - console.log(this.props); - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - // sm: { span: 8 }, - sm: { span: 24 }, - }, - wrapperCol: { - xs: { span: 24 }, - // sm: { span: 16 }, - sm: { span: 24 }, - }, - }; - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - message.error('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - console.log("dfsf"); - console.log(this.props); - return( -
- -
-

- {course_name} - > - {left_banner_name} - > - {topicId==undefined?"新建":"编辑"} -

-
-

{topicId==undefined?"新建":"编辑"}毕设选题

- this.props.history.goBack()} className="color-grey-6 fr font-16">返回 -
- - -
- - {getFieldDecorator('tea_id', { - rules: [{ - required: true, message: '请选择指导老师' - }], - })( - - )} - - - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '最大限制为60个字符', - }], - })( - - )} - -
- - - -
- - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入选题简介', - }, { - max: 10000, message: '最大限制为10000个字符', - }], - })( - - )} - - - { - getFieldDecorator('file',{ - rules:[{ - required:false - }] - })( - - - (单个文件150M以内) - - ) - } - -
- - {getFieldDecorator('topic_type', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_source', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_first', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_second', { - rules: [{ - required: false, message: '', - }], - })( - - )} - -
-
- - - - - -
- - {getFieldDecorator('source_unit', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_repeat', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('city', { - rules: [{ - initialValue: this.state.cityDefaultValue, - type: 'array', - required: false, message: '', - }], - })( - - )} - -
- - -
- - this.props.history.goBack()}>取消 -
-
- -
-
- ) - } -} - -const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew); -// RouteHOC() +import React,{ Component } from "react"; + +import { + Form, Input, InputNumber, Switch, Radio, + Slider, Button, Upload, Icon, Rate, Checkbox, message, + Row, Col, Select, Modal,Cascader +} from 'antd'; +import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; +import axios from 'axios' +import {getUrl} from 'educoder'; +import "../../common/formCommon.css" +import '../style.css' +import '../../css/Courses.css' +import { WordsBtn, City } from 'educoder' +// import City from './City' + +// import './board.css' +// import { RouteHOC } from './common.js' + +const confirm = Modal.confirm; +const $ = window.$ +const { Option } = Select; +// 新建毕设选题 +// https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c +class GraduateTopicNew extends Component{ + constructor(props){ + super(props); + + this.mdRef = React.createRef(); + + this.state = { + fileList: [], + boards: [], + teacherList:[], + topic_property_first:[], + topic_property_second:[], + topic_repeat:[], + topic_source:[], + topic_type:[], + attachments:undefined, + addonAfter:60, + left_banner_id:undefined, + course_name:undefined + } + } + // 获取老师列表 + getTeacherList=()=>{ + const cid = this.props.match.params.coursesId + let url=`/courses/${cid}/graduation_topics/new.json`; + axios.get((url)).then((result)=>{ + if(result.status==200){ + this.setState({ + teacherList:result.data.teacher_list, + left_banner_id:result.data.left_banner_id, + course_name:result.data.course_name, + left_banner_name:result.data.left_banner_name, + topic_property_first:result.data.topic_property_first, + topic_property_second:result.data.topic_property_second, + topic_repeat:result.data.topic_repeat, + topic_source:result.data.topic_source, + topic_type:result.data.topic_type + }) + console.log("sdfds"); + console.log(this.props.current_user && this.props.current_user.user_id); + this.props.form.setFieldsValue({ + tea_id:this.props.current_user && this.props.current_user.user_id + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + componentDidMount = () => { + //新建or编辑 + let topicId=this.props.match.params.topicId; + + if(topicId==undefined){ + this.getTeacherList(); + }else{ + this.getEditInfo(); + + } + } + //编辑,信息显示 + getEditInfo=()=>{ + const cid = this.props.match.params.coursesId + let topicId=this.props.match.params.topicId + let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`; + axios.get((url)).then((result)=>{ + if(result){ + this.setState({ + left_banner_id:result.data.left_banner_id, + course_name:result.data.course_name, + left_banner_name:result.data.left_banner_name, + teacherList:result.data.teacher_list, + topic_property_first:result.data.topic_property_first, + topic_property_second:result.data.topic_property_second, + topic_repeat:result.data.topic_repeat, + topic_source:result.data.topic_source, + topic_type:result.data.topic_type, + attachments:result.data.attachments, + addonAfter:20-parseInt(result.data.selected_data.name.length) + }) + this.props.form.setFieldsValue({ + tea_id:result.data.selected_data.tea_id, + name:result.data.selected_data.name, + city: [result.data.selected_data.province,result.data.selected_data.city], + topic_type:result.data.selected_data.topic_type || undefined, + topic_source:result.data.selected_data.topic_source || undefined, + topic_property_first:result.data.selected_data.topic_property_first || undefined, + topic_property_second:result.data.selected_data.topic_property_second || undefined, + source_unit:result.data.selected_data.source_unit, + topic_repeat:result.data.selected_data.topic_repeat || undefined + }); + this.mdRef.current.setValue(result.data.selected_data.description) + const _fileList = result.data.attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: item.title, + url: item.url, + status: 'done' + } + }) + this.setState({ fileList: _fileList, cityDefaultValue: [result.data.selected_data.province,result.data.selected_data.city] }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + handleSubmit = (e) => { + e.preventDefault(); + const cid = this.props.match.params.coursesId + const topicId = this.props.match.params.topicId + // console.log(this.props); + + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + console.log('Received values of form: ', values); + if (topicId !=undefined) { + const editTopic = this.editTopic + const editUrl = `/courses/${cid}/graduation_topics/${topicId}.json` + + let attachment_ids = undefined + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + axios.put(editUrl, { + graduation_topic:{ + ...values, + province: values.city==undefined?"":values.city[0], + city: values.city==undefined?"":values.city[1], + }, + attachment_ids + }).then((response) => { + if (response.status == 200) { + const { id } = response.data; + if (id) { + this.props.showNotification('保存成功!'); + this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); + } + } + }).catch(function (error) { + console.log(error); + }); + } else { + const url = `/courses/${cid}/graduation_topics.json` + let attachment_ids = undefined + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response.id + }) + } + + axios.post(url, { + graduation_topic:{ + ...values, + province: values.city==undefined?"":values.city[0], + city: values.city==undefined?"":values.city[1], + }, + attachment_ids, + }).then((response) => { + if (response.data) { + const { id } = response.data; + if (id) { + this.props.showNotification('提交成功!'); + this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + } else { + $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) + } + }); + } + + // 选择省市 + ChangeCity=(value, selectedOptions)=>{ + console.log(selectedOptions); + } + + // 附件相关 START + handleChange = (info) => { + let fileList = info.fileList; + this.setState({ fileList }); + } + onAttachmentRemove = (file) => { + confirm({ + title: '确定要删除这个附件吗?', + okText: '确定', + cancelText: '取消', + // content: 'Some descriptions', + onOk: () => { + this.deleteAttachment(file) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } + deleteAttachment = (file) => { + console.log(file); + let id=file.response ==undefined ? file.id : file.response.id + const url = `/attachments/${id}.json` + axios.delete(url, { + }) + .then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { + console.log('--- success') + + this.setState((state) => { + const index = state.fileList.indexOf(file); + const newFileList = state.fileList.slice(); + newFileList.splice(index, 1); + return { + fileList: newFileList, + }; + }); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + + // 附件相关 ------------ END + + changeTopicName=(e)=>{ + let num= 60 - parseInt(e.target.value.length); + this.setState({ + addonAfter:num < 0 ? 0 : num + }) + } + render() { + let { + fileList, + teacherList, + topic_property_first, + topic_property_second, + topic_repeat, + topic_source, + topic_type, + addonAfter, + left_banner_id, + course_name, + left_banner_name + } = this.state; + const { current_user } = this.props + const { getFieldDecorator } = this.props.form; + let{ topicId,coursesId }=this.props.match.params + // console.log(this.props); + + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + // sm: { span: 8 }, + sm: { span: 24 }, + }, + wrapperCol: { + xs: { span: 24 }, + // sm: { span: 16 }, + sm: { span: 24 }, + }, + }; + const uploadProps = { + width: 600, + fileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + onChange: this.handleChange, + onRemove: this.onAttachmentRemove, + beforeUpload: (file) => { + console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; + if (!isLt150M) { + message.error('文件大小必须小于150MB!'); + } + return isLt150M; + }, + }; + // console.log("dfsf"); + // console.log(this.props); + return( +
+ +
+

+ {course_name} + > + {left_banner_name} + > + {topicId==undefined?"新建":"编辑"} +

+
+ +
+
+ + {getFieldDecorator('tea_id', { + rules: [{ + required: true, message: '请选择指导老师' + }], + })( + + )} + + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请输入选题名称', + }, { + max: 60, message: '最大限制为60个字符', + }], + })( + + )} + +
+ + + +
+ + + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请输入选题简介', + }, { + max: 10000, message: '最大限制为10000个字符', + }], + })( + + )} + + + { + getFieldDecorator('file',{ + rules:[{ + required:false + }] + })( + + + (单个文件150M以内) + + ) + } + +
+ + {getFieldDecorator('topic_type', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_source', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_property_first', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_property_second', { + rules: [{ + required: false, message: '', + }], + })( + + )} + +
+
+ + + + + +
+ + {getFieldDecorator('source_unit', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_repeat', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('city', { + rules: [{ + initialValue: this.state.cityDefaultValue, + type: 'array', + required: false, message: '', + }], + })( + + )} + +
+ + +
+ + this.props.history.goBack()}>取消 +
+
+ +
+
+ ) + } +} + +const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew); +// RouteHOC() export default (WrappedGraduateTopicNew); \ No newline at end of file diff --git a/public/react/src/modules/courses/members/modal/AddStudentModal.js b/public/react/src/modules/courses/members/modal/AddStudentModal.js index c3d8cdd75..59c6e41da 100644 --- a/public/react/src/modules/courses/members/modal/AddStudentModal.js +++ b/public/react/src/modules/courses/members/modal/AddStudentModal.js @@ -93,13 +93,14 @@ class AddStudentModal extends Component{ } onSendOk = () => { - this.setState({ - isSpin:true - }) + if(!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) { this.props.showNotification('请从列表中先选择用户。') return; } + this.setState({ + isSpin:true + }) const courseId = this.props.match.params.coursesId const url = `/courses/${courseId}/add_students_by_search.json` const params = { @@ -159,7 +160,7 @@ class AddStudentModal extends Component{ title={`添加${moduleName}`} {...this.props } onOk={this.onOk} - className="addStudentModal" + className="addStudentModal courseForm" > @@ -635,7 +646,7 @@ class CoursesNew extends Component {
-
+
{getFieldDecorator('school', { rules: [{required: true, message: "不能为空"}], diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js index 92b69a9d1..926cd9b1d 100644 --- a/public/react/src/modules/courses/poll/Poll.js +++ b/public/react/src/modules/courses/poll/Poll.js @@ -464,7 +464,7 @@ class Poll extends Component{ modalsBottomval, loadtype }=this.state; - console.log(this.props); + // console.log(this.props); let {child}=this.props; let {coursesId,Id}=this.props.match.params const isAdmin = this.props.isAdmin() diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index 9119b7902..b1e8c3443 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -34,7 +34,7 @@ class PollDetailIndex extends Component{ } getPollInfo=()=>{ - console.log(this.props); + // console.log(this.props); let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}/common_header.json` axios.get(url).then((result)=>{ @@ -123,7 +123,7 @@ class PollDetailIndex extends Component{ />

- {this.props.coursedata.name} + {this.props.coursedata.name} > 问卷 > diff --git a/public/react/src/modules/courses/poll/PollDetailTabSecond.js b/public/react/src/modules/courses/poll/PollDetailTabSecond.js index a01ffbe22..cebae4153 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabSecond.js +++ b/public/react/src/modules/courses/poll/PollDetailTabSecond.js @@ -66,7 +66,7 @@ class PollDetailTabSecond extends Component{ {parseInt(page-1)*parseInt(limit)+(key+1)}、{map[item.question.question_type]} { item.question.is_necessary==1 ? 必答:"" } - { item.question.question_type == 2 ? + { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ? { item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : @@ -127,9 +127,9 @@ class PollDetailTabSecond extends Component{ {options.answer_users_count}

- +

- {parseFloat(options.answer_percent ? options.answer_percent : 0 ).toFixed(2)*100} % + {(options.answer_percent * 100).toFixed(1)}% { diff --git a/public/react/src/modules/courses/poll/PollDetailTabThird.js b/public/react/src/modules/courses/poll/PollDetailTabThird.js index 56455ffdb..b0bc95cea 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabThird.js +++ b/public/react/src/modules/courses/poll/PollDetailTabThird.js @@ -71,7 +71,7 @@ class PollDetailTabThird extends Component{

{item.question.question_number}、{map[item.question.question_type]} { item.question.is_necessary==1 ? 必答:选答 } - { item.question.question_type == 2 && item.question.min_choices && item.question.max_choice ? + { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ? { item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : @@ -89,8 +89,8 @@ class PollDetailTabThird extends Component{ item.question.answers.map((index,k)=>{ return(

  • - - {index.answer_text} + + {index.answer_text} { index.answer_text=="其他" ?

    :"" } @@ -109,8 +109,8 @@ class PollDetailTabThird extends Component{ item.question.answers.map((index,k)=>{ return(
  • - - {index.answer_text} + + {index.answer_text} { index.answer_text=="其他" ?

    :"" } diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index f32d652c2..8429595c9 100644 --- a/public/react/src/modules/courses/poll/PollInfo.js +++ b/public/react/src/modules/courses/poll/PollInfo.js @@ -135,7 +135,7 @@ class PollInfo extends Component{ postAnswer=(q_id,a_id,text,key)=>{ let url=`/poll_questions/${q_id}/poll_votes.json`; - + console.log(text); axios.post(url,{ poll_answer_id:a_id, vote_text:text @@ -207,8 +207,9 @@ class PollInfo extends Component{ }) if(text!=undefined){ - url+="vote_text="+text; - axios.post(url).then((result)=>{ + axios.post((url),{ + vote_text:text + }).then((result)=>{ if(result.status==200){ const answer=Object.assign({}, this.state.question_answered[key]); answer.ques_status=result.data.poll_vote.question_status; @@ -315,7 +316,7 @@ class PollInfo extends Component{ >

    - {courseName} + {courseName} > 问卷 > @@ -383,7 +384,7 @@ class PollInfo extends Component{

    {item.question.question_number}、{map[item.question.question_type]} { item.question.is_necessary==1 ? 必答:选答 } - { item.question.question_type == 2 && item.question.min_choices && item.question.max_choice ? + { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ? { item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : @@ -400,8 +401,9 @@ class PollInfo extends Component{ { item.question.answers && item.question.answers.map((i,k)=>{ return( -
  • - {i.answer_text} +
  • + + {i.answer_text} { i.answer_text=="其他" ? @@ -442,8 +444,9 @@ class PollInfo extends Component{ { item.question.answers && item.question.answers.map((i,k)=>{ return( -
  • - {i.answer_text} +
  • + + {i.answer_text} { i.answer_text=="其他"? diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index cd559b75f..651a8b131 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -844,12 +844,12 @@ class PollNew extends Component { if (object.question.question_type === 2) { if (object.question.max_choices > 0) { - if (object.question.min_choices < 2) { - this.props.showNotification(`可选最小不能少于2个`); - - return; - - } + // if (object.question.min_choices < 2) { + // this.props.showNotification(`可选最小不能少于2个`); + // + // return; + // + // } } } @@ -1332,10 +1332,10 @@ class PollNew extends Component { if (object.question.question_type === 2) { if (object.question.max_choices > 0) { - if (object.question.min_choices < 2) { - this.props.showNotification(`可选最小不能少于2个`); - return; - } + // if (object.question.min_choices < 2) { + // this.props.showNotification(`可选最小不能少于2个`); + // return; + // } } } if (object.question.new === "new") { @@ -2108,14 +2108,24 @@ class PollNew extends Component { } //最大值 - HandleGradationGroupChangeee = (value, index) => { - + HandleGradationGroupChangeee = (value, index,minchoices) => { + // console.log("2112"); + // console.log(value); + // console.log(minchoices); let arr = this.state.adddom; for (var i = 0; i < arr.length; i++) { if (index === i) { - arr[i].question.max_choices = parseInt(value); + if(parseInt(value)===0&&parseInt(minchoices)===0){ + arr[i].question.min_choices= parseInt(minchoices); + arr[i].question.max_choices = parseInt(value); + }else { + arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); + arr[i].question.max_choices = parseInt(value); + } } } + // console.log(2119); + // console.log(arr); this.setState({ adddom: arr }) @@ -2285,7 +2295,7 @@ class PollNew extends Component { readOnlys: "readOnly", cancellation: false, }) - + window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`; }) } else { @@ -2322,7 +2332,7 @@ class PollNew extends Component { gotohome=()=>{ const { current_user} = this.props - this.props.history.push(current_user.first_category_url); + this.props.history.push(current_user && current_user.first_category_url); // let courseId=this.props.match.params.coursesId; @@ -2388,7 +2398,7 @@ class PollNew extends Component { this.gotohome()}>{this.props.coursedata.name} > 问卷 + href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷 > {this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}

    @@ -2772,7 +2782,7 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/} this.HandleGradationGroupChangeee(value, indexo)} + onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} > @@ -3267,7 +3277,7 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/} } -
  • -
    - 必填项 -
    -
    - - -
    - -
    -
    - -
    - -

    简介

    - -
    - -
    -
    -
    -

    -

    -
    - -
    -
    -

    技术平台

    - - -
    - * -
    + + 实训详情 + 配置 + + +
    +
    + 配置 + { + this.props.identity===1&&this.state.status==2? + this.operateshixuns(2)}> + 永久关闭 + :"" + } + { + this.props.identity < 5 && this.state.status==0? + this.operateshixuns(1)}> + 删除实训 + :"" + } + { + this.props.identity == 1 && this.state.status == 2 ? + this.operateshixuns(1)}> + 删除实训 + :"" + } + + - -

    - 列表中没有? - 申请新建 -

    - - - - - - -
    -

    新建申请已提交,请等待管理员的审核

    -
  • 我们将在1-2个工作日内与您联系 -
  • -
    -
    - 知道啦 -
    -
    -
    -
    - -
    - -
    -
    - 必填项 -
    - {/*

    请在配置页面完成后续的评测脚本设置操作

    */} - -
    -
    - {/*
    */} - {/*
    */} -
    -

    评测脚本

    -
    - - -
    -

    原有脚本将被新的脚本覆盖,无法撤销

    -

    是否确认执行覆盖操作

    -
    - - -
    - - -

    评测脚本生成成功!

    - -
    - - { - this.props.identity<5||this.props.power==true? - 使用自定义脚本 : "" - } -
    - this.testscripttip(0)}> -
    - -
    -

    - 使用自定义模板,平台无法自动更新脚本,
    - 请在关卡创建完后手动更新脚本中的必填参
    - 数和以下2个数组元素:
    - challengeProgramNames
    - sourceClassNames

    - 示例:有2个关卡的实训

    - 各关卡的待编译文件为:
    - src/step1/HelloWorld.java
    - src/step2/Other.java

    - 各关卡的编译后生成的执行文件为:
    - step1.HelloWorld
    - step2.Other

    - 则数组元素更新如下:
    - challengeProgramNames=("src/step1/
    - HelloWorld.java" "src/step2/Other.java")
    - sourceClassNames=("step1.HelloWorld
    - " "step2.Other")

    - 其它参数可按实际需求定制 -

    +
    + +
    + +

    实训名称

    + +
    + * +
    +
    + {settingsData === undefined ? "" : + } +
    +
    + 必填项
    -

    - this.testscripttip(1)}>知道了 -

    + +
    - -
    -
  • - - -

    执行命令不能为空

    -
  • - -
  • - - -
  • -
    -
    -
    -
    - -
    -
    - * -
    - - -
    - {/**/} - -
    - - - {/*
    */} - {/*{evaluate_script===undefined?"":evaluate_script}*/} - - {/*
    */} - - - -
    - -
    -
    -
    - - 必填项 -
    -

    -

    -
    -
    - - {/*
    */} - {/***/} - - {/*

    程序最大执行时间

    */} - - {/* 秒*/} - - {/*
    */} - {/*必填项*/} - {/*
    */} - {/*
    */} - - {/*
    - * - -

    Pod存活时间

    - - - -
    - 必填项 -
    -
    */} - - -
    -

    命令行

    - - 无命令行窗口 (选中则不给学员的实践任务提供命令窗口) - 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) - 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) - - 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) - - -
    - -
    -

    公开程度

    - - 对所有公开 (选中则所有已被试用授权的用户可以学习) - 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) - - -
    -
    -
    -
    -
    - -
    - (搜索并选中添加单位名称) -
    - {/*+*/} - {/*添加*/} -
    - -
    - - {/*{*/} - {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/} - {/*return(*/} - {/*
    */} - {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/} - {/*value={item}*/} - {/*/>*/} - {/*
    */} - - {/*)*/} - {/*})*/} - {/*}*/} -
    - - - 请选择需要公开的单位 - -
    -
    -
    - -
    -

    发布信息

    - -
    - * - 面向学员: - -
    - -
    - 实训难易度定位,不限定用户群体 -
    - 必填项 -
    - -
    -
    - 复制: - - - - -
    - -
    - 跳关: - - - - -
    -
    - 测试集解锁: - - - - -
    - -
    - 隐藏代码窗口: - - - - -
    - -
    - 代码目录隐藏: - - - - -
    - -
    - 禁用复制粘贴: - - - - -
    - -
    - 开启时间: - - - - -
    - - {this.props.identity<3?
    - VNC图形化: - - - - -
    :""} +
    +
    -
    - {/*"name": "我是镜像名", # 镜像名称*/} - {/*"cpu_limit": 1, # cpu核*/} - {/*"lower_cpu_limit": 0.1, # 最低cpu核 浮点数*/} - {/*"memory_limit": 1024 ,#内存限制*/} - {/*"request_limit": 10, # 内存要求*/} - {/*"mirror_repository_id": 12, # 镜像id*/} - {this.props.identity<3?
    -

    服务配置

    - { shixun_service_configs&&shixun_service_configs.map((item,key)=>{ - return( -
    -
    -

    {item.name}

    -
    - -
    - this.setConfigsInputs(e,key,1)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    + +

    简介

    + +
    + +
    +
    +
    +

    +

    +
    + +
    +
    +

    技术平台

    + + +
    + * +
    + +

    + 列表中没有? + 申请新建 +

    + + + + + + +
    +

    新建申请已提交,请等待管理员的审核

    +
  • 我们将在1-2个工作日内与您联系 +
  • +
    +
    + 知道啦 +
    +
    +
    +
    + +
    + +
    +
    + 必填项 +
    + {/*

    请在配置页面完成后续的评测脚本设置操作

    */} + +
    +
    + {/*
    */} + {/*
    */} +
    +

    评测脚本

    +
    + + +
    +

    原有脚本将被新的脚本覆盖,无法撤销

    +

    是否确认执行覆盖操作

    +
    + + +
    + + +

    评测脚本生成成功!

    + +
    + + { + this.props.identity<5||this.props.power==true? + 使用自定义脚本 : "" + } +
    + this.testscripttip(0)}> +
    + +
    +

    + 使用自定义模板,平台无法自动更新脚本,
    + 请在关卡创建完后手动更新脚本中的必填参
    + 数和以下2个数组元素:
    + challengeProgramNames
    + sourceClassNames

    + 示例:有2个关卡的实训

    + 各关卡的待编译文件为:
    + src/step1/HelloWorld.java
    + src/step2/Other.java

    + 各关卡的编译后生成的执行文件为:
    + step1.HelloWorld
    + step2.Other

    + 则数组元素更新如下:
    + challengeProgramNames=("src/step1/
    + HelloWorld.java" "src/step2/Other.java")
    + sourceClassNames=("step1.HelloWorld
    + " "step2.Other")

    + 其它参数可按实际需求定制 +

    +
    +

    + this.testscripttip(1)}>知道了 +

    -
    -
    - -
    - this.setConfigsInputs(e,key,2)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> + + +
    +
  • + + +

    执行命令不能为空

    +
  • + +
  • + + +
  • -
    +
    +
    +
    + +
    +
    + * +
    + + +
    + {/**/} +
    -
    - -
    - this.setConfigsInputs(e,key,3)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> + + + {/*
    */} + {/*{evaluate_script===undefined?"":evaluate_script}*/} + + {/*
    */} + + + +
    + +
    +
    +
    + + 必填项 +
    +

    +

    +
    +
    + + {/*
    */} + {/***/} + + {/*

    程序最大执行时间

    */} + + {/* 秒*/} + + {/*
    */} + {/*必填项*/} + {/*
    */} + {/*
    */} + + {/*
    + * + +

    Pod存活时间

    + + + +
    + 必填项 +
    +
    */} + + +
    +

    命令行

    + + 无命令行窗口 (选中则不给学员的实践任务提供命令窗口) + 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) + 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) + + 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) + + +
    + +
    +

    公开程度

    + + 对所有公开 (选中则所有已被试用授权的用户可以学习) + 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) + + +
    +
    +
    +
    +
    + +
    + (搜索并选中添加单位名称)
    -
    + {/*+*/} + {/*添加*/}
    -
    - -
    - this.setConfigsInputs(e,key,4)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> + +
    + - -
    + {/*{*/} + {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/} + {/*return(*/} + {/*
    */} + {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/} + {/*value={item}*/} + {/*/>*/} + {/*
    */} + + {/*)*/} + {/*})*/} + {/*}*/}
    + + + 请选择需要公开的单位 + +
    +
    +
    + +
    +

    发布信息

    + +
    + * + 面向学员: + +
    + +
    + 实训难易度定位,不限定用户群体 +
    + 必填项
    -
    - ) - - })} -
    :""} -

    - { - // this.props.identity<4&&this.props.status==0? - this.props.identity<5? -

    - 保存 - 取消 -
    :"" - } +
    +
    + 复制: + + + + +
    + +
    + 跳关: + + + + +
    +
    + 测试集解锁: + + + + +
    + +
    + 隐藏代码窗口: + + + + +
    + +
    + 代码目录隐藏: + + + + +
    + +
    + 禁用复制粘贴: + + + + +
    + +
    + 开启时间: + + + + +
    + + {this.props.identity<3?
    + VNC图形化: + + + + +
    :""} + +
    + {/*"name": "我是镜像名", # 镜像名称*/} + {/*"cpu_limit": 1, # cpu核*/} + {/*"lower_cpu_limit": 0.1, # 最低cpu核 浮点数*/} + {/*"memory_limit": 1024 ,#内存限制*/} + {/*"request_limit": 10, # 内存要求*/} + {/*"mirror_repository_id": 12, # 镜像id*/} + {this.props.identity<3?
    +

    服务配置

    + { shixun_service_configs&&shixun_service_configs.map((item,key)=>{ + return( +
    +
    +

    {item.name}

    +
    + +
    + this.setConfigsInputs(e,key,1)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    +
    +
    +
    + +
    + this.setConfigsInputs(e,key,2)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    +
    +
    +
    + +
    + this.setConfigsInputs(e,key,3)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    +
    +
    +
    + +
    + this.setConfigsInputs(e,key,4)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    + +
    +
    +
    +
    + ) + + })} +
    :""} + +

    + { + // this.props.identity<4&&this.props.status==0? + this.props.identity<5? +

    + 保存 + 取消 +
    :"" + } -

    +

    -
    +
    ); } } diff --git a/public/react/src/modules/tpm/component/TPMNav.js b/public/react/src/modules/tpm/component/TPMNav.js index 7bcc858e2..1683c59a0 100644 --- a/public/react/src/modules/tpm/component/TPMNav.js +++ b/public/react/src/modules/tpm/component/TPMNav.js @@ -42,7 +42,7 @@ class TPMNav extends Component { className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl`}>排行榜 {/* target="_blank"*/} 4||this.props.identity===undefined ? "none" : 'block'}} >配置
    diff --git a/public/react/src/modules/tpm/component/TPMRightSection.js b/public/react/src/modules/tpm/component/TPMRightSection.js index a3a7e9820..fd96454c4 100644 --- a/public/react/src/modules/tpm/component/TPMRightSection.js +++ b/public/react/src/modules/tpm/component/TPMRightSection.js @@ -67,7 +67,7 @@ class TPMRightSection extends Component {

    创建者

    - + 头像
    diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 65e95319e..c710d4b8c 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -20,6 +20,8 @@ import '../shixunchildCss/Challenges.css' import axios from 'axios'; +import AccountProfile from"../../../user/AccountProfile"; + const $ = window.$; class Challenges extends Component { @@ -218,7 +220,14 @@ class Challenges extends Component { //开始实战按钮 startshixunCombat = (type, ids, id) => { - + if(this.props.current_user&&this.props.current_user.profile_completed===false){ + this.setState({ + AccountProfiletype:true + }) + return + } + + debugger let { ChallengesDataList } = this.state; // let id = this.props.match.params.shixunId; this.setState({ @@ -271,8 +280,15 @@ class Challenges extends Component { startshixunCombattype:false }) } + + hideAccountProfile=()=>{ + this.setState({ + AccountProfiletype:false + }) + } + render() { - let { ChallengesDataList, startbtns, sumidtype ,startshixunCombattype,shixunsreplace,shixunsmessage,hidestartshixunsreplacevalue,operationstrue} = this.state; + let { ChallengesDataList, startbtns, sumidtype ,startshixunCombattype,shixunsreplace,shixunsmessage,hidestartshixunsreplacevalue,operationstrue,AccountProfiletype} = this.state; let { loadingContent } = this.props; if (ChallengesDataList != undefined) { this.updatamakedown("ReactMarkdown") @@ -281,6 +297,12 @@ class Challenges extends Component { const antIcon = ; return ( + {AccountProfiletype===true?this.hideAccountProfile()} + {...this.state} + {...this.props} + />:""} + {loadingContent ? { + if (response != undefined) + if (response && response.data.status === 402) { + this.setState({ + AccountProfiletype: true + }) + + } + return response; + }, (error) => { + + }); + + } + + gotoback=()=>{ + if(this.props.AccountProfiletype!=undefined){ + this.setState({ + AccountProfiletype:false + }) + this.props.hideAccountProfile() + }else{ + window.location.href="/"; + this.setState({ + AccountProfiletype:false + }) + } + } + + + +render() { + return( + +
    +

    您需要去完善您的个人资料,才能使用此功能

    + +
    +
    + ) + } +} + +export default AccountProfile; \ No newline at end of file diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js index 408ca6142..b2e89da52 100644 --- a/public/react/src/modules/user/FindPasswordComponent.js +++ b/public/react/src/modules/user/FindPasswordComponent.js @@ -691,7 +691,7 @@ class LoginRegisterComponent extends Component { this.inputOnBlurzhuche(e)} + // onBlur={(e) => this.inputOnBlurzhuche(e)} onChange={this.loginInputonChange} style={{marginTop: '10px', height: "38px"}}> { Phonenumberisnotco && Phonenumberisnotco !== "" ? diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 1377298a9..eb0a3a5c2 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -65,6 +65,7 @@ class LoginRegisterComponent extends Component { Whethertoverify:false, pciphone:true, MyEduCoderModals:false, + registered:undefined, } } @@ -101,6 +102,7 @@ class LoginRegisterComponent extends Component { Whethertoverify:false, pciphone:true, MyEduCoderModals:false, + registered:undefined, } } @@ -340,10 +342,10 @@ class LoginRegisterComponent extends Component { } - if(response.data.identity === null || response.data.identity === undefined){ - this.props.history.push("/interesse"); - return; - } + // if(response.data.profile_completed !== null || response.data.profile_completed === false){ + // this.setMyEduCoderModals(); + // return; + // } if (response.status === 200) { if (response.data.status === 402) { @@ -358,7 +360,6 @@ class LoginRegisterComponent extends Component { weekArray="/"; } window.location.href = weekArray; - } } @@ -458,13 +459,13 @@ class LoginRegisterComponent extends Component { return; } }else { - this.setState({ - logins: "", - dragOk: false, - codes: "", - passwords: "", - Agreetotheterms: "", - }) + // this.setState({ + // logins: "", + // dragOk: false, + // codes: "", + // passwords: "", + // Agreetotheterms: "", + // }) this.setMyEduCoderModals(); } } @@ -881,12 +882,15 @@ class LoginRegisterComponent extends Component { setNotcompleteds=()=>{ this.setState({ Notcompleteds:true, - MyEduCoderModals:false + MyEduCoderModals:false, + registered:undefined, + }) }; setMyEduCoderModals=()=>{ this.setState({ - MyEduCoderModals:true + MyEduCoderModals:true, + registered:"注册成功" }) }; render() { @@ -1028,7 +1032,7 @@ class LoginRegisterComponent extends Component { value={this.state.logins} type="text" autoComplete="off" onChange={this.loginInputonChanges} - onBlur={(e) => this.inputOnBlurzhuche(e, 2)} + // onBlur={(e) => this.inputOnBlurzhuche(e, 2)} style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}> { Phonenumberisnotcos && Phonenumberisnotcos !== "" ? @@ -1038,10 +1042,11 @@ class LoginRegisterComponent extends Component { :
    } - {this.setNotcompleteds()}} - /> + />:""} { Whethertoverify===false&&pciphone===true? diff --git a/public/react/src/modules/user/Notcompletedysl.js b/public/react/src/modules/user/Notcompletedysl.js index f9c260209..8f147957a 100644 --- a/public/react/src/modules/user/Notcompletedysl.js +++ b/public/react/src/modules/user/Notcompletedysl.js @@ -16,19 +16,19 @@ class Notcompletedysl extends Component { // console.log("Notcompletedysl"); // console.log("开发了402了"); - axios.interceptors.response.use((response) => { - // console.log(response); - if (response != undefined) - if (response && response.data.status === 402) { - this.setState({ - modalsType: true - }) - } - return response; - }, (error) => { - //TODO 这里如果样式变了会出现css不加载的情况 - - }); + // axios.interceptors.response.use((response) => { + // // console.log(response); + // if (response != undefined) + // if (response && response.data.status === 402) { + // this.setState({ + // modalsType: true + // }) + // } + // return response; + // }, (error) => { + // //TODO 这里如果样式变了会出现css不加载的情况 + // + // }); } @@ -53,13 +53,13 @@ class Notcompletedysl extends Component { closable={false} footer={null} destroyOnClose={true} - title="提示" + title={this.props.registered===undefined?"提示":"注册成功"} centered={true} - visible={this.state.modalsType} + visible={this.props.modalsType} width="530px" >
    -

    完善您的资料,将获得更多的使用权限

    +

    完善您的资料,将获得更多的使用权限

    this.modalCancel()}>取消 this.setDownload()}>立即完善 diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index 82f7d60d8..a4637c00e 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -106,6 +106,8 @@ class AccountBasic extends Component { this.setState({ school_id, school: selectedName + }, () => { + this.filterList(selectedName) }) } else if(basicInfo && basicInfo.school_name){ this.setState({ @@ -199,7 +201,7 @@ class AccountBasic extends Component { } // 过滤学校 - filterList=(e)=>{ + filterList =(e)=>{ const inputVal = e.trim() let arr=[]; if(inputVal){ @@ -211,7 +213,7 @@ class AccountBasic extends Component { }) this.setState({ school: inputVal, - filterSchoolList:arr + filterSchoolList: arr }) } else { this.setState({ @@ -254,6 +256,7 @@ class AccountBasic extends Component { this.setState({ department_id: '', departmentsName: e, + filterDepartments: [], }) this.this_department_id = '' return; @@ -261,7 +264,7 @@ class AccountBasic extends Component { this.this_department_id = arr[0].id this.setState({ departmentsName:e, - department_id: arr[0].id + department_id: arr[0].id, }) } @@ -365,7 +368,6 @@ class AccountBasic extends Component { // this.setState({ schoolList }) this.getSchoolList(this.props.basicInfo, name); - this.props.form.setFieldsValue({ name: name }) @@ -400,6 +402,7 @@ class AccountBasic extends Component { filterDepartments, school, school_id, + departments, departmentsName, identity }=this.state; @@ -676,7 +679,7 @@ class AccountBasic extends Component { {!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&& school && -
    +
    未找到包含“{school}”的高校, 申请新增 @@ -716,10 +719,12 @@ class AccountBasic extends Component { { - !filterDepartments || (filterDepartments && filterDepartments.length==0 )&& departmentsName && -
    + (!filterDepartments || (filterDepartments && filterDepartments.length==0 ) + || (departmentsName == '' && !this.state.department_id + && (!departments || departments.length == 0) )) && +
    - 未找到包含“{departmentsName}”的院系/部门, + {departmentsName ? `未找到包含“${departmentsName}”的院系/部门` : '未找到院系'}, 申请新增
    diff --git a/public/react/src/modules/user/account/AccountNav.js b/public/react/src/modules/user/account/AccountNav.js index b0038e43b..e14921d34 100644 --- a/public/react/src/modules/user/account/AccountNav.js +++ b/public/react/src/modules/user/account/AccountNav.js @@ -14,7 +14,7 @@ class AccountNav extends Component { } render() { let { basicInfo } = this.props - console.log(this.props); + // console.log(this.props); const path = window.location.pathname const isBasic = path.indexOf('profile') != -1 || path == "/account" const isCertification = path.indexOf('certification') != -1 diff --git a/public/react/src/modules/user/modal/RealNameCertificationModal.js b/public/react/src/modules/user/modal/RealNameCertificationModal.js index bdd2270ae..1d17b7c20 100644 --- a/public/react/src/modules/user/modal/RealNameCertificationModal.js +++ b/public/react/src/modules/user/modal/RealNameCertificationModal.js @@ -132,7 +132,7 @@ class RealNameCertificationModal extends Component{ multiple: true, showUploadList: false, // https://newweb.educoder.net - action: `/api/users/accounts/${this.props.current_user.login}/auth_attachment.json`, + action: this.props.current_user ? `/api/users/accounts/${this.props.current_user.login}/auth_attachment.json` : '', className: 'idPic-uploader', onChange: this.handleChange2, }; diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 42a713a88..3b58681da 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -239,14 +239,14 @@ class Infos extends Component{
    {is_current ? "我":"TA"}的经验值 - {data && data.experience}
    {is_current ? "我":"TA"}的金币 - {data && data.grade}
    @@ -255,14 +255,14 @@ class Infos extends Component{
    {is_current ? "我":"TA"}的粉丝 - {data && data.fan_count}
    {is_current ? "我":"TA"}的关注 - {data && data.follow_count}
    diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index 1623e9097..ff5321a9f 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -130,7 +130,7 @@ class InfosCourse extends Component{ this.props.current_user && this.props.current_user.user_identity != "学生" ? : "" } { - (!data || data.courses.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" || category) && + (!data || data.courses.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && } { data && data.courses && data.courses.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index a7b0b95f6..759527a6e 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -152,7 +152,7 @@ class InfosPath extends Component{ this.props.current_user && this.props.current_user.user_identity != "学生" ? :"" } { - (!data || data.subjects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" || category) && + (!data || data.subjects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && } { data && data.subjects && data.subjects.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index d308e0fd3..6c1f4a666 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -125,7 +125,7 @@ class InfosProject extends Component{ :"" } { - (!data || data.projects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" || category) && + (!data || data.projects.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && } { data && data.projects && data.projects.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index 7e911202e..bac60fe6f 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -161,7 +161,7 @@ class InfosShixun extends Component{ :"" } { - (!data || data.shixuns.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" || category) && + (!data || data.shixuns.length==0) && (this.props.current_user && this.props.current_user.user_identity === "学生" ) && } { data && data.shixuns && data.shixuns.map((item,key)=>{