import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import { arrToObj } from '@utils'
import './index.scss'
export default class List extends Component {
constructor (props) {
super(props)
this.state = {
newsList: [],
}
}
componentWillMount () {
this.props.onRef(this)
}
getData = (newsList) => {
this.setState({
newsList
})
}
render () {
const dictData = Taro.getStorageSync('dictData')
const { newsList } = this.state
const curItems = newsList.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 (
{tag}
)
})
return (
{item.estate_name}
{item.price_range || "未知"}/㎡
{arrToObj(dictData.area_type)[item.area_type]} {productTypeArr.length > 0 ? `-${productTypeArr.join('/')}` : ''}
{
item.estate_tag === '售罄' || item.estate_tag === '二手'
? {item.estate_tag}
: item.estate_tag === '待售'
? {item.estate_tag}
: {item.estate_tag}
}
{tagViews}
)
})
return (
{curItems}
)
}
}