portraitMap.vue 1.91 KB
<route lang="yaml">
    # 组件名称
    name: ""
  </route>

<template>
  <div class="container_wrap" v-loading="loading">
    <iframe :src="link" frameborder="0" @load="iframeLoad"></iframe>
  </div>
</template>

<script lang="ts" setup name="portraitMap">

import { ref, reactive, computed } from "vue";

import { JSEncrypt } from 'jsencrypt';
import { useElementSize } from "@vueuse/core";
import useUserStore from '@/store/modules/user'
const route = useRoute()

const encryptor = new JSEncrypt()
const publicKey = '-----BEGIN PUBLIC KEY-----MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgFiv3Ko6rOBvWDK96tIExpdyuuQAGgZo0YmQxpT10hD3qu/MnNKlIJgo4+NwUHcwpleKE2DBOxgvCeMtUoP4FDWt8q18X+4+7t8p0D/57NhA0liNKQ/Ise6b5i293ht1XPen3XhR5xIcDNxauQ5vKqdwwzhoonsbJDtbowoinLQbAgMBAAE=-----END PUBLIC KEY-----';
function encrypt(txt) {
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt); // 对数据进行加密
}
const userStore = useUserStore()
const userInfoData = JSON.parse(localStorage.userData)
const url: any = 'https://scm-operation.csyaoly.com/portraitBMap?fUrl=portraitMap&tUrl=portraitBMap';
// const url: any = 'http://localhost:8086/portraitBMap?fUrl=portraitMap&tUrl=portraitBMap';

const link = ref('')
const loading = ref(true);
const iframeLoad = () => {
  loading.value = false;
}

// 搜索区域的schema
onBeforeMount(() => {
  const loginInfo = JSON.stringify({
    username: '13900000023',
    pwd: '666666',
    timestamp: new Date().getTime()
  })
  let linkValue = decodeURIComponent(url) + '&loginInfo=' + encodeURI(encrypt(loginInfo));
  link.value = linkValue;
});

onActivated(() => {
  let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === route.fullPath);
  if (tab) {
    tab.meta.title = route.query.title || '全景地图';
  }
})

</script>

<style lang="scss" scoped>
.container_wrap {
  width: 100%;
  height: 100%;
  padding: 0;

  iframe {
    width: 100%;
    height: 100%;
  }
}
</style>