<template>
  <div class="market-tools">
    <div class="tool-main">
      <div class="tool-bg">
        <div class="tool-content">
          <ul>
            <!-- <li
              @click="selectList(index)"
              v-for="(item, index) in list"
              :key="index"
              :class="listIndex === index ? 'active' : ''"
            > -->
            <li
              @click="selectList(index)"
              v-for="(item, index) in list"
              :key="index"
              :class="listIndex === index ? 'active' : ''"
            >
              <img :src="item.icon" />
              <div class="text">{{ item.text }}</div>
            </li>
          </ul>
          <div class="confirm-btn" @click="handleTool">选好了</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      listIndex: 0,
      list: [
        {
          icon: 'https://webapp-pub.ezijing.com/x-training-new/tool_video.png',
          text: '视频营销'
        },
        {
          icon: 'https://webapp-pub.ezijing.com/x-training-new/tool_email.png',
          text: '邮件营销'
        },
        {
          icon: 'https://webapp-pub.ezijing.com/x-training-new/tool_app.png',
          text: 'APP营销'
        },

        {
          icon: 'https://webapp-pub.ezijing.com/x-training-new/tool_info.png',
          text: '移动短信营销'
        },

        {
          icon: 'https://webapp-pub.ezijing.com/x-training-new/tool_wechat.png',
          text: '微信提醒营销'
        }
      ]
    }
  },
  methods: {
    selectList(n) {
      this.listIndex = n
    },
    handleTool() {
      if (this.listIndex === 0) {
        // this.$router.push('/market-tools/douYin')
        window.location.href = '/market-tools/douYin'
      } else if (this.listIndex === 1) {
        // this.$router.push('/market-tools/mail')
        window.location.href = '/market-tools/mail'
      } else if (this.listIndex === 2) {
        // this.$router.push('/market-tools/app')
        window.location.href = '/market-tools/app'
      } else if (this.listIndex === 3) {
        // this.$router.push('/market-tools/sms')
        window.location.href = '/market-tools/sms'
      } else if (this.listIndex === 4) {
        window.location.href = '/market-tools/weChat'
        // this.$router.push('/market-tools/weChat')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.market-tools {
  .tool-main {
    background: #fff;
    padding-bottom: 11px;
    .tool-bg {
      position: relative;
      width: 1112px;
      height: 489px;
      margin: 0 auto;
      background: url(https://webapp-pub.ezijing.com/x-training-new/tool-index-bg.png);
      background-size: 100% 100%;
      .tool-content {
        width: 708px;
        position: absolute;
        top: 166px;
        left: 282px;
        ul {
          display: flex;
          flex-wrap: wrap;
        }
        li {
          width: 180px;
          height: 96px;
          background: rgba(255, 255, 255, 0.39);
          border: 1px solid #e8e8e8;
          opacity: 1;
          border-radius: 10px;
          display: flex;
          justify-content: center;
          flex-direction: column;
          align-items: center;
          margin: 0 10px 10px 0;
          cursor: pointer;

          &.active {
            border: 1px solid #49bba2;
            box-shadow: 0px 3px 18px rgba(51, 51, 51, 0.15);
          }
          .text {
            font-size: 14px;
            color: #797979;
            line-height: 24px;
          }
        }
      }
      .confirm-btn {
        width: 119px;
        height: 32px;
        background: #49bba2;
        border-radius: 16px;
        position: absolute;
        left: 221px;
        bottom: -50px;
        text-align: center;
        font-size: 18px;
        line-height: 32px;
        color: #ffffff;
        cursor: pointer;
      }
    }
  }
  padding: 30px;
  /* height:calc(100vh - 86px); */
}
</style>
