From 064d76f25cef35944615277950be893105f99f31 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 15:19:09 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E7=9A=84=E8=A7=86=E9=A2=91=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/models/course.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index ed76a4b0c..a6df9bff9 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -147,7 +147,7 @@ module CoursesHelper when "online_learning" course.shixuns.count when "video" - course.course_videos.count + course.live_links.count + course.videos_count + course.live_links.count end end diff --git a/app/models/course.rb b/app/models/course.rb index 2c76f9579..aedbaa040 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -160,6 +160,11 @@ class Course < ApplicationRecord students.find_by(user_id: user_id)&.course_group_name end + def videos_count + course_videos.where(videos: {transcoded: true}) + .or(course_videos.where(videos: {user_id: current_user.id})) + .or(course_videos.where(course_videos: {is_link: true})) + end def teacher_group(user_id) data = From 30ee68911f94f320c0721907928024d1f316facc Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 15:22:51 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index a6df9bff9..8f024c1c6 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -55,32 +55,32 @@ module CoursesHelper return nil if mod.blank? or course.blank? case mod.module_type when "announcement" - "/courses/#{course.id}/informs" + "/classrooms/#{course.id}/informs" when "online_learning" - "/courses/#{course.id}/online_learning" + "/classrooms/#{course.id}/online_learning" when "shixun_homework" - "/courses/#{course.id}/shixun_homeworks/#{mod.id}" + "/classrooms/#{course.id}/shixun_homeworks/#{mod.id}" when "common_homework" - "/courses/#{course.id}/common_homeworks/#{mod.id}" + "/classrooms/#{course.id}/common_homeworks/#{mod.id}" when "group_homework" - "/courses/#{course.id}/group_homeworks/#{mod.id}" + "/classrooms/#{course.id}/group_homeworks/#{mod.id}" when "graduation" - "/courses/#{course.id}/graduation_topics/#{mod.id}" + "/classrooms/#{course.id}/graduation_topics/#{mod.id}" when "exercise" - "/courses/#{course.id}/exercises/#{mod.id}" + "/classrooms/#{course.id}/exercises/#{mod.id}" when "poll" - "/courses/#{course.id}/polls/#{mod.id}" + "/classrooms/#{course.id}/polls/#{mod.id}" when "attachment" - "/courses/#{course.id}/files/#{mod.id}" + "/classrooms/#{course.id}/files/#{mod.id}" when "board" course_board = course.course_board - "/courses/#{course.id}/boards/#{course_board.id}" + "/classrooms/#{course.id}/boards/#{course_board.id}" when "course_group" - "/courses/#{course.id}/course_groups" + "/classrooms/#{course.id}/course_groups" when "statistics" - "/courses/#{course.id}/statistics" + "/classrooms/#{course.id}/statistics" when "video" - "/courses/#{course.id}/course_videos" + "/classrooms/#{course.id}/course_videos" end end @@ -88,17 +88,17 @@ module CoursesHelper def category_url category, course case category.category_type when "shixun_homework" - "/courses/#{course.id}/shixun_homework/#{category.id}" + "/classrooms/#{course.id}/shixun_homework/#{category.id}" when "graduation" if category.name == "毕设选题" - "/courses/#{course.id}/graduation_topics/#{category.course_module_id}" + "/classrooms/#{course.id}/graduation_topics/#{category.course_module_id}" else - "/courses/#{course.id}/graduation_tasks/#{category.course_module_id}" + "/classrooms/#{course.id}/graduation_tasks/#{category.course_module_id}" end when "attachment" - "/courses/#{course.id}/file/#{category.id}" + "/classrooms/#{course.id}/file/#{category.id}" when "video" - "/courses/#{course.id}/course_video/#{category.id}" + "/classrooms/#{course.id}/course_video/#{category.id}" end end @@ -296,11 +296,11 @@ module CoursesHelper none_group_count = course.students.where(course_group_id: 0).size group_info << {category_id: 0, category_name: "未分班", position: course.course_groups.pluck(:position).max.to_i + 1, category_count: none_group_count, category_type: false, - second_category_url: "/courses/#{@course.id}/course_groups/0"} + second_category_url: "/classrooms/#{@course.id}/course_groups/0"} course.course_groups.each do |course_group| group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position, category_count: course_group.course_members_count, category_type: false, - second_category_url: "/courses/#{@course.id}/course_groups/#{course_group.id}"} + second_category_url: "/classrooms/#{@course.id}/course_groups/#{course_group.id}"} end end group_info From 20b1e6439da8928266592c0c9c66f2b088ffff9c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 15:34:01 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E7=9A=84=E8=A7=86=E9=A2=91=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index aedbaa040..b0f3414a6 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -161,8 +161,7 @@ class Course < ApplicationRecord end def videos_count - course_videos.where(videos: {transcoded: true}) - .or(course_videos.where(videos: {user_id: current_user.id})) + course_videos.where(video_id: videos.where("transcoded = 1 or videos.user_id = #{User.current.id}").pluck(:id)) .or(course_videos.where(course_videos: {is_link: true})) end From 42a913814330a18f4f152dedc6422152158b738f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 15:36:30 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E7=9A=84=E8=A7=86=E9=A2=91=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/course.rb b/app/models/course.rb index b0f3414a6..abe17b3cd 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -162,7 +162,7 @@ class Course < ApplicationRecord def videos_count course_videos.where(video_id: videos.where("transcoded = 1 or videos.user_id = #{User.current.id}").pluck(:id)) - .or(course_videos.where(course_videos: {is_link: true})) + .or(course_videos.where(course_videos: {is_link: true})).size end def teacher_group(user_id) From 28c817523e773882ecc2aeb2e41c7217e17f2704 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 10 Mar 2020 15:56:57 +0800 Subject: [PATCH 5/6] issue --- .../react/src/modules/courses/Video/Video.js | 2 +- .../user/usersInfo/video/VideoInReviewItem.js | 38 ++++++++++--------- .../user/usersInfo/video/VideoUploadList.js | 20 ++++++---- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/public/react/src/modules/courses/Video/Video.js b/public/react/src/modules/courses/Video/Video.js index e9a90c918..89c0a0c6f 100644 --- a/public/react/src/modules/courses/Video/Video.js +++ b/public/react/src/modules/courses/Video/Video.js @@ -94,7 +94,7 @@ class Video extends Component { let videoId = { videoId: item.id, title: item.title, - file_url: item.file_url, + file_url: (item.play_url || item.file_url), cover_url: item.cover_url } this.setState({ diff --git a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js index b045f54b8..6849db062 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js +++ b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js @@ -1,5 +1,5 @@ import React, { useState, useEffect, useContext, memo } from 'react'; -import { Progress, Input, Tooltip } from 'antd' +import { Progress, Input, Tooltip , Spin } from 'antd' import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext } from 'educoder' import axios from 'axios' import moment from 'moment' @@ -20,7 +20,7 @@ let _clipboard = null; const clipboardMap = {} function VideoInReviewItem (props) { const theme = useContext(ThemeContext); - const { history, file_url, cover_url, title, created_at, published_at, isReview, id + const { history, file_url , play_url , cover_url , transcoded , title, created_at, published_at, isReview, id , onEditVideo, onMaskClick, getCopyText, showNotification,vv,play_duration,operation , deleteVideo , moveVideo ,link} = props; useEffect(()=> { if (!isReview) { @@ -44,24 +44,26 @@ function VideoInReviewItem (props) { function toUpload() { history.push(`/users/${username}/videos/upload`) } + const imgUrl = (!transcoded && !link) ? defaultImg : (cover_url || defaultImg); return (