courseware
caicai8 5 years ago
parent a6f222934f
commit 60e26b0b12

@ -68,9 +68,6 @@
}
.videoInReviewItem .square-main {
background: #EAEAEA;
}
.videoItem .time {
color: #C0C4CC;
}

@ -65,8 +65,9 @@ function InfoVideo(props) {
const videoEl = useRef(null);
const { showNotification, history } = props;
const username = props.match.params.username
const username = props.match.params.username;
const { user } = props;
console.log(user);
function toUpload() {
if (props.current_user.admin || (props.current_user.is_teacher && props.checkIfProfessionalCertification())) {
history.push(`/users/${username}/videos/upload`)
@ -87,16 +88,15 @@ function InfoVideo(props) {
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`
@ -184,9 +184,8 @@ function InfoVideo(props) {
videoId = {
videoId: item.id,
title: item.title,
file_url: item.file_url,
file_url: item.play_url || item.file_url,
cover_url: item.cover_url
}
videoModalObj.setVisible(true)
}
@ -218,6 +217,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) {
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>`
}
@ -397,7 +426,7 @@ function InfoVideo(props) {
onEditVideo={onEditVideo}
onMaskClick={onMaskClick}
getCopyText={getCopyText}
deleteVideo={user && ((user.login === item.user_login) || user.admin) ? deleteVideo : undefined}
>
</VideoInReviewItem>)
})
@ -416,6 +445,7 @@ function InfoVideo(props) {
{...item}
key={item.id}
isReview={true}
deleteVideo={user && ((user.login === item.user_login) || user.admin) ? deleteVideo : undefined}
>
</VideoInReviewItem>)
})

@ -79,9 +79,9 @@ function VideoInReviewItem (props) {
<i className={`icon-dianjiliang iconfont dianjilianicon`}></i>
</Tooltip> } {!vv || (vv && vv)===0?"":vv}
</span>
{ isReview != true && <div>
<div>
{
moveVideo &&
isReview !== true && moveVideo &&
<Tooltip title="移动到" placement="bottom">
<i className="icon-yidong iconfont font-15" onClick={() => moveVideo(props)}
style={{ marginTop: '1px', display: 'inline-block'}}
@ -98,7 +98,7 @@ function VideoInReviewItem (props) {
}
{
operation &&
isReview !== true && operation &&
<Tooltip title="编辑" placement="bottom">
<i className="icon-bianji1 iconfont" onClick={() => onEditVideo(props)}
style={{ marginTop: '1px', display: 'inline-block'}}
@ -106,13 +106,13 @@ function VideoInReviewItem (props) {
</Tooltip>
}
{
!link ?
isReview !== true && !link ?
<Tooltip title="复制视频地址" placement="bottom">
<i className={`icon-fuzhi iconfont copybtn_item_${id}`} data-clipboard-text={getCopyText((play_url || file_url), cover_url)}></i>
</Tooltip>:""
}
</div> }
</div>
</div>
</div>
</div>

Loading…
Cancel
Save