From 88dcf8e8f705fc09b4b50586594703008772e7a6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 11:47:47 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=9A=84=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 | 8 ++++++-- app/services/videos/batch_publish_service.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 2e94e435d..de0603868 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -133,13 +133,17 @@ class CoursesController < ApplicationController # 视频移动到目录 def move_to_category + tip_exception("请选择要移动的目录") if params[:new_category_id].blank? category = @course.course_second_categories.find_by(id: params[:new_category_id]) if params[:new_category_id].to_i == 0 || category.present? - videos = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])) + video = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])).first + + tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || + video.user_id == current_user.id || current_user.admin_or_business? - videos.update_all(course_second_category_id: params[:new_category_id]) + video.update!(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功") else normal_status(-1, "目录不存在") diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 9ddcae146..5dd511de7 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -41,7 +41,7 @@ class Videos::BatchPublishService < ApplicationService # 如果是课堂上传则创建课堂记录 Rails.logger.info("#####param: #{ param[:course_id]}") if param[:course_id].present? - course_second_category_id = params[:category_id] || 0 + course_second_category_id = param[:category_id] || 0 video.course_videos.create!(course_id: param[:course_id], course_second_category_id: course_second_category_id) end end From 43d124b1992e115025ccb1172a03b511f5342daa Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 11:58:35 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index de0603868..ebdf8dfda 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -140,8 +140,9 @@ class CoursesController < ApplicationController if params[:new_category_id].to_i == 0 || category.present? video = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])).first + user_id = video.user_id || video.video.user_id tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || - video.user_id == current_user.id || current_user.admin_or_business? + user_id == current_user.id || current_user.admin_or_business? video.update!(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功") From d70917fbfc1b3055e66f24b74304dc12a226029b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 12:02:43 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index ebdf8dfda..426820701 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -141,8 +141,7 @@ class CoursesController < ApplicationController video = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])).first user_id = video.user_id || video.video.user_id - tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || - user_id == current_user.id || current_user.admin_or_business? + tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || user_id == current_user.id video.update!(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功") From 7da4ad0c5b71359885769819914241cf03e27fec Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 12:03:48 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E8=BD=AC=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 ++- app/views/users/videos/_video.json.jbuilder | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 2e94e435d..448a00ff9 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -112,7 +112,8 @@ class CoursesController < ApplicationController videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) @count = videos.count - @videos = paginate videos.includes(video: [user: :user_extension], user: :user_extension) + sql = "join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" + @videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) end def delete_course_video diff --git a/app/views/users/videos/_video.json.jbuilder b/app/views/users/videos/_video.json.jbuilder index 1488d120f..5b0bc7a6e 100644 --- a/app/views/users/videos/_video.json.jbuilder +++ b/app/views/users/videos/_video.json.jbuilder @@ -1,5 +1,4 @@ json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id, :transcoded - json.play_duration video.video_play_duration json.published_at video.display_published_at json.created_at video.display_created_at From b31783b798eab3dfe6a8f7163ec5e90329456844 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 12:04:30 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=9A=84=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index de0603868..426820701 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -140,8 +140,8 @@ class CoursesController < ApplicationController if params[:new_category_id].to_i == 0 || category.present? video = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])).first - tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || - video.user_id == current_user.id || current_user.admin_or_business? + user_id = video.user_id || video.video.user_id + tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || user_id == current_user.id video.update!(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功") From cc9592dd1932ab62515f726de259b8e113dcb1b5 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 12:11:11 +0800 Subject: [PATCH 06/16] 1 --- 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 87e2d6a61..ec0a77759 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -112,7 +112,7 @@ class CoursesController < ApplicationController videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) @count = videos.count - sql = "join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" + sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" @videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) end From ac9d16bea2698d64296bdc6b268d6495a8fa0f81 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 12:13:24 +0800 Subject: [PATCH 07/16] 1 --- app/controllers/courses_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index ec0a77759..c9fcb38ac 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -113,7 +113,8 @@ class CoursesController < ApplicationController videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) @count = videos.count sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" - @videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) + videos = videos.joins(sql).reload + @videos = paginate videos.includes(video: [user: :user_extension], user: :user_extension) end def delete_course_video From 285c863fd0728d021cb6a86301f8f13821455603 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 10 Mar 2020 12:14:20 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/Video/Video.js | 21 +++++++++++++------ .../usersInfo/video/AliyunUploaderManager.js | 17 ++++++++------- .../user/usersInfo/video/VideoUploadList.js | 3 +-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/courses/Video/Video.js b/public/react/src/modules/courses/Video/Video.js index b082ef25a..8dbd5ee03 100644 --- a/public/react/src/modules/courses/Video/Video.js +++ b/public/react/src/modules/courses/Video/Video.js @@ -168,11 +168,18 @@ class Video extends Component { } // 移动到 - moveVideo=(id)=>{ - this.setState({ - moveVisible:true, - moveVideoId:id - }) + moveVideo=(id,flag)=>{ + if(!flag){ + this.setState({ + moveVisible:true, + moveVideoId:id + }) + }else{ + this.props.define({ + title:'提示', + content:"您不是课堂管理员或者视频发布者,暂不能移动视频。", + }) + } } setMoveVisible=(flag)=>{ this.setState({ @@ -194,6 +201,8 @@ class Video extends Component { const { videos, upload, uploadVideo, videoData, changePage, pageSize, page } = this.props; const operation = admin || business; + const {course_identity} = this.props.coursedata; + const flagMove = parseInt(course_identity) < 5; return (
this.moveVideo(item.id):undefined} + moveVideo={videoData && videoData.has_category && flagMove ? ()=>this.moveVideo(item.id,(course_identity > 2 && item.user_id === user_id)):undefined} > ) diff --git a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js index ef2eaceda..e3cddd4d2 100644 --- a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js +++ b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js @@ -27,16 +27,16 @@ function loadLib(callback) { }); }); } -function createUploader(options) { +function createUploader(options,setLoading) { if (window.AliyunUpload && window.AliyunUpload.Vod) { - doCreateUploader(options) + doCreateUploader(options,setLoading) } else { loadLib(() => { - doCreateUploader(options) + doCreateUploader(options,setLoading) }) } } -function doCreateUploader (options) { +function doCreateUploader (options,setLoading) { uploader = new window.AliyunUpload.Vod({ timeout: $('#timeout').val() || 60000, partSize: $('#partSize').val() || 1048576, @@ -82,7 +82,8 @@ function doCreateUploader (options) { var uploadAddress = data.UploadAddress var videoId = data.VideoId uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress, videoId) - + console.log("onUploadstarted","false"); + setLoading && setLoading(false); } }).catch((error) => { // 删除当前出错的,并执行下一个任务 @@ -106,7 +107,7 @@ function doCreateUploader (options) { if (response.data.status == -1) { options.onUploadError && options.onUploadError(uploadInfo) return; - } + } const data = response.data.data var uploadAuth = data.UploadAuth var uploadAddress = data.UploadAddress @@ -180,9 +181,9 @@ function doCreateUploader (options) { options.gotUploader(uploader) } } -export function getUploader (_login, options) { +export function getUploader (_login, options,setLoading) { _login && (login = _login) if (!uploader || options.create == true) { - createUploader(options) + createUploader(options,setLoading) } } \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index 7855fc39a..11c4713ef 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -126,7 +126,6 @@ function VideoUploadList (props) { dispatch({type: 'addVideo', uploadInfo}) }, onUploadProgress: (uploadInfo, totalSize, progress) => { - setLoading(false); console.log("upload",uploadInfo); var progressPercent = Math.ceil(progress * 100) @@ -188,7 +187,7 @@ function VideoUploadList (props) { window.uploader = uploader; } - } + },setLoading // ) ) } else { From 2275d303ff8484d6416da5810daf0abab7c04942 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 12:15:46 +0800 Subject: [PATCH 09/16] 1 --- 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 c9fcb38ac..0f54adbc0 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -113,7 +113,7 @@ class CoursesController < ApplicationController videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) @count = videos.count sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" - videos = videos.joins(sql).reload + videos = videos.joins(sql).reload! @videos = paginate videos.includes(video: [user: :user_extension], user: :user_extension) end From 757f5aaa62e78d171a2ec2ac15c6b4aef84178e9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 12:55:26 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=93=BE=E6=8E=A5?= =?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/controllers/courses_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0f54adbc0..c20f77113 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -112,9 +112,11 @@ class CoursesController < ApplicationController videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) @count = videos.count - sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" - videos = videos.joins(sql).reload! + #sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" + #@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) @videos = paginate videos.includes(video: [user: :user_extension], user: :user_extension) + .where(videos: {transcoded: true}).or(videos: {user_id: current_user.id}) + .or(course_videos: {is_link: true}) end def delete_course_video From db6af4f42176d20651ae0554e41b3a30c401cedc Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 12:59:20 +0800 Subject: [PATCH 11/16] 1 --- app/controllers/courses_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c20f77113..db05ea7b5 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -114,9 +114,9 @@ class CoursesController < ApplicationController @count = videos.count #sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" #@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) - @videos = paginate videos.includes(video: [user: :user_extension], user: :user_extension) - .where(videos: {transcoded: true}).or(videos: {user_id: current_user.id}) - .or(course_videos: {is_link: true}) + @videos = paginate videos.includes(:video) + .where(video: {transcoded: true}).or(video: {user_id: current_user.id}) + .or(video: {is_link: true}) end def delete_course_video From ec64e8fd37a2cdf5d2284ef84b27f90b09e0c788 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 13:05:02 +0800 Subject: [PATCH 12/16] 1 --- app/controllers/courses_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index db05ea7b5..d309fef93 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -114,9 +114,10 @@ class CoursesController < ApplicationController @count = videos.count #sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" #@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) - @videos = paginate videos.includes(:video) - .where(video: {transcoded: true}).or(video: {user_id: current_user.id}) - .or(video: {is_link: true}) + videos = videos.includes(video: [user: :user_extension], user: :user_extension) + @videos = paginate videos.where(video: {transcoded: true}) + .or(videos.where(video: {user_id: current_user.id})) + .or(videos.where(course_videos: {is_link: true})) end def delete_course_video From 9e9d39d64442804103fa5304e1f4cce4f718f35b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 13:06:03 +0800 Subject: [PATCH 13/16] 1 --- app/controllers/courses_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d309fef93..129404647 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -115,8 +115,8 @@ class CoursesController < ApplicationController #sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" #@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) videos = videos.includes(video: [user: :user_extension], user: :user_extension) - @videos = paginate videos.where(video: {transcoded: true}) - .or(videos.where(video: {user_id: current_user.id})) + @videos = paginate videos.where(videos: {transcoded: true}) + .or(videos.where(videos: {user_id: current_user.id})) .or(videos.where(course_videos: {is_link: true})) end From 75885fa88065be5eb77147b7fb67dd980ab8c101 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 10 Mar 2020 13:06:43 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/Video/VideoIndex.js | 10 +++++----- .../user/usersInfo/video/AliyunUploaderManager.js | 15 +++++++-------- .../user/usersInfo/video/VideoUploadList.js | 8 ++++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js index ff1129666..5d14e376c 100644 --- a/public/react/src/modules/courses/Video/VideoIndex.js +++ b/public/react/src/modules/courses/Video/VideoIndex.js @@ -301,11 +301,11 @@ class VideoIndex extends Component{ { videoId ? - this.editDir(videoData && videoData.category_name,videoId)} className={"mr30 font-16"}>目录重命名 + this.editDir(videoData && videoData.category_name,videoId)} className={"ml30 font-16"}>目录重命名 : - 新建目录 + 新建目录 } - this.setLinkeVisible(true)}>增加外链 + this.setLinkeVisible(true)}>增加外链 :"" } { @@ -313,9 +313,9 @@ class VideoIndex extends Component{ { upload ? - this.uploadVideo(false)}>取消 + this.uploadVideo(false)}>取消 : - 上传视频 + 上传视频 } :"" } diff --git a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js index e3cddd4d2..61f159ef5 100644 --- a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js +++ b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js @@ -27,16 +27,16 @@ function loadLib(callback) { }); }); } -function createUploader(options,setLoading) { +function createUploader(options) { if (window.AliyunUpload && window.AliyunUpload.Vod) { - doCreateUploader(options,setLoading) + doCreateUploader(options) } else { loadLib(() => { - doCreateUploader(options,setLoading) + doCreateUploader(options) }) } } -function doCreateUploader (options,setLoading) { +function doCreateUploader (options) { uploader = new window.AliyunUpload.Vod({ timeout: $('#timeout').val() || 60000, partSize: $('#partSize').val() || 1048576, @@ -82,8 +82,7 @@ function doCreateUploader (options,setLoading) { var uploadAddress = data.UploadAddress var videoId = data.VideoId uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress, videoId) - console.log("onUploadstarted","false"); - setLoading && setLoading(false); + } }).catch((error) => { // 删除当前出错的,并执行下一个任务 @@ -181,9 +180,9 @@ function doCreateUploader (options,setLoading) { options.gotUploader(uploader) } } -export function getUploader (_login, options,setLoading) { +export function getUploader (_login, options) { _login && (login = _login) if (!uploader || options.create == true) { - createUploader(options,setLoading) + createUploader(options) } } \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index 11c4713ef..606ba9f32 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -168,15 +168,15 @@ function VideoUploadList (props) { }, onUploadEnd: (uploadInfo) => { console.log('onUploadEnd', uploadInfo) - + setLoading(false); }, onUploadSucceed: (uploadInfo) => { console.log('onUploadSucceed', uploadInfo) - + setLoading(false); }, onUploadError: (uploadInfo) => { - + setLoading(false); }, // 可能需要等lib加载完毕才能执行 gotUploader: (_uploader) => { @@ -187,7 +187,7 @@ function VideoUploadList (props) { window.uploader = uploader; } - },setLoading + } // ) ) } else { From 4f6bea08e5a88e542fc7ef8adf00d0ab8154e23a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 13:07:42 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=95=B0=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 129404647..d35741c61 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -111,13 +111,15 @@ class CoursesController < ApplicationController end videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) - @count = videos.count + #sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" #@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) videos = videos.includes(video: [user: :user_extension], user: :user_extension) - @videos = paginate videos.where(videos: {transcoded: true}) - .or(videos.where(videos: {user_id: current_user.id})) - .or(videos.where(course_videos: {is_link: true})) + videos = videos.where(videos: {transcoded: true}) + .or(videos.where(videos: {user_id: current_user.id})) + .or(videos.where(course_videos: {is_link: true})) + @count = videos.count + @videos = paginate videos end def delete_course_video From 54226bdf664b3a35ee885d37e63277d1e5ba0940 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 10 Mar 2020 13:23:32 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Video/Video.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Video/Video.js b/public/react/src/modules/courses/Video/Video.js index 8dbd5ee03..e9a90c918 100644 --- a/public/react/src/modules/courses/Video/Video.js +++ b/public/react/src/modules/courses/Video/Video.js @@ -203,6 +203,7 @@ class Video extends Component { const operation = admin || business; const {course_identity} = this.props.coursedata; const flagMove = parseInt(course_identity) < 5; + return (
0 ? +

{videoData && videoData.count} 个视频

{ videos.map((item, key) => { + console.log(course_identity > 2 && item.user_id === user_id) return ( this.moveVideo(item.id,(course_identity > 2 && item.user_id === user_id)):undefined} + moveVideo={videoData && videoData.has_category && flagMove ? ()=>this.moveVideo(item.id,(course_identity > 2 && item.user_id !== user_id)):undefined} > )