123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <div class="hotspot" v-if="!isMobile">
- <img class="aa" v-if="hotspot.images.length > 1" :src="require('@/assets/images/proj2022/pc/left_1.png')" alt="" @click="handlePage('prev')" />
- <div class="vhotspotcon">
- <div class="vtitle" v-if="hotspot.title" v-html="hotspot.title"></div>
- <div class="hotspotcon" :class="{hotconfull:!hotspot.title&&!(hotspot.title||hotspot.imagesDesc[active])}">
- <div class="img-con" :class="{ bigImg: !(hotspot.imagesDesc[active]|| hotspot.contents[active]) }">
- <div class="imgmain">
- <img id="map" :src="g_fixUrl(hotspot.images[active])" alt="" />
- </div>
- <div class="pagna" v-if="hotspot.images.length > 1">
- <span>{{ active + 1 }}</span>
- /
- <span>{{ hotspot.images.length }}</span>
- </div>
- </div>
-
- <div class="desc" v-html="handleContent(hotspot.imagesDesc[active] || hotspot.contents[active])"></div>
- </div>
- </div>
- <img class="aa" v-if="hotspot.images.length > 1" :src="require('@/assets/images/proj2022/pc/right_1.png')" alt="" @click="handlePage('next')" />
- </div>
- <div v-else class="mbhotspot">
- <div class="mbhcon" :class="{ fullcon: !hotspot.content || !hotspot.contents[active] }">
- <div class="img-con">
- <img class="aa" :class="{hengaa:g_isLandscape}" v-if="hotspot.images.length > 1" :src="require('@/assets/images/proj2022/mobile/prev.png')" alt="" @click="handlePage('prev')" />
- <div class="imgmain" >
- <img id="map" :src="g_fixUrl(hotspot.images[active])" alt="" />
- </div>
- <img class="aa" :class="{hengaa:g_isLandscape}" v-if="hotspot.images.length > 1" :src="require('@/assets/images/proj2022/mobile/next.png')" alt="" @click="handlePage('next')" />
- </div>
- <div class="desc" v-if="hotspot.imagesDesc[active] || hotspot.contents[active]">
- <div class="title" v-html="hotspot.title"></div>
- <div v-html="handleContent(hotspot.imagesDesc[active] || hotspot.contents[active], 14)"></div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Panzoom from "@panzoom/panzoom";
- export default {
-
- props: ["hotspot", "type"],
- data() {
- return {
- panzoom: "",
- active: 0,
- to: null,
- };
- },
- watch: {
- active() {
- setTimeout(() => {
- this.$showLoading();
- });
- if (this.to) {
- clearTimeout(this.to);
- this.to = null;
- }
- this.to = setTimeout(() => {
- this.$hideLoading();
- }, 1000);
- },
- },
- methods: {
- handlePage(type) {
- if (type === "next") {
- if (this.active >= this.hotspot.images.length - 1) {
- this.active = 0;
- return;
- }
- this.active += 1;
- } else {
- if (this.active == 0) {
- this.active = this.hotspot.images.length - 1;
- return;
- }
- this.active -= 1;
- }
- },
- reset() {
- this.panzoom.pan(0, 0);
- // this.panzoom.zoom(this.isMobile ? 1 : !this.hotspot.content ? 0.8 : 1);
- this.panzoom.zoom(1);
- this.$hideLoading();
- },
- },
- computed: {
-
- },
- mounted() {
- const elem = document.getElementById("map");
- this.panzoom = Panzoom(elem, {
- maxScale: 10,
- startScale: 1
- });
- const parent = elem.parentElement
- // No function bind needed
- parent.addEventListener("wheel", this.panzoom.zoomWithWheel);
- parent.addEventListener("load", () => {
- this.reset();
- });
- parent.addEventListener("abort", () => {
- this.reset();
- });
- parent.addEventListener("error", () => {
- this.reset();
- });
- },
- };
- </script>
- <style lang="less" scoped>
- .noshow {
- opacity: 0 !important;
- pointer-events: none !important;
- }
- @w: 75%;
- @fixw: 8px;
- .hotspot {
-
- .vhotspotcon{
- width: 100%;
- }
- }
- .mbhotspot {
- width: 100%;
- height: 100%;
- position: fixed;
- left: 0;
- top: 0;
- z-index: 9999;
- .close {
- position: absolute;
- top: 26px;
- right: 16px;
- width: 20px;
- z-index: 1000;
- }
- .mbhcon {
- position: absolute;
- top: 50%;
- width: 100%;
- left: 50%;
- transform: translate(-50%, -50%);
- height: 100%;
- .img-con {
- display: flex;
- height: 100%;
- align-items: center;
- justify-content: space-between;
- position: relative;
- overflow: hidden;
- .imgmain {
- width: 100%;
- height: auto;
- min-height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- img {
- cursor: pointer;
- max-width: 100%;
- }
- }
- @pos: 10px;
- @posh: 50px;
- .aa {
- position: absolute;
- width: 30px;
- height: auto;
- cursor: pointer;
- top: 50%;
- transform: translateY(-50%);
- left: @pos;
- z-index: 999;
- &:last-of-type {
- right: @pos;
- left: unset;
- }
- }
- .hengaa{
- position: absolute;
- width: 30px;
- height: auto;
- cursor: pointer;
- top: 50%;
- transform: translateY(-50%);
- left: @posh;
- z-index: 999;
- &:last-of-type {
- right: @posh;
- left: unset;
- }
- }
- }
- .desc {
- overflow-y: auto;
- position: absolute;
- z-index: 99999;
- bottom: 0;
- left: 50%;
- width: 100%;
- padding: 2% 5%;
- transform: translateX(-50%);
- margin: 0;
- min-height: 10vh;
- max-height: 34vh;
- background: rgba(0, 0, 0, 0.5);
- text-align: left;
- word-break: break-all;
- .title {
- width: 100%;
- display: inline-block;
- font-size: 16px;
- margin-bottom: 10px;
- }
- }
- }
- .fullcon {
- width: 100%;
- height: 100%;
- .img-con {
- height: 100%;
- .imgmain {
- width: 100%;
- height: auto;
- min-height: 100%;
- display: flex;
- align-items: center;
- text-align: center;
- }
- }
- }
- }
- </style>
|