|
@@ -1,166 +0,0 @@
|
|
|
-<template>
|
|
|
- <component
|
|
|
- :is="defaultTheme"
|
|
|
- :data="data"
|
|
|
- :showContent="showContent"
|
|
|
- :x="x"
|
|
|
- :y="y"
|
|
|
- v-if="useDefault"
|
|
|
- @click.stop="clickHandler"
|
|
|
- @touchstart.stop
|
|
|
- @mouseenter="isHover = true"
|
|
|
- @mouseleave="isHover = false"
|
|
|
- />
|
|
|
- <div
|
|
|
- v-else
|
|
|
- class="hot-item"
|
|
|
- :class="{ active }"
|
|
|
- :style="style"
|
|
|
- @mouseenter="isHover = true"
|
|
|
- @mouseleave="isHover = false"
|
|
|
- @click.stop="clickHandler"
|
|
|
- @touchstart.stop
|
|
|
- >
|
|
|
- <!-- <template></template> -->
|
|
|
- <img
|
|
|
- :src="getResources(data.style.icon)"
|
|
|
- @mousedown="(e) => emit('mousedown', e)"
|
|
|
- @click="(e) => emit('click', e)"
|
|
|
- />
|
|
|
- <div @click.stop>
|
|
|
- <ui-bubble
|
|
|
- class="hot-bubble"
|
|
|
- :class="{ pc: os.isPc || os.isHorizontal.value }"
|
|
|
- :show="showContent && !~pullIndex"
|
|
|
- :type="os.isPc ? 'left' : os.isHorizontal.value ? 'right' : 'top'"
|
|
|
- level="center"
|
|
|
- >
|
|
|
- <template v-if="!$slots.content">
|
|
|
- <h2>
|
|
|
- {{ data.title }}
|
|
|
- <ui-audio
|
|
|
- v-if="data.type === 'AUDIO' && data.meta.length"
|
|
|
- class="audio"
|
|
|
- :src="getResources(data.meta[0].url)"
|
|
|
- ref="audio"
|
|
|
- />
|
|
|
- </h2>
|
|
|
- <div class="content" v-html="data.content"></div>
|
|
|
-
|
|
|
- <FilesMange
|
|
|
- :hot="data"
|
|
|
- v-if="data.type !== 'AUDIO'"
|
|
|
- @pull="(index) => (pullIndex = index)"
|
|
|
- in-full
|
|
|
- />
|
|
|
- <slot :data="data" />
|
|
|
- </template>
|
|
|
- <slot v-else name="content" />
|
|
|
- </ui-bubble>
|
|
|
- <PullHot
|
|
|
- v-if="!!~pullIndex"
|
|
|
- :info="data"
|
|
|
- @close="pullIndex = -1"
|
|
|
- :metaIndex="pullIndex"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script setup lang="ts">
|
|
|
-import { computed, watch, ref, watchEffect } from "vue";
|
|
|
-import { HotAtom } from "@/store";
|
|
|
-import { getResources } from "@/store/app";
|
|
|
-import FilesMange from "./metas-mange.vue";
|
|
|
-import PullHot from "./pull-hot.vue";
|
|
|
-import { useSDK, disabledMap, customMap } from "@/hook";
|
|
|
-import { os } from "@/utils";
|
|
|
-
|
|
|
-const props = withDefaults(
|
|
|
- defineProps<{
|
|
|
- data: HotAtom;
|
|
|
- active?: boolean;
|
|
|
- x: number;
|
|
|
- y: number;
|
|
|
- defaultTheme?: any;
|
|
|
- noUseDefault?: boolean;
|
|
|
- permanent?: boolean;
|
|
|
- forceHide?: boolean;
|
|
|
- isShowContent?: () => boolean;
|
|
|
- }>(),
|
|
|
- {
|
|
|
- forceHide: false,
|
|
|
- }
|
|
|
-);
|
|
|
-
|
|
|
-const emit = defineEmits<{
|
|
|
- (e: "mousedown", ev: MouseEvent);
|
|
|
- (e: "click", ev: MouseEvent);
|
|
|
-}>();
|
|
|
-
|
|
|
-const isHover = ref(false);
|
|
|
-const pullIndex = ref(-1);
|
|
|
-const laser = useSDK();
|
|
|
-const audio = ref();
|
|
|
-const showContent = computed(
|
|
|
- () =>
|
|
|
- !disabledMap.hotInfo &&
|
|
|
- (props.active || (os.isPc && !os.isTablet && isHover.value)) &&
|
|
|
- !customMap.magnifier &&
|
|
|
- !props.forceHide
|
|
|
-);
|
|
|
-
|
|
|
-const useDefault = computed(
|
|
|
- () => !props.noUseDefault && props.data.type === "TEXT" && !props.data.content
|
|
|
-);
|
|
|
-
|
|
|
-const style = computed(() => ({
|
|
|
- left: props.x + "px",
|
|
|
- top: props.y + "px",
|
|
|
-}));
|
|
|
-const inClose = ref(false);
|
|
|
-
|
|
|
-const clickHandler = async () => {
|
|
|
- if (props.isShowContent && !props.isShowContent()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (laser.carry.store.share.showHot !== props.data) {
|
|
|
- laser.carry.store.share.showHot = props.data;
|
|
|
- if (!props.permanent) {
|
|
|
- const handler = () => {
|
|
|
- if (os.isPc && !os.isTablet) {
|
|
|
- laser.carry.store.share.showHot = null;
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- const stopWatch = watch(
|
|
|
- () => laser.carry.store.share.showHot,
|
|
|
- () => {
|
|
|
- stopWatch();
|
|
|
- laser.scene.el.removeEventListener(
|
|
|
- os.isPc && !os.isTablet ? "click" : "touchstart",
|
|
|
- handler
|
|
|
- );
|
|
|
- }
|
|
|
- );
|
|
|
- laser.scene.el.addEventListener(
|
|
|
- os.isPc && !os.isTablet ? "click" : "touchstart",
|
|
|
- handler
|
|
|
- );
|
|
|
- }
|
|
|
- } else {
|
|
|
- laser.carry.store.share.showHot = null;
|
|
|
- inClose.value = true;
|
|
|
- setTimeout(() => (isHover.value = false));
|
|
|
- }
|
|
|
-};
|
|
|
-watchEffect(() => {
|
|
|
- if (audio.value) {
|
|
|
- audio.value.play();
|
|
|
- }
|
|
|
-});
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="sass" scoped>
|
|
|
-@import './style.scss'
|
|
|
-</style>
|