<template>
  <div class="camp-index">
    <Header> </Header>
    <div class="content flex">
      <div class="cc flex">
        <div class="camp_left">
          <ul class="camp_left_box">
            <li
              v-for="(item, index) in tabs"
              :key="index"
              :class="{ active: campindex_type === index }"
              @click="ToSignUp(index)"
            >
              <img :src="item.image" />
              {{ item.desc }}
            </li>
            <!-- <img src="@/assets/img/signUp/icon-bm.png" />营地报名 -->
            <!-- <li @click="ToHomework" :class="type == type_index ? 'active' : ''">
              <img src="@/assets/img/signUp/icon-zs.png" />营地作业
            </li>
            <li @click="ToCertificate" :class="type == type_index ? 'active' : ''">
              <img src="@/assets/img/signUp/icon-zy.png" />营地证书
            </li> -->
          </ul>
        </div>

        <div class="camp_right">
          <router-view />
        </div>
      </div>
    </div>

    <Footer> </Footer>
  </div>
</template>

<script>
/* eslint-disable */
import Header from "@/components/index/SignUp/Header.vue";
import Footer from "@/components/index/Footer.vue";
export default {
  name: "campIndex",
  components: {
    Header,
    Footer,
  },
  data() {
    return {
      tabs: [
        {
          id: "0",
          desc: "营地报名",
          image: require("@/assets/img/signUp/icon-bm.png"),
        },
        {
          id: "1",
          desc: "营地作业",
          image: require("@/assets/img/signUp/icon-zs.png"),
        },
        {
          id: "2",
          desc: "营地证书",
          image: require("@/assets/img/signUp/icon-zy.png"),
        },
      ],

      campindex_type: "",
    };
  },
  watch: {
    type(val) {
      // console.log(val, "index");
      window.localStorage.setItem("campindex_type", val);
    },
  },
  created() {
    window.localStorage.setItem("campindex_type", 0);
    this.campindex_type = window.localStorage.getItem("campindex_type");
    console.log(this.campindex_type, "type");
  },
  methods: {
    ToSignUp(index) {
      this.campindex_type = index;
      if (this.campindex_type == 0) {
        this.$router.replace({ name: "index-signUp" });
      } else if (this.campindex_type == 1) {
        this.$router.replace({ name: "index-homework" });
      } else if (this.campindex_type == 2) {
        this.$router.replace({ name: "index-certificate" });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.camp-index {
  background: #f8f8f8;
  .content {
    justify-content: center;
    .cc {
      width: 60%;
      justify-content: space-around;
      // align-items: center;
      margin: 30px 0 50px 0;
    }
  }
  .tab {
    width: 280px;
    height: 320px;
    background: #ffffff;
    position: relative;
    top: 0;
    // position: relative;
    // top: -544px;
    li {
      height: 52px;
      background: #f8f8f8;
    }
  }

  .camp_left {
    position: relative;
    width: 24%;
    max-width: 280px;
    min-width: 240px;
    /*height: 340px;*/
    border-radius: 8px;
    margin-right: 30px;
    .camp_left_box {
      max-width: 280px;
      min-width: 240px;
      height: 300px;
      background-color: #ffffff;
      border-radius: 8px;
      padding: 20px 0;
      margin: 0;
      &.is-fixed {
        position: fixed;
        top: 92px;
        width: 24%;
        max-width: 280px;
        min-width: 240px;
      }
      &.is-absolute {
        position: absolute;
        bottom: 0;
        width: 100%;
      }
      li {
        position: relative;
        padding: 0 23px;
        height: 44px;
        line-height: 44px;
        margin: 10px 0;
        font-size: 15px;
        list-style: none;
        img {
          vertical-align: middle;
          margin: -3px 8px 0 0;
          width: 20px;
        }

        &.active,
        &:hover {
          cursor: pointer;
          background-color: #f8f8f8;
          // border-right: 4px solid #3c0664;
        }
      }
    }
  }
}
</style>
