import Taro, { Component } from '@tarojs/taro'
import { View, Map } from '@tarojs/components'
import { AtNoticebar, AtFloatLayout } from 'taro-ui'
import './vr.scss'
import { arrToObj } from '@utils'
class Index extends Component {
onShareAppMessage() {
return {
title: `南昌楼盘航拍VR,楼栋外观、周边环境一目了然`,
path: `/pagesOther/map/vr`,
}
}
onShareTimeline () {
return {
title: `南昌楼盘航拍VR,楼栋外观、周边环境一目了然`,
path: `/pagesOther/map/vr`,
}
}
constructor (props) {
super(props)
this.state = {
isPopupShow: false,
curObj: {},
estateList: [],
allDataArr: [],
}
}
config = {
navigationBarTitleText: '楼盘航拍',
}
componentWillUnmount () {
}
componentWillMount () {
Taro.$AHU(this)
this.getData()
}
getData () {
Taro.api.other.apivrestateall().then(res => {
let estateList = res.map((item, index) => {
return ({
id: index + 20000,
longitude: item.longitude,
latitude: item.latitude,
iconPath: 'https://icon.honglouplus.com/icon_1px.png',
// iconPath: item.vr_image,
width: 0,
height: 0,
zIndex: 9,
callout: {
content: `${item.estate_name}`,
color: '#fff',
bgColor: '#369af7',
display: 'ALWAYS',
padding: '6px 10px',
textAlign: 'center',
borderRadius: '10',
}
})
})
this.setState({
allDataArr: res,
estateList
})
})
}
componentDidShow () { }
componentDidHide () { }
calloutTap (e) {
const { markerId } = e.detail
if (markerId > 9999) {
// Taro.showLoading({
// mask: true,
// title: '正在跳转~'
// })
// setTimeout(() => {
// Taro.hideLoading()
// }, 3000)
if (markerId > 19999 && markerId < 30000) { // 楼盘
const { allDataArr } = this.state
const curItem = allDataArr[markerId - 20000]
this.setState({
curObj: curItem
}, () => {
this.openPopup()
})
// console.log(curItem)
// Taro.navigateTo({url: `/pagesHouse/vr?id=${curItem.vr_key}&estateName=${curItem.estate_name}`})
}
}
}
markerTap (e) {}
renderShare () {
const iconShare = require('@img/images/icon_g_share6.png')
return (
)
}
renderHeader () {
return (
点击楼盘查看航拍VR,楼栋外观、周边环境一目了然
)
}
renderSign () {
const img = require('@img/sigin_sy.png')
return (
)
}
renderSign2 () {
const img = require('@img/sigin_sy.png')
return (
)
}
closePopup () {
this.setState({
isPopupShow: false
})
}
openPopup () {
this.setState({
isPopupShow: true
})
}
linkVr () {
const { curObj } = this.state
Taro.navigateTo({url: `/pagesHouse/vr?id=${curObj.vr_key}&estateName=${curObj.estate_name}`})
}
render () {
let { estateList, isPopupShow, curObj } = this.state
const hpI1 = require('@img/icon_hp_1.png')
const hpI2 = require('@img/icon_hp_2.gif')
return (
{this.renderHeader()}
{this.renderShare()}
{/* {this.renderSign()}
{this.renderSign2()} */}
)
}
}
export default Index