123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549 |
- <template>
- <div v-if="cItem.entity">
- <div class="img-body">
- <img
- class="close"
- @click.stop="hideBroadcast"
- :src="require(`@/assets/images/icon/close.png`)"
- />
- <template v-if="cItem.entity.type == 'img'">
- <div class="imgTxtInfo">
- <h3>{{ cItem.entity.name }}</h3>
- <p>{{ cItem.entity.description }}</p>
- </div>
- <div class="swcon swiper-container" id="imglist">
- <ul class="swiper-wrapper">
- <li
- class="swiper-slide"
- v-for="(sub, index) in cItem.file"
- :key="index"
- >
- <div class="sl-item">
- <!-- 邵根2023-11-15 -->
- <img :src="envUrl+sub.filePath" />
- </div>
- </li>
- </ul>
- </div>
- <template v-if="cItem.file.length > 1">
- <img
- :class="{ noneAc: active === 0 }"
- class="vpagination left"
- :src="require('@/assets/images/icon/left.png')"
- @click="slide('slidePrev')"
- alt=""
- />
- <img
- v-if="cItem && cItem.file"
- :class="{ noneAc: active === cItem.file.length - 1 }"
- class="vpagination right"
- :src="require('@/assets/images/icon/right.png')"
- @click="slide('slideNext')"
- alt=""
- />
- </template>
- <ul class="pagna" v-if="cItem.file.length > 1">
- <li
- v-for="(sub, i) in cItem.file"
- :class="{ active: i == active }"
- :key="i"
- ></li>
- </ul>
- </template>
- <template v-else>
- <iframe
- v-if="cItem.entity.type == 'model'"
- :src="`/model-page/model.html?m=${cItem.entity.filePath}`"
- frameborder="0"
- ></iframe>
- <video
- ref="itemvideo"
- controlslist="nodownload noplaybackrate"
- :disablePictureInPicture="true"
- v-else-if="cItem.entity.type == 'video'"
- controls
- :src="cItem.entity.filePath"
- loop
- autoplay
- ></video>
- <vAudio v-else :adata="cItem.entity"></vAudio>
- <div
- v-if="cItem.entity.type != 'audio'"
- class="txtInfo"
- :class="{ videoInfo: cItem.entity.type == 'video' }"
- >
- <h3 class="btmname">
- {{ cItem.entity.name }}
- </h3>
- <div v-if="cItem.entity.type != 'video'">{{cItem.entity.ageName}} {{cItem.entity.textureName}}</div>
- <p>{{ cItem.entity.description }}</p>
- </div>
- </template>
- </div>
- </div>
- </template>
- <script>
- import emitter from "@/mitt/index";
- import vAudio from "@/components/Audio";
- import {envUrl} from '@/utils/index.js'
- export default {
- name: "showCollection",
- props: ["item", "zhuti"],
- data() {
- return {
- isFull: false,
- active: 0,
- swInstance: null,
- };
- },
- components: { vAudio },
- computed: {
- cItem() {
- return { ...this.item };
- },
- },
- watch: {
- isFull(newVal) {
- let tmp = this.cItem.type == "img";
- this.$emit("hideSlide", tmp && !newVal);
- },
- // "swInstance.activeIndex"(val) {
- // this.active = val;
- // console.log("----------", val);
- // },
- },
- methods: {
- slide(type) {
- this.swInstance[type]();
- },
- hideBroadcast() {
- emitter.emit("closeCollection");
- },
- },
- mounted() {
- let that = this;
- this.$nextTick(() => {
- let t = setTimeout(() => {
- clearTimeout(t);
- this.swInstance = new Swiper("#imglist", {
- slidesPerView: "auto",
- normalizeSlideIndex: false,
- on: {
- slideChange() {
- that.active = this.realIndex;
- if (this.realIndex > that.cItem.file.length - 1)
- that.active = that.cItem.file.length - 1;
- },
- },
- });
- }, 200);
- });
- },
- };
- </script>
- <style lang="scss" scoped>
- .noneAc {
- opacity: 0.5;
- pointer-events: none;
- }
- .videoInfo {
- top: auto !important;
- width: 80% !important;
- padding: 0 20px;
- position: absolute;
- color: #fff;
- transform: translateX(-50%);
- left: 50% !important;
- bottom: 10px;
- height: 100px;
- display: flex;
- justify-content: center;
- align-items: center;
- h3 {
- max-width: 30%;
- word-break: break-all;
- margin-right: 3%;
- }
- p {
- margin-top: 0 !important;
- max-width: 65%;
- word-break: break-all;
- }
- }
- .imgTxtInfo {
- top: auto !important;
- width: 80% !important;
- padding: 0 20px;
- position: absolute;
- color: #fff;
- transform: translateX(-50%);
- left: 50% !important;
- bottom: 40px;
- height: 100px;
- display: flex;
- justify-content: center;
- align-items: center;
- h3 {
- max-width: 30%;
- word-break: break-all;
- margin-right: 3%;
- }
- p {
- margin-top: 0 !important;
- max-width: 65%;
- word-break: break-all;
- }
- }
- .img-body {
- width: 100%;
- height: 100%;
- position: relative;
- color: #fff;
- iframe,
- audio,
- video {
- width: 60%;
- height: 70%;
- transform: translate(-50%, -50%);
- top: 50%;
- left: 50%;
- position: absolute;
- }
- audio {
- width: 50%;
- height: 20%;
- }
- .txtInfo {
- position: absolute;
- top: 50px;
- left: 60px;
- width: 240px;
- &>div{
- margin-top: 15px;
- font-size: 16px;
- }
- .btmname {
- word-break: break-all;
- font-size: 24px;
- }
- p {
- margin-top: 15px;
- word-break: break-all;
- font-size: 14px;
- }
- }
- .close {
- position: absolute;
- right: 40px;
- top: 40px;
- width: 50px;
- height: 50px;
- cursor: pointer;
- }
- .swcon {
- position: relative;
- width: 60%;
- height: 100%;
- cursor: grab;
- .swiper-wrapper {
- padding: 0;
- width: 100%;
- .swiper-slide {
- width: 100%;
- transform-style: preserve-3d;
- position: relative;
- height: 100%;
- margin: 0 auto;
- transform: translate3d(0, 0, 0);
- .sl-item {
- width: 100%;
- height: 95%;
- position: relative;
- > img {
- width: auto;
- max-height: 60%;
- max-width: 100%;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- object-fit: cover;
- }
- }
- }
- }
- }
- .pagna {
- position: absolute;
- bottom: 20px;
- left: 50%;
- transform: translateX(-50%);
- text-align: center;
- z-index: 999;
- > li {
- width: 10px;
- border-radius: 50%;
- height: 10px;
- background: rgba(0, 0, 0, 0.3);
- display: inline-block;
- margin: 0 4px;
- &.active {
- background: #fff;
- }
- }
- }
- .vpagination {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- cursor: pointer;
- width: 50px;
- }
- $pos: 180px;
- .left {
- left: $pos;
- }
- .right {
- right: $pos;
- }
- }
- .full {
- width: 100%;
- height: 100%;
- z-index: 99999999;
- position: relative;
- iframe,
- video {
- width: 100%;
- height: 100%;
- }
- .conname {
- color: #fff;
- margin-top: 6px;
- position: fixed;
- left: 50%;
- transform: translateX(-50%);
- bottom: 40px;
- font-size: 18px;
- }
- .img {
- height: 100%;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- }
- .full-btn {
- width: 30px;
- position: absolute;
- right: 12px;
- bottom: 30px;
- cursor: pointer;
- }
- .full-close {
- width: 30px;
- position: absolute;
- right: 12px;
- top: 30px;
- cursor: pointer;
- }
- }
- @media screen and (max-width: 1000px) {
- .img-body {
- width: 100%;
- height: 100%;
- position: relative;
- color: #fff;
- iframe,
- audio,
- video {
- width: 100%;
- height: 80%;
- transform: translate(-50%, -50%);
- top: 50%;
- left: 50%;
- position: absolute;
- }
- audio {
- width: 50%;
- height: 20%;
- }
- .close {
- position: absolute;
- right: 20px;
- top: 20px;
- width: 30px;
- height: 30px;
- cursor: pointer;
- z-index: 999999;
- }
- .swcon {
- position: relative;
- width: 100%;
- height: 100%;
- .swiper-wrapper {
- padding: 0;
- width: 100%;
- .swiper-slide {
- width: 100%;
- transform-style: preserve-3d;
- position: relative;
- height: 100%;
- margin: 0 auto;
- transform: translate3d(0, 0, 0);
- .sl-item {
- width: 100%;
- height: 95%;
- position: relative;
- > img {
- width: auto;
- max-height: 90vh;
- max-width: 100%;
- cursor: pointer;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- > p {
- color: #fff;
- position: absolute;
- bottom: 30px;
- transform: translateX(-50%);
- left: 50%;
- font-size: 24px;
- }
- }
- }
- }
- }
- .pagna {
- position: absolute;
- bottom: 20px;
- left: 50%;
- transform: translateX(-50%);
- text-align: center;
- z-index: 999;
- > li {
- width: 10px;
- border-radius: 50%;
- height: 10px;
- background: rgba(51, 143, 123, 0.24);
- display: inline-block;
- margin: 0 4px;
- &.active {
- background: #338f7b;
- }
- }
- }
- .vpagination {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- cursor: pointer;
- width: 50px;
- display: none;
- }
- $pos: 180px;
- .left {
- left: $pos;
- }
- .right {
- right: $pos;
- }
- }
- .full {
- width: 100%;
- height: 100%;
- z-index: 99999999;
- position: relative;
- iframe,
- video {
- width: 100%;
- height: 100%;
- }
- .conname {
- color: #fff;
- margin-top: 6px;
- position: fixed;
- left: 50%;
- transform: translateX(-50%);
- bottom: 40px;
- font-size: 18px;
- }
- .img {
- height: 100%;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- }
- .full-btn {
- width: 30px;
- position: absolute;
- right: 12px;
- bottom: 30px;
- cursor: pointer;
- }
- .full-close {
- width: 30px;
- position: absolute;
- right: 12px;
- top: 30px;
- cursor: pointer;
- }
- }
- }
- </style>
|