|
|
@ -65,7 +65,8 @@ function InfoVideo(props) {
|
|
|
|
const videoEl = useRef(null);
|
|
|
|
const videoEl = useRef(null);
|
|
|
|
|
|
|
|
|
|
|
|
const { showNotification, history } = props;
|
|
|
|
const { showNotification, history } = props;
|
|
|
|
const username = props.match.params.username
|
|
|
|
const username = props.match.params.username;
|
|
|
|
|
|
|
|
const { user } = props;
|
|
|
|
|
|
|
|
|
|
|
|
function toUpload() {
|
|
|
|
function toUpload() {
|
|
|
|
if (props.current_user.admin || (props.current_user.is_teacher && props.checkIfProfessionalCertification())) {
|
|
|
|
if (props.current_user.admin || (props.current_user.is_teacher && props.checkIfProfessionalCertification())) {
|
|
|
@ -87,16 +88,15 @@ function InfoVideo(props) {
|
|
|
|
sort_direction: sorts[1],
|
|
|
|
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() {
|
|
|
|
function fetchReviewvideos() {
|
|
|
|
const fetchUrl = `/users/${username}/videos/review.json`
|
|
|
|
const fetchUrl = `/users/${username}/videos/review.json`
|
|
|
@ -144,7 +144,8 @@ function InfoVideo(props) {
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if (videoModalObj.visible == false) {
|
|
|
|
if (videoModalObj.visible == false) {
|
|
|
|
// 关闭视频
|
|
|
|
// 关闭视频
|
|
|
|
videoEl.current && videoEl.current.pause()
|
|
|
|
videoEl.current && videoEl.current.pause();
|
|
|
|
|
|
|
|
videoId = {};
|
|
|
|
if (_clipboard) {
|
|
|
|
if (_clipboard) {
|
|
|
|
_clipboard.destroy();
|
|
|
|
_clipboard.destroy();
|
|
|
|
_clipboard = null;
|
|
|
|
_clipboard = null;
|
|
|
@ -184,9 +185,8 @@ function InfoVideo(props) {
|
|
|
|
videoId = {
|
|
|
|
videoId = {
|
|
|
|
videoId: item.id,
|
|
|
|
videoId: item.id,
|
|
|
|
title: item.title,
|
|
|
|
title: item.title,
|
|
|
|
file_url: item.file_url,
|
|
|
|
file_url: item.play_url || item.file_url,
|
|
|
|
cover_url: item.cover_url
|
|
|
|
cover_url: item.cover_url
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
videoModalObj.setVisible(true)
|
|
|
|
videoModalObj.setVisible(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -218,6 +218,36 @@ function InfoVideo(props) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function deleteVideo(item){
|
|
|
|
|
|
|
|
props.confirm({
|
|
|
|
|
|
|
|
content: '该视频将被删除,不可恢复',
|
|
|
|
|
|
|
|
subContent: '是否确认删除?',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onOk: () => {
|
|
|
|
|
|
|
|
const url = `/users/${user && user.login}/videos/${item.id}.json`;
|
|
|
|
|
|
|
|
axios.delete(url).then(result => {
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
|
|
props.showNotification(`视频删除成功!`);
|
|
|
|
|
|
|
|
if (pageObj.current === 1) {
|
|
|
|
|
|
|
|
if (categoryObj.category === 'all') {
|
|
|
|
|
|
|
|
fetchvideos()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fetchReviewvideos()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pageObj.onChange(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
|
|
|
|
console.log('Cancel');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
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>`
|
|
|
|
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>`
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -237,7 +267,7 @@ function InfoVideo(props) {
|
|
|
|
className="showVideoModal"
|
|
|
|
className="showVideoModal"
|
|
|
|
width={800 - 1}
|
|
|
|
width={800 - 1}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<VideoPlay src={videoId.file_url} />
|
|
|
|
{videoModalObj.visible && <VideoPlay src={videoId.file_url} />}
|
|
|
|
<div className="df copyLine">
|
|
|
|
<div className="df copyLine">
|
|
|
|
<Input value={_inputValue}
|
|
|
|
<Input value={_inputValue}
|
|
|
|
className="dark"
|
|
|
|
className="dark"
|
|
|
@ -397,7 +427,7 @@ function InfoVideo(props) {
|
|
|
|
onEditVideo={onEditVideo}
|
|
|
|
onEditVideo={onEditVideo}
|
|
|
|
onMaskClick={onMaskClick}
|
|
|
|
onMaskClick={onMaskClick}
|
|
|
|
getCopyText={getCopyText}
|
|
|
|
getCopyText={getCopyText}
|
|
|
|
|
|
|
|
deleteVideo={user && ((user.login === item.user_login) || user.admin) ? deleteVideo : undefined}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -416,6 +446,7 @@ function InfoVideo(props) {
|
|
|
|
{...item}
|
|
|
|
{...item}
|
|
|
|
key={item.id}
|
|
|
|
key={item.id}
|
|
|
|
isReview={true}
|
|
|
|
isReview={true}
|
|
|
|
|
|
|
|
deleteVideo={user && ((user.login === item.user_login) || user.admin) ? deleteVideo : undefined}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
</VideoInReviewItem>)
|
|
|
|
})
|
|
|
|
})
|
|
|
|