Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

* 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder:
  ..
  调整bd引入方式
  权限调整
video_log
harry 5 years ago
commit 10834cab32

@ -38,6 +38,7 @@ module Educoderplus
origins '*' origins '*'
# location of your api # location of your api
resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put] resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put]
resource 'http://outin-396971199eed11e991a100163e1c7426.oss-cn-shanghai.aliyuncs.com/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put]
end end
end end
end end

@ -195,7 +195,7 @@ function generateNewIndexJsp() {
let cdnHost = 'https://shixun.educoder.net' let cdnHost = 'https://shixun.educoder.net'
cdnHost = 'https://ali-cdn.educoder.net' cdnHost = 'https://ali-cdn.educoder.net'
cdnHost = '' cdnHost = ''
var mainRegex = /<script type="text\/javascript" src="\/react\/build\/.\/static\/js\/main.([a-zA-Z0-9]{8,}).js"><\/script>/ var mainRegex = /<script type="text\/javascript" src="\/react\/build\/.\/static\/js\/main.([a-zA-Z0-9]{8,}).js"><\/script>/
var matchResult = data.match(mainRegex) var matchResult = data.match(mainRegex)
@ -209,7 +209,9 @@ function generateNewIndexJsp() {
} else if (window.location.host == 'www.educoder.net') { } else if (window.location.host == 'www.educoder.net') {
_host = 'https://ali-cdn.educoder.net/react/build/' _host = 'https://ali-cdn.educoder.net/react/build/'
} }
document.write('<script type="text/javascript" src="' + _host + 'js/js_min_all.js"><\\/script>'); document.write('<script type="text/javascript" src="' + _host + 'js/js_min_all.js"><\\/script>');
document.write('<script type="text/javascript" src="' + _host + 'js/flv.min.js"><\\/script>');
document.write('<script type="text/javascript" src="' + _host + 'static/js/main.${matchResult[1]}.js"><\\/script>'); document.write('<script type="text/javascript" src="' + _host + 'static/js/main.${matchResult[1]}.js"><\\/script>');
})() })()
</script> </script>
@ -230,7 +232,7 @@ function generateNewIndexJsp() {
.replace(mainRegex, '') .replace(mainRegex, '')
// .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`) // .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`)
// .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`) // .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`)
// .replace(/https:\/\/testeduplus2.educoder.net/g, ''); // .replace(/https:\/\/testeduplus2.educoder.net/g, '');
// .replace(/http:\/\/testbdweb.educoder.net/g, ''); // .replace(/http:\/\/testbdweb.educoder.net/g, '');

@ -19,7 +19,7 @@ const MAX_FILE_SIZE = 500
let noUploads = true let noUploads = true
function VideoUploadList (props) { function VideoUploadList (props) {
// const [videos, setvideos] = useState([]); // const [videos, setvideos] = useState([]);
const [state, dispatch] = useReducer(reducer, initialState); const [state, dispatch] = useReducer(reducer, initialState);
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
@ -54,7 +54,7 @@ function VideoUploadList (props) {
const username = props.match.params.username || props.CourseUser; const username = props.match.params.username || props.CourseUser;
const { showNotification, history } = props; const { showNotification, history } = props;
const uploaderOptions = { const uploaderOptions = {
} }
function onUploadChange (e) { function onUploadChange (e) {
var file = e.target.files[0] var file = e.target.files[0]
@ -63,18 +63,21 @@ function VideoUploadList (props) {
return return
} }
// avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm // avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm
if (file.name if (file.name
&& file.name.indexOf('.avi') == -1 && file.name.indexOf('.flv') == -1 && file.name.indexOf('.avi') == -1 && file.name.indexOf('.flv') == -1
&& file.name.indexOf('.f4v') == -1 && file.name.indexOf('.m4v') == -1 && file.name.indexOf('.f4v') == -1 && file.name.indexOf('.m4v') == -1
&& file.name.indexOf('.mov') == -1 && file.name.indexOf('.mp4') == -1 && file.name.indexOf('.mov') == -1 && file.name.indexOf('.mp4') == -1
&& file.name.indexOf('.rmvb') == -1 && file.name.indexOf('.swf') == -1 && file.name.indexOf('.rmvb') == -1 && file.name.indexOf('.swf') == -1
&& file.name.indexOf('.webm') == -1 && file.name.indexOf('.webm') == -1
) { ) {
showNotification(`不支持的视频格式`) showNotification(`不支持的视频格式`)
clearInput() clearInput()
return; return;
} }
if (file.size >(parseInt(MAX_FILE_SIZE) * 1024 * 1024)) {
if(props&&props.user.admin===true||props&&props.user.business===true){
}else if (file.size >(parseInt(MAX_FILE_SIZE) * 1024 * 1024)) {
// 超过500m TODO // 超过500m TODO
clearInput() clearInput()
showNotification(`视频大小超过${MAX_FILE_SIZE}M`) showNotification(`视频大小超过${MAX_FILE_SIZE}M`)
@ -95,11 +98,11 @@ function VideoUploadList (props) {
var Title = file.name var Title = file.name
var userData = '{"Vod":{}}' var userData = '{"Vod":{}}'
if (!uploader) { if (!uploader) {
getUploader(username, getUploader(username,
{ {
// 重新创建 才会用最新的 dispatch // 重新创建 才会用最新的 dispatch
create: !uploader, create: !uploader,
addFileSuccess: (uploadInfo) => { addFileSuccess: (uploadInfo) => {
@ -174,7 +177,7 @@ function VideoUploadList (props) {
}, },
onUploadError: (uploadInfo) => { onUploadError: (uploadInfo) => {
}, },
// 可能需要等lib加载完毕才能执行 // 可能需要等lib加载完毕才能执行
gotUploader: (_uploader) => { gotUploader: (_uploader) => {
@ -204,9 +207,9 @@ function VideoUploadList (props) {
} else { } else {
// uploader.cancelFile(index) // uploader.cancelFile(index)
} }
clearInput() clearInput()
dispatch({type: 'removeVideo', index}) dispatch({type: 'removeVideo', index})
// setvideos([...videos.splice(index, 1)]) // setvideos([...videos.splice(index, 1)])
} }
// uploader.deleteFile(index); // uploader.deleteFile(index);
@ -219,7 +222,7 @@ function VideoUploadList (props) {
doDelete(index, isSuccess) doDelete(index, isSuccess)
} }
}) })
} }
function onPublish() { function onPublish() {
// 下列这些参数只有是课堂里面上传视频才会有 // 下列这些参数只有是课堂里面上传视频才会有
@ -259,13 +262,13 @@ function VideoUploadList (props) {
} }
// login // login
const { flag , CourseId } = props; const { flag , CourseId } = props;
const urls = const urls =
flag ? flag ?
<Link to={`/users/${username}/videos/protocol?course=${CourseId}`} target="_blank" style={{color: theme.foreground_select}}>上传内容协议</Link> <Link to={`/users/${username}/videos/protocol?course=${CourseId}`} target="_blank" style={{color: theme.foreground_select}}>上传内容协议</Link>
: :
<Link to={`/users/${username}/videos/protocol`} style={{color: theme.foreground_select}}>上传内容协议</Link> <Link to={`/users/${username}/videos/protocol`} style={{color: theme.foreground_select}}>上传内容协议</Link>
const protocolLine = <div>上传视频即表示您已同意{urls}不得上传未经他人授权的作品</div> const protocolLine = <div>上传视频即表示您已同意{urls}不得上传未经他人授权的作品</div>
return ( return (
<div className={flag?"edu-back-white pb100 videoUploadList":"educontent videoUploadList"} style={{ marginBottom: `${flag?"0px":"200px"}` }}> <div className={flag?"edu-back-white pb100 videoUploadList":"educontent videoUploadList"} style={{ marginBottom: `${flag?"0px":"200px"}` }}>
<Prompt <Prompt
@ -391,7 +394,7 @@ function VideoUploadList (props) {
</div> </div>
</React.Fragment> </React.Fragment>
} }
<div className="section"> <div className="section">
{/* noUploads */} {/* noUploads */}
{noUploads && <div className="noUploads" style={{paddingTop: '72px'}} > {noUploads && <div className="noUploads" style={{paddingTop: '72px'}} >
@ -400,7 +403,7 @@ function VideoUploadList (props) {
<img className="uploadHoverIcon" src={uploadHoverIcon} ></img> <img className="uploadHoverIcon" src={uploadHoverIcon} ></img>
</div> </div>
<div style={{ <div style={{
color: '#000000', color: '#000000',
fontSize: '18px', fontSize: '18px',
@ -423,10 +426,10 @@ function VideoUploadList (props) {
})} })}
</div> </div>
</Spin> </Spin>
{state.videos && state.videos.length === MAX_FILE_COUNT && {state.videos && state.videos.length === MAX_FILE_COUNT &&
<div className="uploadTip"> <div className="uploadTip">
{/* <i className="iconfont icon-tishi" style={{color: '#FF6F6F', verticalAlign: 'text-bottom'}}></i> */} {/* <i className="iconfont icon-tishi" style={{color: '#FF6F6F', verticalAlign: 'text-bottom'}}></i> */}
<span>提示单次最多支持3个视频文件上传</span> <span>提示单次最多支持3个视频文件上传</span>
</div>} </div>}
{(!noUploads && state.videos.length < MAX_FILE_COUNT) && <ActionBtn className="publishBtn" onClick={() => document.getElementById('fileUpload').click()} {(!noUploads && state.videos.length < MAX_FILE_COUNT) && <ActionBtn className="publishBtn" onClick={() => document.getElementById('fileUpload').click()}
@ -446,7 +449,7 @@ function VideoUploadList (props) {
> >
添加更多视频 添加更多视频
</Button>} */} </Button>} */}
<div style={{}} className="publishRow"> <div style={{}} className="publishRow">
<ActionBtn className="publishBtn" onClick={() => onPublish()} <ActionBtn className="publishBtn" onClick={() => onPublish()}
>立即发布</ActionBtn> >立即发布</ActionBtn>

Loading…
Cancel
Save