import React, { useState, useEffect, useContext, memo } from 'react'; import { Progress, Input, Tooltip , Spin } from 'antd' import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext,formatSeconds} from 'educoder' import axios from 'axios' import moment from 'moment' import playIcon from './images/play.png' import ClipboardJS from 'clipboard' import defaultImg from './images/default.png'; import './InfosVideo.css'; /** cover_url: "http://video.educoder.net/f6ba49c3944b43ee98736898e31b7d88/snapshots/12da3f7df07c499b8f0fc6dc410094e9-00005.jpg" created_at: "2019-08-12 13:48:26" file_url: "http://video.educoder.net/sv/4c7eb4-16c845ee09c/4c7eb4-16c845ee09c.mp4" id: 1 published_at: "2019-08-12 15:38:00" title: "测试标题" updated_at: "2019-08-12 17:17:09" */ let _clipboard = null; const clipboardMap = {} function VideoInReviewItem (props) { const theme = useContext(ThemeContext); const { history, file_url , play_url , cover_url , transcoded , title, created_at, published_at, isReview, id , onEditVideo, onMaskClick, getCopyText, showNotification,vv,play_duration,operation , deleteVideo , moveVideo ,link, people_num,total_time} = props; useEffect(()=> { if (!isReview) { _clipboard = new ClipboardJS(`.copybtn_item_${id}`); _clipboard.on('success', (e) => { showNotification('复制成功') }); clipboardMap[id] = _clipboard } return () => { if (clipboardMap[id]) { clipboardMap[id].destroy(); clipboardMap[id] = null; } } }, []) const username = props.match.params.username function toList() { history.push(`/users/${username}/videos`) } function toUpload() { history.push(`/users/${username}/videos/upload`) } const imgUrl = (!transcoded && !link) ? defaultImg : (cover_url || defaultImg); return (
{ link ? 外链 : "" } {!isReview &&
onMaskClick(props)}>
} {!isReview && !link && transcoded &&
onMaskClick(props)}> {/* {play_duration===0?"":
累计学习时长:{play_duration} h
} */}
}
20 ? title : ''} >{title}
{/*
累计学习时长:{play_duration} h
*/} {/* {moment(published_at || created_at).format('YYYY-MM-DD HH:mm:ss')}{people_num} */} {link||total_time===undefined? :累计学习时长:{ formatSeconds(total_time)} {/* total_time<60?total_time+' s':total_time/60<60?(total_time/60).toFixed(0)+' min':(total_time/3600).toFixed(1)+ ' h' */} }
{/* 2019-09-01 10:00:22 */} {total_time===undefined?'':!people_num || (people_num && people_num)===0 ? "" : {!people_num || (people_num && people_num)===0?"":people_num} }
{ isReview !== true && moveVideo && moveVideo(props)} style={{ marginTop: '1px', display: 'inline-block'}} > } { deleteVideo && deleteVideo(props)} style={{ marginTop: '1px', display: 'inline-block'}} > } { isReview !== true && operation && onEditVideo(props)} style={{ marginTop: '1px', display: 'inline-block'}} > } { isReview !== true && !link ? :"" }
) } export default VideoInReviewItem