|
@@ -1,10 +1,10 @@
|
|
<!-- -->
|
|
<!-- -->
|
|
<template>
|
|
<template>
|
|
- <div class="layout">
|
|
|
|
|
|
+ <div class="layout" v-if="metadata">
|
|
<div class="pc-content" v-if="!isMobile">
|
|
<div class="pc-content" v-if="!isMobile">
|
|
<div class="top-con">
|
|
<div class="top-con">
|
|
<div class="left-side">
|
|
<div class="left-side">
|
|
- <div class="back-btn" @click="$router.push('/')"></div>
|
|
|
|
|
|
+ <div class="back-btn" @click="$router.replace('/')"></div>
|
|
<img v-if="type == '1'" src="@/assets/images/tit_pano.png" alt="" class="logo" />
|
|
<img v-if="type == '1'" src="@/assets/images/tit_pano.png" alt="" class="logo" />
|
|
<img v-if="type == '2'" src="@/assets/images/tit_3d.png" alt="" class="logo" />
|
|
<img v-if="type == '2'" src="@/assets/images/tit_3d.png" alt="" class="logo" />
|
|
<img v-if="type == '3'" src="@/assets/images/tit_scene.png" alt="" class="logo" />
|
|
<img v-if="type == '3'" src="@/assets/images/tit_scene.png" alt="" class="logo" />
|
|
@@ -24,7 +24,7 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bottom-con">
|
|
<div class="bottom-con">
|
|
- <template v-if="list.length">
|
|
|
|
|
|
+ <template v-if="typeList.length">
|
|
<Swiper class="ani-swiper" ref="detailImg" :options="swiperOption">
|
|
<Swiper class="ani-swiper" ref="detailImg" :options="swiperOption">
|
|
<SwiperSlide v-for="(item, i) in typeList" :key="i"> <Card @handleItem="handleItem(item)" :item="item" :type="type" /></SwiperSlide>
|
|
<SwiperSlide v-for="(item, i) in typeList" :key="i"> <Card @handleItem="handleItem(item)" :item="item" :type="type" /></SwiperSlide>
|
|
</Swiper>
|
|
</Swiper>
|
|
@@ -66,11 +66,19 @@
|
|
</template>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
<div class="mobile-body" :class="{ hasMargin: type != 2 }">
|
|
<div class="mobile-body" :class="{ hasMargin: type != 2 }">
|
|
- <div class="m-list">
|
|
|
|
- <div class="m-list-item" v-for="(item, i) in typeList" :key="i">
|
|
|
|
- <Card @handleItem="handleItem(item)" :item="item" :type="type" />
|
|
|
|
|
|
+ <template v-if="typeList.length">
|
|
|
|
+ <div class="m-list">
|
|
|
|
+ <div class="m-list-item" v-for="(item, i) in typeList" :key="i">
|
|
|
|
+ <Card @handleItem="handleItem(item)" :item="item" :type="type" />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <div class="no-result">
|
|
|
|
+ <!-- <img :src="`${$cdn}images/search-icon.png`" alt /> -->
|
|
|
|
+ <span>暂时没有内容呢~请搜索其他关键词吧</span>
|
|
|
|
+ </div></template
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -107,9 +115,19 @@ export default {
|
|
},
|
|
},
|
|
//监听属性 类似于data概念
|
|
//监听属性 类似于data概念
|
|
computed: {
|
|
computed: {
|
|
- ...mapGetters({
|
|
|
|
- metadata: "metadata",
|
|
|
|
- }),
|
|
|
|
|
|
+ // ...mapGetters({
|
|
|
|
+ // metadata: "metadata",
|
|
|
|
+ // }),
|
|
|
|
+
|
|
|
|
+ metadata() {
|
|
|
|
+ let data = this.$store.getters["metadata"];
|
|
|
|
+ if (data) {
|
|
|
|
+ this.type = this.$route.params.type;
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ this.getList();
|
|
|
|
+ }
|
|
|
|
+ return data;
|
|
|
|
+ },
|
|
swiperOption() {
|
|
swiperOption() {
|
|
return {
|
|
return {
|
|
slidesPerView: this.typeList.length > 3 ? 2.8 : 3,
|
|
slidesPerView: this.typeList.length > 3 ? 2.8 : 3,
|
|
@@ -147,19 +165,19 @@ export default {
|
|
},
|
|
},
|
|
handleItem(i) {
|
|
handleItem(i) {
|
|
if (this.type == "1") {
|
|
if (this.type == "1") {
|
|
- this.$router.push({
|
|
|
|
|
|
+ this.$router.replace({
|
|
path: `/pano/${i.sceneCode}`,
|
|
path: `/pano/${i.sceneCode}`,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (this.type == "2") {
|
|
if (this.type == "2") {
|
|
- this.$router.push({
|
|
|
|
|
|
+ this.$router.replace({
|
|
path: `/model/${i.id}`,
|
|
path: `/model/${i.id}`,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (this.type == "3") {
|
|
if (this.type == "3") {
|
|
// this.sceneUrl = i.url;
|
|
// this.sceneUrl = i.url;
|
|
|
|
|
|
- this.$router.push({
|
|
|
|
|
|
+ this.$router.replace({
|
|
path: `/scene/${i.num}`,
|
|
path: `/scene/${i.num}`,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -177,34 +195,37 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
async getList() {
|
|
async getList() {
|
|
- // let res = await this.$http({
|
|
|
|
- // method: "get",
|
|
|
|
- // url: `/json/list.json`,
|
|
|
|
- // });
|
|
|
|
- // this.$store.commit('setData',res)
|
|
|
|
-
|
|
|
|
- switch (this.type) {
|
|
|
|
- case "1":
|
|
|
|
- this.list = this.metadata.panos;
|
|
|
|
- this.typeList = this.metadata.panos;
|
|
|
|
- break;
|
|
|
|
- case "2":
|
|
|
|
- this.list = this.metadata.models;
|
|
|
|
- this.typeList = this.metadata.models;
|
|
|
|
- break;
|
|
|
|
- case "3":
|
|
|
|
- this.list = this.metadata.scenes;
|
|
|
|
- this.typeList = this.metadata.scenes;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ // if (!this.metadata) {
|
|
|
|
+ // let res = await this.$http({
|
|
|
|
+ // method: "get",
|
|
|
|
+ // url: `./json/list.json`,
|
|
|
|
+ // });
|
|
|
|
+ // this.$store.commit("setData", res);
|
|
|
|
+ // }
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ switch (this.type) {
|
|
|
|
+ case "1":
|
|
|
|
+ this.list = this.metadata.panos;
|
|
|
|
+ this.typeList = this.metadata.panos;
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ this.list = this.metadata.models;
|
|
|
|
+ this.typeList = this.metadata.models;
|
|
|
|
+ break;
|
|
|
|
+ case "3":
|
|
|
|
+ this.list = this.metadata.scenes;
|
|
|
|
+ this.typeList = this.metadata.scenes;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
},
|
|
},
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
created() {
|
|
created() {
|
|
- this.type = this.$route.params.type;
|
|
|
|
- this.$forceUpdate();
|
|
|
|
- this.getList();
|
|
|
|
|
|
+ // this.type = this.$route.params.type;
|
|
|
|
+ // this.$forceUpdate();
|
|
|
|
+ // this.getList();
|
|
},
|
|
},
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
mounted() {},
|
|
mounted() {},
|
|
@@ -508,7 +529,7 @@ export default {
|
|
|
|
|
|
&::placeholder {
|
|
&::placeholder {
|
|
color: rgba(255, 255, 255, 0.63);
|
|
color: rgba(255, 255, 255, 0.63);
|
|
- font-size: 1vw;
|
|
|
|
|
|
+ font-size: 0.2667rem;
|
|
height: 100%;
|
|
height: 100%;
|
|
line-height: 100%;
|
|
line-height: 100%;
|
|
font-family: "SourceHanSansCN-Regular";
|
|
font-family: "SourceHanSansCN-Regular";
|
|
@@ -587,6 +608,11 @@ export default {
|
|
height: calc(100vh - 1rem - 1.3333rem);
|
|
height: calc(100vh - 1rem - 1.3333rem);
|
|
margin-top: 1rem;
|
|
margin-top: 1rem;
|
|
}
|
|
}
|
|
|
|
+ .no-result {
|
|
|
|
+ span {
|
|
|
|
+ font-size: 0.32rem;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
.m-list {
|
|
.m-list {
|
|
display: flex;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
flex-wrap: wrap;
|