Commit eb104b74 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 9fad306d 4377dc17
<template>
<!-- 应用预览页面 -->
<div class="app-preview flex flexc jcc aic">
<div class="header">
<div class="app-preview">
<!-- <div class="header">
<span class="btn" @click="handleBack">
<a-icon type="left" class="mr10" />
<span>返回上一级</span>
</span>
</div>
<div class="main flex1">
</div> -->
<!-- <div class="main flex1">
<iframe
style="width: 100%; height: 100%"
:src="previewUrl"
frameborder="0"
></iframe>
</div>
</div> -->
<iframe
name="myIframe"
style="width: 100%; height: 100%"
:src="previewInfo.previewUrl"
frameborder="0"
></iframe>
</div>
</template>
......@@ -21,45 +27,80 @@
export default {
data() {
return {
previewUrl: this.$route.query.previewUrl,
previewInfo: this.$route.query,
isReady: false,
};
},
created() {
// 接收子级返回首页指令
// window.onmessage = (res) => {
// if (res.data.message === "返回首页") {
// this.$router.push("/");
// }
// };
window.addEventListener("message", this.getChildrenMsg);
},
watch: {
isReady(newVal) {
if (newVal) {
this.sendInfo();
}
},
},
methods: {
getChildrenMsg(res) {
if (res.data.type === "childStatus") {
this.isReady = res.data.isReady;
}
},
sendInfo() {
let obj = {
type: "siteInfo",
siteId: this.previewInfo.siteId,
appId: this.previewInfo.appId,
};
/* eslint-disable */
myIframe.window.postMessage(obj, "*");
},
handleBack() {
this.$router.back();
},
},
beforeDestroy() {
window.removeEventListener("message", this.getChildrenMsg);
},
};
</script>
<style lang="less" scoped>
.app-preview {
width: 100%;
width: 1920px;
height: 1080px;
padding-bottom: 20px;
// padding-bottom: 20px;
background-color: #f5f5f5;
.header {
width: 100%;
height: 100px;
line-height: 100px;
height: 100px;
padding: 0px 40px;
margin-bottom: 10px;
background: url("../../../assets/img/title.jpg") no-repeat center;
background-size: 100% 100%;
box-shadow: 0px 2px 6px 6px #ccc;
.back-text {
font-size: 28px;
color: #ffffff;
}
.btn {
font-size: 28px;
color: #fff;
cursor: pointer;
}
}
.main {
width: 98%;
}
// .header {
// width: 100%;
// height: 100px;
// line-height: 100px;
// height: 100px;
// padding: 0px 40px;
// margin-bottom: 10px;
// background: url("../../../assets/img/title.jpg") no-repeat center;
// background-size: 100% 100%;
// box-shadow: 0px 2px 6px 6px #ccc;
// .back-text {
// font-size: 28px;
// color: #ffffff;
// }
// .btn {
// font-size: 28px;
// color: #fff;
// cursor: pointer;
// }
// }
// .main {
// width: 98%;
// }
}
</style>
\ No newline at end of file
......@@ -225,12 +225,24 @@ export default {
let res = await previewVersion({ appVersionId });
let { code, data } = res.data;
if (code === 1) {
this.$router.push({
let routeUrl = this.$router.resolve({
path: "/apppreview",
query: {
previewUrl: data,
siteId: this.appInfo.siteId,
appId: this.appId,
},
});
window.open(routeUrl.href, "_blank");
// this.$router.push({
// path: "/apppreview",
// query: {
// previewUrl: data,
// siteId: this.appInfo.siteId,
// appId: this.appId,
// },
// });
// window.open(data);
}
},
......
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