<template>
   <div id="Chapter2_2" class="content-wrap">
      <div style="margin: 30px 0px 50px">
         <router-link to="/MyPlan.page">
               <div class="logo mb25"><img src="../../../../resources/img/logo2.png" alt=""></div>
         </router-link>
      </div>
      <div class="title-box mb25 flex align-center mt40">
         <span class="title mr40">1. Hello WORLD</span>
         <span class="subtitle">my name is dd</span>
      </div>
      <div class="flex justify-between align-center">
         <div class="pre-btn" @click="goToPage('Chapter2_1')"><img src="../../../../resources/img/left.png" alt="">
         </div>
         <div class="content title-box">
            <p class="title mt25 title-bg">step2</p>
          <div class="flex align-center mb30">
          <p class="subtitle2 mr20">다음을 듣고 맞는 단어를 선택하세요.</p>
          <!-- <button><img src="../../../../resources/img/btn10_s.png" alt="">
          </button> -->
        </div>
            

            <div class="imgGroup">

               <div class="flex justify-center">
                  <div class="listenGroup  flex" style="gap: 60px;">
                     <button class="popTxt" v-for="(item, index) in items" :key="index" @click="updateContent(index)"
                        :class="{ active: selectedIndex === index }">
                        <img :src="item.imgSrc1">
                        <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block;">
                        <div class="textbox">
                          <div style="height: 80%; line-height: 200px;"> <img :src="item.imgSrc" alt=""></div>
                           <p class="subtitle3" style="height: 20%;">{{ item.title }}</p>
                        </div>
                     </button>
                  </div>
               </div>
               <div class="listen-btn">
                  <img src="client/resources/img/img60_36s.png" alt="">
               </div>
               <div class="look-text"> <button ><img src="../../../../resources/img/btn08_s.png" alt=""><p>정답확인</p></button></div>
            </div>
         </div>
         <div class="next-btn" @click="goToPage('Chapter2_9')"><img src="../../../../resources/img/right.png" alt="">
         </div>
      </div>
   </div>
</template>
<script>
export default {
   data() {
      return {
         items: [
            { imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img59_36s.png', title: 'apple' },
            { imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img58_36s.png', title: 'cloud'},
            { imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img57_36s.png', title: 'car' },
            { imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img56_36s.png', title: 'guitar' },
         ],
         selectedIndex: 0,
         timer: "00",
         intervalId: null,
      };
   },
   methods: {
      goToPage(page) {
         this.$router.push({ name: page });
      },
      updateContent(index) {
         this.selectedIndex = index;
         this.currentCon = this.items[index].con;
         this.startTimer();
      },

      
      
   },
}
</script>

<style scoped>
.listenGroup{height: 305px;}
.listenGroup button{position: relative;}
.listenGroup .textbox {    
   width: 184px;
    height: 206px;
    left: 46%;
    top: 43%;} 
.look-text{bottom: 50px;}
.btnGroup{width: 1060px; height: 340px;}
.popTxt{width: 216px; }
.popTxt > img {
   position: absolute;
   top: 0;
   left: 0;
}
</style>