Merge branch 'dev_video' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_video

dev_video
caicai8 5 years ago
commit 6c860ebc0f

@ -227,8 +227,10 @@ class ChallengesController < ApplicationController
@challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil) @challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil)
end end
# 关卡评测执行文件如果被修改,需要修改脚本内容 # 关卡评测执行文件如果被修改,需要修改脚本内容
script = modify_shixun_script @shixun, @shixun.evaluate_script unless @shixun.published
@shixun.shixun_info.update_column(:evaluate_script, script) script = modify_shixun_script @shixun, @shixun.evaluate_script
@shixun.shixun_info.update_column(:evaluate_script, script)
end
# TODO: # TODO:
# if path != params[:challenge][:path] # if path != params[:challenge][:path]
# shixun_modify_status_without_publish(@shixun, 1) # shixun_modify_status_without_publish(@shixun, 1)

@ -1,6 +1,7 @@
class CoursesController < ApplicationController class CoursesController < ApplicationController
include MessagesHelper include MessagesHelper
include ExportHelper include ExportHelper
include CustomSortable
# model validation error # model validation error
rescue_from ActiveRecord::RecordInvalid do |ex| rescue_from ActiveRecord::RecordInvalid do |ex|
@ -23,7 +24,7 @@ class CoursesController < ApplicationController
:course_group_list, :set_course_group, :change_course_admin, :change_course_teacher, :course_group_list, :set_course_group, :change_course_admin, :change_course_teacher,
:delete_course_teacher, :teacher_application_review, :students, :all_course_groups, :delete_course_teacher, :teacher_application_review, :students, :all_course_groups,
:transfer_to_course_group, :delete_from_course, :search_users, :add_students_by_search, :transfer_to_course_group, :delete_from_course, :search_users, :add_students_by_search,
:base_info, :get_historical_courses, :create_group_by_importing_file, :base_info, :get_historical_courses, :create_group_by_importing_file, :course_videos,
:attahcment_category_list,:export_member_scores_excel, :duplicate_course, :attahcment_category_list,:export_member_scores_excel, :duplicate_course,
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course, :switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course,
:informs, :update_informs, :online_learning, :update_task_position, :tasks_list, :informs, :update_informs, :online_learning, :update_task_position, :tasks_list,
@ -100,6 +101,14 @@ class CoursesController < ApplicationController
@courses = @courses.preload(:school, :none_hidden_course_modules, teacher: :user_extension) @courses = @courses.preload(:school, :none_hidden_course_modules, teacher: :user_extension)
end end
def course_videos
logger.info("########[#{@course}")
videos = @course.videos
videos = custom_sort(videos, params[:sort_by], params[:sort_direction])
@count = videos.count
@videos = paginate videos
end
def visits_plus_one def visits_plus_one
new_visits = @course.visits + 1 new_visits = @course.visits + 1
@course.update_visits(new_visits) @course.update_visits(new_visits)

@ -242,13 +242,13 @@ class SubjectsController < ApplicationController
## 云上实验室过滤 ## 云上实验室过滤
@courses = @courses.where(id: current_laboratory.all_courses) @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 end
def send_to_course def send_to_course
@course = Course.find_by!(id: params[:course_id]) @course = Course.find_by!(id: params[:course_id])
stages = @subject.stages.where(id: @subject.stage_shixuns.where(shixun_id: params[:shixun_ids]).pluck(:stage_id)) stages = @subject.stages.where(id: @subject.stage_shixuns.where(shixun_id: params[:shixun_ids]).pluck(:stage_id)).reorder("stages.position DESC")
order_ids = params[:shixun_ids].size > 0 ? params[:shixun_ids].reverse.join(',') : -1
course_module = @course.course_modules.where(module_type: "shixun_homework").first course_module = @course.course_modules.where(module_type: "shixun_homework").first
homework_ids = [] homework_ids = []
@ -259,7 +259,8 @@ class SubjectsController < ApplicationController
CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework", CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework",
course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) course_module_id: course_module.id, position: course_module.course_second_categories.count + 1)
stage.shixuns.no_jupyter.where(id: params[:shixun_ids], status: 2).each do |shixun| shixuns = stage.shixuns.no_jupyter.published.where(id: params[:shixun_ids]).reorder("field(shixuns.id, #{order_ids})")
shixuns.each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, category, current_user homework = HomeworksService.new.create_homework shixun, @course, category, current_user
homework_ids << homework.id homework_ids << homework.id
end end

@ -13,7 +13,7 @@ class Users::VideosController < Users::BaseController
end end
def update def update
return render_error('该状态下不能编辑视频信息') unless current_video.published? return render_error('该状态下不能编辑视频信息') unless (current_video.published? || current_video.course_videos.present?)
current_video.update!(title: params[:title]) current_video.update!(title: params[:title])
@ -64,6 +64,6 @@ class Users::VideosController < Users::BaseController
end end
def batch_publish_params def batch_publish_params
params.permit(videos: %i[video_id title]) params.permit(videos: %i[video_id title course_id])
end end
end end

@ -65,6 +65,8 @@ module CoursesHelper
"/courses/#{course.id}/course_groups" "/courses/#{course.id}/course_groups"
when "statistics" when "statistics"
"/courses/#{course.id}/statistics" "/courses/#{course.id}/statistics"
when "video"
"/courses/#{course.id}/course_videos"
end end
end end

@ -81,6 +81,10 @@ class Course < ApplicationRecord
# 老版的members弃用 现用course_members # 老版的members弃用 现用course_members
has_many :members has_many :members
# 视频
has_many :course_videos, dependent: :destroy
has_many :videos, through: :course_videos
validate :validate_sensitive_string validate :validate_sensitive_string
scope :hidden, ->(is_hidden = true) { where(is_hidden: is_hidden) } scope :hidden, ->(is_hidden = true) { where(is_hidden: is_hidden) }
@ -206,7 +210,7 @@ class Course < ApplicationRecord
end end
def all_course_module_types 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 end
def get_course_module_by_type(type) def get_course_module_by_type(type)
@ -406,6 +410,7 @@ class Course < ApplicationRecord
when 'exercise' then '试卷' when 'exercise' then '试卷'
when 'poll' then '问卷' when 'poll' then '问卷'
when 'attachment' then '资源' when 'attachment' then '资源'
when 'video' then '视频'
when 'board' then '讨论' when 'board' then '讨论'
when 'course_group' then '分班' when 'course_group' then '分班'
when 'statistics' then '统计' when 'statistics' then '统计'
@ -425,9 +430,10 @@ class Course < ApplicationRecord
when 'exercise' then 8 when 'exercise' then 8
when 'poll' then 9 when 'poll' then 9
when 'attachment' then 10 when 'attachment' then 10
when 'board' then 11 when 'video' then 11
when 'course_group' then 12 when 'board' then 12
when 'statistics' then 13 when 'course_group' then 13
when 'statistics' then 14
else 100 else 100
end end
end end

@ -0,0 +1,4 @@
class CourseVideo < ApplicationRecord
belongs_to :course
belongs_to :video
end

@ -4,6 +4,7 @@ class Video < ApplicationRecord
belongs_to :user belongs_to :user
has_many :video_applies, dependent: :destroy has_many :video_applies, dependent: :destroy
has_many :course_videos, dependent: :destroy
has_one :processing_video_apply, -> { where(status: :pending) }, class_name: 'VideoApply' has_one :processing_video_apply, -> { where(status: :pending) }, class_name: 'VideoApply'
aasm(:status) do aasm(:status) do

@ -11,22 +11,36 @@ class Videos::BatchPublishService < ApplicationService
def call def call
video_params = Array.wrap(params[:videos]).compact video_params = Array.wrap(params[:videos]).compact
return if video_params.blank? return if video_params.blank?
Rails.logger.info("#####video_course: #{video_params}")
video_ids = [] video_ids = []
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
video_params.each do |param| video_params.each do |param|
video = user.videos.find_by(uuid: param[:video_id]) video = user.videos.find_by(uuid: param[:video_id])
Rails.logger.info("video.processing_video_apply:#{video}")
Rails.logger.info("video.processing_video_apply:#{video.blank? || video.processing_video_apply}")
next if video.blank? || video.processing_video_apply.present? next if video.blank? || video.processing_video_apply.present?
raise Error, '视频还未上传完成' if video.vod_uploading? raise Error, '视频还未上传完成' if video.vod_uploading?
video.title = param[:title].to_s.strip.presence || video.title video.title = param[:title].to_s.strip.presence || video.title
video.apply_publish video.apply_publish
video.save! video.save!
video.video_applies.create! if param[:course_id].present?
video.video_applies.create!(status: "agreed")
else
video.video_applies.create!
end
video_ids << video.id video_ids << video.id
# 如果是课堂上传则创建课堂记录
Rails.logger.info("#####param: #{ param[:course_id]}")
if param[:course_id].present?
video.course_videos.create!(course_id: param[:course_id])
end
end end
end end

@ -20,6 +20,9 @@ class Videos::DispatchCallbackService < ApplicationService
return if video.cover_url.present? return if video.cover_url.present?
video.update!(cover_url: params['CoverUrl']) video.update!(cover_url: params['CoverUrl'])
when 'TranscodeComplete' then # 转码完成
return if video.play_url.present?
video.update!(play_url: params['FileUrl'])
end end
rescue => ex rescue => ex

@ -13,7 +13,7 @@ class Weapps::ShixunSearchService < ApplicationService
shixuns = laboratory.shixuns.published.no_jupyter shixuns = laboratory.shixuns.published.no_jupyter
if type == "mine" if type == "mine"
@shixuns = @shixuns.where(id: User.current.shixuns) shixuns = shixuns.where(id: User.current.shixuns)
else else
# 超级管理员用户显示所有未隐藏的实训、非管理员显示所有已发布的实训(对本单位公开且未隐藏未关闭) # 超级管理员用户显示所有未隐藏的实训、非管理员显示所有已发布的实训(对本单位公开且未隐藏未关闭)
if User.current.admin? || User.current.business? || !User.current.school_id if User.current.admin? || User.current.business? || !User.current.school_id
@ -35,11 +35,10 @@ class Weapps::ShixunSearchService < ApplicationService
keyword = params[:keyword].strip keyword = params[:keyword].strip
shixuns = shixuns.joins(:user). shixuns = shixuns.joins(:user).
where("concat(lastname, firstname) like :keyword or shixuns.name like :keyword", where("concat(lastname, firstname) like :keyword or shixuns.name like :keyword",
keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct. keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct
order("#{sort_str} #{order_str}")
end end
shixuns shixuns.order("#{sort_str} #{order_str}")
end end
private private

@ -0,0 +1,3 @@
json.count @count
json.videos @videos, partial: 'users/videos/video', as: :video
json.course_id @course.id

@ -9,6 +9,8 @@ json.stages @subject.stages.includes(shixuns: [user: :user_extension]) do |stage
json.shixuns stage.shixuns do |shixun| json.shixuns stage.shixuns do |shixun|
if shixun.status == 2 && !shixun.is_jupyter && !@none_shixun_ids.include?(shixun.id) if shixun.status == 2 && !shixun.is_jupyter && !@none_shixun_ids.include?(shixun.id)
json.shixun_id shixun.id json.shixun_id shixun.id
json.id shixun.id
json.identifier shixun.identifier
json.shixun_name "#{stage.position}-#{index} #{shixun.name}" json.shixun_name "#{stage.position}-#{index} #{shixun.name}"
json.title shixun.name json.title shixun.name
json.level level_to_s(shixun.trainee) json.level level_to_s(shixun.trainee)

@ -1,4 +1,4 @@
json.extract! video, :id, :title, :cover_url, :file_url, :vv json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv
json.play_duration video.video_play_duration json.play_duration video.video_play_duration
json.published_at video.display_published_at json.published_at video.display_published_at

@ -515,6 +515,7 @@ Rails.application.routes.draw do
get 'work_score' get 'work_score'
get 'act_score' get 'act_score'
get 'statistics' get 'statistics'
get 'course_videos'
post :inform_up post :inform_up
post :inform_down post :inform_down
get :calculate_all_shixun_scores get :calculate_all_shixun_scores

@ -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

@ -0,0 +1,9 @@
class CreateCourseVideos < ActiveRecord::Migration[5.2]
def change
create_table :course_videos do |t|
t.references :course
t.references :video
t.timestamps
end
end
end

@ -4,10 +4,10 @@
<meta charset="utf-8"></meta> <meta charset="utf-8"></meta>
<title>EduCoder</title> <title>EduCoder</title>
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="/stylesheets/css/edu-common.css?15254409771"> <link rel="stylesheet" type="text/css" href="/stylesheets/css/edu-common.css?1">
<link rel="stylesheet" type="text/css" href="/stylesheets/educoder/edu-main.css?15254409771"> <link rel="stylesheet" type="text/css" href="/stylesheets/educoder/edu-main.css?1">
<link rel="stylesheet" type="text/css" href="/stylesheets/educoder/edu-all.css?15254409771"> <link rel="stylesheet" type="text/css" href="/stylesheets/educoder/edu-all.css?1">
</head> </head>
<body style="" data-gr-c-s-loaded="true"> <body style="" data-gr-c-s-loaded="true">
@ -18,7 +18,7 @@
<div id="md_div" style="display: none;" aria-hidden="true"></div> <div id="md_div" style="display: none;" aria-hidden="true"></div>
<div id="root" class="page -layout-v -fit" aria-hidden="true" style="position: relative;height:100%"> <div id="root" class="page -layout-v -fit" aria-hidden="true" style="position: relative;height:100%">
<div> <div>
<!-- <div class="newHeader" id="nHeader"> <!-- <div class="newHeader" id="nHeader">
<div class="educontent clearfix" style="width: 1200px;"> <div class="educontent clearfix" style="width: 1200px;">
<a href="/"><img alt="高校智能化教学与实训平台" class="logoimg" src="https://www.educoder.net/images/educoder/headNavLogo.png?1526520218"></a> <a href="/"><img alt="高校智能化教学与实训平台" class="logoimg" src="https://www.educoder.net/images/educoder/headNavLogo.png?1526520218"></a>
@ -206,17 +206,17 @@
<div id="picture_display" style="display: none;" aria-hidden="true"></div> <div id="picture_display" style="display: none;" aria-hidden="true"></div>
<!-- js css合并 文件优先级的问题 --> <!-- js css合并 文件优先级的问题 -->
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script> <script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script>
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script> <script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script>
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script> <script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script>
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script> <script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script>
<!-- <link href="//at.alicdn.com/t/font_653600_qa9lwwv74z.css" rel="stylesheet" type="text/css" aria-hidden="true"> --> <!-- <link href="//at.alicdn.com/t/font_653600_qa9lwwv74z.css" rel="stylesheet" type="text/css" aria-hidden="true"> -->
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script> <script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=0001"></script>
<div class="-task-desc" aria-hidden="true"></div> <div class="-task-desc" aria-hidden="true"></div>
<div class="-task-title" aria-hidden="true"> <div class="-task-title" aria-hidden="true">
<div class="data-tip-down"></div> <div class="data-tip-down"></div>
@ -224,6 +224,6 @@
<div class="data-tip-right"></div> <div class="data-tip-right"></div>
<div class="data-tip-top"></div> <div class="data-tip-top"></div>
</div> </div>
</body> </body>
</html> </html>

@ -487,7 +487,7 @@ table.text-file{}
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.subhead_content{width: 1200px;margin: 0px auto;} .subhead_content{width: 1200px;margin: 0px auto;}
.pathInfo li{text-align: center;float: left;margin-right: 38px;} .pathInfo li{text-align: center;float: left;margin-right: 30px;}
.pathInfo li span{display: block;} .pathInfo li span{display: block;}
.produce-content{padding: 40px 20px;background-color: #fff;box-sizing: border-box} .produce-content{padding: 40px 20px;background-color: #fff;box-sizing: border-box}

@ -61,7 +61,7 @@ clearAllCookie();
function setpostcookie() { function setpostcookie() {
const str =window.location.pathname; const str =window.location.pathname;
console.log(str.indexOf("/wxcode")) // console.log(str.indexOf("/wxcode"))
let newdomain=".educoder.net" let newdomain=".educoder.net"
if(str.indexOf("/wxcode") !== -1){ if(str.indexOf("/wxcode") !== -1){
console.log("123") console.log("123")

@ -507,6 +507,13 @@ class CoursesIndex extends Component{
(props) => (<Ordering {...this.props} {...props} {...this.state} />) (props) => (<Ordering {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/*视频列表*/}
<Route path="/courses/:coursesId/course_videos"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 资源列表页 */} {/* 资源列表页 */}
<Route path="/courses/:coursesId/file/:Id" exact <Route path="/courses/:coursesId/file/:Id" exact
render={ render={
@ -666,15 +673,15 @@ class CoursesIndex extends Component{
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></Route>
{/* 普通作业 */} {/* 普通作业 */}
<Route path="/courses/:coursesId/common_homeworks/:category_id" exact <Route path="/courses/:coursesId/common_homeworks/:category_id" exact
render={ render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></Route>
{/* 分组作业 */} {/* 分组作业 */}
<Route path="/courses/:coursesId/group_homeworks/:category_id" exact <Route path="/courses/:coursesId/group_homeworks/:category_id" exact
render={ render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
} }

@ -1,29 +1,22 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { WordsBtn,ActionBtn,getmyUrl,getUrl } from 'educoder'; import { WordsBtn } from 'educoder';
import {Tooltip,message,Input, Button} from 'antd'; import {Tooltip,message} from 'antd';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import {getImageUrl} from 'educoder';
import axios from 'axios' import axios from 'axios'
import {getUrl} from 'educoder';
import moment from 'moment' import moment from 'moment'
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import Showoldfiles from "../coursesPublic/Showoldfiles"; import Showoldfiles from "../coursesPublic/Showoldfiles";
import Modals from '../../modals/Modals'; 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{ class Fileslistitem extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state = { this.state = {
videoModalObj:false,
file_url:null,
} }
} }
setVisible=(bool)=>{
this.setState({
videoModalObj:bool
})
}
settingList=()=>{ settingList=()=>{
let {discussMessage}=this.props let {discussMessage}=this.props
@ -35,9 +28,6 @@ class Fileslistitem extends Component{
} }
showfiles=(list)=>{ showfiles=(list)=>{
// console.log("showfiles");
// console.log(list);
if(this.props.checkIfLogin()===false){ if(this.props.checkIfLogin()===false){
this.props.showLoginDialog() this.props.showLoginDialog()
return return
@ -56,21 +46,7 @@ class Fileslistitem extends Component{
if(list.is_history_file===false){ if(list.is_history_file===false){
// this.props.DownloadFileA(list.title,list.url) // this.props.DownloadFileA(list.title,list.url)
//window.location.href=list.url; //window.location.href=list.url;
if(list.content_type){ window.open(list.url, '_blank');
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');
}
}else{ }else{
let {discussMessage,coursesId}=this.props let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id let file_id=discussMessage.id
@ -89,24 +65,7 @@ class Fileslistitem extends Component{
// //
// } // }
// this.props.DownloadFileA(result.data.title,result.data.url) // this.props.DownloadFileA(result.data.title,result.data.url)
if(list.content_type){ window.open(list.url, '_blank');
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');
}
}else{ }else{
this.setState({ this.setState({
Showoldfiles:true, 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) => { onDelete = (id) => {
this.setState({ 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)=>{ savedelete=(id)=>{
this.setState({ this.setState({
@ -215,40 +152,13 @@ class Fileslistitem extends Component{
} }
render(){ render(){
const {videoModalObj,file_url}=this.state
const { checkBox, const { checkBox,
discussMessage,index discussMessage,index
} = this.props; } = this.props;
// console.log("Fileslistitem");
// console.log( document.domain);
// console.log(this.props.imhost);
// console.log( window.location.href);
return( return(
<div className="graduateTopicList boardsList"> <div className="graduateTopicList boardsList">
{
videoModalObj&&videoModalObj===true?
<HeadlessModal
visible={videoModalObj}
setVisible={(bool)=>this.setVisible(bool)}
className="showVideoModal"
width={800 - 1}
>
<video
preload="auto"
src={file_url} controls="true" >
您的浏览器不支持 video 标签
</video>
<div className="df copyLine">
<Input value={file_url}
className="dark"
></Input>
<ActionBtn className="copybtn" data-clipboard-text={file_url} onClick={() =>this.copyurls()}>复制视频地址</ActionBtn>
</div>
</HeadlessModal>
:""
}
{/*提示*/} {/*提示*/}
{this.state.Modalstype&&this.state.Modalstype===true?<Modals {this.state.Modalstype&&this.state.Modalstype===true?<Modals
@ -263,7 +173,6 @@ class Fileslistitem extends Component{
{...this.props} {...this.props}
visible={this.state.Showoldfiles} visible={this.state.Showoldfiles}
allfiles={this.state.allfiles} allfiles={this.state.allfiles}
Clicktobroadcastthevideo={(bool,urls,index)=>this.Clicktobroadcastthevideo(bool,urls,index)}
closaoldfilesprops={this.closaoldfilesprops} closaoldfilesprops={this.closaoldfilesprops}
/> />
<style>{` <style>{`
@ -457,4 +366,3 @@ class Fileslistitem extends Component{
} }
} }
export default Fileslistitem; export default Fileslistitem;

@ -30,7 +30,7 @@ class VideoIndex extends Component{
videos:undefined, videos:undefined,
count:0, count:0,
page:1, page:1,
videoId:undefined, videoId:undefined,
videoVisible:false, videoVisible:false,
visible:false visible:false
@ -44,7 +44,7 @@ class VideoIndex extends Component{
}) })
} }
setVideoVisible=(flag)=>{ setVideoVisible=(flag)=>{
this.setState({ this.setState({
videoVisible:flag videoVisible:flag
}) })
@ -58,7 +58,7 @@ class VideoIndex extends Component{
} }
} else { } else {
// videoEl.current && videoEl.current.play() // videoEl.current && videoEl.current.play()
setTimeout(() => { setTimeout(() => {
if (!_clipboard) { if (!_clipboard) {
_clipboard = new ClipboardJS('.copybtn'); _clipboard = new ClipboardJS('.copybtn');
@ -68,7 +68,7 @@ class VideoIndex extends Component{
} }
}, 200) }, 200)
} }
} }
// 编辑成功后回调的方法 // 编辑成功后回调的方法
editSuccess=()=>{ editSuccess=()=>{
@ -157,14 +157,10 @@ class VideoIndex extends Component{
render(){ render(){
const { count , videos , upload , visible , videoVisible , videoId } = this.state; const { count , videos , upload , visible , videoVisible , videoId } = this.state;
const CourseId=this.props.match.params.coursesId; const CourseId=this.props.match.params.coursesId;
const { login }= this.props.user; const login=this.props.user&&this.props.user.login;
console.log(this.props); const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url);
// const operation = (is_teacher && professional_certification) || admin;
const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url);
return( return(
<React.Fragment> <React.Fragment>
<div className="edu-back-white"> <div className="edu-back-white">
@ -179,7 +175,7 @@ class VideoIndex extends Component{
width={800 - 1} width={800 - 1}
> >
{ {
videoId && videoId &&
<video <video
autoplay="true" autoplay="true"
ref={videoEl} ref={videoEl}
@ -187,7 +183,7 @@ class VideoIndex extends Component{
您的浏览器不支持 video 标签 您的浏览器不支持 video 标签
</video> </video>
} }
<div className="df copyLine"> <div className="df copyLine">
<Input value={_inputValue} <Input value={_inputValue}
className="dark" className="dark"
@ -199,7 +195,7 @@ class VideoIndex extends Component{
<span className="fl font-grey-9"> <span className="color-orange">{count}</span> </span> <span className="fl font-grey-9"> <span className="color-orange">{count}</span> </span>
<li className="fr"> <li className="fr">
{ {
upload ? upload ?
<WordsBtn style="grey" className="font-16" onClick={()=>this.uploadVideo(false)}>取消</WordsBtn> <WordsBtn style="grey" className="font-16" onClick={()=>this.uploadVideo(false)}>取消</WordsBtn>
: :
<WordsBtn style="blue" className="font-16" onClick={this.toUpload}>上传视频</WordsBtn> <WordsBtn style="blue" className="font-16" onClick={this.toUpload}>上传视频</WordsBtn>
@ -208,7 +204,7 @@ class VideoIndex extends Component{
</p> </p>
</div> </div>
{ {
upload ? upload ?
<VideoUploadList {...this.props} flag={true} CourseId={CourseId} CourseUser={login} successFunc={this.uploadVideo}></VideoUploadList> <VideoUploadList {...this.props} flag={true} CourseId={CourseId} CourseUser={login} successFunc={this.uploadVideo}></VideoUploadList>
: :
<React.Fragment> <React.Fragment>
@ -219,8 +215,8 @@ class VideoIndex extends Component{
{ {
videos.map((item,key)=>{ videos.map((item,key)=>{
return( return(
// <VideoItem // <VideoItem
// item={item} // item={item}
// key={key} // key={key}
// onEditVideo={this.onEditVideo} // onEditVideo={this.onEditVideo}
// ></VideoItem> // ></VideoItem>
@ -243,7 +239,7 @@ class VideoIndex extends Component{
<NoneData style={{width: '100%'}}></NoneData> <NoneData style={{width: '100%'}}></NoneData>
} }
</div> </div>
{ {
count > PAGE_SIZE && count > PAGE_SIZE &&
<div className="mt30 mb50 edu-txt-center"> <div className="mt30 mb50 edu-txt-center">
<Pagination showQuickJumper total={count} pageSize={PAGE_SIZE} onChange={this.changePage}></Pagination> <Pagination showQuickJumper total={count} pageSize={PAGE_SIZE} onChange={this.changePage}></Pagination>
@ -251,7 +247,7 @@ class VideoIndex extends Component{
} }
</React.Fragment> </React.Fragment>
} }
</React.Fragment> </React.Fragment>
) )
} }

@ -436,7 +436,7 @@ class DetailTop extends Component{
border:1px solid rgba(255,255,255,1); border:1px solid rgba(255,255,255,1);
} }
.maxwinth600{ .maxwinth600{
width:600px; width:740px;
} }
` `
} }
@ -454,7 +454,7 @@ class DetailTop extends Component{
</div> </div>
<div className="clearfix mt20"> <div className="clearfix mt20">
{ {
detailInfoList && detailInfoList &&
<ul className="fl color-grey-eb pathInfo"> <ul className="fl color-grey-eb pathInfo">
{ detailInfoList.stages_count!=0 ? <li><span>章节</span><span className="ml5">{detailInfoList.stages_count}</span></li> : ""} { detailInfoList.stages_count!=0 ? <li><span>章节</span><span className="ml5">{detailInfoList.stages_count}</span></li> : ""}
{ detailInfoList.shixuns_count!=0 ? <li><span>实训</span><span className="ml5">{ detailInfoList.shixuns_count}</span></li> : ""} { detailInfoList.shixuns_count!=0 ? <li><span>实训</span><span className="ml5">{ detailInfoList.shixuns_count}</span></li> : ""}
@ -472,8 +472,8 @@ class DetailTop extends Component{
</Link>:"" </Link>:""
} }
{ detailInfoList.allow_send === true?this.props.courses===undefined? { detailInfoList.allow_send === true?
<SendPanel {...this.props} {...this.state}></SendPanel>:"":"" <SendPanel {...this.props} {...this.state}></SendPanel>:""
} }
{this.props.courses===undefined?"":detailInfoList.is_creator===true?<a className={"fr font-18 color-white kaike mr20 kkbths"} onClick={()=>this.OpenCoursefun()}>开课</a>:""} {this.props.courses===undefined?"":detailInfoList.is_creator===true?<a className={"fr font-18 color-white kaike mr20 kkbths"} onClick={()=>this.OpenCoursefun()}>开课</a>:""}
@ -753,7 +753,7 @@ class DetailTop extends Component{
</div> </div>
) )
} }

@ -92,14 +92,14 @@ const style = {
// <Dialog // <Dialog
// open={true} // open={true}
// onClose={this.handleGoldRewardDialogClose} // onClose={this.handleGoldRewardDialogClose}
// > // >
// <DialogTitle id="alert-dialog-title">{"奖励设置"}</DialogTitle> // <DialogTitle id="alert-dialog-title">{"奖励设置"}</DialogTitle>
// <DialogContent> // <DialogContent>
// <FormControl aria-describedby="name-error-text"> // <FormControl aria-describedby="name-error-text">
// <InputLabel htmlFor="goldReward">1请输入奖励的金币数量</InputLabel> // <InputLabel htmlFor="goldReward">1请输入奖励的金币数量</InputLabel>
// <Input id="goldReward" type="number" value={this.state.goldRewardInput} onChange={(e) => this.onGoldRewardInputChange(e)} /> // <Input id="goldReward" type="number" value={this.state.goldRewardInput} onChange={(e) => this.onGoldRewardInputChange(e)} />
// </FormControl> // </FormControl>
// </DialogContent> // </DialogContent>
// <DialogActions> // <DialogActions>
@ -109,7 +109,7 @@ const style = {
// } // }
// } // }
// const TestMaterialDesign = () => ( // const TestMaterialDesign = () => (
// <FlatButton label="Primary" primary={true} /> // <FlatButton label="Primary" primary={true} />
// ); // );
@ -122,7 +122,7 @@ const style = {
function PPHOC(WrappedComponent) { function PPHOC(WrappedComponent) {
return class PP extends React.Component { return class PP extends React.Component {
componentDidMount() { componentDidMount() {
console.log('componentDidMount1 componentDidMount1 ') // console.log('componentDidMount1 componentDidMount1 ')
} }
constructor(props) { constructor(props) {
super(props) super(props)

@ -76,7 +76,7 @@ class NewHeader extends Component {
goshowqqgtounp:false, goshowqqgtounp:false,
visiblemyss:false, visiblemyss:false,
} }
console.log("176") // console.log("176")
// console.log(props); // console.log(props);
// console.log("NewHeader1234567890"); // console.log("NewHeader1234567890");
// console.log(this.props); // console.log(this.props);
@ -89,7 +89,7 @@ class NewHeader extends Component {
} }
} }
componentDidMount() { componentDidMount() {
console.log("componentDidMount1"); // console.log("componentDidMount1");
this.getAppdata(); this.getAppdata();
window._header_componentHandler = this; window._header_componentHandler = this;

@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('<link rel="stylesheet" type="text/css" />') // $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`)); // .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />') $('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?2`)); .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1`));
$('head').append($('<link rel="stylesheet" type="text/css" />') $('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?2`)); .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1`));
// index.html有加载 // index.html有加载
$('head').append($('<link rel="stylesheet" type="text/css" />') $('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?2`)); .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1`));
// $('head').append($('<link rel="stylesheet" type="text/css" />') // $('head').append($('<link rel="stylesheet" type="text/css" />')

@ -141,7 +141,6 @@ export default class Shixuninformation extends Component {
onSubmits = () => { onSubmits = () => {
let {can_copy, use_scope, scope_partment, opening_time,oldscope_partment} = this.state; let {can_copy, use_scope, scope_partment, opening_time,oldscope_partment} = this.state;
if(this.state.opentime===true){ if(this.state.opentime===true){
if(opening_time===null){ if(opening_time===null){
this.setState({ this.setState({
@ -151,8 +150,9 @@ export default class Shixuninformation extends Component {
return return
} }
} }
if(use_scope===1){ if(use_scope===1){
if(oldscope_partment.length===0){ if(oldscope_partment.length===0&&scope_partment.length===0){
this.setState({ this.setState({
scope_partmenttype:true scope_partmenttype:true
}) })

@ -491,7 +491,7 @@ table.text-file{}
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.subhead_content{width: 1200px;margin: 0px auto;} .subhead_content{width: 1200px;margin: 0px auto;}
.pathInfo li{text-align: center;float: left;margin-right: 38px;} .pathInfo li{text-align: center;float: left;margin-right: 30px;}
.pathInfo li span{display: block;} .pathInfo li span{display: block;}
.produce-content{padding: 40px 20px;background-color: #fff;box-sizing: border-box} .produce-content{padding: 40px 20px;background-color: #fff;box-sizing: border-box}

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe CourseVideo, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save