<template>
  <div class="pinBottom-container" @touchstart.stop @keydown.stop>
    <div class="pinBottom center">
      <div id="view-controllers"></div>
    </div>
    <div class="pinBottom left" id="moveChange">
      <div>
        <div class="viewContainer">
          <!-- 展开和收起按钮 -->
          <div class="packDo" @click="packDo = !packDo">
            <img src="../../assets/img/packDo.png" alt="" v-if="packDo" />
            <img src="../../assets/img/packUp.png" alt="" v-else />
          </div>
          <div
            id="previous"
            class="previous desktop-only ui-icon"
            style="display: none"
          >
            <a>
              <img
                rel="tooltip"
                title=""
                :src="require('@/assets/images/play.png')"
                width="24"
                height="24"
                data-original-title="播放"
              />
            </a>
          </div>
          <div
            id="play"
            class="ui-icon"
            rel="tooltip"
            data-original-title="播放"
          >
            <a>
              <img
                title="自动漫游"
                :src="require('@/assets/images/icon/play.png')"
                width="24"
                height="24"
              />
            </a>
            <p class="ttxt">自动导览</p>
          </div>
          <div id="pause" class="ui-icon" style="display: none">
            <a>
              <img
                rel="tooltip"
                title=""
                :src="require('@/assets/images/icon/pause.png')"
                width="24"
                height="24"
                data-original-title="暂停"
              />
            </a>
            <p class="ttxt ttxtAc">自动导览</p>
          </div>
          <div
            id="next"
            class="next desktop-only ui-icon wide"
            style="display: none"
          >
            <a>
              <i
                rel="tooltip"
                title=""
                class="icon icon-dpad-right"
                data-original-title="下一个"
              ></i>
            </a>
          </div>
          <div id="gui-modes-map" class="ui-icon double active">
            <div
              data-original-title="导览"
              @click="isGuide = !isGuide"
              id="pullTab"
              rel="tooltip"
              title="场景导览"
            >
              <img
                class="icon icon-inside"
                :src="
                  require(`@/assets/images/icon/auto${
                    !isGuide ? '_active' : ''
                  }.png`)
                "
              />
              <p class="ttxt" :class="{ ttxtAc: !isGuide }">导览列表</p>
            </div>

            <div
              title="全景漫游"
              data-original-title="全景漫游"
              id="gui-modes-inside"
              rel="tooltip"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/icon/inside.png')"
              />
              <img
                class="icon icon-inside active"
                :src="require('@/assets/images/icon/inside_active.png')"
              />
              <p class="ttxt">自由漫游</p>
            </div>
            <div
              title="迷你漫游"
              data-original-title="迷你模型"
              id="gui-modes-dollhouse"
              rel="tooltip"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/icon/dollhouse.png')"
              />
              <img
                class="icon icon-inside active"
                :src="require('@/assets/images/icon/dollhouse_active.png')"
                title="navigation icon "
              />
              <p class="ttxt">三维视觉</p>
            </div>
            <div
              data-original-title="俯视图"
              id="gui-modes-floorplan"
              rel="tooltip"
              title="顶部俯视"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/icon/floor.png')"
              />
              <img
                class="active icon icon-inside active"
                :src="require('@/assets/images/icon/floor_active.png')"
              />
              <p class="ttxt">平面视觉</p>
            </div>
            <div
              data-original-title="VR"
              id="vr"
              rel="tooltip"
              title=""
              style="display: none"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/VR.png')"
              />
            </div>
            <div
              data-original-title="热点列表"
              id="hotList"
              rel="tooltip"
              title=""
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/hotlist.png')"
              />
              <img
                class="icon icon-inside active"
                :src="require('@/assets/images/hotlist.png')"
              />
            </div>
            <div
              data-original-title="消除外壳"
              id="gui-remove-face"
              rel="tooltip"
              title=""
              style="display: none; float: left"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/face.jpg')"
              />
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="pinBottom right hideTarget">
      <div class="rightViewContainer clearfix">
        <div class="gui-floor">
          <div class="gui-floor-title"></div>
          <div class="gui-floor-icon">
            <span class="gui-floor-number"></span>
          </div>
          <div class="container"></div>
        </div>

        <div id="vr" class="ui-icon wide hidden" style="display: none">
          <a>
            <i
              rel="tooltip"
              title="{[{ VIEW_IN_VR }]}"
              class="icon icon-webvr"
            ></i>
          </a>
        </div>
        <div id="sharing" class="ui-icon wide hidden" style="display: none">
          <a>
            <i
              rel="tooltip"
              title="{[{ SOCIAL_SHARING }]}"
              class="icon icon-share"
            ></i>
          </a>
        </div>
        <div
          id="gui-fullscreen"
          class="ui-icon wide"
          data-placement="top"
          rel="tooltip"
          title="全屏"
        >
          <a>
            <img :src="require('@/assets/images/icon/fullscreen.png')" />
          </a>
        </div>
        <div
          id="gui-fullscreen-exit"
          class="ui-icon wide"
          data-placement="top"
          rel="tooltip"
          title="关闭全屏"
          style="display: none"
        >
          <a>
            <img
              :src="require('@/assets/images/icon/fullscreen_exit.png')"
              style="width: 50px"
            />
          </a>
        </div>
        <div class="pull-right terms terms2">
          <a>{[{ TERMS }]}</a>
        </div>
      </div>
    </div>
    <!-- 顶部固定栏 -->
    <div class="topMean" :class="{ topMeanOpen: topMean }">
      <div class="top">
        <div class="rigIco" @click="cutMean">
          <img src="../../assets/img/meanAc.png" alt="" v-if="topMean" />
          <img src="../../assets/img/mean.png" alt="" v-else />
        </div>
        <!-- 展开下面的内容 -->
        <div class="open">
          <div
            class="row"
            :class="{ active: meanInd === item.id }"
            @click="meanInd = item.id"
            v-for="item in meanList"
            :key="item.id"
          >
            {{ item.name }}
            <img
              :src="
                require(`@/assets/img/you${
                  meanInd === item.id ? 'Ac' : ''
                }.png`)
              "
              alt=""
            />
          </div>
          <div class="bottom" v-show="topMean">
            <!-- 分享 -->
            <div class="share" @click="meanInd = -1">
              <img
                title="分享"
                :src="
                  require(`@/assets/img/share${meanInd === -1 ? 'Ac' : ''}.png`)
                "
                alt=""
              />
              <span class="shareTxt">分享页面</span>
            </div>
            <!-- 音乐 -->
            <div id="volume" class="ui-icon bgandshare wide">
              <div id="openMusic">
                <img
                  @click="switchBGM(true)"
                  src="../../assets/img/musicAc.png"
                  alt=""
                />
                <span class="musicTxt">打开音乐</span>
              </div>
              <div id="closeMusic">
                <img
                  @click="switchBGM(false)"
                  src="../../assets/img/music.png"
                  alt=""
                />
                <span class="musicTxt">关闭音乐</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 分享 -->
    <Share v-if="meanInd === -1" @close="meanInd = null" />
    <!-- 展厅列表 -->
    <MapNav v-if="meanInd === 1" @close="meanInd = null" />
    <!-- 精品文物 -->
    <Antique v-if="meanInd === 2" @close="meanInd = null" />
    <!-- 热点列表 -->
    <Hotspot v-if="meanInd === 3" @close="meanInd = null" />
  </div>
</template>
<script>
import Share from "./component/share.vue";
import MapNav from "./component/mapNav.vue";
import Antique from "./component/antique.vue";
import Hotspot from "./component/hotspot.vue";
export default {
  components: { Share, MapNav, Antique, Hotspot },
  data() {
    return {
      isGuide: true,
      // 底部菜单的展开和收起
      packDo: false,
      // 顶部菜单的展开和收起
      topMean: false,
      // 控制展厅、文物、热点，分享的显示和隐藏
      meanInd: null,
      meanList: [
        { id: 1, name: "展厅列表" },
        { id: 2, name: "精品文物" },
        { id: 3, name: "热点列表" },
      ],
    };
  },
  computed: {},
  mounted() {},
  watch: {
    packDo(val) {
      let dom = document.querySelector("#moveChange");
      if (val) dom.classList.add("packDoCla");
      else dom.classList.remove("packDoCla");
    },
    meanInd() {
      this.topMean = false;
    },
  },
  methods: {
    cutMean() {
      this.topMean = !this.topMean;
      this.$emit("musicOne");
    },
    switchBGM(flag) {
      if (flag) {
        window.manage.switchBgmState(true);
        document.querySelector("#openMusic").style.display = "none";
        document.querySelector("#closeMusic").style.display = "block";
      } else {
        window.manage.switchBgmState(false);
        document.querySelector("#openMusic").style.display = "block";
        document.querySelector("#closeMusic").style.display = "none";
      }
    },
  },
};
</script>

<style lang="less" scoped>
#closeMusic {
  display: none;
}
#hotList {
  display: none !important;
}
.topMean {
  z-index: 9999;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 50px;
  transition: height 0.3s;
  overflow: hidden;
  &::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 20%;
    height: 100%;
    backdrop-filter: blur(10px);
    z-index: -2;
  }
  .top {
    width: 100%;
    height: 50px;
    background: url("../../assets/img/logo.png") no-repeat center center;
    background-size: 144px 40px;
    background-color: #774926;
  }
  .rigIco {
    position: absolute;
    right: 10px;
    top: 13px;
    width: 24px;
    height: 24px;
    & > img {
      width: 100%;
    }
  }
  .open {
    overflow: hidden;
    position: absolute;
    top: 50px;
    right: 0;
    width: 80%;
    height: calc(100% - 50px);
    &::after {
      opacity: 0.3;
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      background: url("../../assets/img/tabBac.png");
      background-size: 100% 100%;
    }
    &::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: #774926;
      z-index: -2;
    }
    .row {
      position: relative;
      color: #fff6d2;
      border-bottom: 1px solid #fff6d2;
      height: 80px;
      line-height: 80px;
      font-size: 20px;
      padding-left: 30px;
      & > img {
        position: absolute;
        width: 10px;
        right: 30px;
        top: 50%;
        transform: translateY(-50%);
      }
    }
    .active {
      pointer-events: none;
      color: #cc946d;
    }
    .bottom {
      display: flex;
      justify-content: center;
      position: absolute;
      bottom: 0px;
      left: 0;
      width: 100%;
      height: 80px;
      & > div {
        width: 100px;
        text-align: center;
        position: relative;
        & > img {
          width: 40px;
        }
        & > span {
          position: absolute;
          top: 45px;
          left: 50%;
          transform: translateX(-50%);
          color: #fff6d2;
          font-size: 12px;
        }
      }
      .musicTxt {
        position: absolute;
        top: 45px;
        left: 50%;
        transform: translateX(-50%);
        color: #fff6d2;
        font-size: 12px;
      }
    }
  }
}
.topMeanOpen {
  height: 100%;
}
// ---------------顶部固定栏👆
.packDoCla {
  left: -308px !important;
}
.ttxt {
  color: #fff6d2;
  font-size: 12px;
  position: absolute;
  bottom: -15px;
  left: 0;
  width: 100%;
  text-align: center;
}
.ttxtAc {
  color: #cc946d;
}
// 移动端样式定制化👆
::-webkit-scrollbar {
  width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
}
::-webkit-scrollbar-thumb {
  // box-shadow   : inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: #edd3b0;
  border-color: #edd3b0;
  color: #edd3b0;
  outline: none;
}

// 右侧菜单栏
@wh: 32px;
@margin: 0px;
#play,
#pause {
  margin-right: @margin;
  img {
    width: @wh;
    height: @wh;
  }
}
.rightViewContainer {
  display: flex !important;
  align-items: center !important;
}
#gui-modes-map {
  > div {
    margin-right: @margin;
    > img {
      width: @wh;
      height: @wh;
      display: block !important;
    }
    .active {
      display: none !important;
    }
  }
  .active {
    > img {
      display: none !important;
    }
    .active {
      display: block !important;
    }
  }
}
#gui-modes-dollhouse {
  position: relative;
}
#gui-modes-dollhouse.active .ttxt {
  color: #cc946d;
}
#gui-modes-floorplan {
  position: relative;
}
#gui-modes-floorplan.active .ttxt {
  color: #cc946d;
}
#gui-modes-inside {
  position: relative;
}
#gui-modes-inside.active .ttxt {
  color: #cc946d;
}
.pinBottom.right .ui-icon {
  background: none;
}

#gui-fullscreen img {
  width: 32px;
}
#gui-fullscreen {
  background-color: rgba(0, 0, 0, 0.5) !important;
  border-radius: 50%;
}
#gui-fullscreen-exit {
  width: 50px;
  background-color: rgba(0, 0, 0, 0.5) !important;
  border-radius: 50%;
}
#gui-fullscreen-exit img {
  width: 32px !important;
}

.viewContainer,
#gui-modes-map {
  width: calc(100% - 55px);
  justify-content: space-around;
}
#myMoMu {
  display: block !important;
}
#myMoMu img {
  margin-left: 12px;
}
.viewContainer {
  width: 350px;
  background-color: rgba(132, 90, 59, 0.8);
  padding: 5px 30px 13px 5px;
  border-radius: 0 50px 50px 0;
  .packDo {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    & > img {
      width: 100%;
    }
  }
}

@wh: 32px;
@margin: 10px;
#play,
#pause {
  margin-bottom: @margin;
  img {
    width: @wh;
    height: @wh;
  }
}
#gui-modes-map {
  > div {
    margin-bottom: @margin;
    > img {
      width: @wh;
      height: @wh;
      display: block;
    }
    .active {
      display: none;
    }
  }
  .active {
    > img {
      display: none;
    }
    .active {
      display: block;
    }
  }
}

@media only screen and (max-width: 351px) {
  .viewContainer {
    width: 320px;
  }
  .ttxt {
    transform: scale(0.8);
    width: 110%;
    left: -3px;
  }
  .packDoCla {
    left: -278px !important;
  }
}
</style>
