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

video_log
caicai8 5 years ago
commit af1e1a7831

@ -5,6 +5,14 @@ class Admins::DashboardsController < Admins::BaseController
@month_active_user_count = User.where(last_login_on: current_month).count
@new_user_count = User.where(created_on: current_month).count
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo"
res = interface_get uri, 502, "数据接口延迟"
if res['code'] == 0
@pod_num = res['sum'] || 0
end
end
def month_active_user

@ -448,6 +448,25 @@ class ApplicationController < ActionController::Base
end
end
# 无参类型处理
def interface_get(uri, status, message)
begin
uid_logger_dubug("--uri_exec: url is #{uri}")
uri = URI.parse(URI.encode(uri.strip))
res = Net::HTTP.get(uri)
uid_logger_dubug("--uri_exec: .....res is #{res}")
res = JSON.parse(res)
if (res && res['code'] != 0)
tip_exception(status, message)
else
res
end
rescue Exception => e
uid_logger("--uri_exec: exception #{e.message}")
raise Educoder::TipException.new(message)
end
end
# json格式请求
def interface_json_post(uri, params, status, message)
begin

@ -35,6 +35,7 @@ module LoginHelper
UserAction.create(action_id: user&.id, action_type: 'Login', user_id: user&.id, ip: request.remote_ip)
user.update_column(:last_login_on, Time.now)
# 注册完成后有一天的试用申请(先去掉)
# UserDayCertification.create(user_id: user.id, status: 1)
end
@ -44,6 +45,8 @@ module LoginHelper
if autologin = cookies.delete(autologin_cookie_name)
User.current.delete_autologin_token(autologin)
end
UserOnline.logout(User.current.id)
User.current.delete_session_token(session[:tk])
self.logged_user = nil
end
@ -52,6 +55,7 @@ module LoginHelper
default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
# end
session[:"#{default_yun_session}"] = nil
session[:request_user_id] = nil
end
# Sets the logged in user
@ -78,6 +82,8 @@ module LoginHelper
# # end
# session[:user_id] = user.id
UserOnline.login(user.id)
session[:request_user_id] = user.id
session[:"#{default_yun_session}"] = user.id
session[:ctime] = Time.now.utc.to_i
session[:atime] = Time.now.utc.to_i

@ -262,7 +262,7 @@ class EcloudController < ApplicationController
u.login = "ecoder_#{user_info['mobile']}"
u.type ='User'
u.status = User::STATUS_ACTIVE
u.nickname = user_info[:username]
u.nickname = user_info['username']
u.lastname = user_info['username']
end

@ -4,6 +4,7 @@ class MainController < ApplicationController
skip_before_action :setup_laboratory
def first_stamp
UserOnline.login(session[:request_user_id]) if session[:request_user_id]
render :json => { status: 0, message: Time.now.to_i }
end

@ -0,0 +1,41 @@
module UserOnline
class << self
def login(user_id)
set_bit(user_id, 1)
end
def logout(user_id)
set_bit(user_id, 0)
end
def set_bit(user_id, flag)
if !Rails.cache.data.exists(cache_key)
Rails.cache.data.setbit(cache_key, user_id, flag)
Rails.cache.data.expire(cache_key, 20 * 60 + 10)
else
Rails.cache.data.setbit(cache_key, user_id, flag)
end
end
def count
if Rails.cache.is_a?(ActiveSupport::Cache::RedisStore)
Rails.cache.data.bitcount(cache_key)
else
0
end
end
def cache_key
if Rails.cache.is_a?(ActiveSupport::Cache::RedisStore)
# 10分钟为一段记录用户在线, 统计范围为20分钟内的线用户
# TODO 更精确时长
begin_hour = Time.now.beginning_of_hour
minutes_piece = (Time.now - begin_hour) / 600
time = begin_hour.since((minutes_piece.to_i - 1) * 600).strftime("%H-%M")
"online_user_#{time}"
else
raise '请配置config.cache_store = redis_store'
end
end
end
end

@ -9,6 +9,10 @@ class ApplicationService
content.gsub(regex, '')
end
def convert_https content
content.gsub("http:", "https:")
end
private
def strip(str)

@ -12,7 +12,7 @@ class Videos::DispatchCallbackService < ApplicationService
# TODO:: 拆分事件分发
case params['EventType']
when 'FileUploadComplete' then # 视频上传完成
video.file_url = params['FileUrl']
video.file_url = convert_https(params['FileUrl'])
video.filesize = params['Size']
video.upload_success
video.save!

@ -42,10 +42,7 @@
</div>
</div>
</div>
<!-- <p class="mt-3 mb-0 text-muted text-sm">-->
<!-- <span class="text-danger mr-2"><i class="fas fa-arrow-down"></i> 3.48%</span>-->
<!-- <span class="text-nowrap">Since last week</span>-->
<!-- </p>-->
</div>
</div>
</div>
@ -63,13 +60,11 @@
</div>
</div>
</div>
<!-- <p class="mt-3 mb-0 text-muted text-sm">-->
<!-- <span class="text-warning mr-2"><i class="fas fa-arrow-down"></i> 1.10%</span>-->
<!-- <span class="text-nowrap">Since yesterday</span>-->
<!-- </p>-->
</div>
</div>
</div>
<div class="col-xl-3 col-lg-6">
<div class="card card-stats mb-4 mb-xl-0">
<div class="card-body">
@ -91,6 +86,45 @@
</div>
</div>
</div>
<div class="col-xl-3 col-lg-6" style="padding-top: 15px;">
<div class="card card-stats mb-4 mb-xl-0">
<div class="card-body">
<div class="row">
<div class="col">
<h5 class="card-title text-uppercase text-muted mb-0">当前在线用户数</h5>
<span class="h2 font-weight-bold mb-0"><%= UserOnline.count %></span>
</div>
<div class="col-auto">
<div class="icon icon-shape rounded-circle shadow">
<i class="fa fa-users"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-lg-6" style="padding-top: 15px;">
<div class="card card-stats mb-4 mb-xl-0">
<div class="card-body">
<div class="row">
<div class="col">
<h5 class="card-title text-uppercase text-muted mb-0">当前Pod总数</h5>
<span class="h2 font-weight-bold mb-0"><%= @pod_num.to_i %></span>
</div>
<div class="col-auto">
<div class="icon icon-shape rounded-circle shadow">
<i class="fa fa-users"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -100,14 +134,6 @@
<div class="row mt-5">
<div class="col-xl-8 mb-5 mb-xl-0">
<div class="card shadow">
<!-- <div class="card-header border-0">-->
<!-- <div class="row align-items-center">-->
<!-- <h5 class="mb-0">近7天评测次数</h5>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="table-responsive">-->
<!-- <div id="evaluate-pie" class="pie"></div>-->
<!-- </div>-->
</div>
</div>
@ -127,92 +153,3 @@
</div>
<!--<div class="container-fluid mt--7">-->
<!-- <div class="row mt-5">-->
<!-- <div class="col-xl-8 mb-5 mb-xl-0">-->
<!-- <div class="card shadow">-->
<!-- <div class="card-header border-0">-->
<!-- <div class="row align-items-center">-->
<!-- <div class="col">-->
<!-- <h3 class="mb-0">Page visits</h3>-->
<!-- </div>-->
<!-- <div class="col text-right">-->
<!-- <a href="#!" class="btn btn-sm btn-primary">Test</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="table-responsive">-->
<!-- <table class="table align-items-center table-flush">-->
<!-- <thead class="thead-light">-->
<!-- <tr>-->
<!-- <th scope="col">Test</th>-->
<!-- <th scope="col">Test</th>-->
<!-- <th scope="col">Test</th>-->
<!-- <th scope="col">Test</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<%# 5.times do %>
<!-- <tr>-->
<!-- <th scope="row">/test/</th>-->
<!-- <td>4,569</td>-->
<!-- <td>340</td>-->
<!-- <td>-->
<!-- <i class="fas fa-arrow-up text-success mr-3"></i> 46,53%-->
<!-- </td>-->
<!-- </tr>-->
<%# end %>
<!-- </tbody>-->
<!-- </table>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="col-xl-4">-->
<!-- <div class="card shadow">-->
<!-- <div class="card-header border-0">-->
<!-- <div class="row align-items-center">-->
<!-- <div class="col">-->
<!-- <h3 class="mb-0">Test</h3>-->
<!-- </div>-->
<!-- <div class="col text-right">-->
<!-- <a href="#!" class="btn btn-sm btn-primary">Test</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="table-responsive">-->
<!-- <table class="table align-items-center table-flush">-->
<!-- <thead class="thead-light">-->
<!-- <tr>-->
<!-- <th scope="col">Test</th>-->
<!-- <th scope="col">Test</th>-->
<!-- <th scope="col"></th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<%# 5.times do %>
<!-- <tr>-->
<!-- <th scope="row">-->
<!-- Test-->
<!-- </th>-->
<!-- <td>-->
<!-- 1,480-->
<!-- </td>-->
<!-- <td>-->
<!-- <div class="d-flex align-items-center">-->
<!-- <span class="mr-2">60%</span>-->
<!-- <div>-->
<!-- <div class="progress">-->
<!-- <div class="progress-bar bg-gradient-danger" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;"></div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </td>-->
<!-- </tr>-->
<%# end %>
<!-- </tbody>-->
<!-- </table>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->

@ -1,4 +1,4 @@
json.status 1
json.message "发送成功"
json.course_id @course.id
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)
json.first_category_url module_url(@course.shixun_course_modules.first, @course)

@ -1,3 +1,3 @@
json.status 1
json.message "发送成功"
json.url module_url(@course.none_hidden_course_modules.first, @course)
json.url module_url(@course.shixun_course_modules.first, @course)

@ -29,6 +29,24 @@ namespace :video do
end
end
desc "将http修改成http"
task modify_http_to_https_file_url: :environment do
p "s"
if ENV['args']
course_id = ENV['args'].split(",")[0]
video_ids = CourseVideo.where(course_id: course_id).pluck(:video_id)
videos = Video.where(id: video_ids)
if videos
videos.each do |v|
if v.file_url
file_url = v.file_url.gsub("http:", "https:")
v.update_column(:file_url, file_url)
end
end
end
end
end
# 执行示例 bundle exec rake video:sample args=2933,'2019-08-19 00:00:00','2019-11-09 23:59:59'
task :sample => :environment do
if ENV['args']

File diff suppressed because it is too large Load Diff

@ -39,6 +39,7 @@
"eslint-plugin-react": "7.4.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"flv.js": "^1.5.0",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"immutability-helper": "^2.6.6",

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8">
<!--<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">-->
@ -12,12 +13,15 @@
<meta name=”Keywords” Content=”翻转课堂,高效课堂创建,教学模式″>
<meta name=”Keywords” Content=”实训项目,python教程,C语言入门,java书,php后端开发,app前端开发,数据库技术″>
<meta name=”Keywords” Content=”在线竞赛,计算机应用大赛,编程大赛,大学生计算机设计大赛,全国高校绿色计算机大赛″>
<meta name=”Description” Content=”EduCoder是信息技术类实践教学平台。EduCoder涵盖了计算机、大数据、云计算、人工智能、软件工程、物联网等专业课程。超10000个实训案例及22000个技能评测点建立学、练、评、测一体化实验环境。”>
<meta name=”Description” Content=”EduCoder实践课程旨在于通过企业级实战实训案例帮助众多程序员提升各项业务能力。解决学生、学员、企业员工等程序设计能力、算法设计能力、问题求解能力、应用开发能力、系统运维能力等。”>
<meta name=”Description” Content=”EduCoder翻转课堂教学模式颠覆了传统教学模式让教师与学生的关系由“权威”变成了“伙伴”。将学习的主动权转交给学生使学生可个性化化学学生的学习主体得到了彰显。”>
<meta name=”Description”
Content=”EduCoder是信息技术类实践教学平台。EduCoder涵盖了计算机、大数据、云计算、人工智能、软件工程、物联网等专业课程。超10000个实训案例及22000个技能评测点建立学、练、评、测一体化实验环境。”>
<meta name=”Description”
Content=”EduCoder实践课程旨在于通过企业级实战实训案例帮助众多程序员提升各项业务能力。解决学生、学员、企业员工等程序设计能力、算法设计能力、问题求解能力、应用开发能力、系统运维能力等。”>
<meta name=”Description”
Content=”EduCoder翻转课堂教学模式颠覆了传统教学模式让教师与学生的关系由“权威”变成了“伙伴”。将学习的主动权转交给学生使学生可个性化化学学生的学习主体得到了彰显。”>
<meta name=”Description” Content=”EduCoder实训项目为单个知识点关卡实践训练帮助学生巩固单一弱点强化学习。 >
<meta name=”Description” Content=”EduCoder实践教学平台各类大赛为进一步提高各类学生综合运用高级语言程序设计能力培养创新意识和实践探索精神发掘优秀软件人才。 >
<!-- <meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3, user-scalable=no">-->
<!-- <meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3, user-scalable=no">-->
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3">
<meta name="theme-color" content="#000000">
@ -27,7 +31,7 @@
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">-->
<!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">-->
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@ -37,15 +41,15 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<!-- <title>EduCoder</title>-->
<!-- <title>EduCoder</title>-->
<!--react-ssr-head-->
<script type="text/javascript">
window.__isR = true;
// 不支持ie9 ie10
if (
( navigator.userAgent.indexOf('MSIE 9') != -1
|| navigator.userAgent.indexOf('MSIE 10') != -1 )
(navigator.userAgent.indexOf('MSIE 9') != -1
|| navigator.userAgent.indexOf('MSIE 10') != -1)
&&
location.pathname.indexOf("/compatibility") == -1) {
debugger;
@ -103,8 +107,9 @@
user-select: none;
</style>
</head>
<body>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
@ -136,44 +141,13 @@
<div id="picture_display" style="display: none;"></div>
<!-- js css合并 文件优先级的问题 -->
<script type="text/javascript" src="/js/js_min_all.js"></script>
<!-- <script type="text/javascript" src="/js/js_min_all_2.js"></script> -->
<!--
<script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/js/editormd/underscore.min.js"></script>
<script type="text/javascript" src="/js/editormd/marked.min.js"></script>
<script type="text/javascript" src="/js/editormd/prettify.min.js"></script>
<script type="text/javascript" src="/js/editormd/raphael.min.js"></script>
<script type="text/javascript" src="/js/editormd/sequence-diagram.min.js"></script>
<script type="text/javascript" src="/js/editormd/flowchart.min.js"></script>
<script type="text/javascript" src="/js/editormd/jquery.flowchart.min.js"></script>
<script type="text/javascript" src="/js/editormd/editormd.min.js"></script>
-->
<!-- codemirror addon -->
<!--
<script type="text/javascript" src="/js/codemirror/codemirror.js"></script>
<script type="text/javascript" src="/js/codemirror/mode/javascript.js"></script>
<script type="text/javascript" src="/js/diff_match_patch.js"></script>
<script type="text/javascript" src="/js/merge.js"></script>
<script type="text/javascript" src="/js/edu_tpi.js"></script>
-->
<!-- testbdweb.trustie.net testbdweb.educoder.net -->
<script type="text/javascript" src="/js/flv.min.js"></script>
<!-- 在tpi js里加载这3个脚本 -->
<script>
(function() { // Scoping function to avoid globals
(function () { // Scoping function to avoid globals
var href = location.href;
if(window.location.port === "3007"){
if (window.location.port === "3007") {
if (href.indexOf('/tasks/') != -1) {
document.write('<script type="text/javascript" src="https://newweb.educoder.net/assets/kindeditor/kindeditor.js"><\/script>');
// build.js中会将这个url附加一个前缀 react/build
@ -183,7 +157,7 @@
document.write('<script type="text/javascript" src="https://newweb.educoder.net/javascripts/educoder/edu_application.js"><\/script>');
}
}else{
} else {
if (href.indexOf('/tasks/') != -1) {
document.write('<script type="text/javascript" src="/assets/kindeditor/kindeditor.js"><\/script>');
// build.js中会将这个url附加一个前缀 react/build
@ -203,10 +177,11 @@
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/educoder/edu_application.js"></script> -->
<script type="text/javascript" src="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.js"></script>
<!-- <script>-->
<!-- document.body.addEventListener('touchmove', function (e) {-->
<!-- e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)-->
<!-- }, {passive: false});-->
<!-- </script>-->
</body>
<!-- <script>-->
<!-- document.body.addEventListener('touchmove', function (e) {-->
<!-- e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)-->
<!-- }, {passive: false});-->
<!-- </script>-->
</body>
</html>

File diff suppressed because one or more lines are too long

@ -209,15 +209,19 @@ function generateNewIndexJsp() {
} else if (window.location.host == 'www.educoder.net') {
_host = 'https://ali-cdn.educoder.net/react/build/'
}
document.write('<script type="text/javascript" src="' + _host + 'js/js_min_all.js"><\\/script>');
document.write('<script type="text/javascript" src="' + _host + 'js/flv.min.js"><\\/script>');
document.write('<script type="text/javascript" src="' + _host + 'static/js/main.${matchResult[1]}.js"><\\/script>');
})()
</script>
`
var jsMinAllRegex = /<script type="text\/javascript" src="\/js\/js_min_all.js"><\/script>/
var flvMinAllRegex = /<script type="text\/javascript" src="\/js\/flv.min.js"><\/script>/
// <script type="text/javascript" src="/js/js_min_all.js"></script>
var result = data
.replace(jsMinAllRegex, code)
.replace(flvMinAllRegex, code)
// .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`)
// .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`)

@ -1,12 +1,13 @@
import React,{ Component } from "react";
import { Input , Pagination } from 'antd';
import { NoneData ,ActionBtn } from 'educoder';
import React, { Component } from "react";
import { Input, Pagination } from 'antd';
import { NoneData, ActionBtn } from 'educoder';
import VideoUploadList from '../../user/usersInfo/video/VideoUploadList';
import VideoInReviewItem from '../../user/usersInfo/video/VideoInReviewItem';
import HeadlessModal from '../../user/usersInfo/common/HeadlessModal';
import EditVideoModal from '../../user/usersInfo/video/EditVideoModal'
import ClipboardJS from 'clipboard'
import VideoPanel from './video-play'
import './video.css';
import '../../user/usersInfo/video/InfosVideo.css'
@ -15,39 +16,38 @@ import axios from 'axios';
const DEFAULT_VIDEO_WIDTH_IN_MD = "90%" // 400
const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400
const videoEl = null;
let _clipboard = null;
class Video extends Component{
constructor(props){
class Video extends Component {
constructor(props) {
super(props);
this.state={
videos:undefined,
count:0,
page:1,
this.state = {
videos: undefined,
count: 0,
page: 1,
videoId:undefined,
videoVisible:false,
visible:false
videoId: undefined,
videoVisible: false,
visible: false
}
}
// 编辑的弹框visible
setVisible=(flag)=>{
setVisible = (flag) => {
this.setState({
visible:flag
visible: flag
})
}
setVideoVisible=(flag)=>{
setVideoVisible = (flag) => {
this.setState({
videoVisible:flag
videoVisible: flag
})
if (flag === false) {
if (_clipboard) {
this.setState({
videoId:undefined
videoId: undefined
})
_clipboard.listener.destroy();
_clipboard = null;
@ -68,13 +68,13 @@ class Video extends Component{
// 编辑成功后回调的方法
editSuccess=()=>{
editSuccess = () => {
this.props.showNotification("视频名称修改成功!");
const { listFunc , page } = this.props;
const { listFunc, page } = this.props;
listFunc && listFunc(page);
}
onEditVideo=(item)=>{
onEditVideo = (item) => {
let videoId = {
videoId: item.id,
title: item.title
@ -85,7 +85,7 @@ class Video extends Component{
this.setVisible(true);
}
onMaskClick=(item)=> {
onMaskClick = (item) => {
let videoId = {
videoId: item.id,
title: item.title,
@ -99,15 +99,15 @@ class Video extends Component{
}
setVideoVisible=(flag)=>{
setVideoVisible = (flag) => {
this.setState({
videoVisible:flag
videoVisible: flag
})
if (flag === false) {
if (_clipboard) {
this.setState({
videoId:undefined
videoId: undefined
})
_clipboard.listener.destroy();
_clipboard = null;
@ -127,31 +127,31 @@ class Video extends Component{
}
getCopyText = (file_url, cover_url)=>{
getCopyText = (file_url, cover_url) => {
return `<video src="${file_url}" controls="true" controlslist="nodownload" width="${DEFAULT_VIDEO_WIDTH_IN_MD}" height="${DEFAULT_VIDEO_HEIGHT_IN_MD}" poster="${cover_url}">您的浏览器不支持 video 标签。</video>`
}
// 删除事件
deleteVideo=(item)=>{
deleteVideo = (item) => {
this.props.confirm({
content: '该视频将被删除,不可恢复',
subContent:'是否确认删除?',
subContent: '是否确认删除?',
onOk: () => {
const CourseId=this.props.match.params.coursesId;
const CourseId = this.props.match.params.coursesId;
const url = `/courses/${CourseId}/delete_course_video.json`;
axios.delete(url,{
params:{
video_id:item.id
axios.delete(url, {
params: {
video_id: item.id
}
}).then(result=>{
if(result){
}).then(result => {
if (result) {
this.props.showNotification(`删除成功!`);
this.props.updataleftNavfun();
const { listFunc , page } = this.props;
const { listFunc, page } = this.props;
listFunc && listFunc(page);
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
},
@ -161,18 +161,18 @@ class Video extends Component{
});
}
render(){
const { visible , videoVisible , videoId } = this.state;
const CourseId=this.props.match.params.coursesId;
const login=this.props.user&&this.props.user.login;
render() {
const { visible, videoVisible, videoId } = this.state;
const CourseId = this.props.match.params.coursesId;
const login = this.props.user && this.props.user.login;
const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url);
const { admin , is_teacher ,business , user_id} = this.props.user;
const { admin, is_teacher, business, user_id } = this.props.user;
const { videos , upload , uploadVideo , videoData , changePage ,pageSize ,page } = this.props;
const { videos, upload, uploadVideo, videoData, changePage, pageSize, page } = this.props;
const operation = admin || business || (is_teacher && this.props.checkIfProfessionalCertification())
return(
return (
<div>
<EditVideoModal {...this.props} visible={visible} setVisible={this.setVisible}
editSuccess={this.editSuccess}
@ -184,15 +184,7 @@ class Video extends Component{
className="showVideoModal"
width={800 - 1}
>
{
videoId &&
<video
autoplay="true"
ref={videoEl}
src={videoId.file_url} controls="true" controlslist="nodownload">
您的浏览器不支持 video 标签
</video>
}
{videoId && <VideoPanel src={videoId.file_url} />}
<div className="df copyLine">
<Input value={_inputValue}
@ -204,7 +196,7 @@ class Video extends Component{
<div className="videoPanel">
{
upload ?
<VideoUploadList {...this.props} flag={true} CourseId={CourseId} CourseUser={login} successFunc={()=>uploadVideo()}></VideoUploadList>
<VideoUploadList {...this.props} flag={true} CourseId={CourseId} CourseUser={login} successFunc={() => uploadVideo()}></VideoUploadList>
:
<React.Fragment>
{
@ -213,8 +205,8 @@ class Video extends Component{
<p className="font-grey-9 mt20 mb20 pl5"> <span className="color-orange">{videoData && videoData.count}</span> </p>
<div className="videoContent">
{
videos.map((item,key)=>{
return(
videos.map((item, key) => {
return (
<VideoInReviewItem
{...this.props}
@ -234,14 +226,14 @@ class Video extends Component{
</React.Fragment>
:
<div className="edu-back-white">
<NoneData style={{width: '100%'}}></NoneData>
<NoneData style={{ width: '100%' }}></NoneData>
</div>
}
{
videoData && videoData.count > pageSize &&
<div className="mt30 mb50 edu-txt-center">
<Pagination showQuickJumper total={videoData.count} current={page} pageSize={pageSize} onChange={(page)=>changePage(page,'video')}></Pagination>
<Pagination showQuickJumper total={videoData.count} current={page} pageSize={pageSize} onChange={(page) => changePage(page, 'video')}></Pagination>
</div>
}
</React.Fragment>

@ -0,0 +1,37 @@
import React, { useEffect, useRef } from 'react'
export default ({ url }) => {
const ref = useRef()
useEffect(() => {
let player = null
if (window.flvjs.isSupported) {
player = window.flvjs.createPlayer({
type: 'flv',
volume: 0.8,
cors: true,
url,
muted: false
})
if (ref.current) {
player.attachMediaElement(ref.current)
player.load()
player.play()
}
}
return () => {
if (player) {
player.unload()
player.pause()
player.destroy()
player = null
}
}
}, [url, ref.current])
return (
<video ref={ref} controls autoPlay={true} muted={false} className="flv-player"></video>
)
}

@ -0,0 +1,18 @@
import React, { Fragment } from 'react'
import ReactFlvPlayer from './flv-player'
export default ({ src }) => {
const suf = src.split('.').pop()
const isFlv = suf === 'flv'
return (
<Fragment>
{
isFlv ? <ReactFlvPlayer url={src} isMuted={true} /> : <video src={src} controls autoPlay={true} controlsList="nodownload">
<source type={`video/${suf}`} src={src} />
您的浏览器不支持 video 标签
</video>
}
</Fragment>
)
}

@ -1,16 +1,15 @@
import React, { useState, useEffect, useContext, useRef, memo } from 'react';
import {Link} from 'react-router-dom';
import {Pagination, Input, Button} from 'antd'
import { getUrl2, isDev, ThemeContext, ActionBtn, NoneData } from 'educoder'
import { Pagination, Input, Button } from 'antd'
import { ThemeContext, ActionBtn, NoneData } from 'educoder'
import axios from 'axios'
import VideoInReviewItem from './VideoInReviewItem'
import EditVideoModal from './EditVideoModal'
import './InfosVideo.css'
import InfoTab from '../common/InfoTab'
import HeadlessModal from '../common/HeadlessModal'
import CRoundSelect from '../common/CRoundSelect'
import ClipboardJS from 'clipboard'
import VideoPlay from '../../../courses/Video/video-play';
function useModal(initValue) {
const [visible, setVisible] = useState(initValue)
@ -45,11 +44,11 @@ const DEFAULT_VIDEO_WIDTH_IN_MD = "90%" // 400
const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400
let videoId = {};
let _clipboard = null;
const _items=[
{key: 'published_at-desc', name: '最新上传'},
{key: 'published_at-asc', name: '最早上传'},
const _items = [
{ key: 'published_at-desc', name: '最新上传' },
{ key: 'published_at-asc', name: '最早上传' },
]
function InfoVideo (props) {
function InfoVideo(props) {
const [videos, setvideos] = useState(undefined)
const [reviewvideos, setReviewvideos] = useState(undefined)
const [count, setCount] = useState(0)
@ -140,7 +139,7 @@ function InfoVideo (props) {
} else {
fetchReviewvideos()
}
}, [ pageObj.current, sortKey ])
}, [pageObj.current, sortKey])
useEffect(() => {
if (videoModalObj.visible == false) {
@ -219,7 +218,7 @@ function InfoVideo (props) {
}
function getCopyText (file_url, cover_url) {
function getCopyText(file_url, cover_url) {
return `<video src="${file_url}" controls="true" controlslist="nodownload" width="${DEFAULT_VIDEO_WIDTH_IN_MD}" height="${DEFAULT_VIDEO_HEIGHT_IN_MD}" poster="${cover_url}">您的浏览器不支持 video 标签。</video>`
}
@ -238,12 +237,7 @@ function InfoVideo (props) {
className="showVideoModal"
width={800 - 1}
>
<video
autoplay="true"
ref={videoEl}
src={videoId.file_url} controls="true" controlslist="nodownload">
您的浏览器不支持 video 标签
</video>
<VideoPlay src={videoId.file_url} />
<div className="df copyLine">
<Input value={_inputValue}
className="dark"
@ -329,7 +323,7 @@ function InfoVideo (props) {
}}>
<span>
<span style={{color: theme.foreground_orange1}}> {count} </span>
<span style={{ color: theme.foreground_orange1 }}> {count} </span>
个视频
</span>
@ -340,7 +334,7 @@ function InfoVideo (props) {
{/*sortKey={sortKey }*/}
{/*></CRoundSelect>}*/}
{categoryObj.category == 'all' &&<div className="fr">
{categoryObj.category == 'all' && <div className="fr">
<li className="drop_down">
<span className="color-grey-9 font-12" style={{
marginRight: " 5px",
@ -407,7 +401,7 @@ function InfoVideo (props) {
>
</VideoInReviewItem>)
})
: <NoneData style={{width: '100%'}}></NoneData>
: <NoneData style={{ width: '100%' }}></NoneData>
}
</div>
:
@ -425,7 +419,7 @@ function InfoVideo (props) {
>
</VideoInReviewItem>)
})
: <NoneData style={{width: '100%'}}></NoneData>
: <NoneData style={{ width: '100%' }}></NoneData>
}
</div>
}

@ -74,7 +74,10 @@ function VideoUploadList (props) {
clearInput()
return;
}
if (file.size >(parseInt(MAX_FILE_SIZE) * 1024 * 1024)) {
if(props&&props.user.admin===true||props&&props.user.business===true){
}else if (file.size >(parseInt(MAX_FILE_SIZE) * 1024 * 1024)) {
// 超过500m TODO
clearInput()
showNotification(`视频大小超过${MAX_FILE_SIZE}M`)

Loading…
Cancel
Save