<template>
  <div class="pinBottom-container">
    <div class="pinBottom center">
      <div id="view-controllers"></div>
    </div>
    <div class="pinBottom left">
      <div class="pinBflex">
        <Danmaku
          class="danmaku"
          :quotes="quotes"
          :danmuArr="danmu"
          :showIcon="require(`@/assets/images/icon/danmu_open.png`)"
          :closeIcon="require('@/assets/images/icon/danmu_close.png')"
          :arrowIcon="require('@/assets/images/icon/danmu_top.png')"
        />
        <div class="viewContainer">
          <div
            id="previous"
            class="previous desktop-only ui-icon tooltip"
            style="display: none"
            title="播放"
          >
            <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="自动导览"
                class="tttttt"
                :src="require('@/assets/images/icon/bigscene/play.png')"
                width="24"
                height="24"
              />
            </a>
          </div>
          <div id="pause" class="ui-icon" style="display: none">
            <a>
              <img
                rel="tooltip"
                title="自动导览"
                class="tttttt"
                :src="require('@/assets/images/icon/bigscene/pause.png')"
                width="24"
                height="24"
                data-original-title="暂停"
              />
            </a>
          </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="handleguide"
              id="pullTab"
              rel="tooltip"
              title="导览片段"
              class="tttttt"
            >
              <img
                class="icon icon-inside"
                :src="
                  require(`@/assets/images/icon/bigscene/auto${
                    !isGuide ? '_active' : ''
                  }.png`)
                "
              />
            </div>

            <div
              data-original-title="全景漫游"
              id="gui-modes-inside"
              rel="tooltip"
              title="全景漫游"
              class="tttttt"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/icon/bigscene/inside.png')"
              />
              <img
                class="icon icon-inside active"
                :src="require('@/assets/images/icon/bigscene/inside_active.png')"
                
              />
            </div>
            <div
              data-original-title="迷你模型"
              id="gui-modes-dollhouse"
              rel="tooltip"
              title="迷你模型"
              class="tttttt"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/icon/bigscene/dollhouse.png')"
                
              />
              <img
                class="icon icon-inside active"
                :src="require('@/assets/images/icon/bigscene/dollhouse_active.png')"
                title="navigation icon "
              />
            </div>
            <div
              data-original-title="俯视图"
              id="gui-modes-floorplan"
              rel="tooltip"
              title="俯视图"
              class="tttttt"
            >
              <img
                class="icon icon-inside"
                :src="require('@/assets/images/icon/bigscene/floor.png')"
              />
              <img
                class="active icon icon-inside active"
                :src="require('@/assets/images/icon/bigscene/floor_active.png')"
              />
            </div>

            <div rel="music">
              <img title="音频"
              @click="switchBGM"
              class="tttttt icon" :src="require(`@/assets/images/icon/bigscene/music${music?'off':'on'}.png`)" />
            </div>

             <div rel="like">
              <div title="点赞" class="likekkk tttttt">
                <img 
                 :class="[isdianzan?'likeactive':'nolike']"
                 @click.stop="dianzan"
                  class=" icon" :src="require('@/assets/images/icon/bigscene/likexuliezhen.png')" />
              </div>
            </div>


            <div class="submenu">
              <img title="更多菜单" class="tttttt" @click="isShowList=!isShowList" :src="require(`@/assets/images/icon/bigscene/menu${isShowList?'_active':''}.png`)" />
              <ul class="ul" :class="{'activeUl':isShowList}">
                <li :title="item.name" class="tttttt" v-for="(item,i) in subList" :key="i">
                  <img @click="clickItem(item)" :src="require(`@/assets/images/icon/bigscene/sublist/${item.img + (subActive==item.img?'_active':'')}.png`)" alt="">
                </li>
              </ul>
            </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=""
              style="display: none"
            >
              <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">

        <xunirenwu :active="xunirenwu" v-if="isMainScene"/>

        <div v-if="isMainScene" class="commentator">
          <img  title="虚拟人物切换" class="tttttt icon" @click="clickItem(curecom)" :src="require('@/assets/images/icon/bigscene/change.png')" />
        </div>
        <div class="gui-floor tttttt" title="楼层切换">
          <div class="gui-floor-title"></div>
          <div class="gui-floor-icon">
            <span class="gui-floor-number"></span>
          </div>
          <div class="container"></div>
        </div>
        <div class="bgandshare">
          <div class="ui-icon wide">
              <img id="gui-fullscreen" title="全屏" class="tttttt" :src="require('@/assets/images/icon/bigscene/fullscreen.png')" />
              <img id="gui-fullscreen-exit" title="退出全屏" class="tttttt" style="display: none" :src="require('@/assets/images/icon/bigscene/screen.png')" />
          </div>
        </div>
        <div id="volume" class="ui-icon wide">
            <a>
                <img src="images/Volume btn_on.png" width="24" height="24">
            </a>
        </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-exit"
          class="ui-icon wide"
          data-placement="top"
          rel="tooltip"
          title="{[{ EXIT_FULLSCREEN }]}"
          style="display: none"
        >
          <a>
            <i class="icon icon-fullscreen-exit"></i>
          </a>
        </div> -->
        <div class="pull-right terms terms2">
          <a>{[{ TERMS }]}</a>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Danmaku from "@/components/Danmaku";
import xunirenwu from "@/newcomponents/xunirenwu";
import { getList  } from "@/config/api";


export default {
  components: {Danmaku,xunirenwu},
  data() {
    let isMainScene = window.number
    return {
      isShowList:false,
      isMainScene:isMainScene,
      isGuide: true,
      isdianzan:false,
      music:false,
      curecom:{ id: 5, current: xunirenwu, img: 'commentator'},
      danmu:[
        "我是光荣的白衣天使，在春风里绽放笑容",
        "救死扶伤的行列里，我们是排头兵",
        "用爱心浇灌生命之树常青，用奉献书写神圣历史使命",
        "忠诚信仰，血脉传承，追求卓越攀高峰",
      ],
      
      subActive:'',
      xunirenwu:'male',
      quotes:[
        "我是光荣的白衣天使，在春风里绽放笑容",
        "救死扶伤的行列里，我们是排头兵",
        "用爱心浇灌生命之树常青，用奉献书写神圣历史使命",
        "忠诚信仰，血脉传承，追求卓越攀高峰",
        "以医疗工作为中心，一切为了病人",
        "忠诚保健、甘于奉献、精益求精、勇攀高峰",
        "服务满腔热忱 技术精益求精"
      ],
    };
  },
  computed: {
    subList(){
      return  this.isMainScene ? [{
          name: "互动留言",
          link: "/message",
          id: 2,
          img: "chat",
        },
        {
          name: "精品典藏",
          link: "/collection",
          id: 1,
          img: "collection",
        },
        {
          name: "捐赠",
          link: "/message",
          id: 3,
          img: "donate",
        },
        {
          name: "问答",
          link: "/message",
          id: 4,
          img: "Q&A",
        }] : [{
          name: "互动留言",
          link: "/message",
          id: 2,
          img: "chat",
        },
        {
          name: "捐赠",
          link: "/message",
          id: 3,
          img: "donate",
        }]
    }
  },
  mounted(){
      this.isMainScene = window.number == '1149_2'

      this.$bus.$on('resetbtnactive',()=>{
        this.subActive = ''
      })

      this.$bus.$on('opencommentator',()=>{
        this.clickItem(this.curecom)
      })

      this.getData()

      // title提示语
      $('.tttttt').tooltipster({
          delay: 300,
      });
    
  },
  methods: {
    handleguide(e, outclk){
      console.log(e,outclk,111111)
      if(outclk){
        if(!this.isGuide){
          $('#pullTab').click()
          this.isGuide = true
        }
        return
      }
      else{
        this.isGuide = !this.isGuide
      }
    },
    dianzan(){
      this.isdianzan = !this.isdianzan
    },
    clickItem(item){
      this.subActive = item.img
      this.$emit("btnactive", item.img);
    },
    async getData() {
      let params = {
        pageNum: 1,
        pageSize: 1000,
      };
      getList("barrage", params, (res) => {
        this.danmu = res.data.list.map(item=>item.content).reverse()
      });
    },
    switchBGM() {
      this.music=!this.music
      window.ISMUTED = this.music

      if(SoundManager.currentAudio.audio){
       SoundManager.currentAudio.audio.muted = this.music

        if(!this.music){
           this.$bus.$emit("changexlzmode","Speaking1")
        } else{
           this.$bus.$emit("resetxlzmode")
        }
      }

      // console.log(window.ISMUTED);
    },
  },
};
</script>

<style lang="less" scoped>
@wh: 47px;
@margin: 0px;
#play,
#pause {
  margin-right: @margin;
  img {
    width: @wh;
    height: @wh;
  }
}
#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-map>div[rel], #play, #pause{
  width: auto;
  margin: 0 12px;
}

.commentator{
  width: @wh!important;
  height: @wh!important;
  margin-bottom: 40px;
  
  >img{
    width: 100%;
    height: 100%;
  }
}

.likekkk{
  width: 47px;
  height: 47px;
  overflow: hidden;
  position: relative;
  >img {
    position: absolute;
    left: 0;
    width: 2538px!important;
    height: 47px!important;
    top: 0;
    animation-direction: alternate;
  }
  .likeactive {
    animation: like 1.4s steps(53) 1 forwards;
  }
  .nolike{
    animation: nolike 1.4s steps(53) 1 forwards;
  }
}

.gui-floor{
  width: @wh!important;
  height: @wh!important;
  border-radius: 50%;
  margin-right: 0;
  margin-bottom: 0;
  position: relative;
  background: linear-gradient(359deg, rgba(26, 14, 10, 0.6) 0%, rgba(112, 80, 73, .6) 100%);
  // &::before{
  //   content: '';
  //   width: 110%;
  //   height: 110%;
  //   background: linear-gradient(45deg, #338F7B 0%, #143E3A 100%);
  //   border-radius: 50%;
  //   position: absolute;
  //   z-index: -1;
  //   top: 50%;
  //   transform: translate(-50%,-50%);
  //   left: 50%;
  // }
}

.submenu{
  display: inline-block;
  margin: 0 13px;
  position: relative;
  >img{
    width: @wh;
    cursor: pointer;
  }
  .ul{
    display: flex;
    align-items: center;
    position: absolute;
    left: calc(100% + 13px);
    top: 50%;
    transform: translateY(-50%);
    max-width: 0;
    overflow: hidden;
    transition: .3s ease all;
    min-height: 50px;
    >li{
      margin: 0 13px;
      >img{
        width: @wh!important;
        height: @wh!important;
        cursor: pointer;
      }
    }
  }
  .activeUl{
    max-width: 340px;
  }
}
.rightViewContainer {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.bgandshare {
  display: flex;
  justify-content: center;
  align-items: center;
  > div {
    margin-top: 10px;
    background: none !important;
    cursor: pointer;
    margin-right: 0!important;
    img {
      width: @wh!important;
    }
  }
}

@media only screen and (max-width: 487px) {
  @wh: 70px;
  #play,
  #pause {
    margin-right: @margin;
    img {
      width: @wh;
      height: @wh;
    }
  }
  #gui-modes-map {
    > div {
      margin-right: @margin;
      > img {
        width: @wh;
        height: @wh;
        display: block;
      }
      .active {
        display: none;
      }
    }
    .active {
      > img {
        display: none;
      }
      .active {
        display: block;
      }
    }
  }

  .bgandshare {
    display: flex;
    position: fixed;
    top: 12%;
    right: 6px;
    flex-direction: column;
    > div {
      width: @wh!important;
      img {
        width: 100%;
      }
    }
  }
}
.pinBflex{
  display: flex;
  align-items: flex-end;
  position: relative;
  padding-left: 354px;
}

.danmaku{
  z-index: 99;
  width: 340px;
  margin-right: 20px;
  position: absolute;
  left: 0;
  bottom: 4px;
}

@keyframes like {
  0%{
    left: 0;
  }
  100% {
    left: -2491px;
  }
}


@keyframes nolike {
  100%{
    left: 0;
  }
}
</style>
