12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <template>
- <div class="container">
- <iframe :src="iframeSrc" class="full-iframe"></iframe>
- </div>
- </template>
- <script lang="ts" setup>
- import { ref, onMounted } from 'vue';
- import { useUserStore } from '@/store/modules/user';
- import { getAction } from '@/api/manage/manage';
- // 使用 setup
- const { userInfo } = useUserStore();
- const iframeSrc = ref('');
- onMounted(() => {
- getUrl();
- });
- // 获取 动态url
- function getUrl() {
- getAction('/adweb/logistics/getMeiri56Token', null).then((res) => {
- if (res.success) {
- const siteCode = localStorage.getItem('siteCode') || '';
- const realName = userInfo?.realname || '';
- const userId = userInfo?.id || '';
- // 获取 字典中存放的token
- const token = res.result || '';
- // 动态生成 URL
- iframeSrc.value = `https://meiri56.cn?company=${encodeURIComponent(siteCode)}&companyName=${encodeURIComponent(realName)}&userId=${encodeURIComponent(userId)}&token=${encodeURIComponent(token)}`;
- } else {
- console.error('未获取到 token!');
- }
- });
- }
- </script>
- <style scoped>
- .container {
- width: 100%;
- height: 100vh;
- margin: 0;
- padding: 0;
- overflow: hidden;
- display: flex;
- }
- .full-iframe {
- width: 100%;
- height: 100%;
- border: none;
- display: block;
- }
- </style>
|