123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- 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 (
- <Button className="g-icon-share btn-to-div" openType="share">
- <Image className="img" src={iconShare} />
- </Button>
- )
- }
- renderHeader () {
- return (
- <View className="scoped-header">
- <AtNoticebar>
- 点击楼盘查看航拍VR,楼栋外观、周边环境一目了然
- </AtNoticebar>
- </View>
- )
- }
- renderSign () {
- const img = require('@img/sigin_sy.png')
- return (
- <View className="scoped-sign">
- <View className="bg"></View>
- <Image className="img" src={img} />
- </View>
- )
- }
- renderSign2 () {
- const img = require('@img/sigin_sy.png')
- return (
- <View className="scoped-sign2">
- <Image className="img" src={img} />
- </View>
- )
- }
- 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 (
- <View className="l-box">
- {this.renderHeader()}
- <Map
- enable-satellite="true"
- longitude='115.851699'
- latitude='28.644161'
- enable-poi={false}
- scale='14'
- markers={estateList}
- min-scale="11"
- max-scale="20"
- subkey="Y7PBZ-FPZRP-4DXDL-VXQ3B-7DFL7-UXBK4"
- onCalloutTap={this.calloutTap.bind(this)}
- className="scoped-map"/>
- {this.renderShare()}
- {/* {this.renderSign()}
- {this.renderSign2()} */}
- <AtFloatLayout isOpened={isPopupShow} title={curObj.estate_name} onClose={this.closePopup.bind(this)}>
- <View className="scoped-vr-img" onClick={this.linkVr.bind(this)} >
- <View className="icon">
- <Image src={hpI1} className="i i1" />
- <Image src={hpI2} className="i i2" />
- </View>
- <Image src={curObj.vr_image} className="img" mode="aspectFit"/>
- </View>
- </AtFloatLayout>
- </View>
- )
- }
- }
- export default Index
|