/* eslint-disable camelcase */
export function resetSize (vm) {
  let img_width, img_height, bar_width, bar_height // 图片的宽度、高度，移动条的宽度、高度

  const parentWidth = vm.$el.parentNode.offsetWidth || window.offsetWidth
  const parentHeight = vm.$el.parentNode.offsetHeight || window.offsetHeight

  if (vm.imgSize.width.indexOf('%') != -1) {
    img_width = parentWidth + 'px'
    // img_width = parseInt(this.imgSize.width) / 90 * parentWidth + 'px'
  } else {
    img_width = this.imgSize.width
  }

  if (vm.imgSize.height.indexOf('%') != -1) {
    img_height = (parentWidth * 0.56) + 'px'
    // img_height = parseInt(this.imgSize.height) / 30 * parentHeight + 'px'
  } else {
    img_height = this.imgSize.height
  }

  if (vm.barSize.width.indexOf('%') != -1) {
    bar_width = parseInt(this.barSize.width) / 90 * parentWidth + 'px'
  } else {
    bar_width = this.barSize.width
  }

  if (vm.barSize.height.indexOf('%') != -1) {
    bar_height = parseInt(this.barSize.height) / 30 * parentHeight + 'px'
  } else {
    bar_height = this.barSize.height
  }

  return { imgWidth: img_width, imgHeight: img_height, barWidth: bar_width, barHeight: bar_height }
}
