<template>
  <div style="height:100%">
  <iframe id="show-iframe" style="height:95%;width:100%" frameborder=0 name="showHere" scrolling=auto :src="src"></iframe>
  <img  src="~@/assets/ustb-oai.com.png" alt="electron-vue" height="4%" > 
  </div>
</template>

<script>
import Vue from "vue";
import vueJsonTreeView from "vue-json-tree-view";
import * as flexranAPI from "../../../utils/flexranAPI";
Vue.use(vueJsonTreeView);
export default {
  data() {
    return {
            dataList:[],
            host:'',
            action:'',
            src:'http://202.204.54.185:2222/ssh/host/192.168.1.210?autologin=1&user=root&pass=199710'
    };
  },
  async mounted() {
      this.host=this.$route.params.host
      this.action=this.$route.params.action
      this.user=this.$route.params.user
      this.pass=this.$route.params.pass
      let res = await flexranAPI.DETECT({})
      try {
      let returnCitySN = JSON.parse(res.split("= ")[1].split(";")[0])
      let local = await flexranAPI.DETECT_LOCAL({},returnCitySN['cip'])
      if(local.area=="北京科技大学"){
       this.src=`http://202.204.54.185:2222/ssh/host/${this.host}?autologin=1&user=${this.user}&pass=${this.pass}`

      }
      else{
        this.src=`http://ustb-oai.com:2222/ssh/host/${this.host}?autologin=1&user=${this.user}&pass=${this.pass}`

      }
      } catch (error) {
       this.src=`http://202.204.54.185:2222/ssh/host/${this.host}?autologin=1&user=${this.user}&pass=${this.pass}`
        
      }


  },
  methods:{
    getJS (){
      var child = document.getElementById("show-iframe").contentWindow;
      let a= child.document.getElementById("menu");
      console.log(a)
    }
  },
  
};
</script>

<style>
html,body,#app{
 height: 100%;
}
.left{}
</style>
