<!--  -->
<template>
  <div class="collection-detail">
    <div class="wrapper">
      <div class="top">
        <img
          class="bg"
          :src="require('@/assets/images/collection-type-top-bg.png')"
          alt=""
        />
      </div>
      <div class="bottom">
        <img
          class="bg"
          :src="require('@/assets/images/survey-type-bottom-bg.png')"
          alt=""
        />

        <div class="content">
          <div class="nav">
            <img
              class="bg"
              :src="require('@/assets/images/survey-type-nav-bg.png')"
              alt=""
            />
            <div class="nav-con">
              <div class="nav-con-title">典藏</div>
              <div class="nav-con-type">
                <ul>
                  <li
                    :class="{ cur: collectionType === 'boutique' }"
                    @click="switchType('boutique')"
                  >
                    <a>精品典藏</a>
                    <div class="arrow" v-if="collectionType === 'boutique'">
                      <img :src="require('@/assets/images/arrow.png')" alt="" />
                    </div>
                  </li>
                  <li
                    :class="{ cur: collectionType === 'threeDimensional' }"
                    @click="switchType('threeDimensional')"
                  >
                    <a>三维藏品</a>
                    <div
                      class="arrow"
                      v-if="collectionType === 'threeDimensional'"
                    >
                      <img :src="require('@/assets/images/arrow.png')" alt="" />
                    </div>
                  </li>
                </ul>
              </div>
            </div>
          </div>
          <div class="con">
            <div class="back" @click="back">
              <img :src="require('@/assets/images/back.png')" alt="" />
            </div>
            <img
              class="bg"
              :src="require('@/assets/images/survey-type-con-bg.png')"
              alt=""
            />
            <div class="detail">
              <div class="detail-wrapper">
                <div class="detail-picOrModel" v-if="detail.type === 'img'">
                  <el-image
                    style="width: 100px; height: 100px"
                    :src="$cdnUrl + detail.thumb"
                    :preview-src-list="bigImgUrl"
                  >
                  </el-image>
                  <!-- <img :src="$cdnUrl + detail.thumb" alt="" /> -->
                  <iframe
                    v-if="detail.type === 'model'"
                    :src="detail.modelUrl"
                    frameborder="0"
                  ></iframe>
                </div>
                <div class="detail-title">{{ detail.name }}</div>
                <div class="detail-desc">
                  <span>年代:&nbsp;{{ detail.myage }}&nbsp;&nbsp;</span>
                  <span>分类:&nbsp;{{ detail.classify }}</span>
                </div>
                <div class="detail-con" v-html="detail.description"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
// 例如：import 《组件名称》 from '《组件路径》';
export default {
  name: 'collection-detail',
  // import引入的组件需要注入到对象中才能使用
  components: {},
  data () {
    // 这里存放数据
    return {
      bigImgUrl: [],
      bigImg: '',
      collectionType: 'boutique',
      detail: {}
    }
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 方法集合
  methods: {
    switchType (type) {
      this.$router.push({ path: '/collection-type', query: { type } })
    },
    back () {
      this.$router.push({
        path: '/collection-type',
        query: { type: this.detail.navType || '' }
      })
    }
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created () {
    // console.log(77777, this.$route.query)
    this.detail = this.$route.query
    this.bigImgUrl[0] = this.$cdnUrl + this.detail.thumb
    this.collectionType = this.detail.navType
  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted () {},
  beforeCreate () {}, // 生命周期 - 创建之前
  beforeMount () {}, // 生命周期 - 挂载之前
  beforeUpdate () {}, // 生命周期 - 更新之前
  updated () {}, // 生命周期 - 更新之后
  beforeDestroy () {}, // 生命周期 - 销毁之前
  destroyed () {}, // 生命周期 - 销毁完成
  activated () {} // 如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang='less' scoped>
// .bigImg{
//   z-index: 99999;
//   position: fixed;
//   top: 0;
//   left: 0;
//   width: 100vw;
//   height: 100vh;
//   background-color: rgba(0,0,0,.8);
//   text-align: center;
//   img {
//     margin-top: 10vh;
//     max-width: 80vw;
//     max-height: 80vh;
//   }
//   // .imgBtnX {
//   //   cursor: pointer;
//   //   width: 100px;
//   //   height: 30px;
//   //   position: absolute;
//   //   left: 50%;
//   //   bottom: 20px;
//   //   background-color: #fff;
//   //   border-radius: 8px;
//   //   color: black;
//   //   display: flex;
//   //   justify-content: center;
//   //   align-items: center;
//   // }
// }
/deep/.el-image{
  width: 300px !important;
  height: 300px !important;
}
/deep/.el-image>img {
  width: auto !important;
}
.bg {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
}
.collection-detail {
  width: 100%;
  margin-bottom: 98px;
  .wrapper {
    width: 100%;
    .top {
      width: 100%;
      height: 278px;
      position: relative;
    }
    .bottom {
      width: 100%;
      position: relative;
      .content {
        min-width: 1090px;
        margin: 0 auto;
        width: 57%;
        display: flex;
        justify-content: center;
        .nav {
          flex: 1;
          margin-right: 1%;
          margin-top: -68px;
          position: relative;
          .nav-con {
            width: 85%;
            margin: 94px auto 0;
            .nav-con-title {
              background: #945335;
              padding: 14.5px 0 14.5px 46px;
              font-size: 20px;
              font-family: Microsoft YaHei;
              font-weight: bold;
              color: #ffffff;
              opacity: 1;
            }
            .nav-con-type {
              margin-top: 3px;
              background: rgba(148, 83, 53, .6);
              overflow: hidden;
              > ul {
                width: 100%;
                margin-top: 21px;
                margin-bottom: 105px;
                > li {
                  width: 100%;
                  padding: 8px 0 8px 51px;
                  font-size: 16px;
                  font-family: Microsoft YaHei;
                  font-weight: 400;
                  color: #000000;
                  position: relative;
                  cursor: pointer;
                  .arrow {
                    position: absolute;
                    top: 10px;
                    right: 11.5px;
                    width: 10.5px;
                    height: 18px;
                    > img {
                      width: 100%;
                      height: 100%;
                    }
                  }
                }
                .cur {
                  background: linear-gradient(180deg, #585a5a 0%, #949198 100%);
                  color: #ffffff;
                }
              }
            }
          }
        }
        .con {
          flex: 3;
          margin-top: -68px;
          position: relative;
          .back {
            width: 19px;
            position: absolute;
            left: 26px;
            top: 97px;
            cursor: pointer;
            > img {
              width: 100%;
            }
          }
          .detail {
            width: 100%;
            .detail-wrapper {
              width: 95%;
              margin: 152px auto 80px;
              overflow: hidden;
              .detail-picOrModel {
                text-align: center;
                width: 100%;
                img {
                  max-width: 100%;
                  max-height: 400px;
                }
                iframe {
                  width: 100%;
                  height: 700px;
                }
                .lookImg {
                  position: relative;
                  i {
                    font-size: 30px;
                    cursor: pointer;
                    position: absolute;
                    bottom: 0;
                    right: 0;
                  }
                }
              }
              .detail-title {
                width: 100%;
                text-align: center;
                margin-top: 35px;
                font-size: 24px;
                font-family: Microsoft YaHei;
                font-weight: 400;
                line-height: 58px;
                color: #202020;
              }
              .detail-desc {
                text-align: center;
                margin-top: 8px;
                font-size: 12px;
                font-weight: 400;
              }
              .detail-con {
                margin-top: 31px;
              }
            }
          }
        }
      }
    }
  }
}
</style>
