|
@@ -0,0 +1,491 @@
|
|
|
+<template>
|
|
|
+ <LoadingLogo :thumb="true" />
|
|
|
+
|
|
|
+ <div class="ui-view-layout" :class="{ show: show }" is-mobile="true">
|
|
|
+ <div class="scene" ref="scene$"></div>
|
|
|
+ <template v-if="dataLoaded">
|
|
|
+ <Information />
|
|
|
+ <Control />
|
|
|
+ <teleport v-if="refMiniMap && player.showWidgets" :to="refMiniMap">
|
|
|
+ <span class="button-switch" @click.stop="toggleMap">
|
|
|
+ <ui-icon type="show_map_collect"></ui-icon>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <p class="change">
|
|
|
+ <ui-icon type="show_3d_normal"></ui-icon>
|
|
|
+ 3D模型
|
|
|
+ </p>
|
|
|
+ </teleport>
|
|
|
+ <template v-if="refMiniMap && player.showWidgets">
|
|
|
+ <div :class="{ disabled: flying }" v-show="mode != 'panorama'" v-if="controls.showFloorplan && controls.showDollhouse" class="tab-layer">
|
|
|
+ <div class="tabs" v-if="controls.showMap">
|
|
|
+ <span :class="{ active: mode === 'floorplan' }" @click="changeMode('floorplan', $event)">
|
|
|
+ <ui-icon :type="mode == 'floorplan' ? 'show_plane_selected' : 'show_plane_normal'"></ui-icon>
|
|
|
+ 二维
|
|
|
+ </span>
|
|
|
+ <span :class="{ active: mode === 'dollhouse' }" @click="changeMode('dollhouse', $event)">
|
|
|
+ <ui-icon :type="mode == 'dollhouse' ? 'show_3d_selected' : 'show_3d_normal'"></ui-icon>
|
|
|
+
|
|
|
+ 三维
|
|
|
+ </span>
|
|
|
+ <div class="background" ref="background"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <!-- <UiTags /> -->
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <GoodsList @close="closetagtype" />
|
|
|
+ <Treasure @close="closetagtype" />
|
|
|
+ <Waterfall @close="closetagtype" />
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { useMusicPlayer } from "@/utils/sound";
|
|
|
+// import UiTags from "@/components/Tags";
|
|
|
+import GoodsList from "@/components/Tags/goods-list.vue";
|
|
|
+import Treasure from "@/components/Tags/treasure.vue";
|
|
|
+import Waterfall from "@/components/Tags/waterfall.vue";
|
|
|
+
|
|
|
+import Information from "@/components/Information";
|
|
|
+import Control from "@/components/Controls/Control.Mobile.vue";
|
|
|
+import LoadingLogo from "@/components/shared/Loading.vue";
|
|
|
+
|
|
|
+import { createApp } from "@/app";
|
|
|
+import { ref, onMounted, computed, watch } from "vue";
|
|
|
+import { useStore } from "vuex";
|
|
|
+import browser from "@/utils/browser";
|
|
|
+import { useApp, getApp } from "@/app";
|
|
|
+import * as apis from "@/apis/index.js";
|
|
|
+
|
|
|
+const musicPlayer = useMusicPlayer();
|
|
|
+
|
|
|
+const closetagtype = () => {
|
|
|
+ store.commit("tag/setTagClickType", "");
|
|
|
+};
|
|
|
+
|
|
|
+const store = useStore();
|
|
|
+const tags = computed(() => {
|
|
|
+ return store.getters["tag/tags"] || [];
|
|
|
+});
|
|
|
+const player = computed(() => store.getters["player"]);
|
|
|
+const flying = computed(() => store.getters["flying"]);
|
|
|
+const metadata = computed(() => store.getters["scene/metadata"]);
|
|
|
+const controls = computed(() => {
|
|
|
+ return metadata.value.controls;
|
|
|
+});
|
|
|
+const mode = computed(() => store.getters["mode"]);
|
|
|
+const showNavigations = computed(() => store.getters["showNavigations"]);
|
|
|
+const scene$ = ref(null);
|
|
|
+const show = ref(false);
|
|
|
+const dataLoaded = ref(false);
|
|
|
+const refMiniMap = ref(null);
|
|
|
+const isCollapse = ref(false);
|
|
|
+const background = ref(null);
|
|
|
+const resize = () => {
|
|
|
+ if (this.$refs.background && (this.mode == "floorplan" || this.mode == "dollhouse")) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let $active = $(this.$el).find(".tabs .active");
|
|
|
+ background.value.style.width = $active[0].getBoundingClientRect().width + "px";
|
|
|
+ background.value.style.left = $active.position().left + "px";
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+watch(
|
|
|
+ () => player.value.showMap,
|
|
|
+ (val, old) => {
|
|
|
+ if (!isCollapse.value) {
|
|
|
+ let $minmap = document.querySelector("[xui_min_map]");
|
|
|
+ if ($minmap) {
|
|
|
+ if (val) {
|
|
|
+ $minmap.classList.remove("collapse");
|
|
|
+ } else {
|
|
|
+ $minmap.classList.add("collapse");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ }
|
|
|
+);
|
|
|
+watch(
|
|
|
+ () => player.value.showWidgets,
|
|
|
+ (val, old) => {
|
|
|
+ let $minmap = document.querySelector("[xui_min_map]");
|
|
|
+ if ($minmap) {
|
|
|
+ if (val) {
|
|
|
+ $minmap.classList.remove("collapse");
|
|
|
+ } else {
|
|
|
+ $minmap.classList.add("collapse");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ }
|
|
|
+);
|
|
|
+const changeMode = (name, e) => {
|
|
|
+ if (!flying.value) {
|
|
|
+ background.value.style.width = e.srcElement.getBoundingClientRect().width + "px";
|
|
|
+ background.value.style.left = e.srcElement.offsetLeft + "px";
|
|
|
+ store.commit("setMode", name);
|
|
|
+ }
|
|
|
+};
|
|
|
+const toggleMap = () => {
|
|
|
+ isCollapse.value = !isCollapse.value;
|
|
|
+ let $minmap = document.querySelector("[xui_min_map]");
|
|
|
+ if ($minmap) {
|
|
|
+ if (!isCollapse.value) {
|
|
|
+ $minmap.classList.remove("collapse");
|
|
|
+ } else {
|
|
|
+ $minmap.classList.add("collapse");
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const onClickTagInfo = (el) => {
|
|
|
+ el.stopPropagation();
|
|
|
+ let item = tags.value.find((item) => item.sid == el.target.dataset.id);
|
|
|
+ console.log(item);
|
|
|
+ if (item.type == "commodity") {
|
|
|
+ store.commit("tag/setTagClickType", "goodlist");
|
|
|
+ } else if (item.type == "waterfall") {
|
|
|
+ store.commit("tag/setTagClickType", "waterfall");
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ const app = createApp({
|
|
|
+ num: browser.getURLParam("m"),
|
|
|
+ dom: scene$.value,
|
|
|
+ mobile: true,
|
|
|
+ });
|
|
|
+ app.use("MinMap", { theme: { camera_fillStyle: "#ED5D18" } });
|
|
|
+ app.use("Tag");
|
|
|
+ app
|
|
|
+ .use("TagView", {
|
|
|
+ render(data) {
|
|
|
+ console.log(data, data.type);
|
|
|
+ if (data.type == "waterfall") {
|
|
|
+ return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
|
|
|
+ <div class="tag-body">
|
|
|
+ <div data-id="${data.sid}" class="tag-commodity">
|
|
|
+ <div style="background-image:url({{icon}})" class='tag-avatar'>
|
|
|
+ </div>
|
|
|
+ <p class="tag-title">這裏是商品標題</p>
|
|
|
+ <p class="tag-info">¥ 198 | 查看 ></p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ } else if (data.type == "coupon") {
|
|
|
+ return `<span class="tag-icon coupon animate" style="background-image:url({{icon}})"></span>`;
|
|
|
+ } else if (data.type == "applet_link") {
|
|
|
+ return `<span class="tag-icon applet_link" style="background-image:url({{icon}})"></span>`;
|
|
|
+ } else if (data.type == "link_scene") {
|
|
|
+ return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
|
|
|
+ <div class="tag-body">sdfsdf</div>
|
|
|
+ `;
|
|
|
+ } else if (data.type == "commodity") {
|
|
|
+ return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
|
|
|
+ <div class="tag-body">
|
|
|
+ <div data-id="${data.sid}" class="tag-commodity">
|
|
|
+ <div style="background-image:url({{icon}})" class='tag-avatar'>
|
|
|
+ </div>
|
|
|
+ <p class="tag-title">這裏是商品標題</p>
|
|
|
+ <p class="tag-info">¥ 198 | 查看 ></p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ } else {
|
|
|
+ return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>`;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((view) => {
|
|
|
+ console.log(view, "viewviewviewviewviewviewviewview");
|
|
|
+ view.on("click", (e) => {
|
|
|
+ var tag = e.data;
|
|
|
+ // 聚焦当前点击的热点
|
|
|
+ view.focus(tag.sid).then(() => {
|
|
|
+ if (tag.type == "coupon") {
|
|
|
+
|
|
|
+ } else if (tag.type == "applet_link") {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ view.on("focus", (e) => {
|
|
|
+ document.querySelectorAll("[xui_tags_view] >div").forEach((el) => {
|
|
|
+ if (el.getAttribute("data-tag-type") == "commodity" || el.getAttribute("data-tag-type") == "waterfall") {
|
|
|
+ el.querySelector(".tag-body").classList.remove("show");
|
|
|
+ el.style.zIndex = "auto";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (e.data.type == "commodity" || e.data.type == "waterfall") {
|
|
|
+ e.target.style.zIndex = "999";
|
|
|
+ e.target.querySelector(".tag-body").classList.add("show");
|
|
|
+ e.target.querySelector(".tag-commodity").removeEventListener("click", onClickTagInfo);
|
|
|
+ e.target.querySelector(".tag-commodity").addEventListener("click", onClickTagInfo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ app.use("TourPlayer");
|
|
|
+ app.Scene.on("ready", () => {
|
|
|
+ show.value = true;
|
|
|
+ });
|
|
|
+ app.Scene.on("loaded", (pano) => {
|
|
|
+ refMiniMap.value = "[xui_min_map]";
|
|
|
+ store.commit("setFloorId", pano.floorIndex);
|
|
|
+ useMusicPlayer();
|
|
|
+ });
|
|
|
+ app.Scene.on("panorama.videorenderer.resumerender", () => {
|
|
|
+ musicPlayer.pause(true);
|
|
|
+ });
|
|
|
+
|
|
|
+ app.Scene.on("panorama.videorenderer.suspendrender", async () => {
|
|
|
+ let player = await getApp().TourManager.player;
|
|
|
+ if (!player.isPlaying) {
|
|
|
+ musicPlayer.resume();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ app.store.on("metadata", (metadata) => {
|
|
|
+ store.commit("scene/load", metadata);
|
|
|
+ if (!metadata.controls.showMap) {
|
|
|
+ app.MinMap.hide(true);
|
|
|
+ }
|
|
|
+ dataLoaded.value = true;
|
|
|
+ });
|
|
|
+ app.store.on("tags", async (tags) => {
|
|
|
+ // let res = await apis.get_tags_list({
|
|
|
+ // num: browser.getURLParam("m"),
|
|
|
+ // });
|
|
|
+ // console.log(res, "============tags");
|
|
|
+ store.commit("tag/load", tags);
|
|
|
+ });
|
|
|
+ app.Camera.on("mode.beforeChange", ({ fromMode, toMode, floorIndex }) => {
|
|
|
+ if (fromMode) {
|
|
|
+ store.commit("setFlying", true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ app.Camera.on("mode.afterChange", ({ toMode, floorIndex }) => {
|
|
|
+ store.commit("setFlying", false);
|
|
|
+ });
|
|
|
+ app.Camera.on("flying.started", (pano) => {
|
|
|
+ store.commit("setFlying", true);
|
|
|
+ });
|
|
|
+ app.Camera.on("flying.ended", ({ targetPano }) => {
|
|
|
+ store.commit("setFlying", false);
|
|
|
+ store.commit("setPanoId", targetPano.id);
|
|
|
+ });
|
|
|
+ app.store.on("tour", async (tour) => {
|
|
|
+ app.TourManager.load(tour);
|
|
|
+ store.commit("tour/setData", {
|
|
|
+ tours: JSON.parse(
|
|
|
+ JSON.stringify(app.TourManager.tours, (key, val) => {
|
|
|
+ if (key === "audio") {
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ return val;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ),
|
|
|
+ });
|
|
|
+ store.commit("tour/setBackUp", {
|
|
|
+ tours: JSON.parse(
|
|
|
+ JSON.stringify(app.TourManager.tours, (key, val) => {
|
|
|
+ if (key === "audio") {
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ return val;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ),
|
|
|
+ });
|
|
|
+ });
|
|
|
+ app.store.on("floorcad", (floor) => store.commit("scene/loadFloorData", floor));
|
|
|
+
|
|
|
+ app.render();
|
|
|
+});
|
|
|
+</script>
|
|
|
+<style lang="scss">
|
|
|
+.tab-layer {
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ z-index: 10;
|
|
|
+ position: fixed;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ top: 2.3rem;
|
|
|
+ pointer-events: none;
|
|
|
+}
|
|
|
+.tabs {
|
|
|
+ pointer-events: auto;
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ background: #222222;
|
|
|
+ border-radius: 6px;
|
|
|
+ padding: 2px;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ border: 1px solid rgba(255, 255, 255, 0.1);
|
|
|
+ box-shadow: inset 0px 0px 6px 0px rgba(0, 0, 0, 0.5);
|
|
|
+ .background {
|
|
|
+ position: absolute;
|
|
|
+ left: 2px;
|
|
|
+ top: 2px;
|
|
|
+ bottom: 2px;
|
|
|
+ width: 50%;
|
|
|
+ border-radius: 4px;
|
|
|
+ background: #444444;
|
|
|
+ box-shadow: 2px 0px 4px 0px rgba(0, 0, 0, 0.3);
|
|
|
+ z-index: 0;
|
|
|
+ transition: left 0.3s;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ flex: 1;
|
|
|
+ color: #fff;
|
|
|
+ opacity: 0.5;
|
|
|
+ border-radius: 6px;
|
|
|
+ height: 0.94737rem;
|
|
|
+ font-size: 0.36842rem;
|
|
|
+ transition: all 0.3s ease;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ padding-left: 10px;
|
|
|
+ padding-right: 10px;
|
|
|
+ white-space: nowrap;
|
|
|
+ z-index: 1;
|
|
|
+ i {
|
|
|
+ font-size: 0.47368rem;
|
|
|
+ margin-right: 4px;
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ span.active {
|
|
|
+ opacity: 1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+[xui_tags_view] {
|
|
|
+ .tag-body {
|
|
|
+ /* display: none; */
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ bottom: 50px;
|
|
|
+
|
|
|
+ transform: translateX(-50%) scale(0);
|
|
|
+ transform-origin: bottom;
|
|
|
+ transition: all 0.3s cubic-bezier(0.35, 0.32, 0.65, 0.63);
|
|
|
+ // pointer-events: none;
|
|
|
+ .tag-commodity {
|
|
|
+ width: 210px;
|
|
|
+ height: 76px;
|
|
|
+ background: rgba(255, 255, 255, 0.8);
|
|
|
+ box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16);
|
|
|
+ border-radius: 2px;
|
|
|
+ position: relative;
|
|
|
+ margin-bottom: 30px;
|
|
|
+ &::before {
|
|
|
+ content: "";
|
|
|
+ display: inline-block;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 2px;
|
|
|
+ height: 28px;
|
|
|
+ bottom: -30px;
|
|
|
+ background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
+ .tag-avatar {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 99;
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ background: #ffffff;
|
|
|
+ box-shadow: 0px 3px 6px 0px rgb(0 0 0 / 16%);
|
|
|
+ border-radius: 2px;
|
|
|
+ top: -14px;
|
|
|
+ left: -12px;
|
|
|
+ background-size: cover;
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+ > p {
|
|
|
+ color: #131d34;
|
|
|
+ font-size: 16px;
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+ .tag-title {
|
|
|
+ padding: 10px 0 10px 76px;
|
|
|
+ width: 200px;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ .tag-info {
|
|
|
+ padding: 0 0 0 76px;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &.show {
|
|
|
+ transform: translateX(-50%) scale(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .coupon {
|
|
|
+ width: 64px !important;
|
|
|
+ height: 64px !important;
|
|
|
+ &::after {
|
|
|
+ content: "发现好礼";
|
|
|
+ width: 100%;
|
|
|
+ color: #ed5d18;
|
|
|
+ position: absolute;
|
|
|
+ bottom: -24px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .applet_link {
|
|
|
+ width: 64px !important;
|
|
|
+ height: 64px !important;
|
|
|
+ border-radius: 50%;
|
|
|
+ background-color: #fff;
|
|
|
+ border: 1px solid #ed5d18;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ &::after {
|
|
|
+ content: "直播中";
|
|
|
+ width: 100%;
|
|
|
+ height: 20px;
|
|
|
+ background: #ed5d18;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 1.2;
|
|
|
+ font-size: 12px;
|
|
|
+ border-radius: 26%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@media (orientation: landscape) {
|
|
|
+ .tab-layer {
|
|
|
+ top: 1.2rem;
|
|
|
+ .tabs {
|
|
|
+ height: 0.7rem;
|
|
|
+ > span {
|
|
|
+ height: 0.7rem;
|
|
|
+ font-size: 0.25rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|