From 1068b5d1fbbc646f2640d9e4e59c7c75056a27a2 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 17 Aug 2019 16:16:22 +0800 Subject: [PATCH 01/19] =?UTF-8?q?windows=20video/*=20=E4=B8=8D=E7=AE=A1?= =?UTF-8?q?=E7=94=A8=20TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/user/usersInfo/video/VideoUploadList.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index 0458f0062..1f6976734 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -177,10 +177,12 @@ function VideoUploadList (props) { } function doDelete(index, isSuccess) { uploader.deleteFile(index) - // uploader.cancelFile(index) if (isSuccess) { - deleteVideoInCloud(username, state.videoes[index].videoId) - } + // uploader.deleteFile(index) + deleteVideoInCloud(username, state.videoes[index].videoId) + } else { + // uploader.cancelFile(index) + } clearInput() dispatch({type: 'removeVideo', index}) @@ -384,7 +386,7 @@ function VideoUploadList (props) {
视频大小:不支持断点续传,单个视频文件最大200M;单次最多支持3个视频文件上传
视频规格:avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm
-
温馨提示:请勿上传违法视频。平台将为每一个视频分配一个地址,您可以通过引用改地址将视频使用在开发社区等模块
+
温馨提示:请勿上传违法视频。平台将为每一个视频分配一个地址,您可以通过引用该地址将视频使用在开发社区等模块
{!noUploads && @@ -405,6 +407,7 @@ function VideoUploadList (props) { } + {/* windows video/* 不管用 TODO */} From a7baacbdec021627a31b65152bb9895edff768b3 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 17 Aug 2019 16:28:35 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E5=85=88=E4=B8=8Ddelete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/user/usersInfo/video/VideoUploadList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index 1f6976734..12af62a10 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -179,7 +179,7 @@ function VideoUploadList (props) { uploader.deleteFile(index) if (isSuccess) { // uploader.deleteFile(index) - deleteVideoInCloud(username, state.videoes[index].videoId) + // deleteVideoInCloud(username, state.videoes[index].videoId) } else { // uploader.cancelFile(index) } From fa17886de04070606659cebbc93c739c840015ca Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 17 Aug 2019 16:32:56 +0800 Subject: [PATCH 03/19] cp --- .../src/modules/user/usersInfo/video/VideoInReviewItem.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js index 9eeee0cd4..8fb84abf2 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js +++ b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js @@ -16,6 +16,7 @@ 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, cover_url, title, created_at, published_at, isReview, id @@ -26,9 +27,13 @@ function VideoInReviewItem (props) { _clipboard.on('success', (e) => { showNotification('复制成功') }); + clipboardMap[id] = _clipboard } return () => { - _clipboard && _clipboard.destroy(); + if (clipboardMap[id]) { + clipboardMap[id].destroy(); + clipboardMap[id] = null; + } } }, []) const username = props.match.params.username From 819fd483c371acd7bac6c08277f54f0168c20cba Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 19 Aug 2019 09:08:05 +0800 Subject: [PATCH 04/19] s --- .../react/src/modules/user/usersInfo/Infos.js | 2 +- .../src/modules/user/usersInfo/InfosBanner.js | 6 +-- .../src/modules/user/usersInfo/InfosIndex.js | 4 +- .../usersInfo/video/AliyunUploaderManager.js | 2 + .../user/usersInfo/video/EditVideoModal.js | 4 +- .../user/usersInfo/video/InfosVideo.js | 37 ++++++++-------- .../user/usersInfo/video/VideoInReviewItem.js | 4 +- .../usersInfo/video/VideoPublishSuccess.js | 6 +-- .../user/usersInfo/video/VideoReducer.js | 20 ++++----- .../user/usersInfo/video/VideoUploadList.js | 43 ++++++++++--------- 10 files changed, 68 insertions(+), 60 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 488287b0e..242e25464 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -298,7 +298,7 @@ class Infos extends Component{ > {/* 项目 */} - () } diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index c3badce13..fdc361dc6 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -101,10 +101,10 @@ class InfosBanner extends Component{ to={`/users/${username}/package`}>众包 {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) - &&
  • + &&
  • this.setState({moduleName: 'videoes'})} - to={`/users/${username}/videoes`}>视频 + onClick={() => this.setState({moduleName: 'videos'})} + to={`/users/${username}/videos`}>视频
  • } diff --git a/public/react/src/modules/user/usersInfo/InfosIndex.js b/public/react/src/modules/user/usersInfo/InfosIndex.js index 092ae9009..a556a77ef 100644 --- a/public/react/src/modules/user/usersInfo/InfosIndex.js +++ b/public/react/src/modules/user/usersInfo/InfosIndex.js @@ -52,12 +52,12 @@ class InfosIndex extends Component{ {/* 视频发布 */} - () } > - () } diff --git a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js index e9789ba6c..2e2ba71f8 100644 --- a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js +++ b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js @@ -93,6 +93,8 @@ function doCreateUploader (options) { axios.put(refreshUrl, { video_id: uploadInfo.videoId, + title: fileName, + file_name: fileName }).then((response) => { if (response.data.status == -1) { options.onUploadError && options.onUploadError(uploadInfo) diff --git a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js index 2e4bd7c3a..248b515a5 100644 --- a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js +++ b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js @@ -14,10 +14,10 @@ function EditVideoModal (props) { const _title = form.getFieldsValue().title; function toList() { - history.push(`/users/${username}/videoes`) + history.push(`/users/${username}/videos`) } function toUpload() { - history.push(`/users/${username}/videoes/upload`) + history.push(`/users/${username}/videos/upload`) } function onOk() { form.validateFieldsAndScroll((err, values) => { diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js index 136972ffd..1ccf7e1b2 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js @@ -50,8 +50,8 @@ const _items=[ {key: 'published_at-asc', name: '最早上传'}, ] function InfoVideo (props) { - const [videoes, setVideoes] = useState(undefined) - const [reviewVideoes, setReviewVideoes] = useState(undefined) + const [videos, setvideos] = useState(undefined) + const [reviewvideos, setReviewvideos] = useState(undefined) const [count, setCount] = useState(0) const [loading, setLoading] = useState(true) const [sortKey, setSortKey] = useState(_items[0].key) @@ -70,13 +70,13 @@ function InfoVideo (props) { function toUpload() { if (props.current_user.admin || (props.current_user.is_teacher && props.checkIfProfessionalCertification())) { - history.push(`/users/${username}/videoes/upload`) + history.push(`/users/${username}/videos/upload`) } else { props.showProfessionalCertificationDialog() } } - function fetchVideoes() { + function fetchvideos() { const fetchUrl = `/users/${username}/videos.json` const sorts = sortKey.split('-') setLoading(true) @@ -92,14 +92,14 @@ function InfoVideo (props) { .then((response) => { setLoading(false) if (response.data.videos) { - setVideoes(response.data.videos) + setvideos(response.data.videos) setCount(response.data.count) } }).catch(() => { }) } - function fetchReviewVideoes() { + function fetchReviewvideos() { const fetchUrl = `/users/${username}/videos/review.json` setLoading(true) axios.get(fetchUrl, { @@ -110,7 +110,7 @@ function InfoVideo (props) { .then((response) => { setLoading(false) if (response.data.videos) { - setReviewVideoes(response.data.videos) + setReviewvideos(response.data.videos) setCount(response.data.count) } }).catch(() => { @@ -119,14 +119,14 @@ function InfoVideo (props) { } useEffect(() => { - fetchVideoes() + fetchvideos() }, [pageObj.current, sortKey]) useEffect(() => { if (categoryObj.category == 'all') { - fetchVideoes() + fetchvideos() } else { - fetchReviewVideoes() + fetchReviewvideos() } }, [categoryObj.category]) @@ -139,6 +139,8 @@ function InfoVideo (props) { _clipboard = null; } } else { + videoEl.current && videoEl.current.play() + setTimeout(() => { if (!_clipboard) { _clipboard = new ClipboardJS('.copybtn'); @@ -155,7 +157,7 @@ function InfoVideo (props) { }, []) function editSuccess() { - fetchVideoes() + fetchvideos() } function onEditVideo(item) { @@ -201,6 +203,7 @@ function InfoVideo (props) { width={800 - 1} >