<template>
  <div class="page_home">
    <div class="swiper-slide">
      <div style="widht:100%;height:100%">
         <iframe  :src = this.customUrl width="100%" height="100%" marginwidth="0" frameborder="no" scrolling="no"></iframe>
      </div>
    </div>
    <!-- tab切换 -->
    <div class="tabs">
      <ul class="tabList">
        <li
          class="tabOne"
          v-for="item in this.navigationdata"
          :key="item.id"
          @click="CallPhone(item.linktype,item.navaddress,item.user_org_id)">
          <img :src="item.nonavimages" alt />
          <span>{{item.navtitle}}</span>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getDefalutNavigationData,} from "@/api/micro/micro";
export default {
  data() {
    return {
      navigationdata: [],
      url:"",
      customUrl:"http://wx.kuyicloud.com/weixin/im/"+this.url,
    };
  },
  methods: {
     getDefalutNavigationData(orgid) {
      getDefalutNavigationData(orgid).then(response => {
        if (response.data.state == 1) {
          var navigation = response.data.data.navigation;
          for (let index = 0; index < navigation.length; index++) {
              navigation[3].nonavimages = "https://images.shengws.com/2101_o_1571990903053.png";
              
          }
          console.log("navigation是什么", navigation);
          this.navigationdata = navigation;
        }
      });
    },

     CallPhone(linktype, address,orgid) {
      console.log("orgid是什么啊",orgid)
      console.log("linktype",linktype)
      if(linktype == "1"){
          this.$router.push({
              path:"/microHome",
              query:{
                  orgid:orgid,
              }
          })
     }
      if (linktype == "2") {
        // window.location.href = address;
        this.$router.push({
          path: "/contactus",
          query: {
            orgid: orgid
          }
         });
      }
      if (linktype == "3") {
        window.location.href = "tel://" + address + "";
      }
      if (linktype == "4") {
        // window.location.href = address;
        this.$router.push({
          path:"/custom",
          query:{
            orgid:orgid
          }
        })
      }
    },
  },
   created(){
    const orgid = this.$route.query.orgid;
    this.url = orgid;
    console.log("我的世界", orgid);
    this.getDefalutNavigationData(orgid);
  },
 };
</script>

<style lang="scss" scoped>
@import "../../assets/styles/mixin.scss";

.page_home {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  > div:first-child {
    flex: 1;
    overflow: auto;
  }
  > div:first-child::-webkit-scrollbar {
    width: 0;
  }
  // border:solid 1px red;
}
// .bugone{
//   border: solid 1px red;
// }


.tabs {
  @include border-top;
  width: 100%;
  height: 3.125rem;
  box-sizing: border-box;
}
.tabList {
  display: flex;
  justify-content: space-around;
  height: 100%;
  .tabOne {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    img {
      // margin-top: 0.5rem;
      width: 1.875rem;
      height: 1.875rem;
    }
    span {
      font-size: 0.75rem;
      color: #999;
      // line-height: 1.3125rem;
    }
  }
}
</style>
