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.

101 lines
2.2 KiB

3 years ago
<template>
<view @click="$u.throttle(toAnswer)">
2 years ago
<iframe ref="iframe" src="static/html/explanation.html" frameborder="0"></iframe>
3 years ago
</view>
</template>
<script>
export default {
data() {
2 years ago
return {
flag: true
};
3 years ago
},
methods: {
2 years ago
showVr (id) {
this.$u.api.baseFormShow({
table_name: 'map_point_contents',
id
})
},
3 years ago
toAnswer () {
uni.navigateTo({
2 years ago
url: `/pages/answer/answer?id=${this.$route.query?.id}`
3 years ago
})
2 years ago
},
2 years ago
async getImages (id) {
const res = await this.$u.api.baseFormIndex({
table_name: 'map_point_images',
'with_relations[0]': 'image',
'with_relations[1]': 'video',
'filter[0][key]': 'map_point_id',
'filter[0][op]': 'eq',
'filter[0][value]': id
})
return res
},
2 years ago
async getDetail (id) {
2 years ago
const res = await this.$u.api.pointDetail({
//table_name: 'map_points',
2 years ago
'with_relations[0]': 'image',
'with_relations[1]': 'video',
2 years ago
'with_relations[2]': 'videoImage',
'with_relations[3]': 'mapPointContent',
2 years ago
id
})
return res
},
async getVrs (id) {
2 years ago
const res = await this.$u.api.pointDetail({
2 years ago
table_name: 'map_point_contents',
'with_relations[0]': 'image',
'with_relations[1]': 'video',
'filter[0][key]': 'map_point_id',
'filter[0][op]': 'eq',
'filter[0][value]': id
})
return res
2 years ago
},
hiddenLoad () {
uni.hideLoading()
3 years ago
}
},
2 years ago
onLoad (option) {
2 years ago
if (this.flag) {
uni.showLoading({
mask: true,
title: '加载中'
})
2 years ago
window.showVr = this.showVr
2 years ago
window.toAnswer = this.toAnswer
window.hideLoading = this.hiddenLoad
this.$nextTick(() => {
this.$refs['iframe'].onload = async () => {
2 years ago
let detail = await this.getDetail(option.id)
2 years ago
let vrs = detail.content
2 years ago
let images = await this.getImages(option.id)
2 years ago
this.$refs['iframe'].contentWindow.setDomData({ detail: detail.points , vrs: vrs, images: images.data })
}
})
this.flag = false
}
2 years ago
},
3 years ago
}
</script>
<style lang="scss">
iframe {
height: 100vh;
width: 100vw;
}
</style>