<template>
  <div>
    <div class="title">
      <i v-if="item.state === '上传成功'" class="iconfont iconxingzhuang2"></i
      >{{ item.state }}
    </div>
    <div class="progress-bar">
      <div class="progress-bar__outer">
        <div
          class="progress-bar__inner"
          :style="Style"
          :class="{ bgw: suss }"
        ></div>
      </div>
    </div>
    <div class="svgbox" @click="$emit('termination')">
      <i class="iconfont iconshanchu1"></i>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      suss: false,
    };
  },
  props: ["item"],

  watch: {
    item: {
      handler(val, oldVal) {
        if (val.speed === 100) {
          val.state = "上传成功";
          this.suss = true;
        }
      },
      deep: true,
      immediate: true,
    },
  },
  computed: {
    Style() {
      const style = {
        width: this.item.speed + "%",
      };
      return style;
    },
  },
};
</script>
<style lang="less" scoped>
.svgbox {
  cursor: pointer;
  float: right;
  margin-left: 46px;
  color: #b6b5ba;
  i {
    font-size: 12px;
  }
}
.title {
  width: 74px;
  font-size: 14px;
  float: left;
  font-weight: 500;
  color: rgba(53, 53, 53, 1);
  line-height: 40px;
  i {
    vertical-align: bottom;
    margin-right: 2px;
    color: #33c724;
  }
}
.progress-bar {
  display: inline-block;
  vertical-align: middle;
  width: 170px;
  box-sizing: border-box;
  .progress-bar__outer {
    height: 6px;
    border-radius: 100px;
    background-color: #ebeef5;
    overflow: hidden;
    position: relative;
    vertical-align: middle;
  }
  .progress-bar__inner {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #5779f4;
    text-align: right;
    border-radius: 100px;
    line-height: 1;
    white-space: nowrap;
    transition: width 0.6s ease;
    &::after {
      display: inline-block;
      content: "";
      height: 100%;
      vertical-align: middle;
    }
  }
  .bgw {
    background: white !important;
    transition: none !important;
  }
}
</style>