|
@@ -1,342 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="stair">
|
|
|
- <div class="ifrBox">
|
|
|
- <iframe
|
|
|
- id="preview"
|
|
|
- :src="textUrl + ifrSrc[$route.params.id]"
|
|
|
- frameborder="0"
|
|
|
- ></iframe>
|
|
|
- </div>
|
|
|
- <!-- 左上浏览量 -->
|
|
|
- <div class="upleft">
|
|
|
- <div class="el-icon-arrow-left" @click="$router.push('/')">返回</div>
|
|
|
- <div class="eye">浏览量:{{ lookNum }}</div>
|
|
|
- </div>
|
|
|
- <!-- 右边村名 -->
|
|
|
- <div class="rightCM">
|
|
|
- <img
|
|
|
- class="name"
|
|
|
- :src="require(`@/assets/img/cunName/${$route.params.id}.png`)"
|
|
|
- alt=""
|
|
|
- />
|
|
|
- </div>
|
|
|
- <!-- 中间选项 -->
|
|
|
- <!-- <div class="conMain">
|
|
|
- <div class="row" v-for="item in data" :key="item.id">{{ item.name }}</div>
|
|
|
- </div> -->
|
|
|
- <!-- 底部功能 -->
|
|
|
- <div class="botBtn">
|
|
|
- <div
|
|
|
- @click="cutPage(item.id)"
|
|
|
- class="btnRow"
|
|
|
- v-for="item in btnData"
|
|
|
- :key="item.id"
|
|
|
- @mouseenter="btnDataInd = item.id"
|
|
|
- @mouseleave="btnDataInd = null"
|
|
|
- >
|
|
|
- <img
|
|
|
- :src="
|
|
|
- require(`@/assets/img/${item.inco}${
|
|
|
- (btnDataInd === item.id && item.id !== 4) ||
|
|
|
- (item.id === 4) & isShowGood ||
|
|
|
- btnDataAc === item.id
|
|
|
- ? '_active'
|
|
|
- : ''
|
|
|
- }.png`)
|
|
|
- "
|
|
|
- alt=""
|
|
|
- />
|
|
|
- <!-- 点赞的数字 -->
|
|
|
- <p v-if="item.id === 4">{{ likeNum }}</p>
|
|
|
- <transition v-if="item.id === 4" name="likeAddAnimate">
|
|
|
- <div class="good" v-show="isShowGood">
|
|
|
- <div class="pic">
|
|
|
- <img :src="require(`@/assets/img/like_active.png`)" alt="" />
|
|
|
- </div>
|
|
|
- <div class="num">+1</div>
|
|
|
- </div>
|
|
|
- </transition>
|
|
|
- <!-- 鼠标移入的显示 -->
|
|
|
- <div
|
|
|
- class="hoverInco"
|
|
|
- :class="{ hovAc: btnDataInd === item.id && !isShowGood }"
|
|
|
- >
|
|
|
- {{ item.name }}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!-- 简介组件 -->
|
|
|
- <StairIntro v-if="btnDataAc === 1" @close="btnDataAc = null" />
|
|
|
- <!-- 打卡组件 -->
|
|
|
- <StairCard v-if="btnDataAc === 2" @close="btnDataAc = null" @daka="daka" />
|
|
|
- <!-- 分享组件 -->
|
|
|
- <StairShare v-if="btnDataAc === 3" @close="btnDataAc = null" />
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import { likeSaveApi, getCunNumApi } from "@/utils/api";
|
|
|
-import StairIntro from "./component/intro.vue";
|
|
|
-import StairCard from "./component/card.vue";
|
|
|
-import StairShare from "./component/share.vue";
|
|
|
-import { Log } from "mars3d";
|
|
|
-export default {
|
|
|
- name: "stair",
|
|
|
- components: { StairIntro, StairCard, StairShare },
|
|
|
- data() {
|
|
|
- //这里存放数据
|
|
|
- return {
|
|
|
- // 测试url
|
|
|
- // textUrl: "http://192.168.20.48:8081", //本地
|
|
|
- textUrl: "/SWKK", //打包
|
|
|
- lookNum: 0,
|
|
|
- btnData: [
|
|
|
- { id: 1, name: "简介", inco: "introduction" },
|
|
|
- { id: 2, name: "打卡", inco: "daily" },
|
|
|
- { id: 3, name: "分享", inco: "share" },
|
|
|
- { id: 4, name: "点赞", inco: "like" },
|
|
|
- { id: 5, name: "资料", inco: "data" },
|
|
|
- ],
|
|
|
- btnDataInd: null,
|
|
|
- btnDataAc: null,
|
|
|
- likeNum: 0,
|
|
|
- isShowGood: false,
|
|
|
- // 场景地址
|
|
|
- ifrSrc: {
|
|
|
- 1: "/show.html?id=WK1526481420019593216",
|
|
|
- 2: "/show.html?id=WK1526504857790345216",
|
|
|
- 3: "/show.html?id=WK1526492643662524416",
|
|
|
- 4: "/show.html?id=WK1534388525183561728",
|
|
|
- 5: "/show.html?id=WK1526467526949629952",
|
|
|
- 6: "/show.html?id=WK1534416074647302144",
|
|
|
- 7: "/show.html?id=WK1534702347710656512",
|
|
|
- 8: "/show.html?id=WK1534781968695259136",
|
|
|
- 9: "/show.html?id=WK1534383548646060032",
|
|
|
- 10: "/show.html?id=WK1526490922810896384",
|
|
|
- 11: "/show.html?id=WK1526504177180635136",
|
|
|
- 12: "/show.html?id=WK1526461619335360512",
|
|
|
- },
|
|
|
- };
|
|
|
- },
|
|
|
- //监听属性 类似于data概念
|
|
|
- computed: {},
|
|
|
- //监控data中的数据变化
|
|
|
- watch: {},
|
|
|
- //方法集合
|
|
|
- methods: {
|
|
|
- // 通知子组件跳转页面
|
|
|
- daka(arr) {
|
|
|
- // 存在本地
|
|
|
- let temp = localStorage.getItem("JMData_daka") || [];
|
|
|
- if (temp.length > 0) {
|
|
|
- temp = JSON.parse(temp);
|
|
|
- }
|
|
|
- if (temp.every((v) => v.name != arr[0])) {
|
|
|
- temp.push({ name: arr[0] });
|
|
|
- localStorage.setItem("JMData_daka", JSON.stringify(temp));
|
|
|
- }
|
|
|
-
|
|
|
- this.btnDataAc = null;
|
|
|
- let ifrDom = document.querySelector("#preview");
|
|
|
- ifrDom.contentWindow.postMessage(arr, "*");
|
|
|
- },
|
|
|
- async cutPage(id) {
|
|
|
- // 点赞
|
|
|
- if (id === 4) {
|
|
|
- if (this.isShowGood) return;
|
|
|
- this.isShowGood = true;
|
|
|
- await likeSaveApi(Number(this.$route.params.id));
|
|
|
- setTimeout(() => {
|
|
|
- this.likeNum++;
|
|
|
- this.isShowGood = false;
|
|
|
- }, 1800);
|
|
|
- return;
|
|
|
- } else if (id === 5) {
|
|
|
- this.$router.push(`/info/${this.$route.params.id}`);
|
|
|
- } else this.btnDataAc = id;
|
|
|
- },
|
|
|
- },
|
|
|
- //生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- async created() {
|
|
|
- let id = Number(this.$route.params.id);
|
|
|
- let res = await getCunNumApi(id);
|
|
|
- this.likeNum = res.data.star;
|
|
|
- this.lookNum = res.data.visit;
|
|
|
- },
|
|
|
- //生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
- mounted() {
|
|
|
- window.addEventListener(
|
|
|
- "message",
|
|
|
- (e) => {
|
|
|
- if (typeof e.data === "string" && e.data.length > 0) {
|
|
|
- // 存在本地
|
|
|
- let temp = localStorage.getItem("JMData_daka") || [];
|
|
|
- if (temp.length > 0) {
|
|
|
- temp = JSON.parse(temp);
|
|
|
- }
|
|
|
- if (temp.every((v) => v.name != e.data)) {
|
|
|
- temp.push({ name: e.data });
|
|
|
- localStorage.setItem("JMData_daka", JSON.stringify(temp));
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- false
|
|
|
- );
|
|
|
- },
|
|
|
- beforeCreate() {}, //生命周期 - 创建之前
|
|
|
- beforeMount() {}, //生命周期 - 挂载之前
|
|
|
- beforeUpdate() {}, //生命周期 - 更新之前
|
|
|
- updated() {}, //生命周期 - 更新之后
|
|
|
- beforeDestroy() {}, //生命周期 - 销毁之前
|
|
|
- destroyed() {}, //生命周期 - 销毁完成
|
|
|
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
-};
|
|
|
-</script>
|
|
|
-<style lang='less' scoped>
|
|
|
-.stair {
|
|
|
- overflow: hidden;
|
|
|
- position: relative;
|
|
|
- padding: 20px 0 0 15px;
|
|
|
- color: #fff;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- // background: url("../../assets/img/bgs.jpg");
|
|
|
- // background-size: 100% 100%;
|
|
|
- .ifrBox {
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- iframe {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- }
|
|
|
- .upleft {
|
|
|
- position: absolute;
|
|
|
- right: 20px;
|
|
|
- top: 20px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- .el-icon-arrow-left {
|
|
|
- cursor: pointer;
|
|
|
- border-right: 1px solid #fff;
|
|
|
- padding-right: 15px;
|
|
|
- margin-right: 15px;
|
|
|
- }
|
|
|
- .eye {
|
|
|
- background-image: url("../../assets/img/number.png");
|
|
|
- background-position: 0px -8px;
|
|
|
- background-repeat: no-repeat;
|
|
|
- padding-left: 40px;
|
|
|
- }
|
|
|
- }
|
|
|
- .rightCM {
|
|
|
- position: absolute;
|
|
|
- top: 240px;
|
|
|
- right: 20px;
|
|
|
- }
|
|
|
- .conMain {
|
|
|
- height: 400px;
|
|
|
- position: absolute;
|
|
|
- bottom: 170px;
|
|
|
- left: 0;
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
- justify-content: space-around;
|
|
|
- .row {
|
|
|
- padding-top: 30px;
|
|
|
- text-align: right;
|
|
|
- line-height: 34px;
|
|
|
- cursor: pointer;
|
|
|
- width: 54px;
|
|
|
- height: 303px;
|
|
|
- background: url("../../assets/img/normal.png");
|
|
|
- background-size: 100% 100%;
|
|
|
- word-wrap: break-word;
|
|
|
- letter-spacing: 20px;
|
|
|
- margin-top: 100px;
|
|
|
- &:nth-of-type(2n) {
|
|
|
- margin-top: 0;
|
|
|
- }
|
|
|
- &:hover {
|
|
|
- background: url("../../assets/img/hover.png");
|
|
|
- background-size: 100% 100%;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- .likeAddAnimate-enter-active,
|
|
|
- .likeAddAnimate-leave-active {
|
|
|
- transition: all 2s ease;
|
|
|
- }
|
|
|
- .likeAddAnimate-enter,
|
|
|
- .likeAddAnimate-leave {
|
|
|
- transform: translateY(0) scale(0);
|
|
|
- opacity: 0;
|
|
|
- }
|
|
|
- .likeAddAnimate-enter-to,
|
|
|
- .likeAddAnimate-leave-to {
|
|
|
- transform: translateY(-50px) scale(1.2);
|
|
|
- opacity: 1;
|
|
|
- }
|
|
|
- .good {
|
|
|
- position: absolute;
|
|
|
- top: -10px;
|
|
|
- right: 0px;
|
|
|
- display: flex;
|
|
|
- .pic {
|
|
|
- width: 35px;
|
|
|
- > img {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- }
|
|
|
- .num {
|
|
|
- margin-top: 10px;
|
|
|
- margin-left: 10px;
|
|
|
- color: #fff;
|
|
|
- text-shadow: 0 0 10px rgba(0, 0, 0, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- .botBtn {
|
|
|
- display: flex;
|
|
|
- position: absolute;
|
|
|
- bottom: 55px;
|
|
|
- left: 80px;
|
|
|
- .btnRow {
|
|
|
- position: relative;
|
|
|
- cursor: pointer;
|
|
|
- text-align: center;
|
|
|
- width: 87px;
|
|
|
- height: 51px;
|
|
|
- & > img {
|
|
|
- width: 52px;
|
|
|
- height: 51px;
|
|
|
- }
|
|
|
- .hoverInco {
|
|
|
- pointer-events: none;
|
|
|
- opacity: 0;
|
|
|
- transform: translateY(10px);
|
|
|
- transition: all 0.5s;
|
|
|
- line-height: 34px;
|
|
|
- position: absolute;
|
|
|
- top: -45px;
|
|
|
- left: 0;
|
|
|
- width: 87px;
|
|
|
- height: 41px;
|
|
|
- background: url("../../assets/img/msg.png");
|
|
|
- background-size: 100% 100%;
|
|
|
- }
|
|
|
- .hovAc {
|
|
|
- transform: translateY(0px);
|
|
|
- opacity: 1;
|
|
|
- }
|
|
|
- & > p {
|
|
|
- font-size: 14px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|