123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- <template>
- <div class="hotspot-detail">
- <div class="wrapper">
- <!-- <button
- v-show="descForShow"
- class="desc"
- @click="isShowDesc = true"
- >
- <img
- src="@/assets/images/desc.png"
- alt="详情"
- draggable="false"
- >
- </button> -->
- <h1
- :title="titleForShow"
- v-html="titleForShow"
- />
- <button
- class="close"
- @click="$emit('close')"
- >
- <img
- src="@/assets/images/close.png"
- alt="关闭"
- draggable="false"
- >
- </button>
- <div
- v-if="typesForShow[currentTabIdx].name === '视频'"
- class="swiper-wrapper-mine video-wrap"
- >
- <div
- class="swiper-root swiper-root"
- >
- <div
- class="swiper-wrapper"
- >
- <div
- v-for="(item, index) in typesForShow[currentTabIdx].list"
- :key="index"
- class="swiper-slide"
- >
- <video
- ref="video"
- :src="`https://4dkk.4dage.com/scene_edit_data/${sceneCode}/user/${item.url}`"
- controls
- controlslist="nodownload"
- disablePictureInPicture
- />
- </div>
- </div>
- <div class="swiper-pagination">
- <span class="cur">{{ currentSlideIdx + 1 }}</span> / <span>{{ typesForShow[currentTabIdx].list.length }}</span>
- </div>
- <div class="swiper-button-prev" />
- <div class="swiper-button-next" />
- </div>
- </div>
- <div
- v-if="typesForShow[currentTabIdx].name === '模型'"
- class="swiper-wrapper-mine model-wrap"
- >
- <div
- class="swiper-root"
- >
- <div
- class="swiper-wrapper"
- >
- <iframe
- v-for="(item, index) in typesForShow[currentTabIdx].list"
- :key="index"
- :src="item.url"
- frameborder="0"
- class="swiper-slide"
- />
- </div>
- <!-- <div class="swiper-pagination">
- <span class="cur">{{ currentSlideIdx + 1 }}</span> / <span>{{ typesForShow[currentTabIdx].list.length }}</span>
- </div> -->
- <div class="swiper-button-prev" />
- <div class="swiper-button-next" />
- </div>
- </div>
- <div
- v-show="typesForShow[currentTabIdx] && typesForShow[currentTabIdx].name === '音频'"
- class="swiper-wrapper-mine audio-wrap"
- >
- <div
- class="swiper-root"
- >
- <div
- class="swiper-wrapper"
- >
- <Audio
- v-for="(item, index) in typesForShow[currentTabIdx].list"
- ref="audio-comp"
- :key="index"
- class="audio-custom swiper-slide"
- :audio-src="`https://4dkk.4dage.com/scene_edit_data/${sceneCode}/user/${item.url}`"
- />
- </div>
- <!-- <div class="swiper-pagination">
- <span class="cur">{{ currentSlideIdx + 1 }}</span> / <span>{{ typesForShow[currentTabIdx].list.length }}</span>
- </div> -->
- <div class="swiper-button-prev" />
- <div class="swiper-button-next" />
- </div>
- </div>
- <div
- v-show="typesForShow[currentTabIdx] && typesForShow[currentTabIdx].name === '图片'"
- class="swiper-wrapper-mine image-wrap"
- >
- <div
- class="swiper-root"
- >
- <div
- v-viewer="{
- button: true,
- navbar: false,
- title: false,
- toolbar: false,
- tooltip: false,
- movable: true,
- zoomable: true,
- rotatable: true,
- scalable: true,
- transition: false,
- fullscreen: false,
- keyboard: true,
- loop: false,
- }"
- class="swiper-wrapper"
- >
- <img
- v-for="(item, index) in typesForShow[currentTabIdx].list"
- :key="index"
- v-lazy="`https://4dkk.4dage.com/scene_edit_data/${sceneCode}/user/${item.url}`"
- class="swiper-slide"
- alt=""
- draggable="false"
- >
- </div>
- <!-- <div class="swiper-pagination">
- <span class="cur">{{ currentSlideIdx + 1 }}</span> / <span>{{ typesForShow[currentTabIdx].list.length }}</span>
- </div> -->
- <div class="swiper-button-prev" />
- <div class="swiper-button-next" />
- </div>
- </div>
- <p class="desc">
- {{ descForShow }}
- </p>
- <!-- <div class="type-tabbar">
- <button
- v-for="(typeItem, index) in typesForShow"
- :key="typeItem.name"
- class="tab"
- :class="{
- active: currentTabIdx === index
- }"
- @click="currentTabIdx = index"
- >
- <img
- :src="currentTabIdx !== index ? typeItem.icon : typeItem.iconActive"
- alt=""
- draggable="false"
- >
- <div>{{ typeItem.name + ' ' + typeItem.list.length }}</div>
- </button>
- </div> -->
- <!-- <MyDesc
- v-show="isShowDesc"
- :title="titleForShow"
- :desc="descForShow"
- @close="isShowDesc = false"
- /> -->
- </div>
- </div>
- </template>
- <script>
- import Swiper from 'swiper/swiper-bundle.esm.js'
- import 'swiper/swiper-bundle.css'
- import Audio from "@/components/Audio.vue"
- // import MyDesc from "@/components/HotspotDetailDesc.vue"
- export default {
- components: {
- Audio,
- // MyDesc,
- },
- props: {
- hotspotList: {
- type: Array,
- required: true,
- },
- sceneCode: {
- type: String,
- required: true,
- }
- },
- data() {
- return {
- currentTabIdx: 0,
- currentSlideIdx: 0,
- isShowDesc: false,
- }
- },
- computed: {
- types() {
- const ret = [
- {
- key: 'video',
- name: '视频',
- icon: require('@/assets/images/swkk/video.png'),
- iconActive: require('@/assets/images/swkk/video_1.png'),
- list: [
- // {
- // title: 'title',
- // url: 'asdf',
- // desc: 'aslf,.dsngkdjlg .,zdskgj. s/lkdsf',
- // },
- ]
- },
- {
- key: 'link',
- name: '模型',
- icon: require('@/assets/images/swkk/model.png'),
- iconActive: require('@/assets/images/swkk/model_1.png'),
- list: [
- // {
- // title: 'title',
- // url: 'asdf',
- // desc: 'aslf,.dsngkdjlg .,zdskgj. s/lkdsf',
- // },
- ]
- },
- {
- key: 'audio',
- name: '音频',
- icon: require('@/assets/images/swkk/audio.png'),
- iconActive: require('@/assets/images/swkk/audio_1.png'),
- list: [
- // {
- // title: 'title',
- // url: require('@/assets/images/close.png'),
- // desc: 'aslf,.dsngkdjlg .,zdskgj. s/lkdsf',
- // },
- // {
- // title: 'title2',
- // url: require('@/assets/images/curvy-line.png'),
- // desc: '看来是关键时刻就是雷锋精神是,送到了方式的方式。',
- // },
- ]
- },
- {
- key: 'image',
- name: '图片',
- icon: require('@/assets/images/swkk/pic.png'),
- iconActive: require('@/assets/images/swkk/pic_1.png'),
- list: [
- // {
- // title: 'title',
- // url: require('@/assets/images/close.png'),
- // desc: 'aslf,.dsngkdjlg .,zdskgj. s/lkdsf',
- // },
- // {
- // title: 'title2',
- // url: require('@/assets/images/curvy-line.png'),
- // desc: '看来是关键时刻就是雷锋精神是,送到了方式的方式。',
- // },
- ]
- },
- ]
- for (const hotspot of this.hotspotList) {
- const targetTypeItem = ret.find((item) => {
- return item.key === hotspot.type
- })
- for (const mediaItem of hotspot.media[hotspot.type]) {
- targetTypeItem.list.push({
- title: /* hotspot.content || */hotspot.title.split('&')[0],
- url: mediaItem.src,
- desc: hotspot.content,
- })
- }
- }
- return ret
- },
- titleForShow() {
- try {
- return this.typesForShow[this.currentTabIdx].list[this.currentSlideIdx].title
- } catch (error) {
- return ''
- }
- },
- descForShow() {
- try {
- return this.typesForShow[this.currentTabIdx].list[this.currentSlideIdx].desc
- } catch (error) {
- return ''
- }
- },
- typesForShow() {
- return this.types.filter((item) => {
- return item.list.length
- })
- },
- },
- watch: {
- currentTabIdx: {
- handler(vNew) {
- this.currentSlideIdx = 0
- this.$nextTick(() => {
- const that = this
- const swiper = new Swiper('.swiper-root', {
- // If we need pagination
- // pagination: {
- // el: '.swiper-pagination',
- // },
- // Navigation arrows
- navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev',
- },
- on: {
- afterInit: function (e) {
- if (that.typesForShow[vNew].key === 'video') {
- that.$nextTick(() => {
- that.$refs.video[0].play()
- })
- }
- if (that.typesForShow[vNew].key === 'audio') {
- that.$nextTick(() => {
- that.$refs['audio-comp'][0].play()
- })
- }
- },
- slideChange: function(e) {
- that.currentSlideIdx = e.activeIndex
- if (that.typesForShow[vNew].key === 'video') {
- for (let index = 0; index < that.$refs.video.length; index++) {
- if (index !== that.currentSlideIdx) {
- that.$refs.video[index].pause()
- } else {
- that.$refs.video[index].play()
- }
- }
- }
- if (that.typesForShow[vNew].key === 'audio') {
- for (let index = 0; index < that.$refs['audio-comp'].length; index++) {
- if (index !== that.currentSlideIdx) {
- that.$refs['audio-comp'][index].pause()
- } else {
- that.$refs['audio-comp'][index].play()
- }
- }
- }
- }
- }
- })
- })
- },
- immediate: true,
- },
- },
- mounted() {
- this.mustMute()
- },
- beforeDestroy() {
- this.cancelMustMute()
- },
- methods: {
- ...globalMapMutations([
- 'mustMute',
- 'cancelMustMute',
- ])
- }
- }
- </script>
- <style lang="less" scoped>
- .hotspot-detail {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: rgba(20, 20, 20, 0.70);
- backdrop-filter: blur(4px);
- > .wrapper {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- width: 100%;
- height: 100%;
- max-width: 1329px;
- max-height: 848px;
- background: #E5DFCD;
- border-top: solid 8px #A10E0C;
- border-bottom: solid 8px #A10E0C;
- padding: 28px 100px;
- > button.desc {
- position: absolute;
- top: 3.2rem;
- left: 1.25rem;
- width: 5rem;
- height: 5rem;
- > img {
- width: 100%;
- height: 100%;
- }
- }
- > h1 {
- text-align: center;
- font-size: 32px;
- font-family: Source Han Sans CN-Regular, Source Han Sans CN;
- font-weight: 400;
- color: #A10E0C;
- overflow: hidden;
- white-space: pre;
- text-overflow: ellipsis;
- margin-bottom: 28px;
- }
- > button.close {
- position: absolute;
- top: 29px;
- right: 37px;
- width: 28px;
- height: 28px;
- > img {
- width: 100%;
- height: 100%;
- }
- }
- .swiper-wrapper-mine {
- height: calc(100% - 32px - 28px - 22px - 72px);
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- margin-bottom: 22px;
- .swiper-root {
- overflow: hidden;
- height: 100%;
- width: 100%;
- .swiper-wrapper {
- }
- .swiper-pagination {
- position: absolute;
- top: calc(100% + 1em);
- left: 50%;
- transform: translateX(-50%);
- font-size: 1.33rem;
- font-family: Inter-Regular, Inter;
- color: #666;
- .cur {
- color: #930909;
- }
- }
- .swiper-button-prev {
- left: calc(-1.67rem - 1.83rem);
- width: 1.83rem;
- height: 3.58rem;
- background-image: url(@/assets/images/arrow-left.png);
- background-size: contain;
- &::after {
- content: '';
- }
- }
- .swiper-button-next {
- right: calc(-1.67rem - 1.83rem);
- width: 1.83rem;
- height: 3.58rem;
- background-image: url(@/assets/images/arrow-right.png);
- background-size: contain;
- &::after {
- content: '';
- }
- }
- }
- }
- .swiper-wrapper-mine.video-wrap {
- height: calc(31.5rem * 0.85);
- width: calc(43.5rem * 0.85);
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -70%);
- .swiper-root {
- .swiper-wrapper {
- .swiper-slide {
- background-image: url(@/assets/images/swkk/hotspot-video-bg.png);
- background-size: contain;
- background-repeat: no-repeat;
- padding: 5.67rem 2.21rem 1.88rem 1.8rem;
- > video {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- }
- .swiper-wrapper-mine.model-wrap {
- .swiper-root {
- .swiper-wrapper {
- }
- }
- }
- .swiper-wrapper-mine.audio-wrap {
- width: calc(100% - 1.67rem * 2 - 1.83rem * 2 - 1.67rem * 2);
- height: 30rem;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -70%);
- .swiper-root {
- width: 100%;
- .swiper-wrapper {
- }
- }
- }
- .swiper-wrapper-mine.image-wrap {
- .swiper-root {
- .swiper-wrapper {
- > img {
- object-fit: contain;
- }
- }
- }
- }
- > p.desc {
- font-size: 16px;
- color: #494140;
- line-height: 19px;
- height: 72px;
- overflow: auto;
- padding-right: 6px;
- }
- > .type-tabbar {
- position: absolute;
- bottom: 11.9%;
- left: 0;
- width: 100%;
- display: flex;
- justify-content: center;
- > button {
- margin-right: 2.08rem;
- &:last-child {
- margin-right: initial;
- }
- > img {
- width: 5rem;
- height: 5rem;
- margin-bottom: 0.42rem;
- }
- > div {
- font-size: 1.25rem;
- color: #666666;
- }
- &.active {
- > div {
- color: #930909;
- }
- }
- }
- }
- }
- ::-webkit-scrollbar { width: 2px; height: 0; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
- ::-webkit-scrollbar-thumb {
- background: #958D76;
- }
- }
- </style>
|