123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <template>
- <div class="Construct">
- <!-- 模型的嵌套盒子 -->
- <div class="ifrBox" v-if="unityUrl">
- <iframe :src="unityUrl" frameborder="0"></iframe>
- </div>
- <!-- 左上的场景选择 -->
- <div class="vrChange" @click="vrShow = true">
- <img src="../../assets/img/construct/vrChange.png" alt="" />
- <p>场景选择</p>
- </div>
- <!-- 右下角的搜索按钮 -->
- <img
- class="search"
- @click="searchShow = !searchShow"
- src="../../assets/img/construct/search.png"
- alt=""
- />
- <!-- 点击左上角出来的轮播图 -->
- <div class="vrBox" :class="{ vrBoxAc: vrShow }">
- <!-- 关闭按钮 -->
- <div class="close" @click="vrShow = false">
- <van-icon name="cross" />
- </div>
- <div class="vrBoxSwi">
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div
- class="swiper-slide"
- @click="handlClick(item.id)"
- v-for="item in data"
- :key="item.id"
- >
- <img :src="require(`@/assets/img/home/${item.id}.jpg`)" alt="" />
- <p>{{ item.name }}</p>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 点击右下角的搜索出来的页面 -->
- <div class="searcBox" :class="{ searcBoxAc: searchShow }">
- <Search />
- </div>
- <!-- 进入景点详情的按钮 -->
- <div class="toInfo" @click="$router.push(`/layout/goods/${Uid}`)">
- <img src="../../assets/img/construct/infoBtn.png" alt="" />
- </div>
- </div>
- </template>
- <script>
- const unityUrlObj = {
- 1: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc204",
- 2: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc214",
- 3: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc215",
- 4: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc211",
- 5: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc213",
- 6: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc210",
- 7: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc206",
- 8: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc209",
- 9: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc207",
- 10: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc208",
- 11: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc205",
- 12: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc201",
- 13: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc212",
- 14: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc203",
- 15: "https://4dscene.4dage.com/culturalrelics/YFYCM2/Model2.html?m=yfyc202",
- };
- const dataAll = [
- { id: 1, name: "老芜湖海关旧址", loction: "滨江公园内" },
- { id: 2, name: "英驻芜领事署旧址", loction: "范罗山" },
- { id: 3, name: "总税务司公所旧址", loction: "范罗山" },
- { id: 4, name: "洋员帮办楼旧址", loction: "范罗山" },
- {
- id: 5,
- name: "英驻芜领事官邸旧址",
- loction: "吉和南路 26 号雨耕山顶",
- },
- { id: 6, name: "天主堂", loction: "吉和街28 号" },
- { id: 7, name: "神父楼", loction: "吉和街28 号" },
- { id: 8, name: "天主教主教公署旧址", loction: "狮子山马路39号" },
- { id: 9, name: "圣母院旧址", loction: "狮子山马路39号" },
- { id: 10, name: "天主教修士楼", loction: "大官山顶" },
- { id: 11, name: "内思高级工业职业学校旧址", loction: "吉和街26号" },
- { id: 12, name: "博仁堂", loction: "安师大附属外国语学校中学内" },
- { id: 13, name: "义德堂", loction: "安师大附属外国语学校中学内" },
- { id: 14, name: "经方堂", loction: "安师大附属外国语学校中学内" },
- { id: 15, name: "广济寺塔", loction: "广济寺内" },
- ];
- import Search from "./components/search.vue";
- import Swiper from "../../assets/libs/swiper.js";
- export default {
- components: { Search },
- name: "RK-id",
- data() {
- return {
- Uid: Number(this.$route.params.id),
- vrShow: false,
- searchShow: false,
- data: [],
- unityUrl: "",
- mySwiper: null,
- };
- },
- computed: {},
- watch: {
- $route(val) {
- let id = val.params.id;
- this.Uid = Number(id);
- this.unityUrl = unityUrlObj[id] || "";
- this.data = dataAll.filter((v) => v.id != id);
- // 轮播图重新生成
- setTimeout(() => {
- this.mySwiper = new Swiper(".Construct .swiper-container", {
- slidesPerView: 1.4,
- spaceBetween: 30,
- centeredSlides: true,
- initialSlide: 0,
- });
- }, 200);
- },
- },
- methods: {
- handlClick(id) {
- this.vrShow = false;
- this.$router.push(`/layout/construct/${id}`);
- },
- },
- created() {},
- mounted() {
- // ------
- let id = this.Uid;
- this.unityUrl = unityUrlObj[id] || "";
- this.data = dataAll.filter((v) => v.id != id);
- setTimeout(() => {
- this.mySwiper = new Swiper(".Construct .swiper-container", {
- slidesPerView: 1.4,
- spaceBetween: 30,
- centeredSlides: true,
- initialSlide: 0,
- });
- }, 200);
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='less' scoped>
- @import "../../assets/libs/swiper.css";
- .Construct {
- font-size: 16px;
- color: #fff;
- width: 100%;
- height: calc(100% - 80px);
- position: relative;
- .ifrBox {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- iframe {
- width: 100%;
- height: 100%;
- }
- }
- .vrChange {
- position: absolute;
- top: 20px;
- left: 20px;
- z-index: 2;
- width: 60px;
- text-align: center;
- & > img {
- width: 40px;
- }
- & > p {
- font-size: 14px;
- }
- }
- .toInfo {
- position: absolute;
- bottom: 20px;
- left: 50%;
- transform: translateX(-50%);
- width: 160px;
- & > img {
- width: 100%;
- }
- }
- .search {
- position: absolute;
- bottom: 20px;
- right: 20px;
- width: 40px;
- z-index: 4;
- }
- .vrBox {
- opacity: 0;
- pointer-events: none;
- transition: opacity 0.3s;
- position: absolute;
- z-index: 4;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.6);
- .close {
- position: absolute;
- z-index: 3;
- top: 20px;
- right: 20px;
- font-size: 24px;
- color: #fff;
- }
- .vrBoxSwi {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- width: 100%;
- height: 55vh;
- .swiper-container {
- width: 100%;
- height: 100%;
- .swiper-slide {
- & > img {
- border-radius: 8px 8px 0 0;
- width: 100%;
- height: calc(100% - 40px);
- object-fit: cover;
- }
- & > p {
- height: 40px;
- line-height: 40px;
- font-size: 18px;
- text-align: center;
- }
- }
- }
- }
- }
- .vrBoxAc {
- opacity: 1;
- pointer-events: auto;
- }
- .searcBox {
- transform: translateX(-300px);
- opacity: 0;
- pointer-events: none;
- transition: all 0.3s;
- position: absolute;
- z-index: 3;
- left: 0;
- width: 100%;
- background-color: rgba(0, 0, 0, 0.6);
- height: 100%;
- }
- .searcBoxAc {
- transform: translateX(0);
- opacity: 1;
- pointer-events: auto;
- }
- }
- </style>
|