From 852e2931b3f23ca76ee689ea56755e662f9ef2bf Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 16 Aug 2019 18:27:22 +0800
Subject: [PATCH 01/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 106ba3dd4..aaf24eadb 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -1129,7 +1129,7 @@ class CoursesController < ApplicationController
def validate_course_name
tip_exception("课堂名称不能为空!") if params[:course][:name].blank?
- if params[:subject_id].blank? || (@course && @course.subject.blank?)
+ if params[:subject_id].blank? && @course.blank? || (@course && @course.subject.blank?)
tip_exception("课程名称不能为空!") if params[:course_list_name].blank?
tip_exception("课堂名称应以课程名称开头命名") unless params[:course][:name].index(params[:course_list_name]) &&
params[:course][:name].index(params[:course_list_name]) == 0
From 961fa1ade5c7175da8bfb9b951fe6de6f314d381 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 16 Aug 2019 18:28:42 +0800
Subject: [PATCH 02/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/homework_common.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index 112fc523b..f198a7143 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -36,7 +36,7 @@ class HomeworkCommon < ApplicationRecord
validates :name, length: { maximum: 60 }
validates :description, length: { maximum: 15000 }
- validates :reference_answer, length: { maximum: 5000 }
+ validates :reference_answer, length: { maximum: 15000 }
# after_update :update_activity
before_destroy :update_homework_bank_quotes
From 905f9c040e3f3035b8c368235a3b229919bd2664 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 16 Aug 2019 19:04:05 +0800
Subject: [PATCH 03/49] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/attachment_histories/_attachment_history.json.jbuilder | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/views/attachment_histories/_attachment_history.json.jbuilder b/app/views/attachment_histories/_attachment_history.json.jbuilder
index afb359e08..285aced42 100644
--- a/app/views/attachment_histories/_attachment_history.json.jbuilder
+++ b/app/views/attachment_histories/_attachment_history.json.jbuilder
@@ -8,3 +8,4 @@ json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
json.url attachment_path(attachment, type: 'history').gsub("/api","")
json.is_pdf attachment.is_history_pdf?
+json.attachment_id attachment.attachment_id
From efb1be8abe54174a317c10b38c0ee90e3bc7d605 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 16 Aug 2019 19:08:01 +0800
Subject: [PATCH 04/49] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../attachment_histories/_attachment_history.json.jbuilder | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/attachment_histories/_attachment_history.json.jbuilder b/app/views/attachment_histories/_attachment_history.json.jbuilder
index 285aced42..790bc9f2d 100644
--- a/app/views/attachment_histories/_attachment_history.json.jbuilder
+++ b/app/views/attachment_histories/_attachment_history.json.jbuilder
@@ -6,6 +6,6 @@ json.publish_time attachment.publish_time
json.quotes attachment.quotes_count
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
-json.url attachment_path(attachment, type: 'history').gsub("/api","")
+json.url download_url(attachment.attachment)
json.is_pdf attachment.is_history_pdf?
json.attachment_id attachment.attachment_id
From b41d127635a981f2b2d9148584f0f60dfeba408a Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 16 Aug 2019 19:13:18 +0800
Subject: [PATCH 05/49] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../attachment_histories/_attachment_history.json.jbuilder | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/attachment_histories/_attachment_history.json.jbuilder b/app/views/attachment_histories/_attachment_history.json.jbuilder
index 790bc9f2d..285aced42 100644
--- a/app/views/attachment_histories/_attachment_history.json.jbuilder
+++ b/app/views/attachment_histories/_attachment_history.json.jbuilder
@@ -6,6 +6,6 @@ json.publish_time attachment.publish_time
json.quotes attachment.quotes_count
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
-json.url download_url(attachment.attachment)
+json.url attachment_path(attachment, type: 'history').gsub("/api","")
json.is_pdf attachment.is_history_pdf?
json.attachment_id attachment.attachment_id
From 93eac23c58ffb58ea35c1b39d2af8ba617b8ca95 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 16 Aug 2019 19:17:48 +0800
Subject: [PATCH 06/49] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 44 ++++++++++++-----------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index a6c74818c..a85937315 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -162,28 +162,30 @@ class AttachmentsController < ApplicationController
def attachment_candown
unless current_user.admin? || current_user.business?
candown = true
- if @file.container && current_user.logged?
- # 课堂资源、作业、毕设相关资源的权限判断
- if @file.container.is_a?(Course)
- course = @file.container
- candown = current_user.member_of_course?(course) || @file.is_public == 1
- elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic)
- course = @file.container&.course
- candown = current_user.member_of_course?(course)
- elsif @file.container.is_a?(StudentWork)
- course = @file.container&.homework_common&.course
- candown = current_user.member_of_course?(course)
- elsif @file.container.is_a?(StudentWorksScore)
- course = @file.container&.student_work&.homework_common&.course
- candown = current_user.member_of_course?(course)
- elsif @file.container.is_a?(GraduationWork)
- course = @file.container&.graduation_task&.course
- candown = current_user.member_of_course?(course)
- elsif @file.container.is_a?(GraduationWorkScore)
- course = @file.container&.graduation_work&.graduation_task&.course
- candown = current_user.member_of_course?(course)
+ unless params[:type] == 'history'
+ if @file.container && current_user.logged?
+ # 课堂资源、作业、毕设相关资源的权限判断
+ if @file.container.is_a?(Course)
+ course = @file.container
+ candown = current_user.member_of_course?(course) || @file.is_public == 1
+ elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic)
+ course = @file.container&.course
+ candown = current_user.member_of_course?(course)
+ elsif @file.container.is_a?(StudentWork)
+ course = @file.container&.homework_common&.course
+ candown = current_user.member_of_course?(course)
+ elsif @file.container.is_a?(StudentWorksScore)
+ course = @file.container&.student_work&.homework_common&.course
+ candown = current_user.member_of_course?(course)
+ elsif @file.container.is_a?(GraduationWork)
+ course = @file.container&.graduation_task&.course
+ candown = current_user.member_of_course?(course)
+ elsif @file.container.is_a?(GraduationWorkScore)
+ course = @file.container&.graduation_work&.graduation_task&.course
+ candown = current_user.member_of_course?(course)
+ end
+ tip_exception(403, "您没有权限进入") if course.present? && !candown
end
- tip_exception(403, "您没有权限进入") if course.present? && !candown
end
end
end
From f9b8af0d617775ab1ad6c5f61e3d480357af9ef0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 09:33:29 +0800
Subject: [PATCH 07/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Resource/Fileslistitem.js | 4 ++--
.../react/src/modules/courses/coursesPublic/Showoldfiles.js | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 563724040..b65297884 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -42,7 +42,7 @@ class Fileslistitem extends Component{
//预览pdf
axios({
method:'get',
- url:result.data.url,
+ url:"http:"+window.location.host+result.data.url,
responseType: 'arraybuffer',
}).then((result)=>{
var binaryData = [];
@@ -53,7 +53,7 @@ class Fileslistitem extends Component{
}else{
let link = document.createElement('a');
document.body.appendChild(link);
- link.href = "/api"+result.data.url;
+ link.href = result.data.url;
link.download = result.data.title;
//兼容火狐浏览器
let evt = document.createEvent("MouseEvents");
diff --git a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
index 483768271..2c682ec19 100644
--- a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
+++ b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
@@ -45,7 +45,7 @@ class Showoldfiles extends Component{
showfiless=(url)=>{
axios({
method:'get',
- url:url,
+ url:"http:"+window.location.host+url,
responseType: 'arraybuffer',
}).then((result)=>{
var binaryData = [];
@@ -188,7 +188,7 @@ class Showoldfiles extends Component{
{allfiles.is_pdf===false?
- {allfiles.title}:
+ {allfiles.title}:
this.showfiless(allfiles.url)} >{allfiles.title}
}
当前版本
@@ -208,7 +208,7 @@ class Showoldfiles extends Component{
{item.is_pdf===false?
- {item.title}:
+ {item.title}:
this.showfiless(item.url)} >{item.title}
}
From 0746014dbaafc72920d41310030f0bad11eac6d2 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Sat, 17 Aug 2019 09:34:06 +0800
Subject: [PATCH 08/49] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E5=92=8C=E5=85=B6=E4=BB=96=E9=99=84=E4=BB=B6=E7=9A=84=E9=A2=84?=
=?UTF-8?q?=E8=A7=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 2 +-
app/views/files/histories.json.jbuilder | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e6f2e1720..099d45406 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -258,7 +258,7 @@ module ApplicationHelper
end
def download_url attachment
- attachment_path(attachment).gsub("/api","")
+ attachment_path(attachment)
end
# 耗时:天、小时、分、秒
diff --git a/app/views/files/histories.json.jbuilder b/app/views/files/histories.json.jbuilder
index 7039752e7..ed322bb17 100644
--- a/app/views/files/histories.json.jbuilder
+++ b/app/views/files/histories.json.jbuilder
@@ -1,3 +1,9 @@
-json.partial! 'attachments/attachment_small', attachment: @file
+# json.partial! 'attachments/attachment_small', attachment: @file
+json.id @file.id
+json.title @file.title
+json.filesize number_to_human_size(@file.filesize)
+json.url download_url(@file).gsub("/api","")
+json.created_on @file.created_on
+json.is_pdf @file.is_pdf?
json.partial! "attachment_histories/list", attachment_histories: @attachment_histories
From 05b09597defc1f612470bacd7b380f8ecd668677 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 09:39:16 +0800
Subject: [PATCH 09/49] 1
---
public/react/src/modules/courses/Resource/Fileslistitem.js | 4 ++--
.../react/src/modules/courses/coursesPublic/Showoldfiles.js | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index b65297884..563724040 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -42,7 +42,7 @@ class Fileslistitem extends Component{
//预览pdf
axios({
method:'get',
- url:"http:"+window.location.host+result.data.url,
+ url:result.data.url,
responseType: 'arraybuffer',
}).then((result)=>{
var binaryData = [];
@@ -53,7 +53,7 @@ class Fileslistitem extends Component{
}else{
let link = document.createElement('a');
document.body.appendChild(link);
- link.href = result.data.url;
+ link.href = "/api"+result.data.url;
link.download = result.data.title;
//兼容火狐浏览器
let evt = document.createEvent("MouseEvents");
diff --git a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
index 2c682ec19..483768271 100644
--- a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
+++ b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
@@ -45,7 +45,7 @@ class Showoldfiles extends Component{
showfiless=(url)=>{
axios({
method:'get',
- url:"http:"+window.location.host+url,
+ url:url,
responseType: 'arraybuffer',
}).then((result)=>{
var binaryData = [];
@@ -188,7 +188,7 @@ class Showoldfiles extends Component{
{allfiles.is_pdf===false?
- {allfiles.title}:
+ {allfiles.title}:
this.showfiless(allfiles.url)} >{allfiles.title}
}
当前版本
@@ -208,7 +208,7 @@ class Showoldfiles extends Component{
{item.is_pdf===false?
- {item.title}:
+ {item.title}:
this.showfiless(item.url)} >{item.title}
}
From 5c76f32eece9e4f5778afa57462c9123bdee63e0 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Sat, 17 Aug 2019 09:53:50 +0800
Subject: [PATCH 10/49] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E6=94=B9=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/services/duplicate_course_service.rb | 2 +-
app/views/files/index.json.jbuilder | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/services/duplicate_course_service.rb b/app/services/duplicate_course_service.rb
index 27ae2f784..acff0a726 100644
--- a/app/services/duplicate_course_service.rb
+++ b/app/services/duplicate_course_service.rb
@@ -11,7 +11,7 @@ class DuplicateCourseService < ApplicationService
@course = copy_course!
copy_course_modules!
- Rails.logger.info("###########second_category_list#{@second_category_list}")
+
join_course!
copy_homework_commons!
diff --git a/app/views/files/index.json.jbuilder b/app/views/files/index.json.jbuilder
index 81fa406dd..7fe3bf5b7 100644
--- a/app/views/files/index.json.jbuilder
+++ b/app/views/files/index.json.jbuilder
@@ -8,6 +8,7 @@ json.data do
json.course_is_public @course.is_public?
json.files do
json.array! @attachments do |attachment|
+ json.is_history_file attachment.attachment_histories.count > 0 #是否有历史文件
json.partial! "attachments/attachment", attachment: attachment
json.author do
json.partial! "users/user_simple", user: attachment.author
From f7bdccda099bbc1c9b61eef88bf9a980f38bf0a0 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Sat, 17 Aug 2019 10:41:20 +0800
Subject: [PATCH 11/49] =?UTF-8?q?time=5Flimit=20+=205=E6=AC=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/page/Index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/page/Index.js b/public/react/src/modules/page/Index.js
index 1513405b0..3a273e0d6 100644
--- a/public/react/src/modules/page/Index.js
+++ b/public/react/src/modules/page/Index.js
@@ -242,7 +242,7 @@ class Index extends Component {
updateChallengePath={context.updateChallengePath}
- time_limit={context.time_limit}
+ time_limit={context.time_limit + 5}
resetTestSetsExpandedArray={context.resetTestSetsExpandedArray}
onRunCodeTestFinish={context.onRunCodeTestFinish}
From 945001cb37ec74edf52980e4a34ae96dcfb82b69 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Sat, 17 Aug 2019 10:42:47 +0800
Subject: [PATCH 12/49] =?UTF-8?q?attachment.json.jbuilder=E7=9A=84?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/attachments/_attachment.json.jbuilder | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder
index 01a7f4163..b87154157 100644
--- a/app/views/attachments/_attachment.json.jbuilder
+++ b/app/views/attachments/_attachment.json.jbuilder
@@ -1,7 +1,8 @@
json.id attachment.id
json.title attachment.title
json.is_public attachment.publiced?
-json.is_lock attachment.locked?(@is_member)
+# json.is_lock attachment.locked?(@is_member)
+json.is_lock !attachment.publiced?
json.is_publish attachment.published?
json.publish_time attachment.publish_time
json.unified_setting attachment.unified_setting
@@ -10,4 +11,6 @@ json.quotes attachment.quotes_count
json.description attachment.description
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
-json.url download_url(attachment) unless attachment.locked?(@is_member)
+json.url download_url(attachment)
+
+# json.url download_url(attachment) unless attachment.locked?(@is_member)
From c37492dc751e02e6a58d4800c6a5cf6d505eb00b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 11:21:52 +0800
Subject: [PATCH 13/49] =?UTF-8?q?=E5=B0=81=E8=A3=85showpdf=E6=96=B9?=
=?UTF-8?q?=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/Resource/Fileslistitem.js | 21 ++++++++++---------
.../courses/coursesPublic/Showoldfiles.js | 21 ++++++++++---------
public/react/src/modules/tpm/TPMIndexHOC.js | 15 ++++++++++++-
3 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 563724040..58305f589 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -39,17 +39,18 @@ class Fileslistitem extends Component{
if(result.data.attachment_histories.length===0){
if(result.data.is_pdf===true){
+ this.props.ShowOnlinePdf(result.data.url)
//预览pdf
- axios({
- method:'get',
- url:result.data.url,
- responseType: 'arraybuffer',
- }).then((result)=>{
- var binaryData = [];
- binaryData.push(result.data);
- this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
- window.open(this.url);
- })
+ // axios({
+ // method:'get',
+ // url:result.data.url,
+ // responseType: 'arraybuffer',
+ // }).then((result)=>{
+ // var binaryData = [];
+ // binaryData.push(result.data);
+ // this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
+ // window.open(this.url);
+ // })
}else{
let link = document.createElement('a');
document.body.appendChild(link);
diff --git a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
index 483768271..1b2b89565 100644
--- a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
+++ b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
@@ -43,16 +43,17 @@ class Showoldfiles extends Component{
}
showfiless=(url)=>{
- axios({
- method:'get',
- url:url,
- responseType: 'arraybuffer',
- }).then((result)=>{
- var binaryData = [];
- binaryData.push(result.data);
- this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
- window.open(this.url);
- })
+ // axios({
+ // method:'get',
+ // url:url,
+ // responseType: 'arraybuffer',
+ // }).then((result)=>{
+ // var binaryData = [];
+ // binaryData.push(result.data);
+ // this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
+ // window.open(this.url);
+ // })
+ this.props.ShowOnlinePdf(url)
}
render(){
let {visible,allfiles}=this.props;
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index f87f128a1..690e8bc80 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -321,6 +321,19 @@ export function TPMIndexHOC(WrappedComponent) {
checkIfProfileCompleted = () => {
return this.state.current_user && this.state.current_user.profile_completed
}
+
+ ShowOnlinePdf = (url) => {
+ return axios({
+ method:'get',
+ url:url,
+ responseType: 'arraybuffer',
+ }).then((result)=>{
+ var binaryData = [];
+ binaryData.push(result.data);
+ this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
+ window.open(this.url);
+ })
+ }
render() {
let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state;
const common = {
@@ -334,11 +347,11 @@ export function TPMIndexHOC(WrappedComponent) {
isNotMember: this.isNotMember,
isUserid:this.state.coursedata&&this.state.coursedata.userid,
fetchUser: this.fetchUser,
-
showLoginDialog: this.showLoginDialog,
checkIfLogin: this.checkIfLogin,
showProfileCompleteDialog: this.showProfileCompleteDialog,
checkIfProfileCompleted: this.checkIfProfileCompleted,
+ ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url)
}
return (
From 9a0c4fa20b0c4082e5d995a5a783da4ae71c2319 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 11:25:43 +0800
Subject: [PATCH 14/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Resource/Fileslistitem.js | 2 +-
.../react/src/modules/courses/coursesPublic/Showoldfiles.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 58305f589..706622570 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -54,7 +54,7 @@ class Fileslistitem extends Component{
}else{
let link = document.createElement('a');
document.body.appendChild(link);
- link.href = "/api"+result.data.url;
+ link.href =result.data.url;
link.download = result.data.title;
//兼容火狐浏览器
let evt = document.createEvent("MouseEvents");
diff --git a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
index 1b2b89565..6b56702c3 100644
--- a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
+++ b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
@@ -189,7 +189,7 @@ class Showoldfiles extends Component{
{allfiles.is_pdf===false?
- {allfiles.title}:
+ {allfiles.title}:
this.showfiless(allfiles.url)} >{allfiles.title}
}
当前版本
@@ -209,7 +209,7 @@ class Showoldfiles extends Component{
{item.is_pdf===false?
- {item.title}:
+ {item.title}:
this.showfiless(item.url)} >{item.title}
}
From b262d98873d4b4d10dca80fef0c3554e6214f716 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Sat, 17 Aug 2019 11:25:47 +0800
Subject: [PATCH 15/49] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=BApdf=E7=9A=84?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD=EF=BC=8C=E5=B9=B6=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E9=93=BE=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../_attachment_history.json.jbuilder | 3 ++-
app/views/attachments/_attachment.json.jbuilder | 3 ++-
app/views/attachments/_attachment_simple.json.jbuilder | 4 +++-
app/views/attachments/_attachment_small.json.jbuilder | 4 ++--
app/views/files/histories.json.jbuilder | 8 +-------
5 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/app/views/attachment_histories/_attachment_history.json.jbuilder b/app/views/attachment_histories/_attachment_history.json.jbuilder
index 285aced42..6a02b569b 100644
--- a/app/views/attachment_histories/_attachment_history.json.jbuilder
+++ b/app/views/attachment_histories/_attachment_history.json.jbuilder
@@ -6,6 +6,7 @@ json.publish_time attachment.publish_time
json.quotes attachment.quotes_count
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
-json.url attachment_path(attachment, type: 'history').gsub("/api","")
+# json.url attachment_path(attachment, type: 'history').gsub("/api","")
json.is_pdf attachment.is_history_pdf?
+json.url attachment.is_history_pdf? ? attachment_path(attachment, type: 'history').gsub("/api","") : attachment_path(attachment, type: 'history')
json.attachment_id attachment.attachment_id
diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder
index b87154157..76b9f2df0 100644
--- a/app/views/attachments/_attachment.json.jbuilder
+++ b/app/views/attachments/_attachment.json.jbuilder
@@ -11,6 +11,7 @@ json.quotes attachment.quotes_count
json.description attachment.description
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
-json.url download_url(attachment)
+json.is_pdf attachment.is_pdf?
+json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
# json.url download_url(attachment) unless attachment.locked?(@is_member)
diff --git a/app/views/attachments/_attachment_simple.json.jbuilder b/app/views/attachments/_attachment_simple.json.jbuilder
index ad98fadb5..4bf6bd3e9 100644
--- a/app/views/attachments/_attachment_simple.json.jbuilder
+++ b/app/views/attachments/_attachment_simple.json.jbuilder
@@ -2,5 +2,7 @@ json.id attachment.id
json.title attachment.title
json.filesize number_to_human_size attachment.filesize
json.description attachment.description
-json.url download_url(attachment)
+json.is_pdf attachment.is_pdf?
+json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
+# json.url download_url(attachment)
json.set! :delete, delete.nil? ? true : delete if defined? delete
\ No newline at end of file
diff --git a/app/views/attachments/_attachment_small.json.jbuilder b/app/views/attachments/_attachment_small.json.jbuilder
index 97cbee120..5a1faae3a 100644
--- a/app/views/attachments/_attachment_small.json.jbuilder
+++ b/app/views/attachments/_attachment_small.json.jbuilder
@@ -1,6 +1,6 @@
json.id attachment.id
json.title attachment.title
json.filesize number_to_human_size(attachment.filesize)
-json.url download_url(attachment)
+json.is_pdf attachment.is_pdf?
+json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
json.created_on attachment.created_on
-json.is_pdf attachment.is_pdf?
\ No newline at end of file
diff --git a/app/views/files/histories.json.jbuilder b/app/views/files/histories.json.jbuilder
index ed322bb17..7039752e7 100644
--- a/app/views/files/histories.json.jbuilder
+++ b/app/views/files/histories.json.jbuilder
@@ -1,9 +1,3 @@
-# json.partial! 'attachments/attachment_small', attachment: @file
-json.id @file.id
-json.title @file.title
-json.filesize number_to_human_size(@file.filesize)
-json.url download_url(@file).gsub("/api","")
-json.created_on @file.created_on
-json.is_pdf @file.is_pdf?
+json.partial! 'attachments/attachment_small', attachment: @file
json.partial! "attachment_histories/list", attachment_histories: @attachment_histories
From b9de46e875b1cba52d559aacc3af18a5d0053818 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Sat, 17 Aug 2019 12:34:12 +0800
Subject: [PATCH 16/49] =?UTF-8?q?=E9=99=84=E4=BB=B6=E7=9A=84pdf=E9=A2=84?=
=?UTF-8?q?=E8=A7=88=E6=B7=BB=E5=8A=A0inline=E8=AF=B7=E6=B1=82=E5=A4=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 4 +++-
app/helpers/application_helper.rb | 4 ++--
.../attachment_histories/_attachment_history.json.jbuilder | 2 +-
app/views/attachments/_attachment.json.jbuilder | 2 +-
app/views/attachments/_attachment_simple.json.jbuilder | 2 +-
app/views/attachments/_attachment_small.json.jbuilder | 2 +-
6 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index a85937315..6202bf86d 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -15,7 +15,9 @@ class AttachmentsController < ApplicationController
update_downloads(@file)
redirect_to @file.cloud_url and return
end
- send_file(absolute_path(local_path(@file)), filename: @file.filename, type: @file.content_type.presence || 'application/octet-stream')
+
+ pdf_attachment = params[:disposition] || "attachment"
+ send_file(absolute_path(local_path(@file)), filename: @file.filename,disposition: pdf_attachment, type: @file.content_type.presence || 'application/octet-stream')
update_downloads(@file)
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 099d45406..a5f291c7b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -257,8 +257,8 @@ module ApplicationHelper
end
end
- def download_url attachment
- attachment_path(attachment)
+ def download_url attachment,options={}
+ attachment_path(attachment,options)
end
# 耗时:天、小时、分、秒
diff --git a/app/views/attachment_histories/_attachment_history.json.jbuilder b/app/views/attachment_histories/_attachment_history.json.jbuilder
index 6a02b569b..a2369888f 100644
--- a/app/views/attachment_histories/_attachment_history.json.jbuilder
+++ b/app/views/attachment_histories/_attachment_history.json.jbuilder
@@ -8,5 +8,5 @@ json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
# json.url attachment_path(attachment, type: 'history').gsub("/api","")
json.is_pdf attachment.is_history_pdf?
-json.url attachment.is_history_pdf? ? attachment_path(attachment, type: 'history').gsub("/api","") : attachment_path(attachment, type: 'history')
+json.url attachment.is_history_pdf? ? attachment_path(attachment, type: 'history',disposition:"inline") : attachment_path(attachment, type: 'history')
json.attachment_id attachment.attachment_id
diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder
index 76b9f2df0..25d7aecd0 100644
--- a/app/views/attachments/_attachment.json.jbuilder
+++ b/app/views/attachments/_attachment.json.jbuilder
@@ -12,6 +12,6 @@ json.description attachment.description
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
json.is_pdf attachment.is_pdf?
-json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
+json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
# json.url download_url(attachment) unless attachment.locked?(@is_member)
diff --git a/app/views/attachments/_attachment_simple.json.jbuilder b/app/views/attachments/_attachment_simple.json.jbuilder
index 4bf6bd3e9..6737838d1 100644
--- a/app/views/attachments/_attachment_simple.json.jbuilder
+++ b/app/views/attachments/_attachment_simple.json.jbuilder
@@ -3,6 +3,6 @@ json.title attachment.title
json.filesize number_to_human_size attachment.filesize
json.description attachment.description
json.is_pdf attachment.is_pdf?
-json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
+json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
# json.url download_url(attachment)
json.set! :delete, delete.nil? ? true : delete if defined? delete
\ No newline at end of file
diff --git a/app/views/attachments/_attachment_small.json.jbuilder b/app/views/attachments/_attachment_small.json.jbuilder
index 5a1faae3a..853c14b40 100644
--- a/app/views/attachments/_attachment_small.json.jbuilder
+++ b/app/views/attachments/_attachment_small.json.jbuilder
@@ -2,5 +2,5 @@ json.id attachment.id
json.title attachment.title
json.filesize number_to_human_size(attachment.filesize)
json.is_pdf attachment.is_pdf?
-json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
+json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
json.created_on attachment.created_on
From 8af97d5655de723f1a2992e8bf7e75ebec49c17b Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Sat, 17 Aug 2019 13:43:10 +0800
Subject: [PATCH 17/49] =?UTF-8?q?pdf=E7=9A=84=E9=A2=84=E8=A7=88=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0disposition?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 6202bf86d..dde7828c5 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -17,8 +17,11 @@ class AttachmentsController < ApplicationController
end
pdf_attachment = params[:disposition] || "attachment"
- send_file(absolute_path(local_path(@file)), filename: @file.filename,disposition: pdf_attachment, type: @file.content_type.presence || 'application/octet-stream')
-
+ if pdf_attachment == "inline"
+ render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream'
+ else
+ send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream')
+ end
update_downloads(@file)
end
From 5493ca53304d4cf1963c35cee5bdf6103d7596a0 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Sat, 17 Aug 2019 13:48:00 +0800
Subject: [PATCH 18/49] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=AE=9E=E8=AE=AD?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 3 ++-
app/views/attachments/_attachment.json.jbuilder | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 099d45406..142ca6d75 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -52,7 +52,8 @@ module ApplicationHelper
shixun_id = shixun_id.blank? ? -1 : shixun_id.join(",")
Shixun.select([:id, :name, :user_id, :challenges_count, :myshixuns_count, :trainee, :identifier]).where("id
- in(#{shixun_id}) or homepage_show =1").unhidden.order("myshixuns_count desc, homepage_show asc").limit(3)
+ in(#{shixun_id})").unhidden.order("homepage_show asc, myshixuns_count desc").limit(3)
+
end
# 相关推荐
diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder
index 01a7f4163..52f16c549 100644
--- a/app/views/attachments/_attachment.json.jbuilder
+++ b/app/views/attachments/_attachment.json.jbuilder
@@ -10,4 +10,4 @@ json.quotes attachment.quotes_count
json.description attachment.description
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
-json.url download_url(attachment) unless attachment.locked?(@is_member)
+json.url download_url(attachment)
From 8f453c4ebdc785e376e4a7f90a10cbcbaba5b329 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 13:48:01 +0800
Subject: [PATCH 19/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/Resource/Fileslistitem.js | 35 +++++--------------
.../courses/coursesPublic/Showoldfiles.js | 29 ++++++---------
public/react/src/modules/tpm/TPMIndexHOC.js | 14 +++++++-
3 files changed, 31 insertions(+), 47 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 706622570..5f7c0fa83 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -38,30 +38,13 @@ class Fileslistitem extends Component{
}).then((result)=>{
if(result.data.attachment_histories.length===0){
- if(result.data.is_pdf===true){
- this.props.ShowOnlinePdf(result.data.url)
- //预览pdf
- // axios({
- // method:'get',
- // url:result.data.url,
- // responseType: 'arraybuffer',
- // }).then((result)=>{
- // var binaryData = [];
- // binaryData.push(result.data);
- // this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
- // window.open(this.url);
- // })
- }else{
- let link = document.createElement('a');
- document.body.appendChild(link);
- link.href =result.data.url;
- link.download = result.data.title;
- //兼容火狐浏览器
- let evt = document.createEvent("MouseEvents");
- evt.initEvent("click", false, false);
- link.dispatchEvent(evt);
- document.body.removeChild(link);
- }
+ // if(result.data.is_pdf===true){
+ // this.props.ShowOnlinePdf(result.data.url)
+ // //预览pdf
+ // }else{
+ //
+ // }
+ this.props.DownloadFileA(result.data.title,result.data.url)
}else{
this.setState({
Showoldfiles:true,
@@ -146,9 +129,7 @@ class Fileslistitem extends Component{
const { checkBox,
discussMessage,
} = this.props;
-
-
-
+
return(
diff --git a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
index 6b56702c3..693e3448b 100644
--- a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
+++ b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
@@ -43,16 +43,6 @@ class Showoldfiles extends Component{
}
showfiless=(url)=>{
- // axios({
- // method:'get',
- // url:url,
- // responseType: 'arraybuffer',
- // }).then((result)=>{
- // var binaryData = [];
- // binaryData.push(result.data);
- // this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
- // window.open(this.url);
- // })
this.props.ShowOnlinePdf(url)
}
render(){
@@ -188,10 +178,11 @@ class Showoldfiles extends Component{
- {allfiles.is_pdf===false?
- {allfiles.title}:
- this.showfiless(allfiles.url)} >{allfiles.title}
- }
+ {allfiles.title}
+ {/*{allfiles.is_pdf===false?*/}
+ {/*{allfiles.title}:*/}
+ {/*this.showfiless(allfiles.url)} >{allfiles.title}*/}
+ {/*}*/}
当前版本
@@ -207,11 +198,11 @@ class Showoldfiles extends Component{
-
- {item.is_pdf===false?
- {item.title}:
- this.showfiless(item.url)} >{item.title}
- }
+ {item.title}
+ {/*{item.is_pdf===false?*/}
+ {/*{item.title}:*/}
+ {/*this.showfiless(item.url)} >{item.title}*/}
+ {/*}*/}
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index 690e8bc80..682e8f866 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -334,6 +334,17 @@ export function TPMIndexHOC(WrappedComponent) {
window.open(this.url);
})
}
+ DownloadFileA=(title,url)=>{
+ let link = document.createElement('a');
+ document.body.appendChild(link);
+ link.href =url;
+ link.download = title;
+ //兼容火狐浏览器
+ let evt = document.createEvent("MouseEvents");
+ evt.initEvent("click", false, false);
+ link.dispatchEvent(evt);
+ document.body.removeChild(link);
+ }
render() {
let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state;
const common = {
@@ -351,7 +362,8 @@ export function TPMIndexHOC(WrappedComponent) {
checkIfLogin: this.checkIfLogin,
showProfileCompleteDialog: this.showProfileCompleteDialog,
checkIfProfileCompleted: this.checkIfProfileCompleted,
- ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url)
+ ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url),
+ DownloadFileA:(title,url)=>this.DownloadFileA(title,url),
}
return (
From b094010ad11c5424eebee3395c238a129d947685 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 13:51:10 +0800
Subject: [PATCH 20/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Resource/Fileslistitem.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 5f7c0fa83..d3405ebf5 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -129,7 +129,7 @@ class Fileslistitem extends Component{
const { checkBox,
discussMessage,
} = this.props;
-
+
return(
From e8dcb166756861f64edd9f5a487d60eb1b804bcd Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Sat, 17 Aug 2019 13:56:14 +0800
Subject: [PATCH 21/49] =?UTF-8?q?pdf=20=E9=A2=84=E8=A7=88=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index dde7828c5..7617270a8 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -18,7 +18,8 @@ class AttachmentsController < ApplicationController
pdf_attachment = params[:disposition] || "attachment"
if pdf_attachment == "inline"
- render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream'
+ send_data absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf'
+ # render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream'
else
send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream')
end
From 476689314bcec5f32665fcd412de3bba975d3ed1 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Sat, 17 Aug 2019 14:00:18 +0800
Subject: [PATCH 22/49] xxx
---
app/controllers/attachments_controller.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 7617270a8..d3317e99e 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -18,8 +18,7 @@ class AttachmentsController < ApplicationController
pdf_attachment = params[:disposition] || "attachment"
if pdf_attachment == "inline"
- send_data absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf'
- # render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream'
+ send_file absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf'
else
send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream')
end
From 3c1d30a133a7e56090612b7473e1e613ed720622 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Sat, 17 Aug 2019 14:03:18 +0800
Subject: [PATCH 23/49] video feature: add account check to api
---
app/controllers/users/video_auths_controller.rb | 2 +-
app/controllers/users/videos_controller.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/users/video_auths_controller.rb b/app/controllers/users/video_auths_controller.rb
index 0eec4dffb..a7d41bce5 100644
--- a/app/controllers/users/video_auths_controller.rb
+++ b/app/controllers/users/video_auths_controller.rb
@@ -1,5 +1,5 @@
class Users::VideoAuthsController < Users::BaseController
- before_action :private_user_resources!, :require_auth_teacher!
+ before_action :private_user_resources!, :check_account, :require_auth_teacher!
def create
result = Videos::CreateAuthService.call(observed_user, create_params)
diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb
index 1df726c0c..0ad3f87d6 100644
--- a/app/controllers/users/videos_controller.rb
+++ b/app/controllers/users/videos_controller.rb
@@ -1,5 +1,5 @@
class Users::VideosController < Users::BaseController
- before_action :private_user_resources!, :require_auth_teacher!
+ before_action :private_user_resources!, :check_account, :require_auth_teacher!
helper_method :current_video
From e7a96f8ad10c931e23d9c1d6e7d692aa2d67e795 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Sat, 17 Aug 2019 14:12:55 +0800
Subject: [PATCH 24/49] sort
---
public/react/src/common/TextUtil.js | 7 ++++++-
public/react/src/common/educoder.js | 2 +-
public/react/src/modules/courses/members/teacherList.js | 5 ++++-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js
index 4482f8607..4c83131f1 100644
--- a/public/react/src/common/TextUtil.js
+++ b/public/react/src/common/TextUtil.js
@@ -70,4 +70,9 @@ export function appendFileSizeToUploadFileAll(fileList) {
return item
})
}
-export const uploadNameSizeSeperator = ' '
\ No newline at end of file
+export const uploadNameSizeSeperator = ' '
+
+export const sortDirections = ["ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
+ "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
+ "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
+ "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", ]
\ No newline at end of file
diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js
index ca1596c54..88f8e1210 100644
--- a/public/react/src/common/educoder.js
+++ b/public/react/src/common/educoder.js
@@ -17,7 +17,7 @@ export { updatePageParams as updatePageParams } from './RouterUti
export { bytesToSize as bytesToSize } from './UnitUtil';
export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension,
- downloadFile } from './TextUtil'
+ downloadFile, sortDirections } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil'
diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js
index c509cb057..06dbe74a8 100644
--- a/public/react/src/modules/courses/members/teacherList.js
+++ b/public/react/src/modules/courses/members/teacherList.js
@@ -8,7 +8,7 @@ import Titlesearchsection from '../common/titleSearch/TitleSearchSection'
import ColorCountText from '../common/titleSearch/ColorCountText'
import update from 'immutability-helper'
-import { WordsBtn, ConditionToolTip, on, off ,trigger} from 'educoder'
+import { WordsBtn, ConditionToolTip, on, off ,trigger, sortDirections } from 'educoder'
import axios from 'axios'
@@ -63,6 +63,7 @@ function buildColumns(that) {
width: 120,
key: 'name',
sorter: showSorter,
+ sortDirections: sortDirections,
sortOrder: sortedInfo.columnKey === 'name' && sortedInfo.order,
render: (name, record) => {
return
Date: Sat, 17 Aug 2019 14:27:08 +0800
Subject: [PATCH 25/49] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=80=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/subjects/show.json.jbuilder | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder
index 93fa105a6..ec76b5a2d 100644
--- a/app/views/subjects/show.json.jbuilder
+++ b/app/views/subjects/show.json.jbuilder
@@ -11,6 +11,7 @@ json.allow_statistics @is_manager
json.allow_send @user.logged?
json.allow_visit @subject.status > 1 || @is_manager
json.allow_add_member @is_manager
+json.is_creator @is_creator
if @subject.excellent
json.courses @courses do |course|
From e17d636ba509c7ce06771ad0fbe057e90de2bf21 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Sat, 17 Aug 2019 14:29:17 +0800
Subject: [PATCH 26/49] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=80=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/user.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 2cd515261..449a86e8b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -268,7 +268,7 @@ class User < ApplicationRecord
# 实训路径管理员
def creator_of_subject?(subject)
- subject.user_id == id
+ subject.user_id == id || admin?
end
# 实训路径:合作者、admin
From 0192c0c11f7df7248d5f8261bd7928ad97d5c046 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Sat, 17 Aug 2019 14:34:01 +0800
Subject: [PATCH 27/49] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=8B=E8=BD=BD?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e6f2e1720..099d45406 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -258,7 +258,7 @@ module ApplicationHelper
end
def download_url attachment
- attachment_path(attachment).gsub("/api","")
+ attachment_path(attachment)
end
# 耗时:天、小时、分、秒
From 3f2cdc3ecef7cfa6d724951749fdeab8e3726aaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 14:39:27 +0800
Subject: [PATCH 28/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/Resource/Fileslistitem.js | 69 ++++++++++---------
1 file changed, 37 insertions(+), 32 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index d3405ebf5..feae05740 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -27,35 +27,40 @@ class Fileslistitem extends Component{
this.props.Settingtypes(discussMessage.id)
}
- showfiles=(value)=>{
- let {discussMessage,coursesId}=this.props
- let file_id=discussMessage.id
- let url="/files/"+file_id+"/histories.json"
- axios.get(url,{
- params:{
- course_id:coursesId
- },
- }).then((result)=>{
-
- if(result.data.attachment_histories.length===0){
- // if(result.data.is_pdf===true){
- // this.props.ShowOnlinePdf(result.data.url)
- // //预览pdf
- // }else{
- //
- // }
- this.props.DownloadFileA(result.data.title,result.data.url)
- }else{
- this.setState({
- Showoldfiles:true,
- allfiles:result.data
- })
- }
-
-
- }).catch((error)=>{
- console.log(error)
- })
+ showfiles=(list)=>{
+ if(list.is_history_file===false){
+ this.props.DownloadFileA(list.title,list.url)
+ }else{
+ let {discussMessage,coursesId}=this.props
+ let file_id=discussMessage.id
+ let url="/files/"+file_id+"/histories.json"
+ axios.get(url,{
+ params:{
+ course_id:coursesId
+ },
+ }).then((result)=>{
+
+ if(result.data.attachment_histories.length===0){
+ // if(result.data.is_pdf===true){
+ // this.props.ShowOnlinePdf(result.data.url)
+ // //预览pdf
+ // }else{
+ //
+ // }
+ this.props.DownloadFileA(result.data.title,result.data.url)
+ }else{
+ this.setState({
+ Showoldfiles:true,
+ allfiles:result.data
+ })
+ }
+
+
+ }).catch((error)=>{
+ console.log(error)
+ })
+ }
+
}
closaoldfilesprops=()=>{
@@ -191,13 +196,13 @@ class Fileslistitem extends Component{
{
this.props.isAdmin ? this.showfiles(discussMessage.title)}
+ onClick={()=>this.showfiles(discussMessage)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title} : ""
}
{
this.props.isStudent? this.showfiles(discussMessage.title)}
+ onClick={()=>this.showfiles(discussMessage)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title} :""
}
@@ -207,7 +212,7 @@ class Fileslistitem extends Component{
discussMessage.is_lock === true ?
{discussMessage.title}
:this.showfiles(discussMessage.title)}
+ onClick={()=>this.showfiles(discussMessage)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}:""
}
From f04ad3ed85de60358d57a062128cab31afec6fc6 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Sat, 17 Aug 2019 14:42:50 +0800
Subject: [PATCH 29/49] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/games/picture_display.json.jbuilder | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder
index 770f0d71b..4c806d142 100644
--- a/app/views/games/picture_display.json.jbuilder
+++ b/app/views/games/picture_display.json.jbuilder
@@ -21,7 +21,7 @@ if @type == "image"
elsif @type == "html"
json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe
elsif @type == "txt"
- json.contents @contents.html_safe
+ json.contents @contents
elsif @type =="qrcode"
json.qrcode_str @qrcode_str
elsif @type == "mp3" || @type == "mp4"
From 989de0432f5059b9604d72a2b665863dd3a43c4b Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Sat, 17 Aug 2019 14:49:18 +0800
Subject: [PATCH 30/49] =?UTF-8?q?txt=E8=AF=84=E6=B5=8B=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/games/picture_display.json.jbuilder | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder
index 4c806d142..eb2309f9b 100644
--- a/app/views/games/picture_display.json.jbuilder
+++ b/app/views/games/picture_display.json.jbuilder
@@ -21,7 +21,7 @@ if @type == "image"
elsif @type == "html"
json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe
elsif @type == "txt"
- json.contents @contents
+ json.contents @contents.to_s
elsif @type =="qrcode"
json.qrcode_str @qrcode_str
elsif @type == "mp3" || @type == "mp4"
From fff396a35fac61eda63fa8f79476d5d704d47dd6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 14:56:21 +0800
Subject: [PATCH 31/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Resource/Fileslistitem.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index feae05740..925bcc817 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -29,7 +29,8 @@ class Fileslistitem extends Component{
showfiles=(list)=>{
if(list.is_history_file===false){
- this.props.DownloadFileA(list.title,list.url)
+ // this.props.DownloadFileA(list.title,list.url)
+ window.location.href=list.url;
}else{
let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id
@@ -47,7 +48,8 @@ class Fileslistitem extends Component{
// }else{
//
// }
- this.props.DownloadFileA(result.data.title,result.data.url)
+ // this.props.DownloadFileA(result.data.title,result.data.url)
+ window.location.href=list.url;
}else{
this.setState({
Showoldfiles:true,
From 2f4e348049003779f99989d1bb33074ea95aa87a Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Sat, 17 Aug 2019 15:01:20 +0800
Subject: [PATCH 32/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/excellent_course_exercise.rake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake
index 07c33d9e9..964951003 100644
--- a/lib/tasks/excellent_course_exercise.rake
+++ b/lib/tasks/excellent_course_exercise.rake
@@ -45,8 +45,8 @@ namespace :excellent_course_exercise do
end
if exercise_user && exercise_user.commit_status == 0
- exercise_question_ids = exercise_question_ids.sample(rand_num)
- questions = exercise.exercise_questions.where(id: exercise_question_ids)
+ question_ids = exercise_question_ids.sample(rand_num)
+ questions = exercise.exercise_questions.where(id: question_ids)
create_exercise_answer questions, member.user_id
total_score = calculate_student_score(exercise, member.user)
From cddd7826864037268b5187da75917795f760aba1 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Sat, 17 Aug 2019 15:05:44 +0800
Subject: [PATCH 33/49] video feature: modify
---
app/controllers/users/videos_controller.rb | 1 +
app/views/users/get_user_info.json.jbuilder | 1 +
2 files changed, 2 insertions(+)
diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb
index 0ad3f87d6..f04d4435d 100644
--- a/app/controllers/users/videos_controller.rb
+++ b/app/controllers/users/videos_controller.rb
@@ -1,5 +1,6 @@
class Users::VideosController < Users::BaseController
before_action :private_user_resources!, :check_account, :require_auth_teacher!
+ skip_before_action :require_auth_teacher!, only: [:index]
helper_method :current_video
diff --git a/app/views/users/get_user_info.json.jbuilder b/app/views/users/get_user_info.json.jbuilder
index 24f7b21b0..6189358ba 100644
--- a/app/views/users/get_user_info.json.jbuilder
+++ b/app/views/users/get_user_info.json.jbuilder
@@ -10,6 +10,7 @@ json.tidding_count 0
json.user_phone_binded @user.phone.present?
json.phone @user.phone
json.profile_completed @user.profile_completed?
+json.professional_certification @user.professional_certification
if @course
json.course_identity @course_identity
json.course_name @course.name
From c417eeaf2aea5a44ca5fcdb2449ffa5277fd7afc Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Sat, 17 Aug 2019 15:06:22 +0800
Subject: [PATCH 34/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_works/edit.json.jbuilder | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/views/student_works/edit.json.jbuilder b/app/views/student_works/edit.json.jbuilder
index 88e5354e4..1f79049d0 100644
--- a/app/views/student_works/edit.json.jbuilder
+++ b/app/views/student_works/edit.json.jbuilder
@@ -1,7 +1,6 @@
json.partial! "homework_commons/homework_public_navigation", locals: {homework: @homework, course: @course, user: @current_user}
json.work_id @work.id
json.description @work.description
-json.
json.attachments @work.attachments do |atta|
json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: @work.delete_atta(atta)}
From 4252648a4aadadb3c6e0c98a6cec541f0e358e98 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Sat, 17 Aug 2019 15:10:49 +0800
Subject: [PATCH 35/49] modify
---
app/controllers/users/videos_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb
index f04d4435d..8b445a7fb 100644
--- a/app/controllers/users/videos_controller.rb
+++ b/app/controllers/users/videos_controller.rb
@@ -1,6 +1,6 @@
class Users::VideosController < Users::BaseController
- before_action :private_user_resources!, :check_account, :require_auth_teacher!
- skip_before_action :require_auth_teacher!, only: [:index]
+ before_action :private_user_resources!, :check_account
+ before_action :require_auth_teacher!, except: [:index, :review]
helper_method :current_video
From e002d9f1eb63cb9d5594c4a60786cd927c28a251 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Sat, 17 Aug 2019 15:27:51 +0800
Subject: [PATCH 36/49] null
---
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 c248c554c..5ac53a065 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkPost.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkPost.js
@@ -69,7 +69,7 @@ class CommonWorkPost extends Component{
status: 'done'
}
})
- const _memebers = response.data.members.slice(0);
+ const _memebers = response.data.members ? response.data.members.slice(0) : [];
this._edit_init_memebers = _memebers
delete response.data.members;
this.setState({
From 0d8de9537aa9d7a81847a03aef7ba144e8cba0ca Mon Sep 17 00:00:00 2001
From: p31729568
Date: Sat, 17 Aug 2019 15:35:31 +0800
Subject: [PATCH 37/49] modify per_page max 100
---
app/controllers/users/base_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/users/base_controller.rb b/app/controllers/users/base_controller.rb
index eb6b98048..01ddee8fc 100644
--- a/app/controllers/users/base_controller.rb
+++ b/app/controllers/users/base_controller.rb
@@ -37,7 +37,7 @@ class Users::BaseController < ApplicationController
end
def per_page_value
- params[:per_page].to_i > 0 && params[:per_page].to_i < 50 ? params[:per_page].to_i : 20
+ params[:per_page].to_i > 0 && params[:per_page].to_i <= 100 ? params[:per_page].to_i : 20
end
alias_method :limit_value, :per_page_value
From 29ab7e95c2c0e4c1e61b8368da8e0f77d2aea68a Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Sat, 17 Aug 2019 15:41:10 +0800
Subject: [PATCH 38/49] =?UTF-8?q?=E5=A4=B4=E9=83=A8=E8=B7=B3=E8=BD=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/NewHeader.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index a6a849183..dff749515 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -727,7 +727,7 @@ submittojoinclass=(value)=>{
src={require('./roundedRectangle.png')}
/>
- 教学案例
+ 教学案例
众包创新
From 95c8f28a74b14fd203f8975adb75a16ed73f0603 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Sat, 17 Aug 2019 15:51:50 +0800
Subject: [PATCH 39/49] video feature: modify refresh auth api
---
app/controllers/users/video_auths_controller.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/controllers/users/video_auths_controller.rb b/app/controllers/users/video_auths_controller.rb
index a7d41bce5..2231dcfdf 100644
--- a/app/controllers/users/video_auths_controller.rb
+++ b/app/controllers/users/video_auths_controller.rb
@@ -10,7 +10,9 @@ class Users::VideoAuthsController < Users::BaseController
def update
video = observed_user.videos.find_by(uuid: params[:video_id])
- return render_error('该视频凭证不存在') if video.blank?
+ if video.blank?
+ video = observed_user.videos.create!(uuid: params[:video_id], title: params[:title], cover_url: params[:cover_url])
+ end
result = AliyunVod::Service.refresh_upload_video(video.uuid)
render_ok(data: result)
From 2d59bf67662c885de3c7516781848bee6ace339e Mon Sep 17 00:00:00 2001
From: p31729568
Date: Sat, 17 Aug 2019 15:57:18 +0800
Subject: [PATCH 40/49] modify
---
app/controllers/users/video_auths_controller.rb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/controllers/users/video_auths_controller.rb b/app/controllers/users/video_auths_controller.rb
index 2231dcfdf..a7d41bce5 100644
--- a/app/controllers/users/video_auths_controller.rb
+++ b/app/controllers/users/video_auths_controller.rb
@@ -10,9 +10,7 @@ class Users::VideoAuthsController < Users::BaseController
def update
video = observed_user.videos.find_by(uuid: params[:video_id])
- if video.blank?
- video = observed_user.videos.create!(uuid: params[:video_id], title: params[:title], cover_url: params[:cover_url])
- end
+ return render_error('该视频凭证不存在') if video.blank?
result = AliyunVod::Service.refresh_upload_video(video.uuid)
render_ok(data: result)
From 5d46519867b49f6cb6333ebebf70d50a85d07c1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 17 Aug 2019 16:06:59 +0800
Subject: [PATCH 41/49] =?UTF-8?q?=E5=B0=81=E8=A3=85open=20pdf=20=E6=96=B0?=
=?UTF-8?q?=E5=BC=80=E9=A1=B5=E4=B8=8B=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/TPMIndexHOC.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index 682e8f866..795e01a31 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -345,6 +345,10 @@ export function TPMIndexHOC(WrappedComponent) {
link.dispatchEvent(evt);
document.body.removeChild(link);
}
+
+ DownloadOpenPdf=(type,url)=>{
+ type===true?window.open(url):window.location.href=url;
+ }
render() {
let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state;
const common = {
@@ -364,6 +368,7 @@ export function TPMIndexHOC(WrappedComponent) {
checkIfProfileCompleted: this.checkIfProfileCompleted,
ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url),
DownloadFileA:(title,url)=>this.DownloadFileA(title,url),
+ DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url)
}
return (
From 3af57e97ce8335d66eae53fed8806d88f66ccae2 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Sat, 17 Aug 2019 16:19:36 +0800
Subject: [PATCH 42/49] video feature: modify
---
app/libs/aliyun_vod/service/base.rb | 10 +++++++++-
app/libs/aliyun_vod/service/video_upload.rb | 9 ---------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb
index 85f74fc6f..e100eadcc 100644
--- a/app/libs/aliyun_vod/service/base.rb
+++ b/app/libs/aliyun_vod/service/base.rb
@@ -10,7 +10,15 @@ module AliyunVod::Service::Base
Rails.logger.info("[AliyunVod] response => status: #{response.status}, result: #{result}")
- raise AliyunVod::Error, result['Code'] if response.status != 200
+ if response.status != 200
+ message =
+ case result['Code']
+ when 'InvalidFileName.Extension' then '不支持的文件格式'
+ when 'IllegalCharacters' then '文件名称包含非法字符'
+ else raise AliyunVod::Error, result['Message']
+ end
+ raise AliyunVod::Error, message if message.present?
+ end
result
rescue => ex
diff --git a/app/libs/aliyun_vod/service/video_upload.rb b/app/libs/aliyun_vod/service/video_upload.rb
index a5ade72f9..97ecd970b 100644
--- a/app/libs/aliyun_vod/service/video_upload.rb
+++ b/app/libs/aliyun_vod/service/video_upload.rb
@@ -16,15 +16,6 @@ module AliyunVod::Service::VideoUpload
result = request(:post, params)
- if result['Code'].present?
- message =
- case result['Code']
- when 'InvalidFileName.Extension' then '不支持的文件格式'
- when 'IllegalCharacters' then '文件名称包含非法字符'
- end
- raise AliyunVod::Error, message if message.present?
- end
-
raise AliyunVod::Error, '获取上传凭证失败' if result['UploadAddress'].blank?
result
From 64a51a1759fcf94292c486be5e5198c31debac50 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 19 Aug 2019 10:30:56 +0800
Subject: [PATCH 43/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index d3317e99e..3d6e20ee9 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -172,7 +172,10 @@ class AttachmentsController < ApplicationController
# 课堂资源、作业、毕设相关资源的权限判断
if @file.container.is_a?(Course)
course = @file.container
+ Rails.logger.info("@@@@@@@@@@@@######################## course_id#{course.id}")
candown = current_user.member_of_course?(course) || @file.is_public == 1
+ Rails.logger.info("@@@@@@@@@@@@######################## public #{@file.is_public}")
+ Rails.logger.info("@@@@@@@@@@@@#########################{candown}")
elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic)
course = @file.container&.course
candown = current_user.member_of_course?(course)
From e9b682383b9b44805301edd4ea3ec417f8ba8455 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 19 Aug 2019 10:47:31 +0800
Subject: [PATCH 44/49] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 3d6e20ee9..df74cf737 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -172,10 +172,7 @@ class AttachmentsController < ApplicationController
# 课堂资源、作业、毕设相关资源的权限判断
if @file.container.is_a?(Course)
course = @file.container
- Rails.logger.info("@@@@@@@@@@@@######################## course_id#{course.id}")
- candown = current_user.member_of_course?(course) || @file.is_public == 1
- Rails.logger.info("@@@@@@@@@@@@######################## public #{@file.is_public}")
- Rails.logger.info("@@@@@@@@@@@@#########################{candown}")
+ candown = current_user.member_of_course?(course) || (course.is_public? && @file.publiced?)
elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic)
course = @file.container&.course
candown = current_user.member_of_course?(course)
From 2f187e1a84884a57edec55d56a698125d06e43e2 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Mon, 19 Aug 2019 11:28:02 +0800
Subject: [PATCH 45/49] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E7=BC=96?=
=?UTF-8?q?=E8=BE=91=E5=95=8A=E7=9A=84=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/exercise_questions_controller.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb
index 3718e18d5..52915a8ba 100644
--- a/app/controllers/exercise_questions_controller.rb
+++ b/app/controllers/exercise_questions_controller.rb
@@ -339,10 +339,11 @@ class ExerciseQuestionsController < ApplicationController
@exercise_question.exercise_shixun_challenges.each_with_index do |challenge, index|
challenge.question_score = params[:question_scores][index].to_f.round(1)
challenge.save
- question_score += challenge.question_score
+ question_score += params[:question_scores][index].to_f.round(1)
end
@exercise_question.question_score = question_score
@exercise_question.shixun_name = shixun_name
+ @exercise_question.save
end
#当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数.
From 9110cc6a9ac3e0a71ae2514d9c2bb5a206f95b6d Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Mon, 19 Aug 2019 11:33:47 +0800
Subject: [PATCH 46/49] list
---
public/react/src/common/components/attachment/AttachmentList.js | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 public/react/src/common/components/attachment/AttachmentList.js
diff --git a/public/react/src/common/components/attachment/AttachmentList.js b/public/react/src/common/components/attachment/AttachmentList.js
new file mode 100644
index 000000000..e69de29bb
From 25c553d3c53e3abefed178fe9af556e9f5877656 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Mon, 19 Aug 2019 13:45:31 +0800
Subject: [PATCH 47/49] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B?=
=?UTF-8?q?=E8=AF=A6=E6=83=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/moop_cases/CaseDetail.js | 203 +++++++++---------
1 file changed, 104 insertions(+), 99 deletions(-)
diff --git a/public/react/src/modules/moop_cases/CaseDetail.js b/public/react/src/modules/moop_cases/CaseDetail.js
index f3ade34d9..4fc7ef84c 100644
--- a/public/react/src/modules/moop_cases/CaseDetail.js
+++ b/public/react/src/modules/moop_cases/CaseDetail.js
@@ -65,110 +65,115 @@ class CaseDetail extends Component{
} = this.state;
return(
-
-
-
- 教学案例 > { CaseDetail && CaseDetail.title}
-
-
-
- { CaseDetail && CaseDetail.title}
-
-
-
- {
- CaseDetail && CaseDetail.status == "pending" && 草稿
- }
- {
- CaseDetail && CaseDetail.status == "processing" && 审核中
- }
- {
- CaseDetail && CaseDetail.status == "refused" && 未通过
- }
-
- 返回
-
-
-
-
-
![82274?1563067098]({getImageUrl(`images/${creator)
-
-
- {creator && creator.name}
- {
- operation && operation.can_deletable ? 删除:""
- }
-
- {
- operation && operation.can_editable ? 编辑:""
- }
-
-
- {creator && creator.school_name}
-
- 编码:{CaseDetail && CaseDetail.uuid}
- {
- CaseDetail && CaseDetail.status=="published" ?
- 发布时间:{CaseDetail && CaseDetail.published_at}
- :
- 上传时间:{CaseDetail && CaseDetail.created_at}
- }
-
-
-
-
-
- 作者:{CaseDetail && CaseDetail.author_name}/{CaseDetail && CaseDetail.author_school_name}
-
-
-
- { CaseDetail && CaseDetail.content && }
-
- { attachments &&
-
{
- attachments.map((item,key)=>{
- return(
-
-
-
-
- {item.title}
- {item.filesize}
-
- )
- })
+ CaseDetail.status == "refused" &&
未通过
}
+
+
返回
+
+
+
+
+
![82274?1563067098]({getImageUrl(`images/${creator)
+
+
+ {creator && creator.name}
+ {
+ operation && operation.can_deletable ? 删除:""
+ }
+
+ {
+ operation && operation.can_editable ? 编辑:""
+ }
+
+
+ {creator && creator.school_name}
+
+ 编码:{CaseDetail.uuid}
+ {
+ CaseDetail && CaseDetail.status=="published" ?
+ 发布时间:{CaseDetail.published_at}
+ :
+ 上传时间:{CaseDetail.created_at}
+ }
+
+
+
+
+
+ 作者:{CaseDetail.author_name}/{CaseDetail.author_school_name}
+
+
+
+ { CaseDetail.content && }
+
+ { attachments &&
+
+ {
+ attachments.map((item,key)=>{
+ return(
+
+
+
+
+ {item.title}
+ {item.filesize}
+
+ )
+ })
+ }
+
+ }
+
+ {
+ user_praised ?
+
+ 已赞
+ {praise_count}
+
+ :
+
this.props.praisePoint(this.props.match.params.caseID)} className="pointsBtn">
+
+ {praise_count}
+
+ }
+
- }
-
- {
- user_praised ?
-
- 已赞
- {praise_count}
-
- :
-
this.props.praisePoint(this.props.match.params.caseID)} className="pointsBtn">
-
- {praise_count}
-
- }
-
-
+
+ }
)
}
From a7c6674fe2970d6b7834396cbca1974354b879da Mon Sep 17 00:00:00 2001
From: p31729568
Date: Mon, 19 Aug 2019 14:05:04 +0800
Subject: [PATCH 48/49] video: only teacher can visit video list
---
app/controllers/users/base_controller.rb | 6 ++++++
app/controllers/users/videos_controller.rb | 1 +
2 files changed, 7 insertions(+)
diff --git a/app/controllers/users/base_controller.rb b/app/controllers/users/base_controller.rb
index 01ddee8fc..3ba6940f5 100644
--- a/app/controllers/users/base_controller.rb
+++ b/app/controllers/users/base_controller.rb
@@ -26,6 +26,12 @@ class Users::BaseController < ApplicationController
render_forbidden
end
+ def require_teacher!
+ return if current_user.admin_or_business? || observed_user.is_teacher?
+
+ render_forbidden
+ end
+
def require_auth_teacher!
return if current_user.admin_or_business? || observed_user.certification_teacher?
diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb
index 8b445a7fb..1fb209970 100644
--- a/app/controllers/users/videos_controller.rb
+++ b/app/controllers/users/videos_controller.rb
@@ -1,5 +1,6 @@
class Users::VideosController < Users::BaseController
before_action :private_user_resources!, :check_account
+ before_action :require_teacher!
before_action :require_auth_teacher!, except: [:index, :review]
helper_method :current_video
From 957d8f1592c4081c03cf22f01dc3810be90fe517 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Mon, 19 Aug 2019 14:08:28 +0800
Subject: [PATCH 49/49] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B-?=
=?UTF-8?q?=E9=99=84=E4=BB=B6=E5=88=97=E8=A1=A8-=E5=8D=95=E7=8B=AC?=
=?UTF-8?q?=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/attachment/AttachmentList.js | 33 +++++++++++++++++++
public/react/src/common/educoder.js | 3 ++
.../src/modules/moop_cases/CaseDetail.js | 18 +++-------
3 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/public/react/src/common/components/attachment/AttachmentList.js b/public/react/src/common/components/attachment/AttachmentList.js
index e69de29bb..8ece1c39d 100644
--- a/public/react/src/common/components/attachment/AttachmentList.js
+++ b/public/react/src/common/components/attachment/AttachmentList.js
@@ -0,0 +1,33 @@
+import React,{ Component } from "react";
+
+class AttachmentsList extends Component{
+ constructor(props){
+ super(props);
+ }
+ render(){
+ let { attachments } = this.props;
+ return(
+
+ {
+ attachments.map((item,key)=>{
+ return(
+
+
+
+
+ {
+ item.is_pdf && item.is_pdf == true ?
+ {item.title}
+ :
+ {item.title}
+ }
+ {item.filesize}
+
+ )
+ })
+ }
+
+ )
+ }
+}
+export default AttachmentsList;
\ No newline at end of file
diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js
index 88f8e1210..30a98868a 100644
--- a/public/react/src/common/educoder.js
+++ b/public/react/src/common/educoder.js
@@ -30,6 +30,9 @@ export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info
export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const'
+
+export { default as AttachmentList } from './components/attachment/AttachmentList'
+
export { themes, ThemeContext } from './context/ThemeContext'
export { ModalHOC } from './components/ModalHOC'
diff --git a/public/react/src/modules/moop_cases/CaseDetail.js b/public/react/src/modules/moop_cases/CaseDetail.js
index 4fc7ef84c..6e278307e 100644
--- a/public/react/src/modules/moop_cases/CaseDetail.js
+++ b/public/react/src/modules/moop_cases/CaseDetail.js
@@ -2,13 +2,15 @@ import React,{ Component } from "react";
import './css/moopCases.css'
import '../courses/css/Courses.css'
-import { getImageUrl , MarkdownToHtml , ActionBtn } from 'educoder';
+import { getImageUrl , MarkdownToHtml , ActionBtn , AttachmentList } from 'educoder';
import Tags from './CaseTags'
import axios from 'axios';
import Modals from '../modals/Modals'
+// import AttachmentList from '../../common/components/attachment/AttachmentList'
+
class CaseDetail extends Component{
constructor(props){
super(props);
@@ -141,19 +143,7 @@ class CaseDetail extends Component{
{ attachments &&
- {
- attachments.map((item,key)=>{
- return(
-
-
-
-
- {item.title}
- {item.filesize}
-
- )
- })
- }
+
}