From 597632478dec980aa215f1366b84bcefd61ecb7b Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 13 Mar 2020 23:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=97=B6=E5=88=86=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/DateUtil.js | 30 +++++++++++++++++++ public/react/src/common/educoder.js | 2 +- .../react/src/modules/courses/Video/Video.js | 2 +- .../user/usersInfo/video/VideoInReviewItem.js | 7 +++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/public/react/src/common/DateUtil.js b/public/react/src/common/DateUtil.js index dc2288ff3..4bc481b10 100644 --- a/public/react/src/common/DateUtil.js +++ b/public/react/src/common/DateUtil.js @@ -38,6 +38,36 @@ export function getNextHalfHourOfMoment(moment) { return moment } + export function formatSeconds(value) { + + var theTime = parseInt(value);// 秒 + var middle= 0;// 分 + var hour= 0;// 小时 + + if(theTime > 60) { + middle= parseInt(theTime/60); + theTime = parseInt(theTime%60); + if(middle> 60) { + hour= parseInt(middle/60); + middle= parseInt(middle%60); + } + } + var result = ""+parseInt(theTime)+"秒"; + if(middle > 0) { + if(hour>0){ + result = ""+parseInt(middle)+"分"; + }else{ + result = ""+parseInt(middle)+"分"+result; + } + + } + if(hour> 0) { + result = ""+parseInt(hour)+"小时"+result; + } + return result; + } + + export function formatDuring(mss){ var days = parseInt(mss / (1000 * 60 * 60 * 24)); var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 2cb074a6a..c990b5dea 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -20,7 +20,7 @@ export { bytesToSize as bytesToSize } from './UnitUtil'; export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension, downloadFile, sortDirections } from './TextUtil' -export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil' +export { handleDateString, getNextHalfHourOfMoment,formatDuring,formatSeconds} from './DateUtil' export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil' diff --git a/public/react/src/modules/courses/Video/Video.js b/public/react/src/modules/courses/Video/Video.js index 1ad16d702..181c082ae 100644 --- a/public/react/src/modules/courses/Video/Video.js +++ b/public/react/src/modules/courses/Video/Video.js @@ -243,7 +243,7 @@ class Video extends Component {
共 {videoData && videoData.count} 个视频
-播放数据从2020-03-13 24:00开始统计
+播放数据从2020-03-13 24:00开始统计