Commit 43aa5bbe authored by tianhongyang's avatar tianhongyang

iframe子系统传参添加是否为外部链接

parent 22d5962b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: thy * @Author: thy
* @Date: 2023-11-08 09:28:17 * @Date: 2023-11-08 09:28:17
* @LastEditors: thy * @LastEditors: thy
* @LastEditTime: 2023-11-14 13:56:59 * @LastEditTime: 2023-11-17 09:36:01
* @Description: file content * @Description: file content
* @FilePath: \dsk-operate-ui\src\utils\iframeTools.js * @FilePath: \dsk-operate-ui\src\utils\iframeTools.js
*/ */
...@@ -23,6 +23,7 @@ class IframeTools { ...@@ -23,6 +23,7 @@ class IframeTools {
count = 0; count = 0;
authToken = ""; authToken = "";
origin = location.origin; origin = location.origin;
isOuter = false;
/** /**
* 插件域名地址 * 插件域名地址
* @param {string} pluginDomain 默认当前环境变量VUE_APP_SUB_SYSTEM_ADDRESS * @param {string} pluginDomain 默认当前环境变量VUE_APP_SUB_SYSTEM_ADDRESS
...@@ -40,6 +41,7 @@ class IframeTools { ...@@ -40,6 +41,7 @@ class IframeTools {
this.queryParams = query; this.queryParams = query;
this.pluginDomain = pluginDomain; this.pluginDomain = pluginDomain;
this.subSystemIframe = subSystemIframe; this.subSystemIframe = subSystemIframe;
this.isOuter = query.isOuter && typeof JSON.parse(query.isOuter) == "boolean" ? JSON.parse(query.isOuter) : false;
// 是一个合法地址 初始化 先替换域名地址 再获取令牌并 拼接 // 是一个合法地址 初始化 先替换域名地址 再获取令牌并 拼接
this.init(); this.init();
} catch (error) { } catch (error) {
...@@ -59,7 +61,7 @@ class IframeTools { ...@@ -59,7 +61,7 @@ class IframeTools {
// 获取子系统path // 获取子系统path
const subSystemUrl = new URL(this.queryParams.url); const subSystemUrl = new URL(this.queryParams.url);
// 以环境文件地址为准 拼接子系统查询参数 // 以环境文件地址为准 拼接子系统查询参数
let url = `${this.pluginDomain}${subSystemUrl.pathname == "/" ? "" : subSystemUrl.pathname}`; let url = this.isOuter ? this.queryParams.url : `${this.pluginDomain}${subSystemUrl.pathname == "/" ? "" : subSystemUrl.pathname}`;
// 子系统地址带有查询参数 处理 // 子系统地址带有查询参数 处理
Object.keys(subSystemParams).length ? url = `${url}?${paramsToQuery(subSystemParams)}` : null; Object.keys(subSystemParams).length ? url = `${url}?${paramsToQuery(subSystemParams)}` : null;
// 获取授权 token // 获取授权 token
...@@ -75,6 +77,7 @@ class IframeTools { ...@@ -75,6 +77,7 @@ class IframeTools {
}; };
url = `${url}${paramsToQuery(query) ? "?" + paramsToQuery(query) : ""}`; url = `${url}${paramsToQuery(query) ? "?" + paramsToQuery(query) : ""}`;
this.queryParams.url = url; this.queryParams.url = url;
console.log(this.queryParams.url);
// 倒计时刷新token 正常误差10s 提前获取 // 倒计时刷新token 正常误差10s 提前获取
this.setTokenRefresh(expire * 1000 - 1000 * 10); this.setTokenRefresh(expire * 1000 - 1000 * 10);
} }
......
...@@ -162,7 +162,7 @@ export default { ...@@ -162,7 +162,7 @@ export default {
console.log(error); console.log(error);
} finally { } finally {
loadingService.close(); loadingService.close();
successCount > 0 ? elementMessageSingleton("success", "添加账号成功") : elementMessageSingleton("error", "添加账号失败"); successCount > 0 ? elementMessageSingleton("success", "添加账号成功") : null;
} }
}); });
} }
......
<template> <template>
<div class="iframe-com-ins" :style="stylesTransform(containerStyles)"> <div class="iframe-com-ins" :style="stylesTransform(containerStyles)">
<iframe :src="url" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" width="100%" <iframe class="iframe-subsystem-ins" :src="url" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" width="100%"
:style="stylesTransform(iframeInsStyles)"></iframe> :style="stylesTransform(iframeInsStyles)"></iframe>
</div> </div>
</template> </template>
...@@ -71,5 +71,10 @@ export default { ...@@ -71,5 +71,10 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
.iframe-subsystem-ins {
width: 100%;
height: 100%;
}
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment