<template>
|
<flex-layout no-bg>
|
<div
|
class="iframe-container"
|
v-loading="loading"
|
element-loading-text="加载中..."
|
element-loading-spinner="el-icon-loading"
|
element-loading-background="rgba(0, 0, 0, 0.2)"
|
>
|
<iframe v-if="src" scrolling="no" frameborder="0" :src="src"></iframe>
|
</div>
|
</flex-layout>
|
</template>
|
|
<script>
|
import getScreenUrl from "@/assets/js/tools/getScreenUrl";
|
import axios from "@/assets/js/axios";
|
export default {
|
data() {
|
let url = getScreenUrl();
|
|
return {
|
loading: true,
|
url: url,
|
src: "",
|
};
|
},
|
methods: {
|
getActivePage(userId) {
|
axios({
|
methods: "get",
|
url: this.url + "application/active",
|
params: {
|
userId: userId,
|
},
|
})
|
.then((res) => {
|
let rs = res.data;
|
// console.log(rs);
|
if (rs.code == 1 && rs.data) {
|
let id = rs.data.id;
|
let name = rs.data.name;
|
let screenUrl;
|
if (process.env.NODE_ENV != "dev") {
|
screenUrl = this.url + "index.html";
|
} else {
|
screenUrl = "http://localhost:8008/";
|
}
|
this.src =
|
screenUrl +
|
"#/exhibition?id=" +
|
id +
|
"&name=" +
|
name +
|
"&head=1" +
|
"&userId=" +
|
userId +
|
"&newPlatform=1";
|
} else {
|
// this.$router.push("index");
|
window.parent.postMessage({
|
type: "showDefault",
|
});
|
}
|
this.loading = false;
|
})
|
.catch((error) => {
|
window.parent.postMessage({
|
type: "showDefault",
|
});
|
this.loading = false;
|
console.log(error);
|
});
|
},
|
},
|
mounted() {
|
this.$nextTick(() => {
|
let userId = sessionStorage.getItem("userId");
|
this.getActivePage(userId);
|
window.addEventListener("message", (msg) => {
|
if (msg?.data?.params?.pageInfo?.src) {
|
// 处理数据
|
this.$router.push(msg?.data?.params?.pageInfo?.src);
|
}
|
});
|
});
|
},
|
beforeDestroy() {},
|
};
|
</script>
|
|
<style scoped>
|
.iframe-container {
|
height: 100%;
|
}
|
.iframe-container > iframe {
|
width: 100%;
|
height: 100%;
|
}
|
</style>
|