You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.5 KiB

5 years ago
<template>
5 years ago
<div class="preview-container">
<el-tabs v-if="projectConfig.projectKey" type="card">
5 years ago
<el-tab-pane>
<span slot="label"><i class="el-icon-mobile" />
手机
</span>
5 years ago
<div class="preview-layer">
<div class="preview-bg" />
5 years ago
<div class="preview-phone">
5 years ago
<iframe id="preview-html"
:src="mobilePreviewUrl"
class="preview-html" frameborder="0"
name="preview-html"
scrolling="auto"
5 years ago
/>
</div>
</div>
4 years ago
<div v-if="mobilePreviewUrl&&previewQrcode" class="qrcode-view">
<p>手机扫码查看效果</p>
<vue-qr
v-if="mobilePreviewUrl&&previewQrcode" :size="194" :text="mobilePreviewUrl"
/>
</div>
5 years ago
</el-tab-pane>
<el-tab-pane>
<span slot="label"><i class="el-icon-monitor" />
电脑
</span>
4 years ago
<el-scrollbar style="height: 77vh;overflow-x: hidden!important;">
<project-form
v-if="projectConfig.projectKey"
:project-config="projectConfig"
/>
</el-scrollbar>
5 years ago
</el-tab-pane>
</el-tabs>
5 years ago
</div>
</template>
<script>
5 years ago
import ProjectForm from './ProjectForm'
4 years ago
import VueQr from 'vue-qr'
5 years ago
5 years ago
export default {
5 years ago
name: 'PreView',
components: {
4 years ago
ProjectForm,
VueQr
},
props: {
previewQrcode: null
},
5 years ago
data() {
5 years ago
return {
4 years ago
projectKey: null,
5 years ago
mobilePreviewUrl: '',
5 years ago
projectConfig: {
projectKey: '',
showBtns: true
5 years ago
}
}
5 years ago
},
mounted() {
4 years ago
this.projectKey = this.$route.query.key
5 years ago
let url = window.location.protocol + '//' + window.location.host
4 years ago
this.mobilePreviewUrl = `${url}/s/${this.projectKey}`
5 years ago
this.$set(this.projectConfig, 'projectKey', this.projectKey)
5 years ago
}
}
</script>
4 years ago
<style lang="scss" scoped>
5 years ago
.preview-container {
4 years ago
margin: 0;
padding-top: 30px;
background-color: #f7f7f7;
}
::v-deep .el-tabs--card>.el-tabs__header .el-tabs__nav{
border: 1px solid #E4E7ED!important;
5 years ago
}
4 years ago
::v-deep .el-tabs__header {
4 years ago
width: 300px;
margin: 0 auto;
border: none;
5 years ago
}
4 years ago
4 years ago
::v-deep .el-tabs--card > .el-tabs__header .el-tabs__item {
4 years ago
background-color: white;
border: 1px solid white;
5 years ago
}
4 years ago
5 years ago
div.preview-layer {
4 years ago
width: 500px;
height: 100%;
margin: 10px auto;
right: 0;
text-align: center;
5 years ago
}
4 years ago
5 years ago
div.preview-layer .preview-bg {
4 years ago
width: 500px;
height: 100%;
margin: 20px auto;
z-index: 999;
opacity: 0.7;
5 years ago
}
4 years ago
5 years ago
div.preview-layer .preview-phone {
4 years ago
width: 372px;
height: 744px;
background: url('~@/assets/images/appearset_bgc_big.png');
background-size: 372px 744px;
z-index: 1000;
}
.qrcode-view{
position: absolute;
top: 0;
right: 20px;
p{
text-align: center;
font-size: 12px;
color: #303133;
}
5 years ago
}
4 years ago
5 years ago
.preview-html {
4 years ago
width: 345px !important;
height: 568px !important;
margin: 74px 0 0;
border-radius: 5px;
outline: none;
background-color: #fff;
border-width: 2px;
border-style: inset;
border-color: initial;
border-image: initial;
border-top-width: 0;
border-right-width: 0;
border-bottom-width: 0;
border-left-width: 0;
5 years ago
}
5 years ago
5 years ago
</style>