接入全景数字地图
Showing
1 changed file
with
68 additions
and
0 deletions
src/views/data_meta/portraitMap.vue
0 → 100644
| 1 | <route lang="yaml"> | ||
| 2 | # 组件名称 | ||
| 3 | name: "" | ||
| 4 | </route> | ||
| 5 | |||
| 6 | <template> | ||
| 7 | <div class="container_wrap" v-loading="loading"> | ||
| 8 | <iframe :src="link" frameborder="0" @load="iframeLoad"></iframe> | ||
| 9 | </div> | ||
| 10 | </template> | ||
| 11 | |||
| 12 | <script lang="ts" setup name="portraitMap"> | ||
| 13 | |||
| 14 | import { ref, reactive, computed } from "vue"; | ||
| 15 | |||
| 16 | import { JSEncrypt } from 'jsencrypt'; | ||
| 17 | import { useElementSize } from "@vueuse/core"; | ||
| 18 | import useUserStore from '@/store/modules/user' | ||
| 19 | const route = useRoute() | ||
| 20 | |||
| 21 | const encryptor = new JSEncrypt() | ||
| 22 | const publicKey = '-----BEGIN PUBLIC KEY-----MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgFiv3Ko6rOBvWDK96tIExpdyuuQAGgZo0YmQxpT10hD3qu/MnNKlIJgo4+NwUHcwpleKE2DBOxgvCeMtUoP4FDWt8q18X+4+7t8p0D/57NhA0liNKQ/Ise6b5i293ht1XPen3XhR5xIcDNxauQ5vKqdwwzhoonsbJDtbowoinLQbAgMBAAE=-----END PUBLIC KEY-----'; | ||
| 23 | function encrypt(txt) { | ||
| 24 | encryptor.setPublicKey(publicKey) // 设置公钥 | ||
| 25 | return encryptor.encrypt(txt); // 对数据进行加密 | ||
| 26 | } | ||
| 27 | const userStore = useUserStore() | ||
| 28 | const userInfoData = JSON.parse(localStorage.userData) | ||
| 29 | const url: any = 'https://scm-operation-test.csbr.cn/portraitBMap?fUrl=portraitBMap'; | ||
| 30 | |||
| 31 | const link = ref('') | ||
| 32 | const loading = ref(true); | ||
| 33 | const iframeLoad = () => { | ||
| 34 | loading.value = false; | ||
| 35 | } | ||
| 36 | |||
| 37 | // 搜索区域的schema | ||
| 38 | onBeforeMount(() => { | ||
| 39 | const loginInfo = JSON.stringify({ | ||
| 40 | username: '13822222222', | ||
| 41 | pwd: '666666', | ||
| 42 | timestamp: new Date().getTime() | ||
| 43 | }) | ||
| 44 | let linkValue = decodeURIComponent(url) + '&loginInfo=' + encodeURI(encrypt(loginInfo)); | ||
| 45 | link.value = linkValue; | ||
| 46 | }); | ||
| 47 | |||
| 48 | onActivated(() => { | ||
| 49 | let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === route.fullPath); | ||
| 50 | if (tab) { | ||
| 51 | tab.meta.title = route.query.title || '全景地图'; | ||
| 52 | } | ||
| 53 | }) | ||
| 54 | |||
| 55 | </script> | ||
| 56 | |||
| 57 | <style lang="scss" scoped> | ||
| 58 | .container_wrap { | ||
| 59 | width: 100%; | ||
| 60 | height: 100%; | ||
| 61 | padding: 0; | ||
| 62 | |||
| 63 | iframe { | ||
| 64 | width: 100%; | ||
| 65 | height: 100%; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | </style> |
-
Please register or sign in to post a comment