/**
 * 将长字符串转化成...的形式
 * @param {Number} max 最多显示的字符串
 */
export const strOverflow = (value, max) => {
  if (!value) return ''
  value = value.toString()
  if (value.length <= max) return value
  return value.substring(0, max) + '...'
}

/**
 * 将秒转化成XX:XX的形式
 */
export const formatSec = (val) => {
  val = parseInt(val)
  if (!val) return '00:00'
  let minute = parseInt(val / 60)
  let second = val - minute * 60
  minute = minute < 10 ? `0${minute}` : minute
  second = second < 10 ? `0${second}` : second
  return `${minute}:${second}`
}
