<!-- -->
<template>
  <div class="home-virtural">
    <div class="title">
      <div class="ch">虚拟展厅</div>
      <div class="en">Virtual Exhibition Hall</div>
    </div>
    <div class="bar">
      <img
        src="@/assets/imgs/home/virtual-bg.png"
        alt=""
        class="bg"
        width="100%"
      />
      <div class="intro" v-if="list.records.length > 0">
        <div class="name">{{ list.records[0].name }}</div>
        <div class="deptName">{{ list.records[0].deptName }}</div>
        <div class="entrance" @click="handleClick(list.records[0])">
          <span style="margin-right: 12px">点击进入</span>
          <img src="@/assets/imgs/home/entrance.png" alt="" />
        </div>
      </div>
      <div class="virtual-items">
        <el-row :gutter="10">
          <el-col
            :span="8"
            v-for="(item, index) in list.records"
            :key="index"
            class="item"
            @click.native="handleClick(item)"
          >
            <img :src="item.faceImageUrl" alt="" />
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import { getVirtualList } from "@/api/vitual";
export default {
  data() {
    return {
      list: {
        records: [],
        size: 6,
        current: 1,
        total: 0,
      },
    };
  },
  mounted() {
    this.loadData();
  },
  methods: {
    // TODO:后面替换成随机推荐
    async loadData() {
      var params = {
        page: this.list.current,
        limit: this.list.size,
      };
      let res = await getVirtualList(params);
      if (res.code == 0) {
        this.list = res.data;
      }
    },

    handleClick(item) {
      window.open(item.url);
    },
  },
};
</script>

<style lang="scss" scoped>
.home-virtural {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  .title {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 0 120px 0;
    font-family: "Alibaba PuHuiTi";
    .ch {
      font-size: 30px;
      font-weight: bold;
      color: #333333;
      margin-bottom: 12px;
    }
    .en {
      font-size: 14px;
      color: #333333;
    }
  }
  .bar {
    height: 524px;
    position: relative;
    .bg {
      height: 100%;
    }
    .intro {
      position: absolute;
      left: 13%;
      top: 45px;
      .name {
        margin-bottom: 27px;
        font-size: 20px;
        font-family: "Alibaba PuHuiTi";
        font-weight: bold;
        color: #ffffff;
      }
      .deptName {
        font-size: 16px;
        font-family: "Alibaba PuHuiTi";
        color: #ffffff;
        margin-bottom: 85px;
      }
      .entrance {
        color: #fff;
        font-size: 16px;
        cursor: pointer;
        font-family: "Alibaba PuHuiTi";
      }
    }
    .virtual-items {
      position: absolute;
      width: 965px;
      top: -58px;
      right: 13%;
      img {
        width: 316px;
        height: 238px;
      }
      .item {
        margin-bottom: 5px;
        cursor: pointer;
      }
    }
  }
}
</style>
