Newer
Older
CloudBrainNew / src / views / mapViews / mapFrame.vue
[wangxitong] on 4 Jun 2021 2 KB 0604 submit

<template>
  <div ref="container" class="container">
    <!--内容-->
    <div ref="body" class="body">
      <img :src="frameImg" class="frame-img"/>
      <img :src="homeImg" class="home-img" @click="close"/>
      <div class="frame-div">
        <!--<img :src="currentScreen" style="z-index:1002;width:100%;height:100%"/>-->
        <iframe :src="currentScreen" scrolling="no" frameborder="0" id="iframe"></iframe>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MapFrame',
  data () {
    return {
      currentScreen: '',
      frameImg: require('@/assets/images/1411/frame.png'), // 边框图片
      homeImg: require('@/assets/images/button/home.png')
    }
  },
  mounted () {
    const that = this
    // this.calSize()
    window.onload = () => {
      that.calSize()
    }
    window.onresize = () => {
      that.calSize()
    }
    // window.open('http://11.100.6.143:10003/DisasterImpact', '_blank')
  },
  methods: {
    close () {
      this.currentScreen = ''
      this.$emit('watchChild')
    },
    reloadUrl () {
      // this.currentScreen = 'http://11.100.6.143:10003'
      this.currentScreen = 'http://113.194.84.171:9706/inspect_platform/web/index.html#/screen1'
    },
    // 计算屏幕各元素大小
    calSize () {
      const height = this.$refs.container.offsetHeight
      const headerHeight = this.$refs.header.$el.clientHeight
      const bodyHeight = height - headerHeight
      this.$refs.body.style.height = bodyHeight + 'px'
      console.log('calSize:' + bodyHeight)
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  @media screen and (max-width: 3000px) {
    .container{
      height: 100%;
      width:100%;
    }
  }
  @media screen and (min-width: 3000px) {
    .container{
      height: 1080px;
      width:1920px;
    }
  }
  .container{
    top:0px !important;
    background: url("../../assets/images/background/background-left.png") no-repeat;
    -webkit-background-size: 100% 100%;
    background-size: 100% 100%;
    background-color: black;
    /*display: flex;*/
    /*justify-content: space-between;*/
    /*flex-direction: column;*/
  }
  .body{
    /*flex:1;*/
    position:relative;
    height:100%;
    width:100%;
    .frame-img{
      position: absolute;
      z-index:999;
      width:100%;
      height:100%;
      top:50%;
      left:50%;
      transform: translate(-51%,-50%);
    }
    .home-img{
      position: absolute;
      right: 3em;
      top:1em;
      z-index:100000;
      width:2.5em;
      height:2.5em;
    }
    .frame-div{
      position: absolute;
      z-index:1000;
      width:100%;
      height:100%;
      top:50%;
      left:50%;
      transform: translate(-51%,-50%);
      padding:0.061rem 0.061rem;
      iframe{
        position:relative;
        width:100%;
        height:100%;
      }
    }
  }

</style>