123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- <template>
- <div class="raside">
- <vsearch @isshowSearch="handleShowSearch" />
- <div v-show="!showsearch">
- <rmenu :tourStatus="tourStatus" @play="toggle" />
- <div class="smenu">
- <template>
- <ul>
- <li v-for="(item, i) in menu" :key="i">
- <div @click="onClick(item)">
- <div
- :title="item.name"
- :class="{ iactive: currentActive.id == item.id }"
- :style="{ backgroundImage: `url(${require(`@/assets/images/proj2022/xueliezhen/${item.id}.png`)})` }"
- ></div>
- <span>{{ item.name }}</span>
- </div>
- </li>
- </ul>
- </template>
- <transition name="likeAddAnimate">
- <div class="good" v-show="isShowGood">
- <div class="num">+{{ 1 }}</div>
- </div>
- </transition>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { supCount, getsupCount } from "@/config/api";
- import vsearch from "./raside/search.vue";
- import rmenu from "./raside/rmenu.vue";
- import { Booth } from "@/data/booth.js";
- import { g_findCloseNum } from "@/utils/index.js";
- let findNextItem = (arr, currentItem) => {
- let idx = arr.findIndex((item) => item == currentItem);
- if (idx == arr.length - 1) {
- idx = 0;
- } else {
- idx += 1;
- }
- return arr[idx];
- };
- let findPrevItem = (arr, currentItem) => {
- let idx = arr.findIndex((item) => item == currentItem);
- if (idx == 0) {
- idx = arr.length - 1;
- } else {
- idx -= 1;
- }
- return arr[idx];
- };
- let menu = [
- {
- id: "like",
- maidiancode:'p_func1',
- name: "点赞",
- },
- {
- id: "message",
- name: "留言",
- maidiancode:'p_func2',
- cp: "vcontent",
- },
- {
- id: "share",
- name: "分享",
- maidiancode:'p_func3',
- cp: "qrcode",
- },
- {
- id: "clear",
- name: "清屏",
- },
- ];
- export default {
- props: ["tourStatus", "currentPanoid"],
- data() {
- return {
- menu,
- goodNum: 1099,
- isShowGood: false,
- showsearch: false,
- isShowZX: true,
- currentActive: {},
- flying: false,
- };
- },
- components: { vsearch, rmenu },
- computed: {
- nextZhanXiang() {
- let zhanqu = Booth.find((item) => item.id === this.theme);
- let panoArr = zhanqu.company.map((item) => item.panoId);
- let currentIdx = panoArr.indexOf(this.currentPanoid);
- let nextPanoItem = "";
- if (currentIdx > -1) {
- if (currentIdx == panoArr.length - 1) {
- zhanqu = findNextItem(Booth, zhanqu);
- nextPanoItem = zhanqu.company[0];
- } else {
- currentIdx += 1;
- nextPanoItem = zhanqu.company[currentIdx];
- }
- } else {
- let ttt = g_findCloseNum(
- zhanqu.company.map((item) => item.panoId),
- this.currentPanoid
- );
- nextPanoItem = zhanqu.company.find((item) => item.panoId == ttt);
- }
- return nextPanoItem;
- },
- prevZhanXiang() {
- let zhanqu = Booth.find((item) => item.id === this.theme);
- let panoArr = zhanqu.company.map((item) => item.panoId);
- let currentIdx = panoArr.indexOf(this.currentPanoid);
- let prevPanoItem = "";
- if (currentIdx > -1) {
- if (currentIdx == 0) {
- zhanqu = findPrevItem(Booth, zhanqu);
- prevPanoItem = zhanqu.company[zhanqu.company.length - 1];
- } else {
- currentIdx -= 1;
- prevPanoItem = zhanqu.company[currentIdx];
- }
- } else {
- let ttt = g_findCloseNum(
- zhanqu.company.map((item) => item.panoId),
- this.currentPanoid
- );
- prevPanoItem = zhanqu.company.find((item) => item.panoId == ttt);
- }
- return prevPanoItem;
- },
- },
- methods: {
- handleShowSearch(data) {
- this.showsearch = data;
- },
- onClick(item) {
- this.currentActive = item;
- item.maidiancode && window.goldlog.record(`/${item.maidiancode}`, "", `snsScene=${item.maidiancode}&product=pcweb&pagename=中国网络文明建设成果展云展示`, "");
- setTimeout(() => {
- this.currentActive = {};
- }, 1000);
- if (item.id == "clear") {
- this.$bus.$emit("toggleClear", true);
- document.querySelector("#ifr").contentWindow.postMessage(
- {
- source: "toggleClear",
- data: true,
- },
- "*"
- );
- return;
- }
- item.path && this.$router.push(item.path);
- item.cp && this.$emit("opencp", item.cp);
- if (item.id == "like") {
- this.dianzan();
- }
- },
- onClickNavigate(type) {
- if (document.querySelector("#ifr").contentWindow.player.flying) {
- return;
- }
- if (type == "up") {
- this.$bus.$emit("ifrMessage", {
- events: "flyToPano",
- data: this.nextZhanXiang,
- });
- } else {
- this.$bus.$emit("ifrMessage", {
- events: "flyToPano",
- data: this.prevZhanXiang,
- });
- }
- },
- dianzan() {
- if (this.isShowGood) return;
- // getsupCount((res) => {
- // console.log(111111,res);
- // this.goodNum = Number(this.goodNum ? this.goodNum : (res.voteNum || 0) );
- this.isShowGood = true;
- setTimeout(() => {
- this.isShowGood = false;
- }, 2500);
- supCount(() => {});
- // });
- },
- toggle() {
- let fn = this.tourStatus ? "stopTour" : "startAndPlay";
- this.$bus.$emit("ifrMessage", {
- events: "toggleTour",
- data: fn,
- });
- },
- },
- mounted() {
- this.$bus.$on("toggleShowZX", (data) => {
- this.isShowZX = data;
- });
- this.$bus.$on("resetMenuActive", () => {
- this.currentActive = {};
- });
- },
- };
- </script>
- <style lang="less" scoped>
- .raside {
- position: fixed;
- top: 190px;
- right: 0;
- z-index: 999;
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- .smenu {
- bottom: 22px;
- left: 0;
- position: fixed;
- transition: 0.3s ease all;
- width: 100%;
- .fandb {
- border-radius: 60px;
- width: 285px;
- height: 45px;
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- border-radius: 31px;
- backdrop-filter: blur(6px);
- display: flex;
- justify-content: center;
- align-items: center;
- .line {
- display: inline-block;
- width: 1px;
- height: 45px;
- background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, #ffffff 48%, rgba(255, 255, 255, 0.5) 100%);
- }
- > div {
- display: flex;
- cursor: pointer;
- width: 49%;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- }
- }
- > ul {
- background-repeat: no-repeat;
- background-size: 100% 100%;
- display: flex;
- text-align: center;
- justify-content: center;
- align-items: center;
- text-align: center;
- position: absolute;
- right: 10px;
- bottom: 0;
- > li {
- display: inline-block;
- padding: 0 8px;
- > div {
- cursor: pointer;
- display: flex;
- flex-direction: column;
- text-align: center;
- justify-content: center;
- > div {
- width: 50px;
- height: 50px;
- overflow: hidden;
- background-position: 0 0;
- background-size: auto 100%;
- &.iactive {
- animation: boom-open-data 1s steps(25) forwards;
- }
- }
- }
- }
- }
- }
- .smtop {
- bottom: 162px;
- .good {
- bottom: 176px;
- }
- }
- .likeAddAnimate-enter-active,
- .likeAddAnimate-leave-active {
- transition: all 2.5s ease;
- }
- .likeAddAnimate-enter,
- .likeAddAnimate-leave {
- transform: translate(-10%, 0) scale(0);
- opacity: 0;
- }
- .likeAddAnimate-enter-to,
- .likeAddAnimate-leave-to {
- transform: translate(-10%, -70px) scale(1.05);
- opacity: 1;
- }
- .good {
- position: fixed;
- bottom: 36px;
- right: 230px;
- display: flex;
- z-index: 999;
- .pic {
- width: 35px;
- > img {
- width: 100%;
- height: 100%;
- }
- }
- .num {
- margin-top: 10px;
- margin-left: 0;
- }
- }
- }
- </style>
|