Commit 746259ee authored by tianhongyang's avatar tianhongyang

公招市场 外部容器样式控制

parent d3d79069
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"axios": "0.24.0", "axios": "0.24.0",
"clipboard": "2.0.8", "clipboard": "2.0.8",
"core-js": "3.25.3", "core-js": "^3.32.2",
"echarts": "^5.0.0", "echarts": "^5.0.0",
"el-table-horizontal-scroll": "^1.2.5", "el-table-horizontal-scroll": "^1.2.5",
"element-resize-detector": "^1.2.4", "element-resize-detector": "^1.2.4",
......
<template> <template>
<div v-loading="loading" class="app-container"> <div v-loading="loading" class="market-container">
<iframe id="companyIframe" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" width="100%" :style="{height:iframeHight+'px'}" :src="src" /> <iframe id="companyIframe" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" width="100%" :style="{height:iframeHight+'px'}"
:src="src" />
</div> </div>
</template> </template>
<script> <script>
import { steerScroll } from '@/assets/js/jskplug' import { steerScroll } from '@/assets/js/jskplug';
import { dskAccessToken } from '@/api/common' import { dskAccessToken } from '@/api/common';
export default { export default {
name: 'Enterprise', name: 'Enterprise',
components: { components: {
...@@ -19,75 +20,77 @@ ...@@ -19,75 +20,77 @@
iframeTimer: '', // 是否加载中定时器-当前页控制 iframeTimer: '', // 是否加载中定时器-当前页控制
footHeight: 0, //底部高度,若为0(页面内部嵌套或者没有底部板块) footHeight: 0, //底部高度,若为0(页面内部嵌套或者没有底部板块)
iframeHight: window.innerHeight, // iframe高度-当前页控制 iframeHight: window.innerHeight, // iframe高度-当前页控制
navigation: {isFixed: true, fixedHeight: 56, totalHeight: 68}, // iframe之外页面顶部对象,ifFixed:是否浮动;fixedHeight:浮动对象高度;totalHeight:顶部整体高度 navigation: { isFixed: true, fixedHeight: 56, totalHeight: 68 }, // iframe之外页面顶部对象,ifFixed:是否浮动;fixedHeight:浮动对象高度;totalHeight:顶部整体高度
src: '', //iframe嵌套页面地址 src: '', //iframe嵌套页面地址
// domain: 'https://plug.jiansheku.com', // 插件地址 // domain: 'https://plug.jiansheku.com', // 插件地址
domain: 'https://pre-plug.jiansheku.com', // 插件地址测试 // domain: 'https://pre-plug.jiansheku.com', // 插件地址测试
// domain: 'http://192.168.60.19:3400', domain: 'http://192.168.60.104:3400',
// domain: 'http://192.168.60.30:3300',
ak: 'aec7b3ff2y2q8x6t49a7e2c463ce21912', // 需要携带的sdkId ak: 'aec7b3ff2y2q8x6t49a7e2c463ce21912', // 需要携带的sdkId
timelongs:7200,//刷新token时间 timelongs: 7200,//刷新token时间
tokentimer:null, tokentimer: null,
} };
}, },
created() { created() {
this.gettokens() this.gettokens();
}, },
mounted() { mounted() {
this.iframeLoading() // 判断iframe页面是否加载完成-当前页控制 this.iframeLoading(); // 判断iframe页面是否加载完成-当前页控制
steerScroll('companyIframe', this.navigation, this.footHeight, true) // iframeId: iframe的id;navigation:页面排除iframe后剩下的顶部高度;footHeight: 页面排除iframe后剩下的底部高度;state:监听or移除监听;parentId: 父级id[不带默认就是铺满整个页面]];_this:指向当前实例(可忽略) steerScroll('companyIframe', this.navigation, this.footHeight, true); // iframeId: iframe的id;navigation:页面排除iframe后剩下的顶部高度;footHeight: 页面排除iframe后剩下的底部高度;state:监听or移除监听;parentId: 父级id[不带默认就是铺满整个页面]];_this:指向当前实例(可忽略)
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.iframeTimer) // -当前页控制 clearInterval(this.iframeTimer); // -当前页控制
steerScroll('companyIframe', this.navigation, this.footHeight) // iframeId: iframe的id;navigation:页面排除iframe后剩下的顶部高度;footHeight: 页面排除iframe后剩下的底部高度;state:监听or移除监听;parentId: 父级id[不带默认就是铺满整个页面]];_this:指向当前实例(可忽略) steerScroll('companyIframe', this.navigation, this.footHeight); // iframeId: iframe的id;navigation:页面排除iframe后剩下的顶部高度;footHeight: 页面排除iframe后剩下的底部高度;state:监听or移除监听;parentId: 父级id[不带默认就是铺满整个页面]];_this:指向当前实例(可忽略)
clearInterval(this.tokentimer) clearInterval(this.tokentimer);
}, },
methods: { methods: {
gettokens(){ gettokens() {
dskAccessToken().then(res=>{ dskAccessToken().then(res => {
if(res.code == 200){ if (res.code == 200) {
this.timelongs = res.data.expire this.timelongs = res.data.expire;
this.ak = res.data.accessToken this.ak = res.data.accessToken;
this.src = `${this.domain}/search/market?ak=${this.ak}&initTime=${new Date().getTime()}&uid=${this.ak}` this.src = `${this.domain}/search/market?ak=${this.ak}&initTime=${new Date().getTime()}&uid=${this.ak}`;
this.refreshtoken() this.refreshtoken();
}else{ } else {
clearTimeout(this.tokentimer) clearTimeout(this.tokentimer);
} }
}) });
}, },
refreshtoken(){ refreshtoken() {
this.tokentimer = setTimeout(()=>{ this.tokentimer = setTimeout(() => {
dskAccessToken().then(res => { dskAccessToken().then(res => {
if (res.code == 200) { if (res.code == 200) {
this.timelongs = res.data.expire this.timelongs = res.data.expire;
this.ak = res.data.accessToken this.ak = res.data.accessToken;
let ifam = document.getElementById('companyIframe') //iframe的id let ifam = document.getElementById('companyIframe'); //iframe的id
let akObj = res.data.expire //accessToken接口的返回值 let akObj = res.data.expire; //accessToken接口的返回值
let initTime = new Date().getTime() //accessToken接口返回后的当前时间戳 let initTime = new Date().getTime(); //accessToken接口返回后的当前时间戳
ifam.contentWindow.postMessage({ 'accessToken': akObj.accessToken, 'initTime': initTime }, '*') ifam.contentWindow.postMessage({ 'accessToken': akObj.accessToken, 'initTime': initTime }, '*');
}else{ } else {
clearTimeout(this.tokentimer) clearTimeout(this.tokentimer);
} }
}) });
}, this.timelongs*1000) }, this.timelongs * 1000);
}, },
//判断iframe页面是否加载完成-当前页控制 //判断iframe页面是否加载完成-当前页控制
iframeLoading() { iframeLoading() {
let iframeHeight = document.getElementById("companyIframe").clientHeight, number = 0 let iframeHeight = document.getElementById("companyIframe").clientHeight, number = 0;
this.iframeTimer = setInterval(()=>{ this.iframeTimer = setInterval(() => {
number ++ number++;
if(document.getElementById("companyIframe").clientHeight != iframeHeight || number == 5000){ if (document.getElementById("companyIframe").clientHeight != iframeHeight || number == 5000) {
this.loading = false this.loading = false;
clearInterval(this.iframeTimer) clearInterval(this.iframeTimer);
}
})
} }
});
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.app-container{ .market-container {
padding: 0; width: 100%;
} height: 100%;
padding: 16px 24px;
box-sizing: border-box;
}
</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