diff --git a/app/assets/javascripts/admins/message-modal.js b/app/assets/javascripts/admins/message-modal.js
index 227d75776..2c9ce27a7 100644
--- a/app/assets/javascripts/admins/message-modal.js
+++ b/app/assets/javascripts/admins/message-modal.js
@@ -1,14 +1,22 @@
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-message-modal');
+ var $submitBtn = $modal.find('.submit-btn');
if ($modal.length > 0) {
$modal.on('hide.bs.modal', function(){
$modal.find('.modal-body').html('');
+ $submitBtn.unbind();
});
}
});
-function showMessageModal(html) {
+function showMessageModal(html, callback) {
var $modal = $('.modal.admin-message-modal');
+ var $submitBtn = $modal.find('.submit-btn');
+ $submitBtn.unbind();
+ if(callback !== undefined && typeof callback === 'function'){
+ $submitBtn.on('click', callback);
+ }
+
$modal.find('.modal-body').html(html);
$modal.modal('show');
}
\ No newline at end of file
diff --git a/app/assets/javascripts/admins/modals/admin-import-customer-member-modal.js b/app/assets/javascripts/admins/modals/admin-import-customer-member-modal.js
new file mode 100644
index 000000000..01038c7de
--- /dev/null
+++ b/app/assets/javascripts/admins/modals/admin-import-customer-member-modal.js
@@ -0,0 +1,78 @@
+$(document).on('turbolinks:load', function() {
+ var $modal = $('.modal.admin-import-course-member-modal');
+ if ($modal.length > 0) {
+ var $form = $modal.find('form.admin-import-course-member-form');
+
+ var resetFileInputFunc = function(file){
+ file.after(file.clone().val(""));
+ file.remove();
+ }
+
+ $modal.on('show.bs.modal', function(){
+ $modal.find('.file-names').html('选择文件');
+ $modal.find('.upload-file-input').trigger('click');
+ });
+ $modal.on('hide.bs.modal', function(){
+ resetFileInputFunc($modal.find('.upload-file-input'));
+ });
+ $modal.on('change', '.upload-file-input', function(e){
+ var file = $(this)[0].files[0];
+ $modal.find('.file-names').html(file ? file.name : '请选择文件');
+ })
+
+ var importFormValid = function(){
+ if($form.find('input[name="file"]').val() == undefined || $form.find('input[name="file"]').val().length == 0){
+ $form.find('.error').html('请选择文件');
+ return false;
+ }
+
+ return true;
+ };
+
+ var buildResultMessage = function(data){
+ var messageHtml = "
导入结果:成功" + data.success + "条,失败"+ data.fail.length + "条
";
+
+ if(data.fail.length > 0){
+ messageHtml += '数据 | 失败原因 |
';
+
+ data.fail.forEach(function(item){
+ messageHtml += '' + item.data + ' | ' + item.message + ' |
';
+ });
+
+ messageHtml += '
'
+ }
+
+ return messageHtml;
+ }
+
+ $modal.on('click', '.submit-btn', function(){
+ $form.find('.error').html('');
+
+ if (importFormValid()) {
+ $('body').mLoading({ text: '正在导入...' });
+
+ $.ajax({
+ method: 'POST',
+ dataType: 'json',
+ url: '/admins/import_course_members',
+ data: new FormData($form[0]),
+ processData: false,
+ contentType: false,
+ success: function(data){
+ $('body').mLoading('destroy');
+ $modal.modal('hide');
+
+ showMessageModal(buildResultMessage(data), function(){
+ window.location.reload();
+ });
+ },
+ error: function(res){
+ $('body').mLoading('destroy');
+ var data = res.responseJSON;
+ $form.find('.error').html(data.message);
+ }
+ });
+ }
+ });
+ }
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/admins/users/index.js b/app/assets/javascripts/admins/users/index.js
index 4d4f0f945..1ac936df5 100644
--- a/app/assets/javascripts/admins/users/index.js
+++ b/app/assets/javascripts/admins/users/index.js
@@ -122,14 +122,18 @@ $(document).on('turbolinks:load', function(){
// 导入学生
var $importUserModal = $('.modal.admin-import-user-modal');
var $importUserForm = $importUserModal.find('form.admin-import-user-form')
+ var resetFileInputFunc = function(file){
+ file.after(file.clone().val(""));
+ file.remove();
+ }
$importUserModal.on('show.bs.modal', function(){
+ resetFileInputFunc($importUserModal.find('.upload-file-input'));
$importUserModal.find('.file-names').html('选择文件');
$importUserModal.find('.upload-file-input').trigger('click');
});
- $importUserModal.find('.upload-file-input').on('change', function(e){
+ $importUserModal.on('change', '.upload-file-input', function(e){
var file = $(this)[0].files[0];
-
$importUserModal.find('.file-names').html(file ? file.name : '请选择文件');
})
@@ -175,7 +179,9 @@ $(document).on('turbolinks:load', function(){
$('body').mLoading('destroy');
$importUserModal.modal('hide');
- showMessageModal(buildResultMessage(data));
+ showMessageModal(buildResultMessage(data), function(){
+ window.location.reload();
+ });
},
error: function(res){
$('body').mLoading('destroy');
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index ceddb9112..10d733a94 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -212,7 +212,7 @@ class CoursesController < ApplicationController
@course.update_attributes!(course_params.merge(extra_params))
@course.update_course_modules(params[:course_module_types])
-
+ Rails.logger.info("###############course_update_end")
normal_status(0, "成功")
rescue => e
uid_logger_error(e.message)
@@ -1484,8 +1484,10 @@ class CoursesController < ApplicationController
shixun_titles = shixun_homeworks.pluck(:name) + ["总得分"]
# 更新实训作业成绩
- shixun_homeworks.includes(:homework_challenge_settings, :published_settings, :homework_commons_shixun).each do |homework|
- homework.update_homework_work_score
+ unless course.is_end
+ shixun_homeworks.includes(:homework_challenge_settings, :published_settings, :homework_commons_shixun).each do |homework|
+ homework.update_homework_work_score
+ end
end
shixun_homeworks = shixun_homeworks&.includes(score_student_works: :user)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 89b6dca27..2807a0215 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -916,7 +916,8 @@ class GamesController < ApplicationController
# 更新关卡状态和一些学习进度
def update_game_parameter game
game.update_attribute(:status, 0) if game.status == 1
- game.update_attributes(status: 0, open_time: Time.now) if game.status == 3
+ # 第一次进入关卡更新时间
+ game.update_attributes(status: 0, open_time: Time.now) if game.open_time.blank? || game.status == 3
# 开启实训更新myshixuns的时间,方便跟踪用于的学习进度。
game.myshixun.update_column(:updated_at, Time.now)
end
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 8591f9821..74d1d05e2 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -601,7 +601,7 @@ class ShixunsController < ApplicationController
challenges.each_with_index do |challenge, index|
status = (index == 0 ? 0 : 3)
game_identifier = generate_identifier(Game, 12)
- worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now,
+ worker.add(base_attr.merge(challenge_id: challenge.id, status: status,
identifier: game_identifier, modify_time: challenge.modify_time))
end
end
diff --git a/app/views/admins/courses/shared/_import_course_member_modal.html.erb b/app/views/admins/courses/shared/_import_course_member_modal.html.erb
new file mode 100644
index 000000000..d52a60b09
--- /dev/null
+++ b/app/views/admins/courses/shared/_import_course_member_modal.html.erb
@@ -0,0 +1,30 @@
+
\ No newline at end of file
diff --git a/app/views/admins/shared/modal/_message_modal.html.erb b/app/views/admins/shared/modal/_message_modal.html.erb
index 94454ca2d..17c02ea14 100644
--- a/app/views/admins/shared/modal/_message_modal.html.erb
+++ b/app/views/admins/shared/modal/_message_modal.html.erb
@@ -11,7 +11,7 @@
保存成功
diff --git a/app/views/admins/users/index.html.erb b/app/views/admins/users/index.html.erb
index fa6d67a64..0892b5641 100644
--- a/app/views/admins/users/index.html.erb
+++ b/app/views/admins/users/index.html.erb
@@ -28,6 +28,7 @@
<% end %>
<%= javascript_void_link '导入用户', class: 'btn btn-secondary btn-sm', data: { toggle: 'modal', target: '.admin-import-user-modal'} %>
+ <%= javascript_void_link '导入课堂成员', class: 'btn btn-secondary btn-sm ml-2', data: { toggle: 'modal', target: '.admin-import-course-member-modal'} %>
@@ -35,4 +36,7 @@
<%= render partial: 'admins/users/shared/reward_grade_modal' %>
-<%= render partial: 'admins/users/shared/import_user_modal' %>
\ No newline at end of file
+<%= render partial: 'admins/users/shared/import_user_modal' %>
+
+
+<%= render partial: 'admins/courses/shared/import_course_member_modal' %>
\ No newline at end of file
diff --git a/app/views/admins/users/shared/_import_user_modal.html.erb b/app/views/admins/users/shared/_import_user_modal.html.erb
index ff3c725b9..b0d3c9a77 100644
--- a/app/views/admins/users/shared/_import_user_modal.html.erb
+++ b/app/views/admins/users/shared/_import_user_modal.html.erb
@@ -14,8 +14,8 @@
文件
-
-
+
+
diff --git a/app/views/users/get_user_info.json.jbuilder b/app/views/users/get_user_info.json.jbuilder
index 6189358ba..e18ccfe05 100644
--- a/app/views/users/get_user_info.json.jbuilder
+++ b/app/views/users/get_user_info.json.jbuilder
@@ -20,6 +20,7 @@ if @course
json.group_info @course.teacher_group(@user.id) if @course_identity < Course::STUDENT
end
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)
+ json.course_is_end @course.is_end
end
if params[:school]
diff --git a/dump.rdb b/dump.rdb
index 6673bf623..bcf064366 100644
Binary files a/dump.rdb and b/dump.rdb differ
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkPost.js b/public/react/src/modules/courses/busyWork/CommonWorkPost.js
index 312756ec4..ed96914de 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkPost.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkPost.js
@@ -646,7 +646,7 @@ render(){
{/*>*/}
{/**/}
- {`${current_user ? current_user.username : ''} ${ this.isEdit ? '编辑' : '提交'}作品` }
+ {`${current_user ? current_user.real_name : ''} ${ this.isEdit ? '编辑' : '提交'}作品` }
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index 0755b9df5..a803ecdd2 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -2499,8 +2499,8 @@ class Listofworksstudentone extends Component {
// console.log(data);
// console.log(datas);
// console.log(this.props.isAdmin());
- console.log("学生老师列表");
+ let course_is_end = this.props.current_user&&this.props.current_user.course_is_end;
return (
this.props.isAdmin() === true ?
(
@@ -2641,7 +2641,7 @@ class Listofworksstudentone extends Component {
-
计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}
-
+ {course_is_end===true?
{teacherdata&&teacherdata.publish_immediately===false&&computeTimetype===true?
(this.props.isNotMember()===false?
计算成绩
@@ -2651,7 +2651,7 @@ class Listofworksstudentone extends Component {
计算成绩
:"")
}
-
+ :""}
计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}
- {teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":
+ { course_is_end===true?"":teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":
{computeTimetype===true?
(this.props.isNotMember()===false?
@@ -3156,7 +3156,7 @@ class Listofworksstudentone extends Component {
计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}
- {teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":
+ { course_is_end===true?"":teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":
{computeTimetype===true?
(this.props.isNotMember()===false?
计算成绩
diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
index 60161d829..491751b6a 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
@@ -561,7 +561,8 @@ export default class TPMevaluation extends Component {
if(type==="sr"){
newevaluationlist[key].input=e.target.value
}else if(type==="yq"){
- newevaluationlist[key].output=e.target.value
+ // 统一转成\r\n
+ newevaluationlist[key].output= e.target.value ? e.target.value.replace(/\r?\n/g, "\r\n") : e.target.value
}
this.setevaluationlist(newevaluationlist);
}