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开始统计

diff --git a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js index dd4de7ecd..299af0d08 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js +++ b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js @@ -1,6 +1,6 @@ import React, { useState, useEffect, useContext, memo } from 'react'; import { Progress, Input, Tooltip , Spin } from 'antd' -import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext } from 'educoder' +import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext,formatSeconds} from 'educoder' import axios from 'axios' import moment from 'moment' import playIcon from './images/play.png' @@ -38,6 +38,7 @@ function VideoInReviewItem (props) { } }, []) + const username = props.match.params.username function toList() { @@ -74,7 +75,9 @@ function VideoInReviewItem (props) { {/*
累计学习时长:{play_duration} h
*/} {/* {moment(published_at || created_at).format('YYYY-MM-DD HH:mm:ss')}{people_num} */} {link ? :累计学习时长:{ - total_time<60?total_time+' s':total_time/60<60?(total_time/60).toFixed(0)+' min':(total_time/60/60).toFixed(1)+ ' h'}} + formatSeconds(total_time)} + {/* total_time<60?total_time+' s':total_time/60<60?(total_time/60).toFixed(0)+' min':(total_time/3600).toFixed(1)+ ' h' */} + }
{/* 2019-09-01 10:00:22 */}