|
@@ -59,6 +59,7 @@ class Index extends Component {
|
|
|
hot2RowArr: [],
|
|
|
scrollTop: 0,
|
|
|
curScrollObj: {},
|
|
|
+ newRoomList: [],
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -81,6 +82,14 @@ class Index extends Component {
|
|
|
// isFirstOpen
|
|
|
// })
|
|
|
// }
|
|
|
+
|
|
|
+ Taro.api.room.apieshouselist({page_size: 2}).then(res => {
|
|
|
+ console.log(res.list)
|
|
|
+ this.setState({
|
|
|
+ newRoomList: res.list || []
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
Taro.api.base.apiindex().then(res => {
|
|
|
const resObj = res || {}
|
|
|
// 轮播图广告
|
|
@@ -660,7 +669,85 @@ class Index extends Component {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ renderNewRoom () {
|
|
|
+ const { newRoomList } = this.state
|
|
|
+ const hpV = require('@img/icon_hp_v.png')
|
|
|
+ const itemsList = newRoomList.map((item, index) => {
|
|
|
+ let FHstr = '未知楼层'
|
|
|
+ if (item.floor) {
|
|
|
+ const FH = Number(item.floor) || 1
|
|
|
+ const H = Number(item.storeys) || 1
|
|
|
+ if (FH > H * 0.6666) {
|
|
|
+ FHstr = '中高层'
|
|
|
+ } else if (FH > H * 0.33333) {
|
|
|
+ FHstr = '中楼层'
|
|
|
+ } else {
|
|
|
+ FHstr = '中低层'
|
|
|
+ }
|
|
|
+ if (FH === 1) FHstr = '一楼'
|
|
|
+ if (FH === H) FHstr = '顶楼'
|
|
|
+ }
|
|
|
+ let houseTypeStr = '未知户型'
|
|
|
+ if (item.house_type) {
|
|
|
+ let arr = item.house_type.split('-')
|
|
|
+ houseTypeStr = `${arr[0]}室${arr[1]}厅${arr[2]}卫`
|
|
|
+ }
|
|
|
+ const cTagStr = item.custom_tag || ''
|
|
|
+ const tagViews = cTagStr.split(',').map((tag, tagIndex) => {
|
|
|
+ return (
|
|
|
+ <View className="s" key={tagIndex}>{tag}</View>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ return (
|
|
|
+ <View className="ilr-item" key={index} onClick={this.linkHandle.bind(this, item)}>
|
|
|
+ <View className="ilr-img">
|
|
|
+ {
|
|
|
+ item.video
|
|
|
+ ?
|
|
|
+ <View className="vr-icon">
|
|
|
+ <Image src={hpV} className="i i1" />
|
|
|
+ </View>
|
|
|
+ : ''
|
|
|
+ }
|
|
|
+ <Image src={item.pri_image + '_white'} className="img" />
|
|
|
+ <View className="f-t">{houseTypeStr} | {parseInt(item.area)}㎡</View>
|
|
|
+ <View className="t-t">{item.title}</View>
|
|
|
+ </View>
|
|
|
+ <View className="ilr-info">
|
|
|
+ {/* <View className="ilr-p1">{item.title}</View> */}
|
|
|
+ <View className="ilr-p2">{item.price}万
|
|
|
+ <View className="sub">单价:{parseInt(item.price * 10000 / item.area)}元/平</View>
|
|
|
+ </View>
|
|
|
+ <View className="ilr-p3">{item.estate_name}-{FHstr}</View>
|
|
|
+ {/* <View className="ilr-sign">
|
|
|
+ {tagViews}
|
|
|
+ </View> */}
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ const bgTitle = require('./img/room_tit.png')
|
|
|
+ return (
|
|
|
+ <View className="index-list">
|
|
|
+ <View className="il-header">
|
|
|
+ <Image className="bg" src={bgTitle} />
|
|
|
+ <Navigator url={'/pagesRoom/list'} className="r"></Navigator>
|
|
|
+ </View>
|
|
|
+ {
|
|
|
+ newRoomList.length > 0
|
|
|
+ &&
|
|
|
+ <View className="il-room">
|
|
|
+ {itemsList}
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ linkHandle (item) {
|
|
|
+ Taro.navigateTo({
|
|
|
+ url: `/pagesRoom/dtl?id=${item.id}`
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
|
|
|
closeTips () {
|
|
@@ -879,10 +966,11 @@ class Index extends Component {
|
|
|
|
|
|
{this.renderTopNav()}
|
|
|
{/* {this.renderLine()} */}
|
|
|
- {this.renderHotRecommend()}
|
|
|
<Pendant />
|
|
|
{/* {this.renderEntry()} */}
|
|
|
+ {this.renderNewRoom()}
|
|
|
<InfoMore onRef={this.onInfoMoreRef} />
|
|
|
+ {this.renderHotRecommend()}
|
|
|
{/* <News2 onRef={this.onNews2Ref} /> */}
|
|
|
<NewsNews onRef={this.onNewsRef} />
|
|
|
<Channel onRef={this.onChannelRef} />
|