<!--  -->
<template>
  <div class="information">
    <img class="bg" :src="require('@/assets/images/survey-bg.png')" alt="" />
    <div class="content">
      <div class="logo">
        <img :src="require('@/assets/images/information-title.png')" alt="" />
      </div>
      <ul>
        <li
          @click="toType('recentNews')"
          @mouseover="mouseOver('recentNews')"
          @mouseleave="mouseLeave('recentNews')"
        >
          <img
            :src="
              require(`@/assets/images/information-recentNews${
                recentNewsHover ? '-hover' : ''
              }.jpg`)
            "
            alt=""
          />
          <div class="txt" :class="{ active: select==='recentNews' }"></div>
        </li>
        <li
          @click="toType('activity')"
          @mouseover="mouseOver('activity')"
          @mouseleave="mouseLeave('activity')"
        >
          <img
            :src="
              require(`@/assets/images/information-activity${
                activityHover ? '-hover' : ''
              }.jpg`)
            "
            alt=""
          />
          <div class="txt" :class="{ active: select==='activity' }"></div>
        </li>
        <li
          @click="toType('infor')"
          @mouseover="mouseOver('infor')"
          @mouseleave="mouseLeave('infor')"
        >
          <img
            :src="
              require(`@/assets/images/information-infor${
                inforHover ? '-hover' : ''
              }.jpg`)
            "
            alt=""
          />
          <div class="txt" :class="{ active: select==='infor' }"></div>
        </li>
        <li
          @click="toType('book')"
          @mouseover="mouseOver('book')"
          @mouseleave="mouseLeave('book')"
        >
          <img
            :src="
              require(`@/assets/images/information-book${
                bookHover ? '-hover' : ''
              }.jpg`)
            "
            alt=""
          />
          <div class="txt" :class="{ active: select==='book' }"></div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
// 例如：import 《组件名称》 from '《组件路径》';

export default {
  name: 'information',
  // import引入的组件需要注入到对象中才能使用
  components: {},
  data () {
    // 这里存放数据
    return {
      select: '',
      recentNewsHover: false,
      activityHover: false,
      inforHover: false,
      bookHover: false
    }
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 方法集合
  methods: {
    toType (type) {
      this.$router.push({ path: '/information-type', query: { type } })
    },
    mouseOver (type) {
      this.select = type
      switch (type) {
        case 'recentNews':
          this.recentNewsHover = true
          break
        case 'activity':
          this.activityHover = true
          break
        case 'infor':
          this.inforHover = true
          break
        case 'book':
          this.bookHover = true
          break
        default:
          break
      }
    },
    mouseLeave (type) {
      this.select = ''
      switch (type) {
        case 'recentNews':
          this.recentNewsHover = false
          break
        case 'activity':
          this.activityHover = false
          break
        case 'infor':
          this.inforHover = false
          break
        case 'book':
          this.bookHover = false
          break
        default:
          break
      }
    }
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created () {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted () {},
  beforeCreate () {}, // 生命周期 - 创建之前
  beforeMount () {}, // 生命周期 - 挂载之前
  beforeUpdate () {}, // 生命周期 - 更新之前
  updated () {}, // 生命周期 - 更新之后
  beforeDestroy () {}, // 生命周期 - 销毁之前
  destroyed () {}, // 生命周期 - 销毁完成
  activated () {} // 如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang='less' scoped>
.information {
  width: 100%;
  position: relative;
  overflow: hidden;
  .bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
  }
  .content {
    width: 1350px;
    margin: 66px auto 142px;
    display: flex;
    .logo {
      width: 120px;
      > img {
        width: 100%;
      }
    }
    ul {
      display: flex;
      margin-left: 105px;
      margin-top: 107px;
      display: flex;
      li {
        width: 259px;
        height: 624px;
        position: relative;
        margin-right: 23px;
        cursor: pointer;
        .txt {
          width: 28px;
          font-size: 28px;
          font-family: Microsoft YaHei;
          font-weight: 400;
          line-height: 33px;
          color: #000000;
          opacity: 0.7;
          position: absolute;
          top: 9px;
          right: 20px;
        }
        .active{
          color: #fff;
        }
        > img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
</style>
