whyczyk
2022-03-02 733823ffa701f749c7154cacf60a26951891f2ca
src/pages/exhibition.vue
@@ -3,7 +3,7 @@
      <screen-title :title="nowlayOut.appName" :bgImg="screenTitleBg" v-if="isHeader"></screen-title>
      <div class="pageWarp" ref="pageWarp">
         <vue-draggable-resizable :w="item.w" :h="item.h" :x="item.x" :y="item.y" :parent="true" :debug="false" :snap="true" :snapTolerance="5" :draggable="false" :resizable="false" style="transition: none; will-change: transform;" v-for="(item,i) in nowlayOut.children" :key="i">
            <div @contextmenu.prevent.stop="openMenu(item,$event)" style="width:100%;height:100%;">
            <div style="width:100%;height:100%;">
               <layout-box :title="item.name">
                  <div style="width:100%;height:100%" :id="'layout-box'+item.id" :ref="'layout-box'+item.id" v-if="isNow"></div>
               </layout-box>
@@ -41,15 +41,22 @@
         screenTitleBg: null,
         screenBg: null,
         isHeader: true,
         isNow: true
         isNow: true,
         state: 1,
      }
   },
   mounted() {
      if (this.$route.query.userId) {
         localStorage.setItem('userId', this.$route.query.userId);
      }
      this.nowlayOut.appName = this.$route.query.name;
      if (this.$route.query.head && this.$route.query.head == 1) {
         this.isHeader = false
      }
      this.$nextTick(() => {
         if (this.$route.query.newPlatform) {
            this.$store.dispatch('app/setNewPlatform', this.$route.query.newPlatform)
         }
         clientWidth = this.$refs.pageWarp.clientWidth;
         clientHeight = this.$refs.pageWarp.clientHeight;
         this.loadLayout();
@@ -102,11 +109,35 @@
                        nowBox[0].appendChild(chartModular.$el)
                        this.modularArr.push(chartModular);
                     }
                     chartModular.setData();
                     if (chartModular.id == "chart14" && sessionStorage.getItem('newPlatform')) {
                        this.$nextTick(() => {
                           chartModular.$children[0].setData()
                        })
                     } else {
                        chartModular.setData();
                     }
                     chartModular.resize();
                  }, 0)
               })
               window.addEventListener("message", (msg) => {
                  // 处理数据
                  this.state = msg.data.state
                  if (this.state == 1) {
                     this.modularArr.map(item => {
                        if (item.postData) {
                           item.postData()
                        }
                     })
                  } else if (this.state == 0) {
                     this.modularArr.map(item => {
                        if (item.outClear) {
                           item.outClear()
                        }
                     })
                  }
               });
            }
         }).catch((err) => {
            console.log(err)