|
@@ -0,0 +1,286 @@
|
|
|
+import Taro, { Component } from '@tarojs/taro'
|
|
|
+import { View, Image, Text, Navigator } from '@tarojs/components'
|
|
|
+
|
|
|
+import hlSign from '@/c/hlSign'
|
|
|
+import ListMore from '@/c/pageDataList/listMore'
|
|
|
+import EchartMap from './components/nChart/EchartMap'
|
|
|
+import Footer from '@/c/footer'
|
|
|
+import './index2.scss'
|
|
|
+import { arrToObj } from '@utils'
|
|
|
+
|
|
|
+class Index extends Component {
|
|
|
+ onShareAppMessage() {
|
|
|
+ return {
|
|
|
+ title: '找房',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ onShareTimeline () {
|
|
|
+ return {
|
|
|
+ title: '洪楼Plus,专注南昌本地房地产市场,让买房,更省心!',
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ constructor (props) {
|
|
|
+ super(props)
|
|
|
+ this.state = {
|
|
|
+ page_size: 10,
|
|
|
+ page: 1,
|
|
|
+ isListEnd: false,
|
|
|
+ isListLoading: false,
|
|
|
+ isListEmpty: false,
|
|
|
+ dataList: [],
|
|
|
+ scrollTop: 0,
|
|
|
+ curScrollObj: {},
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ config = {
|
|
|
+ navigationBarTitleText: '查楼盘',
|
|
|
+ }
|
|
|
+
|
|
|
+ componentWillMount () {
|
|
|
+ Taro.$AHU(this)
|
|
|
+ // this.getDataList()
|
|
|
+ }
|
|
|
+
|
|
|
+ componentDidShow () { }
|
|
|
+
|
|
|
+ componentDidHide () { }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ getDataList () {
|
|
|
+ let { page_size, page, dataList, isListEmpty } = this.state
|
|
|
+ Taro.api.house.admestatelist({
|
|
|
+ page,
|
|
|
+ page_size,
|
|
|
+ }).then(res => {
|
|
|
+ const curData = res.list || []
|
|
|
+ let isListEnd = false
|
|
|
+ if (curData.length > 0) {
|
|
|
+ if (page === 1) {
|
|
|
+ dataList = curData
|
|
|
+ } else {
|
|
|
+ dataList = dataList.concat(curData)
|
|
|
+ }
|
|
|
+ if (curData.length === page_size && res.total !== curData.length) {
|
|
|
+ isListEnd = false
|
|
|
+ } else {
|
|
|
+ isListEnd = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ isListEnd = true
|
|
|
+ }
|
|
|
+ if ((curData.length === 0 && page === 1) || (curData.length === 0 && dataList.length === 0)) {
|
|
|
+ isListEmpty = true
|
|
|
+ dataList = []
|
|
|
+ } else {
|
|
|
+ isListEmpty = false
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ dataList,
|
|
|
+ isListEnd,
|
|
|
+ isListEmpty,
|
|
|
+ isListLoading: false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ onScrollToLower (e) {
|
|
|
+ let { isListEnd, isListLoading, page } = this.state
|
|
|
+ if (!isListEnd && !isListLoading) {
|
|
|
+ page++
|
|
|
+ this.setState({
|
|
|
+ page,
|
|
|
+ isListLoading: true
|
|
|
+ }, () => {
|
|
|
+ this.getDataList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ renderImgUpInfo (item) {
|
|
|
+ const iconView = require('@img/icon_g_eye.png')
|
|
|
+ const hpI1 = require('@img/icon_hp_1.png')
|
|
|
+ const hpI2 = require('@img/icon_hp_2s.gif')
|
|
|
+ return (
|
|
|
+ <View>
|
|
|
+ {
|
|
|
+ item.vr_key
|
|
|
+ ?
|
|
|
+ <View className="vr-icon">
|
|
|
+ <Image src={hpI1} className="i i1" />
|
|
|
+ <Image src={hpI2} className="i i2" />
|
|
|
+ </View>
|
|
|
+ : ''
|
|
|
+ }
|
|
|
+ {
|
|
|
+ item.view_count
|
|
|
+ ?
|
|
|
+ <View className="view-num">
|
|
|
+ <View className="bg"></View>
|
|
|
+ <View className="content">
|
|
|
+ <Image src={iconView} className="i" />
|
|
|
+ <View className="t">{String((item.view_count * 11 + 1000) / 10000).substring(0, 4)}w</View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ : ''
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ renderList () {
|
|
|
+ const { dataList } = this.state
|
|
|
+ const dictData = Taro.getStorageSync('dictData')
|
|
|
+ const curItems = dataList.map((item, index) => {
|
|
|
+ const product_type = item.product_type || ''
|
|
|
+ const productTypeArr = product_type.split(',').map(v => {
|
|
|
+ return arrToObj(dictData.product_type)[v]
|
|
|
+ })
|
|
|
+ const cTagStr = item.custom_tag || ''
|
|
|
+ const tagViews = cTagStr.split(',').map((tag, tagIndex) => {
|
|
|
+ return (
|
|
|
+ <View className="s" key={tagIndex}>{tag}</View>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ return (
|
|
|
+ <Navigator url={'/pagesHouse/indexDtl?id=' + item.id} className="lhl-item col-1" key={index}>
|
|
|
+ <View className="lhl-img">
|
|
|
+ {this.renderImgUpInfo(item)}
|
|
|
+ <Image src={item.pri_image + '_xs'} className="img" />
|
|
|
+ </View>
|
|
|
+ <View className="lhl-info">
|
|
|
+ <View className="lhl-p1">{item.estate_name}</View>
|
|
|
+ <View className="lhl-p2">{item.price_range || "未知"}/㎡</View>
|
|
|
+ <View className="lhl-p3">{arrToObj(dictData.area_type)[item.area_type]} {productTypeArr.length > 0 ? `-${productTypeArr.join('/')}` : ''}</View>
|
|
|
+ <View className="lhl-sign">
|
|
|
+ {
|
|
|
+ item.estate_tag === '售罄' || item.estate_tag === '二手'
|
|
|
+ ? <View className="s t4">{item.estate_tag}</View>
|
|
|
+ : item.estate_tag === '待售'
|
|
|
+ ? <View className="s t3">{item.estate_tag}</View>
|
|
|
+ : <View className="s t2">{item.estate_tag}</View>
|
|
|
+ }
|
|
|
+ {tagViews}
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ </Navigator>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ return (
|
|
|
+ <View className="l-house-list">
|
|
|
+ {curItems}
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ onScroll (e) {
|
|
|
+ this.setState({
|
|
|
+ curScrollObj: e.detail || {}
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ backTopHandle () {
|
|
|
+ this.setState({
|
|
|
+ scrollTop: Math.random()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ renderBackTop () {
|
|
|
+ const bg = require('@img/share_top.png')
|
|
|
+ return (
|
|
|
+ <View className="scoped-back-top" onClick={this.backTopHandle.bind(this)}>
|
|
|
+ <Image className="img" src={bg} />
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ renderMap () {
|
|
|
+ return (
|
|
|
+ <View className="scoped-map">
|
|
|
+ <EchartMap onRef={this.refMap} />
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ refMap = (ref) => {
|
|
|
+ this.subMap = ref
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ renderSearchBtn () {
|
|
|
+ return (
|
|
|
+ <View className="l-floor-footer t2">
|
|
|
+ <View className="lff-flex">
|
|
|
+ <View className="lff-btn full" onClick={this.saveHandle.bind(this)}>提交</View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ saveHandle () {
|
|
|
+ this.setState({
|
|
|
+ page: 1,
|
|
|
+ }, () => {
|
|
|
+ this.getDataList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ render () {
|
|
|
+ const { isListEnd, isListLoading, isListEmpty, dataList } = this.state
|
|
|
+ const { scrollTop, curScrollObj } = this.state
|
|
|
+ return (
|
|
|
+ <View className="l-box has-footer">
|
|
|
+ <ScrollView
|
|
|
+ className='l-scroll-view'
|
|
|
+ scrollY
|
|
|
+ scrollWithAnimation
|
|
|
+ scrollTop={scrollTop}
|
|
|
+ onScroll={this.onScroll.bind(this)}
|
|
|
+ lowerThreshold="60"
|
|
|
+ onScrollToLower={this.onScrollToLower.bind(this)}>
|
|
|
+ {this.renderMap()}
|
|
|
+ {this.renderSearchBtn()}
|
|
|
+ {/* <hlSign /> */}
|
|
|
+ {
|
|
|
+ dataList.length > 0
|
|
|
+ ?
|
|
|
+ <View className="scoped-box">
|
|
|
+ <View className="sb-title">全部楼盘</View>
|
|
|
+ <View className="sb-content">
|
|
|
+ {this.renderList()}
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ : ''
|
|
|
+ }
|
|
|
+ <ListMore isListEnd={isListEnd} isListLoading={isListLoading} isListEmpty={isListEmpty} />
|
|
|
+ { curScrollObj.scrollTop > 600 ? this.renderBackTop() : ''}
|
|
|
+ </ScrollView>
|
|
|
+ <Footer current={1} />
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export default Index
|