dev_hjm
hjm 6 years ago
parent 855fd745bf
commit f5a50a149d

@ -21,7 +21,7 @@ function createUploader () {
retryCount: $('#retryCount').val() || 3,
retryDuration: $('#retryDuration').val() || 2,
region: $('#region').val() || 'ap-southeast-1',
userId: $('#userId').val() || 1202060945918292, // 1303984639806000,
userId: $('#userId').val() || 1829848226361863, // 1202060945918292, // 1303984639806000,
// 添加文件成功
addFileSuccess: function (uploadInfo) {
console.log('addFileSuccess')

@ -101,6 +101,7 @@ function InfoVideo (props) {
.then((response) => {
if (response.data.videos) {
setReviewVideoes(response.data.videos)
setCount(response.data.count)
}
}).catch(() => {

@ -2,6 +2,7 @@ import React, { useState, useEffect, useContext, memo } from 'react';
import { Progress, Input } from 'antd'
import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext } from 'educoder'
import axios from 'axios'
import okIcon from './images/ok_border.png'
function VideoUpload (props) {
const theme = useContext(ThemeContext);
@ -18,7 +19,7 @@ function VideoUpload (props) {
return (
<div className={`videoPublishSuccess educontent`}>
<CBreadcrumb
className="mb26"
className="mb26 mt16"
separator=" > "
items={[
{ to: `/users/${username}/videoes`, name: '视频'},
@ -29,13 +30,17 @@ function VideoUpload (props) {
<style>{`
.videoPublishSuccess .section {
background: #fff;
padding: 16px 20px;
padding-top: 0px;
padding: 72px 20px;
position: relative;
text-align: center;
color: ${theme.foreground_tip};
}
.videoPublishSuccess img.ok {
width: 64px;
margin: 16px;
margin-top: 0px;
}
.videoPublishSuccess .tip {
margin-top: 10px;
margin-bottom: 12px;
@ -50,7 +55,8 @@ function VideoUpload (props) {
<div className="section">
<div>
<i className="icon-wanchenggouxuan iconfont font-36" style={{color: theme.foreground_select}}></i>
<img className="ok" src={okIcon}></img>
{/* <i className="icon-wanchenggouxuan iconfont font-36" style={{color: theme.foreground_select}}></i> */}
</div>
<div className="font-16" style={{ 'line-height': '16px'}}>恭喜</div>
<div className="font-16">提交成功</div>

@ -15,12 +15,33 @@ let uploader
const files = []
const MAX_FILE_COUNT = 3
const MAX_FILE_SIZE = 200
let noUploads = true
function VideoUploadList (props) {
const [videoes, setVideoes] = useState([]);
const [state, dispatch] = useReducer(reducer, initialState);
const theme = useContext(ThemeContext)
useEffect(() => {
window.addEventListener("beforeunload", beforeunload);
return () => {
window.removeEventListener("beforeunload", beforeunload);
}
}, [])
// TODO 闭包!
noUploads = (!state.videoes || state.videoes.length == 0);
function beforeunload(e) {
if (noUploads) {
return true;
}
var confirmationMessage = "确认要离开当前页面,当前数据不可恢复";
(e || window.event).returnValue = confirmationMessage; //Gecko + IE
return confirmationMessage; //Webkit, Safari, Chrome etc.
}
const _beforeunload = beforeunload // .bind(this, noUploads, state)
const username = props.match.params.username
const { showNotification, history } = props;
const uploaderOptions = {
@ -188,7 +209,6 @@ function VideoUploadList (props) {
dispatch({type: 'updateTitle', title, index})
}
// login
const noUploads = (!state.videoes || state.videoes.length == 0);
const protocolLine = <div>上传视频即表示您已同意<span style={{color: theme.foreground_select}}>上传内容协议</span></div>
return (
<div className="educontent videoUploadList" style={{ marginBottom: '200px' }}>
@ -204,6 +224,10 @@ function VideoUploadList (props) {
.videoUploadList .cBreadcrumb {
margin-top: 16px;
}
.videoUploadList .uploadTip {
line-height: 18px;
margin-bottom: 16px;
}
.videoUploadList .title {
margin-bottom: 4px;
}
@ -231,6 +255,7 @@ function VideoUploadList (props) {
.videoUploadList .publishRow .publishBtn {
padding: 6px 24px;
height: auto;
margin-bottom: 24px;
}
.videoUploadList .addVideoBtn {
position: absolute;
@ -307,12 +332,12 @@ function VideoUploadList (props) {
})}
</div>
{state.videoes && state.videoes.length === MAX_FILE_COUNT &&
<div className="tip">
<div className="uploadTip">
<i className="iconfont icon-tishi" style={{color: '#FF6F6F', verticalAlign: 'text-bottom'}}></i>
<span>单次最多支持3个视频文件上传</span>
</div>}
{!noUploads && <ActionBtn className="publishBtn" onClick={() => document.getElementById('fileUpload').click()}
{(!noUploads && state.videoes.length < MAX_FILE_COUNT) && <ActionBtn className="publishBtn" onClick={() => document.getElementById('fileUpload').click()}
>继续添加</ActionBtn>}
<div className={`description ${noUploads ? 'noUploads' : ''}`}>

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Loading…
Cancel
Save