From 5bd82b9674b2e00fd3b0c027c9f0db2e0c274f4a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 7 Feb 2020 15:32:32 +0800 Subject: [PATCH 01/25] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=BD=AC=E7=A0=81?= =?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/dispatch_callback_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index e4ad1628a..b32c87c4e 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -20,6 +20,9 @@ class Videos::DispatchCallbackService < ApplicationService return if video.cover_url.present? video.update!(cover_url: params['CoverUrl']) + when 'TranscodeComplete' then # 转码完成 + return if video.play_url.present? + video.update!(play_url: params['FileUrl']) end rescue => ex From 319521ab6194649e466d3e2c133746a99e0d86f3 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 7 Feb 2020 15:46:09 +0800 Subject: [PATCH 02/25] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/choose_course.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/subjects/choose_course.json.jbuilder b/app/views/subjects/choose_course.json.jbuilder index 252359710..51eebd18f 100644 --- a/app/views/subjects/choose_course.json.jbuilder +++ b/app/views/subjects/choose_course.json.jbuilder @@ -9,6 +9,7 @@ json.stages @subject.stages.includes(shixuns: [user: :user_extension]) do |stage json.shixuns stage.shixuns do |shixun| if shixun.status == 2 && !shixun.is_jupyter && !@none_shixun_ids.include?(shixun.id) json.shixun_id shixun.id + json.identifier shixun.identifier json.shixun_name "#{stage.position}-#{index} #{shixun.name}" json.title shixun.name json.level level_to_s(shixun.trainee) From f654248a27be681bea09100d58535088b48ee983 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 7 Feb 2020 15:46:42 +0800 Subject: [PATCH 03/25] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/choose_course.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/subjects/choose_course.json.jbuilder b/app/views/subjects/choose_course.json.jbuilder index 51eebd18f..2e03c5287 100644 --- a/app/views/subjects/choose_course.json.jbuilder +++ b/app/views/subjects/choose_course.json.jbuilder @@ -9,6 +9,7 @@ json.stages @subject.stages.includes(shixuns: [user: :user_extension]) do |stage json.shixuns stage.shixuns do |shixun| if shixun.status == 2 && !shixun.is_jupyter && !@none_shixun_ids.include?(shixun.id) json.shixun_id shixun.id + json.id shixun.id json.identifier shixun.identifier json.shixun_name "#{stage.position}-#{index} #{shixun.name}" json.title shixun.name From d741fd99072f3c3ac93951955084b60359c3109d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 7 Feb 2020 15:53:09 +0800 Subject: [PATCH 04/25] =?UTF-8?q?=E9=80=89=E7=94=A8=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/weapps/shixun_search_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/weapps/shixun_search_service.rb b/app/services/weapps/shixun_search_service.rb index d5d8f7d47..333024cc4 100644 --- a/app/services/weapps/shixun_search_service.rb +++ b/app/services/weapps/shixun_search_service.rb @@ -13,7 +13,7 @@ class Weapps::ShixunSearchService < ApplicationService shixuns = laboratory.shixuns.published.no_jupyter if type == "mine" - @shixuns = @shixuns.where(id: User.current.shixuns) + shixuns = shixuns.where(id: User.current.shixuns) else # 超级管理员用户显示所有未隐藏的实训、非管理员显示所有已发布的实训(对本单位公开且未隐藏未关闭) if User.current.admin? || User.current.business? || !User.current.school_id From 7ed500530535e6236efc314f76b50db886564c9c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 7 Feb 2020 15:57:43 +0800 Subject: [PATCH 05/25] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=87=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index e820c383d..1f66555f9 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -242,7 +242,7 @@ class SubjectsController < ApplicationController ## 云上实验室过滤 @courses = @courses.where(id: current_laboratory.all_courses) - @none_shixun_ids = ShixunSchool.where("school_id != #{current_user.user_extension.try(:school_id).to_i}").pluck(:shixun_id) + @none_shixun_ids = @subject.shixuns.joins(:shixun_schools).where("school_id != #{current_user.user_extension.try(:school_id).to_i}").where(use_scope: 1).pluck(:id) end def send_to_course From 81ceac90e7558fa9a2d1ce4fef7a72a9aea0177b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 7 Feb 2020 16:04:47 +0800 Subject: [PATCH 06/25] =?UTF-8?q?=E9=80=89=E7=94=A8=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E7=9A=84=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/weapps/shixun_search_service.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/services/weapps/shixun_search_service.rb b/app/services/weapps/shixun_search_service.rb index 333024cc4..448bb1992 100644 --- a/app/services/weapps/shixun_search_service.rb +++ b/app/services/weapps/shixun_search_service.rb @@ -35,11 +35,10 @@ class Weapps::ShixunSearchService < ApplicationService keyword = params[:keyword].strip shixuns = shixuns.joins(:user). where("concat(lastname, firstname) like :keyword or shixuns.name like :keyword", - keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct. - order("#{sort_str} #{order_str}") + keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct end - shixuns + shixuns.order("#{sort_str} #{order_str}") end private From d71c181d12b90c4d6f6773fa928d8a008967a961 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 7 Feb 2020 17:30:50 +0800 Subject: [PATCH 07/25] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 10 ++++++---- .../20200207090252_add_video_to_course_module.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20200207090252_add_video_to_course_module.rb diff --git a/app/models/course.rb b/app/models/course.rb index 1d5175ed3..eb7ffd91f 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -206,7 +206,7 @@ class Course < ApplicationRecord end def all_course_module_types - %w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board statistics] + %w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board statistics video] end def get_course_module_by_type(type) @@ -406,6 +406,7 @@ class Course < ApplicationRecord when 'exercise' then '试卷' when 'poll' then '问卷' when 'attachment' then '资源' + when 'video' then '视频' when 'board' then '讨论' when 'course_group' then '分班' when 'statistics' then '统计' @@ -425,9 +426,10 @@ class Course < ApplicationRecord when 'exercise' then 8 when 'poll' then 9 when 'attachment' then 10 - when 'board' then 11 - when 'course_group' then 12 - when 'statistics' then 13 + when 'video' then 11 + when 'board' then 12 + when 'course_group' then 13 + when 'statistics' then 14 else 100 end end diff --git a/db/migrate/20200207090252_add_video_to_course_module.rb b/db/migrate/20200207090252_add_video_to_course_module.rb new file mode 100644 index 000000000..1d0364524 --- /dev/null +++ b/db/migrate/20200207090252_add_video_to_course_module.rb @@ -0,0 +1,12 @@ +class AddVideoToCourseModule < ActiveRecord::Migration[5.2] + def change + Course.all.each do |course| + unless course.course_modules.exists?(module_type: "video") + atta_position = course.course_modules.find_by(module_type: 'attachment')&.position.to_i + video_position = atta_position != 0 ? (atta_position + 1) : 11 + course.course_modules.where("position >= #{video_position}").update_all("position = position + 1") + course.course_modules << CourseModule.new(module_type: "video", hidden: 1, module_name: "视频", position: video_position) + end + end + end +end From 4435771abe9e3e1ec92e368881b50246e76f438f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 7 Feb 2020 17:49:43 +0800 Subject: [PATCH 08/25] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/Resource/Fileslistitem.js | 110 ++---------------- 1 file changed, 9 insertions(+), 101 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index b038c836f..53f607b2e 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -1,29 +1,22 @@ import React,{ Component } from "react"; -import { WordsBtn,ActionBtn,getmyUrl,getUrl } from 'educoder'; -import {Tooltip,message,Input, Button} from 'antd'; +import { WordsBtn } from 'educoder'; +import {Tooltip,message} from 'antd'; import {Link} from 'react-router-dom'; +import {getImageUrl} from 'educoder'; import axios from 'axios' +import {getUrl} from 'educoder'; import moment from 'moment' import CoursesListType from '../coursesPublic/CoursesListType'; import Showoldfiles from "../coursesPublic/Showoldfiles"; import Modals from '../../modals/Modals'; -import HeadlessModal from '../../user/usersInfo/common/HeadlessModal' -import ClipboardJS from 'clipboard' -import '../../user/usersInfo/video/InfosVideo.css' -let _clipboard = null; + class Fileslistitem extends Component{ constructor(props){ super(props); this.state = { - videoModalObj:false, - file_url:null, + } } - setVisible=(bool)=>{ - this.setState({ - videoModalObj:bool - }) - } settingList=()=>{ let {discussMessage}=this.props @@ -35,9 +28,6 @@ class Fileslistitem extends Component{ } showfiles=(list)=>{ - // console.log("showfiles"); - // console.log(list); - if(this.props.checkIfLogin()===false){ this.props.showLoginDialog() return @@ -56,21 +46,7 @@ class Fileslistitem extends Component{ if(list.is_history_file===false){ // this.props.DownloadFileA(list.title,list.url) //window.location.href=list.url; - if(list.content_type){ - if(list.content_type==="video/mp4"){ - this.setState({ - videoModalObj:true, - file_url:"https://"+document.domain+list.url+'?file_name='+list.title+"&disposition=MP4", - // file_url:getUrl()+list.url+'?file_name='+list.title+'&disposition=MP4', - }) - return - }else{ - window.open(list.url, '_blank'); - } - - }else{ - window.open(list.url, '_blank'); - } + window.open(list.url, '_blank'); }else{ let {discussMessage,coursesId}=this.props let file_id=discussMessage.id @@ -89,24 +65,7 @@ class Fileslistitem extends Component{ // // } // this.props.DownloadFileA(result.data.title,result.data.url) - if(list.content_type){ - if(list.content_type==="video/mp4"){ - this.setState({ - videoModalObj:true, - file_url:"https://"+document.domain+list.url+'?file_name='+list.title+'&disposition=MP4', - // file_url:getUrl()+list.url+'?file_name='+list.title+'&disposition=MP4', - - }) - return - }else{ - window.open(list.url, '_blank'); - } - - }else{ - window.open(list.url, '_blank'); - } - - + window.open(list.url, '_blank'); }else{ this.setState({ Showoldfiles:true, @@ -128,17 +87,6 @@ class Fileslistitem extends Component{ }) } - Clicktobroadcastthevideo=(bool,url)=>{ - this.setState({ - videoModalObj:bool, - file_url:"https://"+document.domain+url+'&disposition=MP4', - // file_url:getUrl()+url+'&disposition=MP4', - }) - } - - - - onDelete = (id) => { this.setState({ @@ -163,17 +111,6 @@ class Fileslistitem extends Component{ } - copyurls =()=>{ - //复制网络链接 - setTimeout(() => { - if (!_clipboard) { - _clipboard = new ClipboardJS('.copybtn'); - _clipboard.on('success', (e) => { - this.props.showNotification("复制成功"); - }); - } - }, 200) - } savedelete=(id)=>{ this.setState({ @@ -215,40 +152,13 @@ class Fileslistitem extends Component{ } render(){ - const {videoModalObj,file_url}=this.state + const { checkBox, discussMessage,index } = this.props; - // console.log("Fileslistitem"); - // console.log( document.domain); - // console.log(this.props.imhost); - // console.log( window.location.href); return(
- { - videoModalObj&&videoModalObj===true? - this.setVisible(bool)} - className="showVideoModal" - width={800 - 1} - > - -
- - this.copyurls()}>复制视频地址 -
-
- - :"" - } {/*提示*/} {this.state.Modalstype&&this.state.Modalstype===true?this.Clicktobroadcastthevideo(bool,urls,index)} closaoldfilesprops={this.closaoldfilesprops} />