Commit c61c8de4 by zhangleyuan

feat:处理文件后缀名的展示

parent 3863a30a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-16 13:57:33 * @LastEditTime: 2021-07-16 15:52:42
* @Description: 线上课新增/编辑页 * @Description: 线上课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -319,7 +319,7 @@ class AddVideoCourse extends React.Component { ...@@ -319,7 +319,7 @@ class AddVideoCourse extends React.Component {
selectedFileList.map((file,index) => { selectedFileList.map((file,index) => {
console.log('') console.log('')
const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file; const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file;
console.log('folderFormat',folderFormat); const _mediaName =folderName.replace(`.${_.last(folderName.split('.')).toLowerCase()}`,'')
if(folderFormat === 'MP4' || folderFormat === 'video/mp4'){ if(folderFormat === 'MP4' || folderFormat === 'video/mp4'){
const videoDom = document.createElement('video') const videoDom = document.createElement('video')
videoDom.src = ossUrl videoDom.src = ossUrl
...@@ -328,7 +328,7 @@ class AddVideoCourse extends React.Component { ...@@ -328,7 +328,7 @@ class AddVideoCourse extends React.Component {
mediaContent: resourceId, mediaContent: resourceId,
contentType: 'SCHEDULE', contentType: 'SCHEDULE',
mediaType: "VIDEO", mediaType: "VIDEO",
mediaName: folderName.replace('.mp4',''), mediaName: _mediaName,
videoDuration: videoDom.duration, videoDuration: videoDom.duration,
resourceId, resourceId,
mediaUrl: ossUrl, mediaUrl: ossUrl,
...@@ -339,12 +339,6 @@ class AddVideoCourse extends React.Component { ...@@ -339,12 +339,6 @@ class AddVideoCourse extends React.Component {
}) })
} }
}else if( folderFormat==="WORD" || folderFormat==="PDF"){ }else if( folderFormat==="WORD" || folderFormat==="PDF"){
let _mediaName = folderName;
if(folderFormat === 'PDF'){
_mediaName = folderName.replace('.pdf','')
}else{
_mediaName = folderName.replace('.doc','').replace('.docx','')
}
const suffix = _.last(folderName.split('.')).toUpperCase(); const suffix = _.last(folderName.split('.')).toUpperCase();
_courseChapterList.push({ _courseChapterList.push({
mediaContent: resourceId, mediaContent: resourceId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment