dev_hjm
parent
0e47f3e69d
commit
1703e76c78
@ -0,0 +1,70 @@
|
|||||||
|
import React, { useState, useEffect, useContext, useRef, memo } from 'react';
|
||||||
|
import { Progress, Input, Tooltip, Form } from 'antd'
|
||||||
|
import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext, ModalWrapper } from 'educoder'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
function EditVideoModal (props) {
|
||||||
|
const modalEl = useRef(null);
|
||||||
|
const theme = useContext(ThemeContext);
|
||||||
|
const { history, id, cover_url, title, created_at, isReview, onEditVideo, visible, setVisible,
|
||||||
|
form } = props;
|
||||||
|
const getFieldDecorator = form.getFieldDecorator
|
||||||
|
const username = props.match.params.username
|
||||||
|
function toList() {
|
||||||
|
history.push(`/users/${username}/videoes`)
|
||||||
|
}
|
||||||
|
function toUpload() {
|
||||||
|
history.push(`/users/${username}/videoes/upload`)
|
||||||
|
}
|
||||||
|
function onOk() {
|
||||||
|
form.validateFieldsAndScroll((err, values) => {
|
||||||
|
|
||||||
|
if (!err) {
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// $("html").animate({ scrollTop: $('html').scrollTop() - 100 })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// setVisible(false)
|
||||||
|
|
||||||
|
}
|
||||||
|
function onCancel() {
|
||||||
|
setVisible(false)
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
modalEl.current.setVisible(visible)
|
||||||
|
}, [visible])
|
||||||
|
const _title = form.getFieldsValue().title;
|
||||||
|
return (
|
||||||
|
<ModalWrapper
|
||||||
|
ref={modalEl}
|
||||||
|
width="600px"
|
||||||
|
title={`视频编辑`}
|
||||||
|
{ ...props }
|
||||||
|
onOk={onOk}
|
||||||
|
onCancel={onCancel}
|
||||||
|
className="editVideoModal"
|
||||||
|
>
|
||||||
|
<Form.Item
|
||||||
|
label="视频标题"
|
||||||
|
className="title "
|
||||||
|
>
|
||||||
|
|
||||||
|
{getFieldDecorator('title', {
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请输入标题',
|
||||||
|
}, {
|
||||||
|
max: 30, message: '最大限制为30个字符',
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<Input placeholder="" className="titleInput" maxLength="30"
|
||||||
|
addonAfter={String(_title ? _title.length : 0)} />
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</ModalWrapper>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const WrappedEditVideoModal = Form.create({ name: 'editVideoModal' })(EditVideoModal);
|
||||||
|
export default WrappedEditVideoModal
|
@ -0,0 +1,68 @@
|
|||||||
|
.itemWrap {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* item */
|
||||||
|
.videoItem {
|
||||||
|
width: 280px;
|
||||||
|
margin-right: 26px;
|
||||||
|
margin-bottom: 26px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.videoItem:nth-child(4n+0) {
|
||||||
|
margin-right: 0px;
|
||||||
|
}
|
||||||
|
.videoItem img.cover {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 6px 6px 0px 0px;
|
||||||
|
height: 180px;
|
||||||
|
}
|
||||||
|
.nItem.videoItem:hover .mask {
|
||||||
|
display: block;
|
||||||
|
top: 0px;
|
||||||
|
width: 100%;
|
||||||
|
height: 180px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.nItem .mask {
|
||||||
|
border-radius: 6px 6px 0px 0px;
|
||||||
|
display: none;
|
||||||
|
text-align: center;
|
||||||
|
position: absolute;
|
||||||
|
background: #000;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.videoItem img.play {
|
||||||
|
margin-top: 20%;
|
||||||
|
}
|
||||||
|
.videoItem .square-main {
|
||||||
|
padding: 10px 8px;
|
||||||
|
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 0px 0px 6px 6px;
|
||||||
|
}
|
||||||
|
.videoItem .square-main .title{
|
||||||
|
max-width: 256px;
|
||||||
|
line-height: 18px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.videoInReviewItem .square-main {
|
||||||
|
background: #EAEAEA;
|
||||||
|
}
|
||||||
|
.videoItem .time {
|
||||||
|
color: #A0A0A0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.videoItem .square-main .buttonRow {
|
||||||
|
justify-content: space-between;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nItem.videoItem:hover .square-main {
|
||||||
|
color: #fff;
|
||||||
|
background: #333;
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
import React, { useState, useEffect, useContext, memo } from 'react';
|
||||||
|
import { Progress, Input, Tooltip } from 'antd'
|
||||||
|
import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext } from 'educoder'
|
||||||
|
import axios from 'axios'
|
||||||
|
import moment from 'moment'
|
||||||
|
import playIcon from './images/play.png'
|
||||||
|
|
||||||
|
/**
|
||||||
|
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"
|
||||||
|
*/
|
||||||
|
function VideoInReviewItem (props) {
|
||||||
|
const theme = useContext(ThemeContext);
|
||||||
|
const { history, cover_url, title, created_at, isReview, onEditVideo } = props;
|
||||||
|
|
||||||
|
const username = props.match.params.username
|
||||||
|
function toList() {
|
||||||
|
history.push(`/users/${username}/videoes`)
|
||||||
|
}
|
||||||
|
function toUpload() {
|
||||||
|
history.push(`/users/${username}/videoes/upload`)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div className={`${isReview ? 'videoInReviewItem' : 'nItem'} videoItem`}>
|
||||||
|
|
||||||
|
<img className="cover" src={cover_url || "http://video.educoder.net/e7d18970482a46d2a6f0e951b504256c/snapshots/491e113950d74f1dab276097dae287dd-00005.jpg"}
|
||||||
|
></img>
|
||||||
|
{!isReview && <div className="mask">
|
||||||
|
<img className="play" src={playIcon}></img>
|
||||||
|
</div>}
|
||||||
|
<div className="square-main">
|
||||||
|
<div className="title overflowHidden1"
|
||||||
|
title={title && title.length > 20 ? title : ''}
|
||||||
|
>{title}</div>
|
||||||
|
<div className="df buttonRow">
|
||||||
|
{/* 2019-09-01 10:00:22 */}
|
||||||
|
<span className="time">{moment(created_at).format('YYYY-MM-DD HH:mm:ss')}</span>
|
||||||
|
{ isReview != true && <div>
|
||||||
|
<Tooltip title="编辑">
|
||||||
|
<i className="icon-fuzhi iconfont" onClick={() => onEditVideo(props)}></i>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title="复制视频地址">
|
||||||
|
<i className="icon-fuzhi iconfont"></i>
|
||||||
|
</Tooltip>
|
||||||
|
</div> }
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default VideoInReviewItem
|
After Width: | Height: | Size: 413 B |
After Width: | Height: | Size: 337 B |
Loading…
Reference in new issue