This commit is contained in:
liuye
2022-06-28 09:15:10 +08:00
parent 6896dfd197
commit b9964d64b0
32 changed files with 1246 additions and 929 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="AppGigscreenViewer">
<section class="AppGigscreenViewer">
<div v-if="!component">
<div
class="component-item"
@@ -14,21 +14,18 @@
}"
v-for="(item, index) in componentList"
:key="index">
<RenderElement :instance="instance" :data="item" :index="index" :theme="dashboard.theme"></RenderElement>
<ai-dv-render :instance="instance" :data="item" :index="index" :theme="dashboard.theme"/>
</div>
</div>
<components v-else :is="component" :dict="dict" :instance="instance" :nav="meta"/>
</div>
</section>
</template>
<script>
import RenderElement from '../designer/components/RenderElement'
export default {
name: 'AppGigscreenViewer',
label: '大屏预览',
props: {
instance: Function,
dict: Object,
@@ -38,17 +35,11 @@ export default {
default: '/app'
}
},
watch: {
id(v) {
this.getInfo(v)
}
},
components: {
RenderElement
},
data() {
return {
component: '',
@@ -65,32 +56,25 @@ export default {
meta: {}
}
},
created() {
this.getInfo(this.id)
// this.scale = document.body.clientWidth / 1920
},
mounted() {
this.$nextTick(() => {
let content = document.querySelector('#dv-full-screen-container')
if (content) {
const transform = content.style.transform
const scale = transform.replace('scale', '').replace('(', '').replace(')', '')
if (scale == 1) {
this.scale = document.body.clientWidth / 1920
}
}
})
},
methods: {
getInfo(id) {
this.component = null
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenDetailById?id=${id}`).then(res => {
id && this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenDetailById?id=${id}`).then(res => {
if (res?.data) {
const config = JSON.parse(res.data.config)
if (config.custom) {
@@ -123,7 +107,6 @@ export default {
}
})
},
getSourceData(item, index) {
const api = item.dataType === 'apiData' ? item.api : `${this.urlPrefix}/appdiylargescreen/statisticsByLsid?id=${item.sourceDataId}`
this.instance.post(api).then(res => {
@@ -174,9 +157,13 @@ export default {
...obj
})
})
} else dynamicData = res.data
} else {
dynamicData = res.data
}
}
this.$set(this.componentList[index], item.dataType, dynamicData)
} else {
this.$set(this.componentList[index], item.dataType, [])
}
}
})