123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422 |
- <template>
- <ul
- class="control-fdkk"
- v-if="
- (fdkkmetadata &&
- fdkkCurrentVersion != 'V3' &&
- fdkkmetadata &&
- !fdkkmetadata.controls.showMap &&
- (fdkkmetadata.controls.showPanorama ||
- fdkkmetadata.controls.showFloorplan ||
- fdkkmetadata.controls.showDollhouse)) ||
- toursList.length > 0 ||
- (customLink && customLink.isShow) ||
- (customTelephone && customTelephone.isShow) ||
- metadata.description ||
- isHasNormalBGM ||
- fdkkBGM
- "
- >
- <li
- class="daolan"
- :class="{ v3daolan: fdkkCurrentVersion == 'V3' }"
- @click.stop="playTour"
- v-if="toursList.length > 0"
- >
- <img
- :src="
- require(`@/assets/images/icon/${
- (fdkkCurrentVersion == 'V3' ? v3toursStatus : isPlayTours)
- ? 'pause01@2x'
- : 'playing01@2x'
- }.png`)
- "
- alt=""
- />
- <span>{{ $t("menu.tour") }}</span>
- <img
- @click.stop="openTours"
- :class="{ active: showTours }"
- class="jiantou"
- :src="require(`@/assets/images/icon/expand_arrows@2x.png`)"
- alt=""
- />
- <div class="vlink"></div>
- </li>
- <template
- v-if="
- fdkkCurrentVersion != 'V3' &&
- fdkkmetadata &&
- !fdkkmetadata.controls.showMap
- "
- >
- <li
- v-if="fdkkmetadata && fdkkmetadata.controls.showPanorama"
- :class="{ disabled: isPlayTours || flying }"
- @click="onModeChange('panorama')"
- >
- <img
- :src="
- require(`@/assets/images/icon/${
- mode == 'panorama' ? 'roaming_selected@2x' : 'roaming_normal@2x'
- }.png`)
- "
- alt=""
- />
- </li>
- <li
- v-if="fdkkmetadata && fdkkmetadata.controls.showFloorplan"
- :class="{ disabled: isPlayTours || flying }"
- @click="onModeChange('floorplan')"
- >
- <img
- :src="
- require(`@/assets/images/icon/${
- mode == 'floorplan' ? 'plane_selected@2x' : 'plane_normal@2x'
- }.png`)
- "
- alt=""
- />
- </li>
- <li
- v-if="fdkkmetadata && fdkkmetadata.controls.showDollhouse"
- :class="{ disabled: isPlayTours || flying }"
- @click="onModeChange('dollhouse')"
- >
- <img
- :src="
- require(`@/assets/images/icon/${
- mode == 'dollhouse' ? '3d_selected@2x' : '3d_normal@2x'
- }.png`)
- "
- alt=""
- />
- </li>
- <li
- class="vlink"
- v-if="
- (customLink && customLink.isShow) ||
- (customTelephone && customTelephone.isShow) ||
- metadata.description ||
- (((metadata.backgroundMusic && metadata.backgroundMusic.id) ||
- fdkkBGM) &&
- fdkkmetadata &&
- (fdkkmetadata.controls.showPanorama ||
- fdkkmetadata.controls.showFloorplan ||
- fdkkmetadata.controls.showDollhouse))
- "
- ></li>
- </template>
- <!-- 自定义链接 -->
- <li @click="onLink" v-if="customLink && customLink.isShow">
- <img :src="require(`@/assets/images/icon/link@2x.png`)" alt="" />
- </li>
- <!-- 联系电话 -->
- <li v-if="customTelephone && customTelephone.isShow">
- <a :href="`tel:${customTelephone.value}`">
- <img :src="require(`@/assets/images/icon/telephone@2x.png`)" alt="" />
- </a>
- </li>
- <!-- 简介 -->
- <li @click="onIntroduce" v-if="metadata.description">
- <img :src="require(`@/assets/images/icon/text@2x.png`)" alt="" />
- </li>
- <li @click="onIsBGM" v-if="isHasNormalBGM || isHasV4BGM || isHasV3BGM">
- <img
- v-if="isHasV3BGM"
- :src="
- require(`@/assets/images/icon/${
- isPlayV3BGM ? 'music@2x.png' : 'music_disabled@2x.png'
- }`)
- "
- alt=""
- />
- <img
- v-else
- :src="
- require(`@/assets/images/icon/${
- (isPlayNormalBGM || isPlayV4BGM) && isCurrentPlaying
- ? 'music@2x.png'
- : 'music_disabled@2x.png'
- }`)
- "
- alt=""
- />
- </li>
- </ul>
- <teleport to="body">
- <introduce v-if="showIntroduce" />
- <telephone v-if="showTelephone" />
- <clink v-if="showLink" />
- </teleport>
- </template>
- <script setup>
- import { computed, unref, ref } from "vue";
- import introduce from "./control/text";
- import telephone from "./control/telephone";
- import clink from "./control/link";
- import { useStore } from "vuex";
- const store = useStore();
- const toursList = computed(() => store.getters["fdkk/toursList"]);
- const isShowScenesList = computed(
- () => store.getters["functions/isShowScenesList"]
- );
- const toursStatus = computed(() => store.getters["fdkk/toursStatus"]);
- const v3toursStatus = computed(() => store.getters["fdkk/v3toursStatus"]);
- const isPlayTours = computed(() => store.getters["fdkk/isPlayTours"]);
- const flying = computed(() => store.getters["fdkk/isFlying"]);
- const mode = computed(() => store.getters["fdkk/mode"]);
- const showTours = computed(() => store.getters["fdkk/isShowToursList"]);
- // const currentScene = computed(() => store.getters["scene/currentScene"]);
- const metadata = computed(() => store.getters["scene/metadata"]);
- const fdkkmetadata = computed(() => store.getters["fdkk/metadata"]);
- const fdkkCurrentVersion = computed(
- () => store.getters["scene/fdkkCurrentVersion"]
- );
- const fdkkBGM = computed(() => store.getters["fdkk/fdkkBGM"]);
- // const v3IsBgm = computed(() => store.getters["fdkk/v3IsBgm"]);
- // const v3BGMStatus = computed(() => store.getters["fdkk/v3BGMStatus"]);
- const customTelephone = computed(() => store.getters["scene/customTelephone"]);
- const customLink = computed(() => store.getters["scene/customLink"]);
- const showIntroduce = computed(() => store.getters["functions/showIntroduce"]);
- const showTelephone = computed(() => store.getters["functions/showTelephone"]);
- const showLink = computed(() => store.getters["functions/showLink"]);
- //BMG音乐
- const isHasNormalBGM = computed(() => store.getters["audio/isHasNormalBGM"]);
- const isCurrentPlaying = computed(
- () => store.getters["audio/isCurrentPlaying"]
- );
- const isHasV3BGM = computed(() => store.getters["audio/isHasV3BGM"]);
- const isHasV4BGM = computed(() => store.getters["audio/isHasV4BGM"]);
- const isHasExplanationBGM = computed(
- () => store.getters["audio/isHasExplanationBGM"]
- );
- //BMG playing音乐
- const isPlayNormalBGM = computed(() => store.getters["audio/isPlayNormalBGM"]);
- const isPlayV3BGM = computed(() => store.getters["audio/isPlayV3BGM"]);
- const isPlayV4BGM = computed(() => store.getters["audio/isPlayV4BGM"]);
- const onIntroduce = () => {
- store.commit("functions/setShowIntroduce", true);
- };
- const onLink = () => {
- const { openMethod, value } = unref(customLink);
- if (openMethod == "_target") {
- window.open(value, "_blank");
- } else {
- store.commit("functions/setShowLink", true);
- }
- };
- const onIsBGM = () => {
- console.log("fdkk----onIsBGM", fdkkCurrentVersion.value);
- if (unref(isHasV3BGM)) {
- const v3playToggle = !unref(isPlayV3BGM);
- console.log("v3playToggle", v3playToggle);
- toggleV3BGM(v3playToggle);
- return;
- }
- if (unref(isHasV4BGM)) {
- if (!unref(isCurrentPlaying)) {
- store.dispatch("audio/playBGM", 2);
- } else {
- store.dispatch("audio/pauseBGM");
- }
- } else {
- if (!unref(isCurrentPlaying)) {
- store.dispatch("audio/playBGM", 0);
- } else {
- store.dispatch("audio/pauseBGM");
- }
- }
- };
- /**
- * 只有v3利用Iframe postMessage
- */
- const toggleV3BGM = (status) => {
- const target = document.querySelector("#showifr");
- if (target) {
- target.contentWindow.postMessage(
- {
- source: "mingyuan",
- event: "settings",
- params: {
- playMusic: status,
- },
- },
- "*"
- );
- }
- };
- window.toggleV3BGM = toggleV3BGM;
- const openTours = () => {
- if (isShowScenesList.value) {
- store.commit("functions/setShowScenesList", false);
- }
- store.commit("fdkk/setShowToursList", !showTours.value);
- };
- const playTour = () => {
- if (fdkkCurrentVersion.value == "V3") {
- store.commit("fdkk/setV3ToursStatus", !v3toursStatus.value);
- let ele = document.getElementById("showifr");
- ele &&
- ele.contentWindow.postMessage(
- {
- source: "mingyuan",
- event: v3toursStatus.value ? "guide-start" : "guide-pause",
- },
- "*"
- );
- return;
- }
- store.commit("fdkk/setToursStatus", !toursStatus.value);
- };
- const onIsShowList = (data) => {
- if (showTours.value) {
- store.commit("fdkk/setShowToursList", false);
- }
- store.commit("functions/setShowScenesList", !isShowScenesList.value);
- };
- const onModeChange = (name) => {
- document.querySelector("#fdkkifr") &&
- document.querySelector("#fdkkifr").contentWindow.postMessage(
- {
- source: "qjkankan",
- event: "setMode",
- params: {
- name: name,
- },
- },
- "*"
- );
- };
- </script>
- <style lang="scss" scoped>
- .control-fdkk {
- display: flex;
- align-items: center;
- height: 100%;
- &::-webkit-scrollbar {
- display: none;
- }
- > li {
- width: 26px;
- height: 26px;
- margin: 0 2px;
- cursor: pointer;
- white-space: nowrap;
- display: inline-block;
- flex-shrink: 0;
- img {
- width: 100%;
- height: 100%;
- }
- &:last-of-type {
- margin-right: 10px;
- &::after {
- width: 10px;
- height: 1px;
- background: none;
- content: "";
- display: inline-block;
- }
- }
- &:first-of-type {
- margin-left: 10px;
- }
- }
- .daolan {
- display: flex;
- width: auto;
- align-items: center;
- > img {
- width: 26px;
- height: 26px;
- }
- .jiantou {
- margin-left: -2px;
- transform: rotate(180deg);
- transition: 0.3s ease transform;
- &.active {
- transform: none;
- }
- }
- > span {
- font-size: 12px;
- margin-top: 2px;
- }
- }
- .v3daolan {
- > img {
- &:last-of-type {
- display: none;
- }
- }
- > span {
- margin-left: 0;
- }
- .vlink {
- margin-left: 10px;
- }
- }
- .vlink {
- width: 1px;
- height: 20px;
- background: linear-gradient(
- 180deg,
- rgba(255, 255, 255, 0) 0%,
- #ffffff 49%,
- rgba(255, 255, 255, 0) 100%
- );
- opacity: 0.5;
- }
- }
- </style>
|