From 731b72146e589b837f785f2eccc9eec36d63dfd0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 23:40:53 +0800 Subject: [PATCH 01/32] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 19f611b3b..cad8cfbd9 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -30,7 +30,8 @@ class Videos::BatchPublishService < ApplicationService end # 标清转码为h264 - if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265') + code_info = AliyunVod::Service.get_meta_code_info(video.uuid) + if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true #Rails.logger.info("####video.uuid:#{video.uuid}") #result = AliyunVod::Service.get_play_info(video.uuid) From 2a7b4896a7cd07c7afe3e3247046142eae672a2f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:04:19 +0800 Subject: [PATCH 02/32] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=AF=8F=E5=A4=A9=E8=BD=AE=E8=AE=AD?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/get_video_data.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/get_video_data.rake b/lib/tasks/get_video_data.rake index 2a009790e..f6f85c7d5 100644 --- a/lib/tasks/get_video_data.rake +++ b/lib/tasks/get_video_data.rake @@ -62,7 +62,7 @@ namespace :video do end task :get_play_url => :environment do - Video.all.each do |video| + Video.where(play_url: nil).each do |video| result = AliyunVod::Service.get_play_info(video.uuid) rescue nil if result.present? && result["PlayInfoList"]["PlayInfo"].present? puts result From 9d24a593cb6d23bc1c7736c88f716f965fb2d8b9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:32:31 +0800 Subject: [PATCH 03/32] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- app/models/shixun.rb | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 54eb19474..3f202c994 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -154,7 +154,7 @@ class ShixunsController < ApplicationController @can_fork = {can_fork: "已经职业认证的教师才能fork实训", certi_url: "/account/certification"} end - @current_myshixun = @shixun.current_myshixun(current_user) + @current_myshixun = @shixun.current_myshixun(current_user.id) if @shixun.fork_from fork_shixun = Shixun.select(:id, :user_id, :name, :identifier).where(id: @shixun.fork_from).first @fork_from = {name: fork_shixun.name, username: fork_shixun.owner.try(:full_name), diff --git a/app/models/shixun.rb b/app/models/shixun.rb index b9bd372b0..5caacebce 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -210,9 +210,8 @@ class Shixun < ApplicationRecord end # 当前用户开启的实训 - def current_myshixun(user) - return nil unless user.logged? - myshixuns.find_by(user_id: user.id) + def current_myshixun(user_id) + myshixuns.find_by(user_id: user_id) end # 实训技术平台 From 6285b9767a9ed9820e75de7c41aea0a43ce477f4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:33:56 +0800 Subject: [PATCH 04/32] =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index a2d34b6ef..01d19a433 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -22,8 +22,8 @@ module AliyunVod::Service::Base result rescue => ex - ::Util.logger_error(ex) raise AliyunVod::Error, ex.message + ::Util.logger_error(ex) end def base_params From df2b49948492834a7d7fa94337490b7fa73da6bf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:34:51 +0800 Subject: [PATCH 05/32] 1 --- app/libs/aliyun_vod/service/base.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index 01d19a433..1233c65af 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -22,8 +22,9 @@ module AliyunVod::Service::Base result rescue => ex - raise AliyunVod::Error, ex.message ::Util.logger_error(ex) + raise AliyunVod::Error, ex.message + "" end def base_params From b1e006abc748aaebbd64d43ae03bcd0bee5e44a0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:36:16 +0800 Subject: [PATCH 06/32] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/base.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index 1233c65af..ebbcce694 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -23,8 +23,7 @@ module AliyunVod::Service::Base result rescue => ex ::Util.logger_error(ex) - raise AliyunVod::Error, ex.message - "" + #raise AliyunVod::Error, ex.message end def base_params From 221e7ed1f023f047a3ac1b1c5ac89a6f579bbc48 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:41:46 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/video_manage.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index 535f76546..ef8e707b3 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -40,6 +40,7 @@ module AliyunVod::Service::VideoManage rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" + "" end # 删除视频信息 From 2a258ac9fb293260993066880fdca8169a6bfa2c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 09:40:04 +0800 Subject: [PATCH 08/32] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A7=86=E9=A2=91?= =?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/services/videos/batch_publish_service.rb | 7 +++---- app/services/videos/dispatch_callback_service.rb | 4 +--- lib/gitlab-cli/.rakeTasks | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index cad8cfbd9..c47906192 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -33,10 +33,9 @@ class Videos::BatchPublishService < ApplicationService code_info = AliyunVod::Service.get_meta_code_info(video.uuid) if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true - #Rails.logger.info("####video.uuid:#{video.uuid}") - #result = AliyunVod::Service.get_play_info(video.uuid) - # Rails.logger.info("####video.result:#{result}") - #video.play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil + play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result + video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 2e3d85987..4ff94a1c4 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,9 +18,7 @@ class Videos::DispatchCallbackService < ApplicationService video.save! when 'SnapshotComplete' then # 封面截图完成 return if video.cover_url.present? - result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result - video.update!(cover_url: params['CoverUrl'], play_url: play_url) + video.update!(cover_url: params['CoverUrl']) when 'StreamTranscodeComplete' then # 转码完成 #return if video.play_url.present? video.update!(play_url: params['FileUrl'], transcoded: true) diff --git a/lib/gitlab-cli/.rakeTasks b/lib/gitlab-cli/.rakeTasks index ea716fd52..f349995e9 100644 --- a/lib/gitlab-cli/.rakeTasks +++ b/lib/gitlab-cli/.rakeTasks @@ -4,4 +4,4 @@ You are allowed to: 1. Remove rake task 2. Add existing rake tasks To add existing rake tasks automatically delete this file and reload the project. ---> +--> From a1521276ed166cc834e113372641e62b4e51f5c9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 09:45:07 +0800 Subject: [PATCH 09/32] 1 --- app/services/videos/batch_publish_service.rb | 3 --- app/services/videos/dispatch_callback_service.rb | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index c47906192..18fa442d8 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -33,9 +33,6 @@ class Videos::BatchPublishService < ApplicationService code_info = AliyunVod::Service.get_meta_code_info(video.uuid) if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true - result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result - video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 4ff94a1c4..7d5f239c6 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,7 +18,9 @@ class Videos::DispatchCallbackService < ApplicationService video.save! when 'SnapshotComplete' then # 封面截图完成 return if video.cover_url.present? - video.update!(cover_url: params['CoverUrl']) + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil + play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result + video.update!(cover_url: params['CoverUrl'],play_url: play_url) when 'StreamTranscodeComplete' then # 转码完成 #return if video.play_url.present? video.update!(play_url: params['FileUrl'], transcoded: true) From df6496556b495ea831830dedbec9cd3af100120d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 09:46:54 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/base.rb | 1 + app/services/videos/batch_publish_service.rb | 3 +++ app/services/videos/dispatch_callback_service.rb | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index ebbcce694..f10f079b4 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -23,6 +23,7 @@ module AliyunVod::Service::Base result rescue => ex ::Util.logger_error(ex) + "" #raise AliyunVod::Error, ex.message end diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 18fa442d8..022098fd4 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -33,6 +33,9 @@ class Videos::BatchPublishService < ApplicationService code_info = AliyunVod::Service.get_meta_code_info(video.uuid) if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil + play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result.present? + video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 7d5f239c6..4ff94a1c4 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,9 +18,7 @@ class Videos::DispatchCallbackService < ApplicationService video.save! when 'SnapshotComplete' then # 封面截图完成 return if video.cover_url.present? - result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result - video.update!(cover_url: params['CoverUrl'],play_url: play_url) + video.update!(cover_url: params['CoverUrl']) when 'StreamTranscodeComplete' then # 转码完成 #return if video.play_url.present? video.update!(play_url: params['FileUrl'], transcoded: true) From f340b54c614b3fbabeb8e8f7e5152a38900f5aa1 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 11 Mar 2020 10:45:15 +0800 Subject: [PATCH 11/32] =?UTF-8?q?=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/user/usersInfo/video/VideoUploadList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index 3c053166a..2558e75fe 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -443,7 +443,7 @@ function VideoUploadList (props) {
上传说明:目前不支持断点续传,单个视频文件最大限制500M,单次最多支持3个视频文件上传
视频规格:avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm
-
温馨提示:为了更好播放的体验,建议您优先上传MP4格式。如果您是自己录制视频,建议您保存的时候将视频编码设置为AVC(H264)
+
温馨提示:为了更好的播放体验,建议您优先上传MP4格式。如果您是自己录制视频,建议您保存的时候将视频编码设置为AVC(H264)
{!noUploads && From 2caaf8c3469a564e8dce6dabef3eb8c9bacc84b7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:51:37 +0800 Subject: [PATCH 12/32] 1 --- app/libs/aliyun_vod/service/video_manage.rb | 9 ++++++--- app/services/videos/batch_publish_service.rb | 7 ++++--- lib/tasks/video_transcode.rake | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index ef8e707b3..d93a0f5ef 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -26,7 +26,7 @@ module AliyunVod::Service::VideoManage result end - # 读取视频编码格式 + # 读取视频编码格式与视频格式 def get_meta_code_info(video_id) params = { Action: 'GetMezzanineInfo', @@ -36,11 +36,14 @@ module AliyunVod::Service::VideoManage result = request(:post, params) Rails.logger.info("#######:#{result['Mezzanine']['VideoStreamList'][0]['CodecName']}") - result['Mezzanine']['VideoStreamList'][0]['CodecName'] + codecnamne = result['Mezzanine']['VideoStreamList'].first['CodecName'] + file_url = result['Mezzanine']['FileURL'] + format = file_url&.split(".")&.last + {codecnamne: codecnamne, format: format} rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" - "" + [codecnamne: "", format: ""] end # 删除视频信息 diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 022098fd4..20ce4ac32 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -29,12 +29,13 @@ class Videos::BatchPublishService < ApplicationService video.status = "published" end - # 标清转码为h264 + # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) - if code_info.present? && code_info.start_with?('h264', 'h265') + Rails.logger.info("code_info: #{ode_info['format']}, #{code_info['codecnamne']}") + if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result.present? + play_url = result['PlayInfoList']['PlayInfo'].first['PlayURL'] if result.present? video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index 955905632..a14b5bf8b 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,7 +3,7 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do Video.find_each do |v| - if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265") + if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)['codecnamne'].start_with?("h264", "h265") p "--- Start submit video trans code #{v.uuid}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') else From a587961744d6a812c8975e7cb44403c5466a95e7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:54:19 +0800 Subject: [PATCH 13/32] 1 --- app/services/videos/batch_publish_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 20ce4ac32..d0b5e8cef 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,7 +31,7 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) - Rails.logger.info("code_info: #{ode_info['format']}, #{code_info['codecnamne']}") + Rails.logger.info("code_info: #{code_info['format']}, #{code_info['codecnamne']}") if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil From 828dbae5d883a46c0a8b904df8f0c1573d58131a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:57:21 +0800 Subject: [PATCH 14/32] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index d0b5e8cef..697d9df7e 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,7 +31,10 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) + Rails.logger.info("code_info: #{code_info}") Rails.logger.info("code_info: #{code_info['format']}, #{code_info['codecnamne']}") + Rails.logger.info("code_info: #{code_info[:format]}, #{code_info[:codecnamne]}") + return if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil From ace5effc7832c77e3d48803cedd567a3f45f6ea7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:58:33 +0800 Subject: [PATCH 15/32] =?UTF-8?q?=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 697d9df7e..553ffe4f2 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,11 +31,8 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) - Rails.logger.info("code_info: #{code_info}") - Rails.logger.info("code_info: #{code_info['format']}, #{code_info['codecnamne']}") Rails.logger.info("code_info: #{code_info[:format]}, #{code_info[:codecnamne]}") - return - if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') + if code_info[:format] == "mp4" && code_info[:codecnamne].present? && code_info[:codecnamne].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil play_url = result['PlayInfoList']['PlayInfo'].first['PlayURL'] if result.present? From b751a79b06157a961535ea77994ef50905cbb645 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:58:58 +0800 Subject: [PATCH 16/32] =?UTF-8?q?=E6=94=B9=E5=8F=98=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index a14b5bf8b..995f9a82f 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,7 +3,7 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do Video.find_each do |v| - if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)['codecnamne'].start_with?("h264", "h265") + if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)[:codecnamne].start_with?("h264", "h265") p "--- Start submit video trans code #{v.uuid}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') else From e466aafa95939c2f726089bc7dfb0de975a658ce Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 12:12:08 +0800 Subject: [PATCH 17/32] 1 --- app/libs/aliyun_vod/service/video_manage.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index d93a0f5ef..f80f31788 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -43,7 +43,7 @@ module AliyunVod::Service::VideoManage {codecnamne: codecnamne, format: format} rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" - [codecnamne: "", format: ""] + {codecnamne: "", format: ""} end # 删除视频信息 From 89875130b48c6b885f8e8992da03806714e845b9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 12:26:53 +0800 Subject: [PATCH 18/32] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=A7=86=E8=A7=92?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=9C=AA?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 4 +++- app/models/attachment.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 8f024c1c6..0ee83e839 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -238,7 +238,9 @@ module CoursesHelper # 获取课堂的资源数 def get_attachment_count(course, category_id) - category_id.to_i == 0 ? course.attachments.size : course.attachments.where(course_second_category_id: category_id).size + identity = current_user.course_identity(course) + attachments = category_id.to_i == 0 ? course.attachments : course.attachments.where(course_second_category_id: category_id) + identity > Course::ASSISTANT_PROFESSOR ? attachments.published.size : attachments.size end # 获取课堂的视频数 diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 3ff9a6a90..1a9b50c3b 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -24,6 +24,7 @@ class Attachment < ApplicationRecord scope :simple_columns, -> { select(:id, :filename, :filesize, :created_on, :cloud_url, :author_id, :content_type, :container_type, :container_id) } scope :search_by_container, -> (ids) {where(container_id: ids)} scope :unified_setting, -> {where("unified_setting = ? ", 1)} + scope :published, -> {where(is_publish: 1)} validates_length_of :description, maximum: 100, message: "不能超过100个字符" From 8fc0396af695bd06bc83ef9e192083c16c263744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 13:28:01 +0800 Subject: [PATCH 19/32] =?UTF-8?q?=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/coursesDetail/CoursesBanner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 7d2791b15..98c56ff37 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -706,7 +706,7 @@ class CoursesBanner extends Component { {this.props.isStudent()?this.props.current_user&&this.props.current_user.course_is_end===true?"": this.exitclass()} - > 退出课堂 :""} + > 永久退出课堂 :""} From fb05f15f45a0a33f52c13acacfb0b4476609a9e3 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, 11 Mar 2020 13:39:10 +0800 Subject: [PATCH 20/32] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?= =?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 --- .../src/modules/courses/Resource/index.js | 40 ++++++++++++------- .../courses/busyWork/CommonWorkList.js | 2 +- .../courses/coursesDetail/CoursesLeftNav.js | 39 ++++++++++++------ .../courses/shixunHomework/shixunHomework.js | 5 ++- .../src/modules/tpm/shixuns/shixun-card.js | 2 +- 5 files changed, 56 insertions(+), 32 deletions(-) diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 11b81c33d..d5d777f3b 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -64,6 +64,7 @@ class Fileslists extends Component{ }); } componentDidMount=()=>{ + this.getcourse_groupslists() this.setState({ isSpin:true, @@ -85,43 +86,45 @@ class Fileslists extends Component{ this.seactall(parseInt(this.props.match.params.Id),"desc") } this.updadatalist(); - on('updateNavSuccess', this.updateNavSuccess) - on('updateNavSuccess',this.updadatalist) + on('files', this.updateNavSuccess) + on('files',this.updadatalist) } updateNavSuccess=()=>{ + let{sort}=this.state; this.setState({ isSpin:true }) if(this.props.match.params.main_id){ + this.seactall(undefined,sort); }else if(this.props.match.params.Id){ + this.seactall(parseInt(this.props.match.params.Id),sort) } } componentDidUpdate = (prevProps) => { - if(prevProps.coursesidtype!=this.props.coursesidtype||prevProps.match.params.main_id!=this.props.match.params.main_id||prevProps.match.params.Id!=this.props.match.params.Id){ + if(prevProps.coursesidtype!=this.props.coursesidtype||prevProps.match.params.Id!=this.props.match.params.Id&&this.props.coursesidtype!="node") { + if(this.props.coursesidtype==="node") { - if(this.props.match.params.main_id){ this.getcourse_groupslists() this.setState({ - isSpin:true, - checkBoxValues:[], - checkAllValue:false, + isSpin: true, + checkBoxValues: [], + checkAllValue: false, }) - if(this.props.match.params.main_id!=undefined){ + if (this.props.match.params.main_id != undefined) { this.setState({ - child:false, - sort:"desc" + child: false, + sort: "desc" }) - this.seactall(undefined,"desc"); + this.seactall(undefined, "desc"); } - } + }else{ - if(this.props.match.params.Id){ this.getcourse_groupslists() this.setState({ isSpin:true, @@ -136,8 +139,12 @@ class Fileslists extends Component{ this.seactall(parseInt(this.props.match.params.Id),"desc") } } + } + + + } updadatalist=(id)=>{ @@ -174,6 +181,7 @@ class Fileslists extends Component{ } updatafiled=()=>{ + let{sort}=this.state; if(this.props.match.params.main_id){ this.seactall(undefined,sort); @@ -640,7 +648,7 @@ class Fileslists extends Component{ } Settingtypess=(id,title,link)=>{ - debugger + this.setState({ Addanexternallink:true, Exterchainname:"资源设置", @@ -951,10 +959,12 @@ class Fileslists extends Component{ } secondRowLeft={ -
+ this.props.isAdmin()?
共 {total_count} 个资源 已发布:{publish_count}个 未发布:{unpublish_count}个 +
:
+ 共 {publish_count} 个资源
} onPressEnter={this.onPressEnter} diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 58156beea..e2b70aed5 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -775,7 +775,7 @@ class CommonWorkList extends Component{ const hasData = this.state.homework_status && this.state.homework_status.indexOf("未发布") == -1 // student_works && !!student_works.length && page == 1 && - console.log(StudentData) + //console.log(StudentData) // console.log(student_works) return( diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 63466646e..1c627b78d 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -536,7 +536,7 @@ class Coursesleftnav extends Component{ successFunc && successFunc(1); } - saveNavmodapost=(url,value,positiontype,coursesId)=>{ + saveNavmodapost=(url,value,positiontype,coursesId,type)=>{ axios.post(url, {name:value}).then((result)=>{ @@ -548,16 +548,29 @@ class Coursesleftnav extends Component{ description:result.data.message }); - if(positiontype==="shixun_homeworks"){ - this.updasaveNavmoda() - trigger('updateNavSuccess') - this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`); + if(positiontype==="shixun_homeworks"||positiontype==="shixun_homework"){ + if(type===true){ + this.updasaveNavmoda() + trigger('shixun') + }else{ + this.updasaveNavmoda() + this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`); + + } } - if(positiontype==="files"){ - this.updasaveNavmoda() - trigger('updateNavSuccess') - this.props.history.push(`/classrooms/${coursesId}/file/${result.data.category_id}`); - } + + if(positiontype==="files"||positiontype==="file"){ + + if(type===true){ + this.updasaveNavmoda() + trigger('files') + + }else{ + this.updasaveNavmoda() + this.props.history.push(`/classrooms/${coursesId}/file/${result.data.category_id}`); + } + + } if(positiontype==="boards"){ this.updasaveNavmoda() @@ -565,7 +578,7 @@ class Coursesleftnav extends Component{ this.props.history.push(`/classrooms/${coursesId}/boards/${result.data.category_id}`); } - if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"){ + if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"&&positiontype!="shixun_homework"){ this.updasaveNavmoda() } @@ -640,12 +653,12 @@ class Coursesleftnav extends Component{ }else if(Navmodaltypename===3){ let url="/course_modules/"+id+"/rename_module.json" - this.saveNavmodapost(url,NavmodalValue) + this.saveNavmodapost(url,NavmodalValue,this.state.positiontype,null,true) }else if(Navmodaltypename===4){ let url="/course_second_categories/"+id+"/rename_category.json"; - this.saveNavmodapost(url,NavmodalValue) + this.saveNavmodapost(url,NavmodalValue,this.state.positiontype,null,true) }else if(Navmodaltypename===5){ diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index a6fca8e0b..5b6eda89f 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -58,6 +58,7 @@ class ShixunHomework extends Component{ } } updateNavSuccess=()=>{ + debugger this.setState({ isSpin:true }) @@ -111,7 +112,7 @@ class ShixunHomework extends Component{ this.updadatalist() } } - on('updateNavSuccess', this.updateNavSuccess) + on('shixun', this.updateNavSuccess) } seactall=(id)=>{ this.setState({ @@ -146,7 +147,7 @@ class ShixunHomework extends Component{ componentDidUpdate = (prevProps) => { - if(prevProps.coursesidtype!=this.props.coursesidtype||prevProps.match.params.main_id!=this.props.match.params.main_id||prevProps.match.params.category_id!=this.props.match.params.category_id) { + if(prevProps.coursesidtype!=this.props.coursesidtype||prevProps.match.params.category_id!=this.props.match.params.category_id&&this.props.coursesidtype!="node") { if(this.props.match.params.main_id){ if(this.props.match.params.main_id!=undefined){ diff --git a/public/react/src/modules/tpm/shixuns/shixun-card.js b/public/react/src/modules/tpm/shixuns/shixun-card.js index 5fe07d074..f33f4f157 100644 --- a/public/react/src/modules/tpm/shixuns/shixun-card.js +++ b/public/react/src/modules/tpm/shixuns/shixun-card.js @@ -83,7 +83,7 @@ export default ({ middleshixundata, pagination, typepvisible, pages, totalcount,
-
From f618ca305fe9aafcfec27fb38809d92bec9fcf20 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 11 Mar 2020 14:40:22 +0800 Subject: [PATCH 21/32] =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/course/WordsBtn.js | 4 ++-- .../src/modules/courses/Video/LiveItem.js | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/public/react/src/common/course/WordsBtn.js b/public/react/src/common/course/WordsBtn.js index 6828cca99..7fdb08d15 100644 --- a/public/react/src/common/course/WordsBtn.js +++ b/public/react/src/common/course/WordsBtn.js @@ -13,14 +13,14 @@ class WordsBtn extends Component { { to==undefined&&targets==undefined ? - {this.props.children}: targets!=undefined? {this.props.children} : - {this.props.children} } diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js index b71e5b02b..b54b0f03d 100644 --- a/public/react/src/modules/courses/Video/LiveItem.js +++ b/public/react/src/modules/courses/Video/LiveItem.js @@ -158,18 +158,18 @@ class LiveItem extends Component{ { item.live_time && 开播时间:{item.live_time}} { item.duration && 直播预计时长:{item.duration}分钟 } - - { - item.op_auth ? - setLiveId(item.id)}>编辑:"" - } - { - item.delete_auth ? - this.deleteLive(item.id)}>删除 - :"" - } - -

+ + { + item.op_auth ? + setLiveId(item.id)}>编辑:"" + } + { + item.delete_auth ? + this.deleteLive(item.id)}>删除 + :"" + } + +

) } From d7dc5cfa01cc19fe5e8d62b2e91247cbb1682268 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, 11 Mar 2020 14:53:17 +0800 Subject: [PATCH 22/32] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=A4=B4=E9=83=A8=E5=BC=B9=E7=AA=97=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/paths/PathDetail/sendPanel.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/sendPanel.js b/public/react/src/modules/paths/PathDetail/sendPanel.js index a4c14f1ef..1491ea903 100644 --- a/public/react/src/modules/paths/PathDetail/sendPanel.js +++ b/public/react/src/modules/paths/PathDetail/sendPanel.js @@ -188,6 +188,7 @@ class sendPanel extends Component{ :'' } +
- :"" } - `}
From 74979f72fcf650193114b11d67f616bc7d794345 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, 11 Mar 2020 15:51:46 +0800 Subject: [PATCH 23/32] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=B7=B3=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/busyWork/CommonWorkList.js | 3 ++- .../shixunHomework/Listofworksstudentone.js | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index e2b70aed5..549dd6ae3 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -378,7 +378,8 @@ function buildColumns(that, student_works, studentData) { {/* /classrooms/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */} that.props.toWorkDetailPage2(e, courseId, workId, record.id)} - onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}>{isAdmin ? '评阅' : '查看'} + // onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)} + >{isAdmin ? '评阅' : '查看'}
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 3ebd4fab3..d83f51c0a 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -502,7 +502,8 @@ class Listofworksstudentone extends Component { this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating} + // onClick={() => this.Viewstudenttraininginformation(record)} + >{record.operating} } @@ -897,7 +898,8 @@ class Listofworksstudentone extends Component { this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating} + // onClick={() => this.Viewstudenttraininginformation(record)} + >{record.operating} } @@ -1295,11 +1297,13 @@ class Listofworksstudentone extends Component { record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "} : + // onClick={() => this.Viewstudenttraininginformationt(record)} + >{record.has_comment===true?"详情":"评阅 "} : this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "} + // onClick={() => this.Viewstudenttraininginformationt(record)} + >{record.has_comment===true?"详情":"评阅 "} ) }, @@ -1657,11 +1661,13 @@ class Listofworksstudentone extends Component { record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"} : + // onClick={() => this.Viewstudenttraininginformationt(record)} + >{record.has_comment===true?"详情":"评阅"} : this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"} + // onClick={() => this.Viewstudenttraininginformationt(record)} + >{record.has_comment===true?"详情":"评阅"} ) }, From 81cb771bcd883d95243c0965a5622015d0234a07 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 16:16:50 +0800 Subject: [PATCH 24/32] =?UTF-8?q?=E6=99=AE=E9=80=9A=E5=92=8C=E5=88=86?= =?UTF-8?q?=E7=BB=84=E4=BD=9C=E4=B8=9A=E5=A2=9E=E5=8A=A0=E5=AD=90=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/helpers/courses_helper.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 94e95adbe..a102f92de 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1297,7 +1297,7 @@ class CoursesController < ApplicationController @is_teacher = @user_course_identity < Course::ASSISTANT_PROFESSOR @course_modules = @course.course_modules.where(hidden: 0) @hidden_modules = @course.course_modules.where(hidden: 1) - @second_category_type = ["shixun_homework", "graduation", "attachment", "board", "course_group", "video"] + @second_category_type = ["shixun_homework", "graduation", "attachment", "board", "course_group", "video", "common_homework", "group_homework"] end def board_list diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 0ee83e839..27444b3c9 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -89,6 +89,10 @@ module CoursesHelper case category.category_type when "shixun_homework" "/classrooms/#{course.id}/shixun_homework/#{category.id}" + when "common_homework" + "/classrooms/#{course.id}/common_homework/#{category.id}" + when "group_homework" + "/classrooms/#{course.id}/group_homework/#{category.id}" when "graduation" if category.name == "毕设选题" "/classrooms/#{course.id}/graduation_topics/#{category.course_module_id}" @@ -107,6 +111,10 @@ module CoursesHelper case category.category_type when "shixun_homework" get_homework_commons_count(course, 4, category.id) + when "common_homework" + get_homework_commons_count(course, 1, category.id) + when "group_homework" + get_homework_commons_count(course, 3, category.id) when "graduation" if category.name == "毕设选题" course.graduation_topics_count From 52c2d38d602d6b28e6c7514db5e9f3b4a73cb101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 16:25:47 +0800 Subject: [PATCH 25/32] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/common/quillForEditor/ImageBlot.js | 23 ++- .../question/component/ChoquesEditor.js | 146 ++++++++++++++---- .../question/component/JudquestionEditor.js | 25 ++- .../question/component/SingleEditor.js | 128 ++++++++++++--- 4 files changed, 266 insertions(+), 56 deletions(-) diff --git a/public/react/src/common/quillForEditor/ImageBlot.js b/public/react/src/common/quillForEditor/ImageBlot.js index 0a9bec733..6e585f31f 100644 --- a/public/react/src/common/quillForEditor/ImageBlot.js +++ b/public/react/src/common/quillForEditor/ImageBlot.js @@ -1,7 +1,7 @@ /* * @Description: 重写图片 * @Author: tangjiang - * @Github: + * @Github: * @Date: 2019-12-16 15:50:45 * @LastEditors : tangjiang * @LastEditTime : 2019-12-31 13:59:02 @@ -17,9 +17,14 @@ export default class ImageBlot extends BlockEmbed { const node = super.create(); node.setAttribute('alt', value.alt); node.setAttribute('src', value.url); + console.log('~~~~~~~~~~~', node, value); node.addEventListener('click', function () { - value.onclick(value.url); - }, false); + try { + value.onclick(value.url); + }catch (e) { + + } + }, false); if (value.width) { node.setAttribute('width', value.width); } @@ -35,6 +40,16 @@ export default class ImageBlot extends BlockEmbed { node.setAttribute('width', '100%'); } + // node.setAttribute('style', { cursor: 'pointer' }); + + // if (node.onclick) { + // console.log('image 有图片点击事件======》》》》》》'); + // // node.setAttribute('onclick', node.onCLick); + // } + // 给图片添加点击事件 + // node.onclick = () => { + // value.onClick && value.onClick(value.url); + // } return node; } @@ -54,4 +69,4 @@ export default class ImageBlot extends BlockEmbed { } ImageBlot.blotName = 'image'; -ImageBlot.tagName = 'img'; \ No newline at end of file +ImageBlot.tagName = 'img'; diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 512e6e373..640205d92 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -79,6 +79,8 @@ class ChoquesEditor extends Component{ question_titlesysl:this.props.question_titlesysl||'', question_titleysl:this.props.question_title || '', item_banksedit:[], + bindinginputs:null, + url:"", } } addOption = () => { @@ -175,7 +177,14 @@ class ChoquesEditor extends Component{ this.props.onEditorCancel() } + handleShowUploadImage = (url,i) => { + this.setState({ + url:url, + bindinginputs:i + }) + + } componentDidMount = () => { try { @@ -228,10 +237,22 @@ class ChoquesEditor extends Component{ } var texts; const _text = quill.getText(); + // console.log("onOptionContentChange"); + // console.log(value); + // console.log(value.ops.length); + // console.log(_text); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; if (!reg.test(_text)) { // 处理编辑器内容为空 texts=""; + try { + if(value.ops.length>1){ + //单独图片的话 _text是为空的 + texts=JSON.stringify(value); + } + }catch (e) { + + } } else { if(_text.length>=500){ var result = _text.substring(0,450); @@ -288,40 +309,68 @@ class ChoquesEditor extends Component{ if (!reg.test(_text)) { // 处理编辑器内容为空 this.setState({ - question_titleysl:"" + question_titleysl:"", }) + try { + if(value.ops.length>1) { + this.setState({ + question_titleysl:JSON.stringify(value), + }) + } + }catch (e) { + + } } else { // 提交到后台的内容需要处理一下; try { let texts = JSON.stringify(value); this.setState({ - question_titleysl:texts + question_titleysl:texts, }) }catch (e) { this.setState({ - question_titleysl:"" + question_titleysl:"", }) } } } + bindinginputs=(i)=>{ + this.setState({ + bindinginputs:i + }) + + } + + onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; if (!reg.test(_text)) { // 处理编辑器内容为空 this.setState({ - question_titlesysl:"" + question_titlesysl:"", }) + try { + if(value.ops.length>1){ + //单独图片的话 _text是为空的 + this.setState({ + question_titlesysl:JSON.stringify(value), + }) + } + }catch (e) { + + } } else { // 提交到后台的内容需要处理一下; try { let texts = JSON.stringify(value); this.setState({ - question_titlesysl:texts + question_titlesysl:texts, + }) }catch (e) { this.setState({ - question_titlesysl:"" + question_titlesysl:"", }) } @@ -330,7 +379,7 @@ class ChoquesEditor extends Component{ render() { - let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state; + let { question_title, question_score, question_type, question_choices, standard_answers,question_titles,bindinginputs} = this.state; let { question_id, index, exerciseIsPublish, // question_title, // question_type, @@ -382,6 +431,20 @@ class ChoquesEditor extends Component{ .signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{ font-family: MicrosoftYaHei; } + + .content_editorMd_show{ + display: flex !important; + margin-top:0px !important; + border-radius:2px !important; + max-width: 1056px !important; + word-break:break-all !important; + border:1px solid rgba(221,221,221,1) !important; + } + .contestedtext{ + font-size:14px; + font-family:MicrosoftYaHei; + color:rgba(172,172,172,1); + } `}

{/* {!question_id ? '新建' : '编辑'} */} @@ -391,7 +454,7 @@ class ChoquesEditor extends Component{ {question_choices.map( (item, index) => { + // console.log("question_choices"); + // console.log(item); const bg = standard_answers[index] ? 'check-option-bg' : '' return

0?"df optionRow mt15": "df optionRow"} > {/* 点击设置答案 */} @@ -423,25 +488,51 @@ class ChoquesEditor extends Component{ { item===undefined||item===null||item===""? - this.onOptionContentChange(value,quill,index)} - /> +
+ { + bindinginputs===null||bindinginputs!==index? +
this.bindinginputs(index)}> + {/*

请您输入选项

*/} +
: + this.onOptionContentChange(value,quill,index)} + showUploadImage={(url)=>this.handleShowUploadImage(url,index)} + /> + + } +
: - this.onOptionContentChange(value,quill,index)} - /> +
+ { + bindinginputs===null||bindinginputs!==index? +
this.bindinginputs(index)}> + + this.handleShowUploadImage(url,index)} + /> +
+ : + this.onOptionContentChange(value,quill,index)} + showUploadImage={(url)=>this.handleShowUploadImage(url,index)} + /> + } + +
}
@@ -474,12 +565,13 @@ class ChoquesEditor extends Component{
diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 868700c6b..ab7e930b1 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -310,7 +310,16 @@ class JudquestionEditor extends Component{ this.setState({ question_titleysl:"" }) - // console.log("空"); + try { + if(value.ops.length>1){ + //单独图片的话 _text是为空的 + this.setState({ + question_titleysl:JSON.stringify(value), + }) + } + }catch (e) { + + } } else { // 提交到后台的内容需要处理一下; try { @@ -334,6 +343,16 @@ class JudquestionEditor extends Component{ this.setState({ question_titlesysl:"" }) + try { + if(value.ops.length>1){ + //单独图片的话 _text是为空的 + this.setState({ + question_titlesysl:JSON.stringify(value), + }) + } + }catch (e) { + + } } else { // 提交到后台的内容需要处理一下; try { @@ -412,7 +431,7 @@ class JudquestionEditor extends Component{ { @@ -249,8 +251,23 @@ class SingleEditor extends Component{ // standard_answers[index] = !standard_answers[index]; this.setState({ standard_answers }) } + + handleShowUploadImage = (url,i) => { + + this.setState({ + url:url, + bindinginputs:i + }) + + } + bindinginputs=(i)=>{ + this.setState({ + bindinginputs:i + }) + + } + onOptionContentChange = (value,quill,index) => { - debugger if (index >= this.state.question_choices.length) { // TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3 return; @@ -261,6 +278,14 @@ class SingleEditor extends Component{ if (!reg.test(_text)) { // 处理编辑器内容为空 texts=""; + try { + if(value.ops.length>1){ + //单独图片的话 _text是为空的 + texts=JSON.stringify(value); + } + }catch (e) { + + } } else { if(_text.length>=500){ var result = _text.substring(0,450); @@ -318,6 +343,16 @@ class SingleEditor extends Component{ this.setState({ question_titleysl:"" }) + try { + if(value.ops.length>1){ + //单独图片的话 _text是为空的 + this.setState({ + question_titleysl:JSON.stringify(value), + }) + } + }catch (e) { + + } } else { try { let texts = JSON.stringify(value); @@ -341,6 +376,16 @@ class SingleEditor extends Component{ this.setState({ question_titlesysl:"" }) + try { + if(value.ops.length>1){ + //单独图片的话 _text是为空的 + this.setState({ + question_titlesysl:JSON.stringify(value), + }) + } + }catch (e) { + + } } else { try { let texts = JSON.stringify(value); @@ -363,7 +408,7 @@ class SingleEditor extends Component{ } render() { - let { question_title, question_score, question_type, question_choices, standard_answers,question_titles,question_titlesysl} = this.state; + let { question_title, question_score, question_type, question_choices, standard_answers,question_titles,question_titlesysl,bindinginputs} = this.state; let { question_id, index, exerciseIsPublish, // question_title, // question_type, @@ -417,6 +462,19 @@ class SingleEditor extends Component{ .signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{ font-family: MicrosoftYaHei; } + .content_editorMd_show{ + display: flex !important; + margin-top:0px !important; + border-radius:2px !important; + max-width: 1056px !important; + word-break:break-all !important; + border:1px solid rgba(221,221,221,1) !important; + } + .contestedtext{ + font-size:14px; + font-family:MicrosoftYaHei; + color:rgba(172,172,172,1); + } `}

{/* {!question_id ? '新建' : '编辑'} */} @@ -426,7 +484,7 @@ class SingleEditor extends Component{ { item===undefined||item===null||item===""? - this.onOptionContentChange(value,quill,index)} - /> +

+ { + bindinginputs===null||bindinginputs!==index? +
this.bindinginputs(index)}> + {/*

请您输入选项

*/} +
: + this.onOptionContentChange(value,quill,index)} + showUploadImage={(url)=>this.handleShowUploadImage(url,index)} + /> + + } +
: - this.onOptionContentChange(value,quill,index)} - /> +
+ { + bindinginputs===null||bindinginputs!==index? +
this.bindinginputs(index)}> + + this.handleShowUploadImage(url,index)} + /> +
+ : + this.onOptionContentChange(value,quill,index)} + showUploadImage={(url)=>this.handleShowUploadImage(url,index)} + /> + } + +
} @@ -509,7 +593,7 @@ class SingleEditor extends Component{
Date: Wed, 11 Mar 2020 16:25:59 +0800 Subject: [PATCH 26/32] =?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/homework_commons_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 4515e5482..0e3771e61 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -34,7 +34,7 @@ class HomeworkCommonsController < ApplicationController module_type = @homework_type == 4 ? "shixun_homework" : @homework_type == 1 ? "common_homework" : "group_homework" @homework_commons = @course.homework_commons.where(homework_type: @homework_type) @main_category = @course.course_modules.find_by(module_type: module_type) - if @homework_type == 4 && !params[:category].blank? + if !params[:category].blank? @category = @main_category.course_second_categories.find_by(id: params[:category]) tip_exception("子目录id有误") if !@category.present? @homework_commons = @homework_commons.where(course_second_category_id: params[:category]) From 076cc1bae9f9b809f63076965277252bbc4eb05e Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 11 Mar 2020 16:31:46 +0800 Subject: [PATCH 27/32] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=94=BE=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/hooks/ImageLayer2.js | 2 +- public/react/src/modules/page/layers/ImageLayer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/common/hooks/ImageLayer2.js b/public/react/src/common/hooks/ImageLayer2.js index 2b1979c74..202a7f343 100644 --- a/public/react/src/common/hooks/ImageLayer2.js +++ b/public/react/src/common/hooks/ImageLayer2.js @@ -16,7 +16,7 @@ function ImageLayer2(props) { const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href') // 判断imageSrc是否是图片 const fileName = event.target.innerHTML.trim() - if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName) || event.target.tagName == 'IMG' || imageSrc.indexOf('base64,') != -1) { + if (isImageExtension((imageSrc && imageSrc.trim())) || isImageExtension(fileName) || event.target.tagName == 'IMG' || (imageSrc && imageSrc.indexOf('base64,')) != -1) { // 非回复里的头像图片; 非emoticons if (imageSrc.indexOf('/images/avatars/User') === -1 && imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) { diff --git a/public/react/src/modules/page/layers/ImageLayer.js b/public/react/src/modules/page/layers/ImageLayer.js index 921a47d8c..b1adc5b6b 100644 --- a/public/react/src/modules/page/layers/ImageLayer.js +++ b/public/react/src/modules/page/layers/ImageLayer.js @@ -19,7 +19,7 @@ class ImageLayer extends Component { {showImage ?
-
+
: From bd0060fe87262ed120c7aadf9f843a3a2da106cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 16:33:08 +0800 Subject: [PATCH 28/32] =?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/question/Questionitem_banks.js | 24 ++++++++++++++++++- .../question/component/ChoquesEditor.js | 6 +++++ .../question/component/SingleEditor.js | 4 ++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index aade5de2e..345ca9753 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -22,6 +22,7 @@ import JudquestionEditor from "./component/JudquestionEditor"; import Bottomsubmit from "../../modules/modals/Bottomsubmit"; import { connect } from 'react-redux'; import actions from "../../redux/actions"; +import QuestionModalPicture from "./component/QuestionModalPicture"; var restricte=false; class Questionitem_banks extends Component { constructor(props) { @@ -38,6 +39,7 @@ class Questionitem_banks extends Component { knowledgepoints: [], disciplmy:[], pages:1, + url:'' } @@ -526,14 +528,32 @@ class Questionitem_banks extends Component { this.scrollToAnchor("Itembankstopid"); } + handleShowUploadImage=(url)=>{ + this.setState({ + url:url + }) + } + handleClose=()=>{ + this.setState({ + url:'', + }) + } + + render() { - let {page, limit, count, Headertop, visible, placement, modalsType, item_type,restricte} = this.state; + let {page, limit, count, Headertop, visible, placement, modalsType, item_type,restricte,url} = this.state; const params = this.props && this.props.match && this.props.match.params; // ////console.log(params); return (
+ + {url? + this.handleClose()}> + : + "" + } { restricte===false? this.getanswerMdRef(ref)} + handleShowUploadImage={(url)=>this.handleShowUploadImage(url)} > @@ -594,6 +615,7 @@ class Questionitem_banks extends Component { {...this.state} {...this.props} getanswerMdRef={(ref) => this.getChoquesEditor(ref)} + handleShowUploadImage={(url)=>this.handleShowUploadImage(url)} > diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 640205d92..3277f03c9 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -184,6 +184,12 @@ class ChoquesEditor extends Component{ bindinginputs:i }) + try { + this.props.handleShowUploadImage(url) + }catch (e) { + + } + } componentDidMount = () => { diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 659cd90a2..b34bfa9bb 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -258,7 +258,11 @@ class SingleEditor extends Component{ url:url, bindinginputs:i }) + try { + this.props.handleShowUploadImage(url) + }catch (e) { + } } bindinginputs=(i)=>{ this.setState({ From 084f77fcca1ef50b79af36c47c8b7cf553c48ffb Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 16:39:29 +0800 Subject: [PATCH 29/32] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E5=8A=A9?= =?UTF-8?q?=E6=95=99=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 5 ++++- app/views/exercises/common_header.json.jbuilder | 2 +- app/views/exercises/index.json.jbuilder | 2 +- db/migrate/20200311082736_add_auth_to_exercise.rb | 5 +++++ 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20200311082736_add_auth_to_exercise.rb diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 15f5c67d9..e5d9fc495 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -379,6 +379,7 @@ class ExercisesController < ApplicationController #试卷的提交设置 def commit_setting + tip_exception("助教无权限修改本试卷") if @user_course_identity == Course::ASSISTANT_PROFESSOR && !@exercise.assistant_auth ActiveRecord::Base.transaction do error_count = 0 # 判断循环里是否有已发布/已截止的,且时间更改了的分班。 # course_group_ids = @course.teacher_course_group_ids(current_user.id) #当前老师的班级id数组 @@ -398,6 +399,7 @@ class ExercisesController < ApplicationController choice_random = params[:choice_random] ? true : false score_open = params[:score_open] ? true : false #分数是否公开 answer_open = params[:answer_open] ? true : false #答案是否公开 + assistant_auth = params[:assistant_auth] ? true : false # 助教权限 # 统一设置或者分班为0,则更新试卷,并删除试卷分组 if unified_setting || (course_group_ids.size == 0) @@ -426,7 +428,8 @@ class ExercisesController < ApplicationController :answer_open => answer_open, :exercise_status => exercise_status_n, :publish_time => params_publish_time, - :end_time => params_end_time + :end_time => params_end_time, + :assistant_auth => assistant_auth } @exercise.update!(exercise_params) @exercise.exercise_group_settings.destroy_all diff --git a/app/views/exercises/common_header.json.jbuilder b/app/views/exercises/common_header.json.jbuilder index d43d7c3f8..7843c260e 100644 --- a/app/views/exercises/common_header.json.jbuilder +++ b/app/views/exercises/common_header.json.jbuilder @@ -1,5 +1,5 @@ json.course_is_end @course.is_end # true表示已结束,false表示未结束 -json.extract! @exercise, :id,:exercise_name,:exercise_description,:show_statistic +json.extract! @exercise, :id,:exercise_name,:exercise_description,:show_statistic,:assistant_auth json.time (@user_left_time.to_i / 60) json.exercise_status @ex_status diff --git a/app/views/exercises/index.json.jbuilder b/app/views/exercises/index.json.jbuilder index c8f6cd380..e1c8bd3a4 100644 --- a/app/views/exercises/index.json.jbuilder +++ b/app/views/exercises/index.json.jbuilder @@ -2,7 +2,7 @@ if @exercises_count > 0 json.exercises do json.array! @exercises do |exercise| - json.extract! exercise, :id, :exercise_name,:is_public,:created_at + json.extract! exercise, :id, :exercise_name,:is_public,:created_at,:assistant_auth if @is_teacher_or == 2 second_left = get_exercise_left_time(exercise,@current_user_) json.time second_left.present? ? (second_left / 60) : nil diff --git a/db/migrate/20200311082736_add_auth_to_exercise.rb b/db/migrate/20200311082736_add_auth_to_exercise.rb new file mode 100644 index 000000000..fceb96e0c --- /dev/null +++ b/db/migrate/20200311082736_add_auth_to_exercise.rb @@ -0,0 +1,5 @@ +class AddAuthToExercise < ActiveRecord::Migration[5.2] + def change + add_column :exercises, :assistant_auth, :boolean, default: 1 + end +end From 6f12e3de097841e7c70b77448c7189da65e39932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 16:43:39 +0800 Subject: [PATCH 30/32] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/question/Questionitem_banks.js | 3 ++- .../modules/question/component/ChoquesEditor.js | 12 ++++++++++++ .../question/component/JudquestionEditor.js | 15 +++++++++++++++ .../modules/question/component/SingleEditor.js | 12 ++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index 345ca9753..503e6f5de 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -529,6 +529,7 @@ class Questionitem_banks extends Component { } handleShowUploadImage=(url)=>{ + debugger this.setState({ url:url }) @@ -550,7 +551,7 @@ class Questionitem_banks extends Component { > {url? - this.handleClose()}> + this.handleClose()}> : "" } diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 3277f03c9..82cd7b1b4 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -176,7 +176,16 @@ class ChoquesEditor extends Component{ onCancel = () => { this.props.onEditorCancel() } + handleShowUploadImages=(url)=>{ + this.setState({ + url:url, + }) + try { + this.props.handleShowUploadImage(url) + }catch (e) { + } + } handleShowUploadImage = (url,i) => { this.setState({ @@ -466,6 +475,8 @@ class ChoquesEditor extends Component{ options={options} value={question_title} onContentChange={this.onContentChange} + showUploadImage={(url)=>this.handleShowUploadImages(url)} + /> @@ -577,6 +588,7 @@ class ChoquesEditor extends Component{ options={options} value={question_titles} onContentChange={this.onContentChanges} + showUploadImage={(url)=>this.handleShowUploadImages(url)} /> diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index ab7e930b1..baea3391f 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -58,6 +58,7 @@ class JudquestionEditor extends Component{ zqda:null, item_banksedit:[], mychoicess:[], + url:'' } } addOption = () => { @@ -334,6 +335,16 @@ class JudquestionEditor extends Component{ } } } + handleShowUploadImages=(url)=>{ + this.setState({ + url:url, + }) + try { + this.props.handleShowUploadImage(url) + }catch (e) { + + } + } onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; @@ -437,6 +448,8 @@ class JudquestionEditor extends Component{ options={options} value={question_title} onContentChange={this.onContentChange} + showUploadImage={(url)=>this.handleShowUploadImages(url)} + /> @@ -487,6 +500,8 @@ class JudquestionEditor extends Component{ options={options} value={question_titles} onContentChange={this.onContentChanges} + showUploadImage={(url)=>this.handleShowUploadImages(url)} + />
diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index b34bfa9bb..06b057c82 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -251,6 +251,16 @@ class SingleEditor extends Component{ // standard_answers[index] = !standard_answers[index]; this.setState({ standard_answers }) } + handleShowUploadImages=(url)=>{ + this.setState({ + url:url, + }) + try { + this.props.handleShowUploadImage(url) + }catch (e) { + + } + } handleShowUploadImage = (url,i) => { @@ -494,6 +504,7 @@ class SingleEditor extends Component{ options={options} value={question_title} onContentChange={this.onContentChange} + showUploadImage={(url)=>this.handleShowUploadImages(url)} />
@@ -603,6 +614,7 @@ class SingleEditor extends Component{ options={options} value={question_titles} onContentChange={this.onContentChanges} + showUploadImage={(url)=>this.handleShowUploadImages(url)} />
From e39f7e9f0c2883df3e550a0ba8d7bbfaa602caac Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 11 Mar 2020 17:13:42 +0800 Subject: [PATCH 31/32] =?UTF-8?q?=E5=AD=A6=E9=99=A2=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/college/College.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/college/College.js b/public/react/src/college/College.js index 15b0e82f8..bc8f2a3a2 100644 --- a/public/react/src/college/College.js +++ b/public/react/src/college/College.js @@ -907,7 +907,7 @@ class College extends Component {
{ - teachers_count? + teachers_count || teachers_count===0?
{teachers_count}
: @@ -915,7 +915,7 @@ class College extends Component {
{ - students_count? + students_count || students_count===0?
{students_count}
: @@ -923,7 +923,7 @@ class College extends Component {
{ - courses_count? + courses_count || courses_count === 0?
{courses_count}
: @@ -931,7 +931,7 @@ class College extends Component {
{ - shixuns_count? + shixuns_count || shixuns_count === 0?
{shixuns_count}
: @@ -939,7 +939,7 @@ class College extends Component {
{ - shixun_report_count? + shixun_report_count || shixun_report_count===0?
{shixun_report_count}
: @@ -947,7 +947,7 @@ class College extends Component {
{ - shixun_time? + shixun_time || shixun_time === 0 ?
{shixun_time}
: From 1ccb16f76d8235e6ec29de8590aae3b4aa35c106 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 17:34:38 +0800 Subject: [PATCH 32/32] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...311092049_add_index_user_id_challenge_id_for_games.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb diff --git a/db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb b/db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb new file mode 100644 index 000000000..c9fab49d4 --- /dev/null +++ b/db/migrate/20200311092049_add_index_user_id_challenge_id_for_games.rb @@ -0,0 +1,9 @@ +class AddIndexUserIdChallengeIdForGames < ActiveRecord::Migration[5.2] + def change + delete_games = Game.where.not(myshixun_id: Myshixun.all).reorder(nil) + puts "delete_games: #{delete_games.pluck(:id)}" + delete_games.destroy_all + + add_index :games, [:user_id, :challenge_id], unique: true + end +end