|
|
|
@ -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)
|
|
|
|
@ -80,30 +79,30 @@ function InfoVideo (props) {
|
|
|
|
|
const fetchUrl = `/users/${username}/videos.json`
|
|
|
|
|
const sorts = sortKey.split('-')
|
|
|
|
|
setLoading(true)
|
|
|
|
|
axios.get(fetchUrl, {
|
|
|
|
|
axios.get(fetchUrl, {
|
|
|
|
|
params: {
|
|
|
|
|
page: pageObj.current,
|
|
|
|
|
per_page: PAGE_SIZE,
|
|
|
|
|
sort_by: sorts[0],
|
|
|
|
|
sort_direction: sorts[1],
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
if (response.data.videos) {
|
|
|
|
|
setvideos(response.data.videos)
|
|
|
|
|
setCount(response.data.count)
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
if (response.data.videos) {
|
|
|
|
|
setvideos(response.data.videos)
|
|
|
|
|
setCount(response.data.count)
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function fetchReviewvideos() {
|
|
|
|
|
const fetchUrl = `/users/${username}/videos/review.json`
|
|
|
|
|
const sorts = sortKey.split('-')
|
|
|
|
|
setLoading(true)
|
|
|
|
|
axios.get(fetchUrl, {
|
|
|
|
|
axios.get(fetchUrl, {
|
|
|
|
|
params: {
|
|
|
|
|
page: pageObj.current,
|
|
|
|
|
per_page: PAGE_SIZE,
|
|
|
|
@ -111,15 +110,15 @@ function InfoVideo (props) {
|
|
|
|
|
sort_direction: sorts[1],
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
if (response.data.videos) {
|
|
|
|
|
setReviewvideos(response.data.videos)
|
|
|
|
|
setCount(response.data.count)
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
.then((response) => {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
if (response.data.videos) {
|
|
|
|
|
setReviewvideos(response.data.videos)
|
|
|
|
|
setCount(response.data.count)
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
@ -130,7 +129,7 @@ function InfoVideo (props) {
|
|
|
|
|
fetchReviewvideos()
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pageObj.onChange(1)
|
|
|
|
|
pageObj.onChange(1)
|
|
|
|
|
}
|
|
|
|
|
}, [categoryObj.category])
|
|
|
|
|
|
|
|
|
@ -140,7 +139,7 @@ function InfoVideo (props) {
|
|
|
|
|
} else {
|
|
|
|
|
fetchReviewvideos()
|
|
|
|
|
}
|
|
|
|
|
}, [ pageObj.current, sortKey ])
|
|
|
|
|
}, [pageObj.current, sortKey])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (videoModalObj.visible == false) {
|
|
|
|
@ -158,9 +157,9 @@ function InfoVideo (props) {
|
|
|
|
|
_clipboard = new ClipboardJS('.copybtn');
|
|
|
|
|
_clipboard.on('success', (e) => {
|
|
|
|
|
showNotification('复制成功')
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, 200)
|
|
|
|
|
}, 200)
|
|
|
|
|
}
|
|
|
|
|
}, [videoModalObj.visible])
|
|
|
|
|
|
|
|
|
@ -173,7 +172,7 @@ function InfoVideo (props) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onEditVideo(item) {
|
|
|
|
|
videoId = {
|
|
|
|
|
videoId = {
|
|
|
|
|
videoId: item.id,
|
|
|
|
|
title: item.title
|
|
|
|
|
}
|
|
|
|
@ -182,7 +181,7 @@ function InfoVideo (props) {
|
|
|
|
|
// this.refs['editVideoModal'].setVisible(true, video);
|
|
|
|
|
}
|
|
|
|
|
function onMaskClick(item) {
|
|
|
|
|
videoId = {
|
|
|
|
|
videoId = {
|
|
|
|
|
videoId: item.id,
|
|
|
|
|
title: item.title,
|
|
|
|
|
file_url: item.file_url,
|
|
|
|
@ -219,12 +218,12 @@ 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>`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const _inputValue = getCopyText(videoId.file_url, videoId.cover_url);
|
|
|
|
|
const sorts = sortKey.split('-')
|
|
|
|
|
const _inputValue = getCopyText(videoId.file_url, videoId.cover_url);
|
|
|
|
|
const sorts = sortKey.split('-')
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="educontent infoVideo">
|
|
|
|
@ -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"
|
|
|
|
@ -318,130 +312,130 @@ function InfoVideo (props) {
|
|
|
|
|
onClick={() => { toUpload() }}
|
|
|
|
|
className="toUploadBtn"
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
>
|
|
|
|
|
上传视频
|
|
|
|
|
</Button>
|
|
|
|
|
}
|
|
|
|
|
></InfoTab>
|
|
|
|
|
|
|
|
|
|
<div className="toolbarRow df" style={{
|
|
|
|
|
lineHeight: "40px",
|
|
|
|
|
}}>
|
|
|
|
|
<div className="toolbarRow df" style={{
|
|
|
|
|
lineHeight: "40px",
|
|
|
|
|
}}>
|
|
|
|
|
<span>
|
|
|
|
|
共
|
|
|
|
|
<span style={{color: theme.foreground_orange1}}> {count} </span>
|
|
|
|
|
<span style={{ color: theme.foreground_orange1 }}> {count} </span>
|
|
|
|
|
个视频
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
{/*{categoryObj.category == 'all' && <CRoundSelect {...props}*/}
|
|
|
|
|
{/*width={'90px'}*/}
|
|
|
|
|
{/*items={_items}*/}
|
|
|
|
|
{/*onSortChange={onSortChange}*/}
|
|
|
|
|
{/*sortKey={sortKey }*/}
|
|
|
|
|
{/*width={'90px'}*/}
|
|
|
|
|
{/*items={_items}*/}
|
|
|
|
|
{/*onSortChange={onSortChange}*/}
|
|
|
|
|
{/*sortKey={sortKey }*/}
|
|
|
|
|
{/*></CRoundSelect>}*/}
|
|
|
|
|
|
|
|
|
|
{categoryObj.category == 'all' &&<div className="fr">
|
|
|
|
|
<li className="drop_down">
|
|
|
|
|
<span className="color-grey-9 font-12" style={{
|
|
|
|
|
marginRight: " 5px",
|
|
|
|
|
}}>{"最新上传"}</span>
|
|
|
|
|
|
|
|
|
|
<sapn className="relativef color-grey-9 fr"
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
height: "40px",
|
|
|
|
|
lineHeight: "40px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
height: "10px",
|
|
|
|
|
lineHeight: "10px",
|
|
|
|
|
display: "table",
|
|
|
|
|
marginTop: "9px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<i className={sorts[1] === "asc" ?
|
|
|
|
|
"iconfont icon-sanjiaoxing-up font-12 color-blue h10 " : "iconfont icon-sanjiaoxing-up font-12 h10"}
|
|
|
|
|
onClick={() => onSortChange("published_at-asc", 0)}></i>
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
height: "10px",
|
|
|
|
|
lineHeight: "10px",
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
display: "table",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<i className={sorts[1] === "desc" ?
|
|
|
|
|
"iconfont icon-sanjiaoxing-down font-12 yslbottomsj color-blue h10" : "iconfont icon-sanjiaoxing-down font-12 yslbottomsj h10"}
|
|
|
|
|
onClick={() => onSortChange("published_at-desc", 0)}></i>
|
|
|
|
|
</span>
|
|
|
|
|
</sapn>
|
|
|
|
|
</li>
|
|
|
|
|
</div>}
|
|
|
|
|
{categoryObj.category == 'all' && <div className="fr">
|
|
|
|
|
<li className="drop_down">
|
|
|
|
|
<span className="color-grey-9 font-12" style={{
|
|
|
|
|
marginRight: " 5px",
|
|
|
|
|
}}>{"最新上传"}</span>
|
|
|
|
|
|
|
|
|
|
<sapn className="relativef color-grey-9 fr"
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
height: "40px",
|
|
|
|
|
lineHeight: "40px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
height: "10px",
|
|
|
|
|
lineHeight: "10px",
|
|
|
|
|
display: "table",
|
|
|
|
|
marginTop: "9px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<i className={sorts[1] === "asc" ?
|
|
|
|
|
"iconfont icon-sanjiaoxing-up font-12 color-blue h10 " : "iconfont icon-sanjiaoxing-up font-12 h10"}
|
|
|
|
|
onClick={() => onSortChange("published_at-asc", 0)}></i>
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
height: "10px",
|
|
|
|
|
lineHeight: "10px",
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
display: "table",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<i className={sorts[1] === "desc" ?
|
|
|
|
|
"iconfont icon-sanjiaoxing-down font-12 yslbottomsj color-blue h10" : "iconfont icon-sanjiaoxing-down font-12 yslbottomsj h10"}
|
|
|
|
|
onClick={() => onSortChange("published_at-desc", 0)}></i>
|
|
|
|
|
</span>
|
|
|
|
|
</sapn>
|
|
|
|
|
</li>
|
|
|
|
|
</div>}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{categoryObj.category == 'all' ?
|
|
|
|
|
<div className="itemWrap">
|
|
|
|
|
{
|
|
|
|
|
videos == undefined ? '' :
|
|
|
|
|
videos.length ?
|
|
|
|
|
videos.map((item, index) => {
|
|
|
|
|
return (<VideoInReviewItem
|
|
|
|
|
{...props}
|
|
|
|
|
|
|
|
|
|
{...item}
|
|
|
|
|
key={item.id}
|
|
|
|
|
onEditVideo={onEditVideo}
|
|
|
|
|
onMaskClick={onMaskClick}
|
|
|
|
|
getCopyText={getCopyText}
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
|
})
|
|
|
|
|
: <NoneData style={{width: '100%'}}></NoneData>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
:
|
|
|
|
|
<div className="itemWrap">
|
|
|
|
|
{
|
|
|
|
|
reviewvideos == undefined ? '' :
|
|
|
|
|
reviewvideos.length ?
|
|
|
|
|
reviewvideos.map((item, index) => {
|
|
|
|
|
return (<VideoInReviewItem
|
|
|
|
|
{...props}
|
|
|
|
|
|
|
|
|
|
{...item}
|
|
|
|
|
key={item.id}
|
|
|
|
|
isReview={true}
|
|
|
|
|
>
|
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
|
})
|
|
|
|
|
: <NoneData style={{width: '100%'}}></NoneData>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
{categoryObj.category == 'all' ?
|
|
|
|
|
<div className="itemWrap">
|
|
|
|
|
{
|
|
|
|
|
videos == undefined ? '' :
|
|
|
|
|
videos.length ?
|
|
|
|
|
videos.map((item, index) => {
|
|
|
|
|
return (<VideoInReviewItem
|
|
|
|
|
{...props}
|
|
|
|
|
|
|
|
|
|
{...item}
|
|
|
|
|
key={item.id}
|
|
|
|
|
onEditVideo={onEditVideo}
|
|
|
|
|
onMaskClick={onMaskClick}
|
|
|
|
|
getCopyText={getCopyText}
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
|
})
|
|
|
|
|
: <NoneData style={{ width: '100%' }}></NoneData>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
:
|
|
|
|
|
<div className="itemWrap">
|
|
|
|
|
{
|
|
|
|
|
reviewvideos == undefined ? '' :
|
|
|
|
|
reviewvideos.length ?
|
|
|
|
|
reviewvideos.map((item, index) => {
|
|
|
|
|
return (<VideoInReviewItem
|
|
|
|
|
{...props}
|
|
|
|
|
|
|
|
|
|
{...item}
|
|
|
|
|
key={item.id}
|
|
|
|
|
isReview={true}
|
|
|
|
|
>
|
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
|
})
|
|
|
|
|
: <NoneData style={{ width: '100%' }}></NoneData>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* categoryObj.category == 'all' && */}
|
|
|
|
|
{/* categoryObj.category == 'all' && */}
|
|
|
|
|
{
|
|
|
|
|
count > PAGE_SIZE &&
|
|
|
|
|
count > PAGE_SIZE &&
|
|
|
|
|
<div className="mt30 mb50 edu-txt-center">
|
|
|
|
|
<Pagination showQuickJumper total={count} pageSize={PAGE_SIZE}
|
|
|
|
|
{...pageObj}
|
|
|
|
|
<Pagination showQuickJumper total={count} pageSize={PAGE_SIZE}
|
|
|
|
|
{...pageObj}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|