From 058118a4f97d9d911d65b88074bab4a8fe373a46 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 4 Sep 2019 09:35:11 +0800
Subject: [PATCH 01/66] =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=97=B6=E9=97=B4?=
=?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E8=BF=9B=E5=85=A5=E7=9A=84=E6=97=B6?=
=?UTF-8?q?=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 3 ++-
app/controllers/shixuns_controller.rb | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 89b6dca27..c8627a642 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?
# 开启实训更新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
From 1600ce7e12ac021fbd9093449f4ac5f2a6defe36 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 4 Sep 2019 09:35:22 +0800
Subject: [PATCH 02/66] =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=97=B6=E9=97=B4?=
=?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E8=BF=9B=E5=85=A5=E7=9A=84=E6=97=B6?=
=?UTF-8?q?=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index c8627a642..2807a0215 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -917,7 +917,7 @@ 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.open_time.blank?
+ 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
From c410b547098b9c5440a0ae06b670d923291cf711 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Wed, 4 Sep 2019 09:40:32 +0800
Subject: [PATCH 03/66] admin: import course member entry
---
.../javascripts/admins/message-modal.js | 10 ++-
.../admin-import-customer-member-modal.js | 78 +++++++++++++++++++
app/assets/javascripts/admins/users/index.js | 12 ++-
.../_import_course_member_modal.html.erb | 30 +++++++
.../shared/modal/_message_modal.html.erb | 2 +-
app/views/admins/users/index.html.erb | 6 +-
.../users/shared/_import_user_modal.html.erb | 4 +-
7 files changed, 134 insertions(+), 8 deletions(-)
create mode 100644 app/assets/javascripts/admins/modals/admin-import-customer-member-modal.js
create mode 100644 app/views/admins/courses/shared/_import_course_member_modal.html.erb
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/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 @@
文件
-
-
+
+
From 45606550beddda31ede7fba943eae80a6fb8fe96 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Wed, 4 Sep 2019 09:44:00 +0800
Subject: [PATCH 04/66] =?UTF-8?q?=09=09=09//=20=E7=BB=9F=E4=B8=80=E8=BD=AC?=
=?UTF-8?q?=E6=88=90\r\n?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/challengesnew/TPMevaluation.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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);
}
From 05f39c2ebd045f56369fe40758c1c6e4ba897680 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 4 Sep 2019 09:54:12 +0800
Subject: [PATCH 05/66] =?UTF-8?q?=E8=B7=B3=E6=B0=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 2 +-
dump.rdb | Bin 2385 -> 2487 bytes
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index ceddb9112..ec2761fd5 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)
diff --git a/dump.rdb b/dump.rdb
index 6673bf623217d16ad3eb91474b062ba394d9a79a..bcf064366d9465f66c11de3ea1199b9ada47f4bd 100644
GIT binary patch
delta 635
zcmV~$O-L0%007{9v%7EC_fu&PpK0`dd|^JDb#`WUb|%6w(CDBbNChD>yEAJS70Mt8
zDLO>dCE8;i>QaP{AR?kehdOsi=o-ip5)xS*qh5XAR^RJ`_fhYy>gvL8_v#g`;IdwR
z|MB{Z$>+JgY4^f-ZG6Bmj`tfz$uK7Wq&aZ=Xc#Af4mE-ZqXbeBQOE_65aUP$TrpEK
zBGL{xnFl^W^@Vf~oV$?|N&QnFmP|)ng(y*R5(`2VtKT~uU)FL>t3|oiJmCi{44BUl
z_Ix6^;Pn+_MPA$Pskzh_C|vLU%Qb=VH`@djl~E!Z0|u;rtx8C#QZT|CL&gKjktB&k
zv{B1ufq~CvOQ0I~D8Y%8lq4upk^}*XxS#NPmN}qAQ4nJ8g@UpGWkquv)NRh!yB27g
zMmOu2Ifj})opi%&mA*uIixRC->+}BfgE?>R=wdo-dFD<}DV?{@dmsqeXs<=R0F#j)
zS;5-Q)d9u0b$ZM*!yZcOaDmDAu+%@&BRcg^Wy
z)&T`X6-N=nFk!8tLB~qHkcWsunF!8_CO)Pzn*-l2RntZLOl2Pwglic3iH;dkAry^T
z`o=!eKl>yrfH5!cg`6-NW@T`*<_)EL_7eHNIcWH!zZ|6l1%0902ONzQlsJ^fhFqfJ
zSVkC&xruDbG-vekYU^TpH$Mg7!*nZus$lyh^eCYtMmp%!Y$IXqaysEmx)$~X4%zt2
SJI=eD`|R!5%+tpkul@riWv{{j
delta 541
zcmV~$%}W$f008jWH#@Vl>n{0`3PJ3qs}=1GZ{GI{A&ex7>STI~cyHc&7PJXv2M(A8>
zv+pazb8i-U?cP`roIM@{13@r*=qupq6j9nq>1Zm2R4F0Gq#6m7GC_%e3WrWX;y1xe
zEkYQ|iJm_I3yb44hYmTV2zF2#g(<~aQ1Et2twT?s9s8fe|sCPI?@meUEtJAj)9cOGh>4S5t%}*6gON*
zhWX@F`6V2|s3;`%ccW9?{bcYWSZ_xXlC`6-+yV_qjDVV<)UocsD4{I(ThV9~4{g#dZ
From db1cbba307df03227fadbb466363b99250061049 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 4 Sep 2019 10:22:55 +0800
Subject: [PATCH 06/66] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=BE=E5=A0=82=E6=98=AF=E5=90=A6=E5=B7=B2?=
=?UTF-8?q?=E7=BB=93=E6=9D=9F=E7=9A=84=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 6 ++++--
app/views/users/get_user_info.json.jbuilder | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index ec2761fd5..10d733a94 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -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/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]
From de47c662636162f421241dd390242d9c965c3a08 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Wed, 4 Sep 2019 10:26:21 +0800
Subject: [PATCH 07/66] real
---
public/react/src/modules/courses/busyWork/CommonWorkPost.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 ? '编辑' : '提交'}作品` }
From c80adad2030753c1400845aacdc17a0c00c449f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 4 Sep 2019 10:32:04 +0800
Subject: [PATCH 08/66] =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E7=BB=93=E6=9D=9F?=
=?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A=E4=B8=8D?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AE=A1=E7=AE=97=E6=88=90=E7=BB=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/shixunHomework/Listofworksstudentone.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index 64e2e6a99..a803ecdd2 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -2499,6 +2499,8 @@ class Listofworksstudentone extends Component {
// console.log(data);
// console.log(datas);
// console.log(this.props.isAdmin());
+
+ let course_is_end = this.props.current_user&&this.props.current_user.course_is_end;
return (
this.props.isAdmin() === true ?
(
@@ -2639,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?
计算成绩
@@ -2649,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?
@@ -3154,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?
计算成绩
From d34f4a300276f1e3115fb12d2da5ecc5157f55d5 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Wed, 4 Sep 2019 10:52:21 +0800
Subject: [PATCH 09/66] js sdk api
---
app/controllers/wechats/js_sdk_signatures_controller.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/controllers/wechats/js_sdk_signatures_controller.rb b/app/controllers/wechats/js_sdk_signatures_controller.rb
index e4ee0da27..6d7b3d87d 100644
--- a/app/controllers/wechats/js_sdk_signatures_controller.rb
+++ b/app/controllers/wechats/js_sdk_signatures_controller.rb
@@ -1,7 +1,10 @@
class Wechats::JsSdkSignaturesController < ApplicationController
def create
- signature = Util::Wechat.js_sdk_signature(params[:url], params[:noncestr], params[:timestamp])
- render_ok(signature: signature)
+ timestamp = (Time.now.to_f * 1000).to_i
+ noncestr = ('A'..'z').to_a.sample(8).join
+ signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp)
+
+ render_ok(appid: Util::Wechat.appid, timestamp: timestamp, noncestr: noncestr, signature: signature)
rescue Util::Wechat::Error => ex
render_error(ex.message)
end
From 308e582d8d851b2d1ebc1695a964628461a32e03 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Wed, 4 Sep 2019 13:39:29 +0800
Subject: [PATCH 10/66] =?UTF-8?q?=E5=8F=AA=E8=83=BD=E4=B8=80=E4=B8=AA?=
=?UTF-8?q?=E9=99=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/tpm/TPMsettings/TPMsettings.js | 18 ++++++++++++------
.../src/modules/tpm/newshixuns/Newshixuns.js | 18 +++++++++++-------
2 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
index e277ad85f..f1184e7b7 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -15,7 +15,7 @@ import axios from 'axios';
import './css/TPMsettings.css';
-import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll} from 'educoder';
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
let origin = getUrl();
@@ -1372,15 +1372,18 @@ export default class TPMsettings extends Component {
})
}
+
handleChange = (info) => {
+ let {fileList}=this.state;
+
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
console.log("handleChange1");
- let {fileList}=this.state;
- if(fileList.length===0){
+
+ // if(fileList.length===0){
let fileLists = info.fileList;
this.setState({ fileList:fileLists,
deleteisnot:false});
- }
+ // }
}
}
@@ -1497,10 +1500,13 @@ export default class TPMsettings extends Component {
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
- action: `${getUrl()}/api/attachments.json`,
+ action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
- beforeUpload: (file) => {
+ beforeUpload: (file, fileList) => {
+ if (this.state.fileList.length >= 1) {
+ return false
+ }
// console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 50;
if (!isLt150M) {
diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
index cc178dbe0..d7b2b7d26 100644
--- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js
+++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
@@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {TPMIndexHOC} from '../TPMIndexHOC';
-import {SnackbarHOC,appendFileSizeToUploadFileAll} from 'educoder';
+import {SnackbarHOC,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
import {Input, Select, Radio, Checkbox, Modal, Icon, DatePicker,Upload,Button,message,Form,notification,Tooltip} from 'antd';
@@ -757,19 +757,19 @@ class Newshixuns extends Component {
})
}
-
// 附件相关 START
handleChange = (info) => {
+ let {fileList}=this.state;
+
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
- let {fileList}=this.state;
console.log("handleChange1");
- if(fileList.length===0){
+ // if(fileList.length===0){
let fileLists = info.fileList;
this.setState({
// fileList:appendFileSizeToUploadFileAll(fileList),
fileList:fileLists,
deleteisnot:false});
- }
+ // }
}
}
@@ -872,10 +872,14 @@ class Newshixuns extends Component {
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
- action: `${getUrl()}/api/attachments.json`,
+ action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
- beforeUpload: (file) => {
+ beforeUpload: (file, fileList) => {
+
+ if (this.state.fileList.length >= 1) {
+ return false
+ }
// console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 50;
if (!isLt150M) {
From c4756cde6711df13cbfafec211673886426bbaad Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Wed, 4 Sep 2019 14:03:52 +0800
Subject: [PATCH 11/66] https://www.trustie.net/issues/23867
---
public/react/src/modules/comment/Comments.js | 4 ++--
.../src/modules/courses/boards/TopicDetail.js | 8 +++++---
public/react/src/modules/courses/boards/index.js | 5 +++--
.../modules/courses/coursesDetail/CoursesBanner.js | 14 +++++++-------
.../src/modules/courses/members/studentsList.js | 3 ++-
public/react/src/modules/tpm/TPMIndexHOC.js | 6 ++++++
6 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js
index ae246197c..836b520cc 100644
--- a/public/react/src/modules/comment/Comments.js
+++ b/public/react/src/modules/comment/Comments.js
@@ -383,12 +383,12 @@ class Comments extends Component {
{/* |*/}
- this.initReply(item) } >
-
+ }
{/* |*/}
diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js
index 542157bfb..8ecc85565 100644
--- a/public/react/src/modules/courses/boards/TopicDetail.js
+++ b/public/react/src/modules/courses/boards/TopicDetail.js
@@ -527,6 +527,7 @@ class TopicDetail extends Component {
// TODO 图片上传地址
const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId
+ const isCourseEnd = this.props.isCourseEnd()
return (
{/* fl with100 */}