lex-xin há 8 meses atrás
pai
commit
fe90a75cbf

+ 1 - 1
src/helpers/utils.ts

@@ -137,7 +137,7 @@ export const dateFormat = (value: string | Date, format = 'YYYY-MM-DD HH:mm:ss')
 
 // 秒转分
 export const getSecondRPM = (second: number, type?: string) => {
-  if (isNaN(second)) return '00:00'
+  if (isNaN(second) || second < 0) return '00:00'
   const mm = Math.floor(second / 60)
     .toString()
     .padStart(2, '0')

+ 1 - 1
src/views/coursewarePlay/component/video-play.tsx

@@ -20,7 +20,7 @@ import useErrorLog from '@/hooks/useErrorLog';
 
 // 秒转分
 export const getSecondRPM = (second: number, type?: string) => {
-  if (isNaN(second)) return '00:00'
+  if (isNaN(second) || second < 0) return '00:00'
   const mm = Math.floor(second / 60)
     .toString()
     .padStart(2, '0')