<!-- 步骤条 -->
<template>
  <div class="list progress" id="scrollBox">
    <div :ops="ops" class="list-item progress-item" v-for="(item, index) in list" :key="index">
      <div :class="['progress-item-dot', { active: projectData.constructionStage-1 >= index }]"></div>
      <div class="info">
        <span class="label">{{ item.name }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import { getProjectDetail } from '@/assets/js/api/baseInfo.js'
export default {
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  data(){
    return{
      projectData: {
        constructionStage: 10,
      },
      ops: {
        vuescroll: {
          wheelDirectionReverse: true
        }
      },
    }
  },
  created(){
    console.log('this.list',this.list)
    this.getDataDateils()
  },
  mounted(){
    
  },
  methods:{
    getDataDateils() {
      let data = { projectSn: this.$store.state.projectSn }
      getProjectDetail(data).then((res) => {
        if (res.code == 200) {
          console.log('查询进度',res)
          this.projectData = res.result
        }
      })
    },
  }
}
</script>

<style lang="scss" scoped>
.progress {
  display: flex;
  align-items: center;

  width: 100%;
  height: 95%;

  .progress-item {
    position: relative;
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    width: 185px;
    color: #fff;

    .progress-item-dot {
      width: 10px;
      height: 10px;
      background-color: #fff;
      border-radius: 50%;

      &::after {
        content: '';
        position: absolute;
        top: 4px;
        transform: translateX(-99%);
        display: block;
        width: 185px;
        height: 2px;
        background: #fff;
      }

      &.active {
        &::after {
          background: #6dc6d8;
        }
      }

      &::before {
        content: '';
        position: relative;
        z-index: 9;
        display: block;
        width: 10px;
        height: 10px;
        background-color: #fff;
        border-radius: 50%;
      }
    }

    .info {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 10px;
      height: 60px;
      .label {
        margin-bottom: 20px;
      }
    }

    &:first-child {
      .progress-item-dot {
        &::after {
          display: none;
        }
      }
    }
  }
}
</style>
