|
@@ -14,6 +14,7 @@ import RemindRoom from './components/popup/remindRoom'
|
|
|
import RemindCust from './components/popup/remindCust'
|
|
|
// import CountChart from './components/countChart'
|
|
|
import FooterModule from './components/footerList'
|
|
|
+import LoginJudge from '@/c/login/Judge'
|
|
|
import './index.scss'
|
|
|
import { arrToObj } from '@utils'
|
|
|
|
|
@@ -79,6 +80,7 @@ class Index extends Component {
|
|
|
componentWillMount () {
|
|
|
const that = this
|
|
|
Taro.$AHU(this)
|
|
|
+ this.getSaleData()
|
|
|
const uoObj = Taro.getStorageSync('APP_userInfo')
|
|
|
if (uoObj) {
|
|
|
this.setState({
|
|
@@ -192,27 +194,115 @@ class Index extends Component {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ renderAdBanner () {
|
|
|
+ const cbg = require('@img/ad_ziliao.jpg')
|
|
|
+ return (
|
|
|
+ <View className="index-banner">
|
|
|
+ <View className='ad-img' onClick={this.saleChat.bind(this)} >
|
|
|
+ <Image src={cbg} className="img" />
|
|
|
+ <LoginJudge />
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ saleChat () {
|
|
|
+ let token = Taro.getStorageSync('APP_token')
|
|
|
+ if (!token) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const { curSaleObj } = this.state
|
|
|
+ let params = {
|
|
|
+ target_id: 999,
|
|
|
+ target_type: 3,
|
|
|
+ sale_id: curSaleObj.sale_id,
|
|
|
+ click_type: '1'
|
|
|
+ }
|
|
|
+ Taro.api.room.apiusercontactclick(params).then((res) => {
|
|
|
+ Taro.navigateTo({
|
|
|
+ url: `/pagesQa/msg/chat?to_user_id=${curSaleObj.user_id}&diyText=领取楼盘资料`
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ Taro.navigateTo({
|
|
|
+ url: `/pagesQa/msg/chat?to_user_id=${curSaleObj.user_id}&diyText=领取楼盘资料`
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ getSaleData = () => {
|
|
|
+ const curSaleObj = Taro.getStorageSync('APP_cur_sale')
|
|
|
+ if (curSaleObj.curObj) {
|
|
|
+ this.setState({
|
|
|
+ curSaleObj: curSaleObj.curObj,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.getSaleList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getSaleList () {
|
|
|
+ let params = {
|
|
|
+ show_status: 1,
|
|
|
+ page_size: 99
|
|
|
+ }
|
|
|
+ const referrer = Taro.getStorageSync('APP_MY_REFERRER')
|
|
|
+ if (referrer) params.referrer = referrer
|
|
|
+ Taro.api.room.apisalelist(params).then(res => {
|
|
|
+ const list = res.list || []
|
|
|
+ if (list.length === 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const arrIndex = Math.floor(Math.random() * list.length)
|
|
|
+ this.setState({
|
|
|
+ curSaleObj: list[arrIndex],
|
|
|
+ })
|
|
|
+ Taro.setStorageSync('APP_cur_sale', {curObj: list[arrIndex]})
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
renderBanner () {
|
|
|
const { adBannerList } = this.state
|
|
|
+ console.log(adBannerList.length === 0)
|
|
|
+ if (adBannerList.length === 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const oneObj = adBannerList[0] || {}
|
|
|
const adItems = adBannerList.map((item, index) => {
|
|
|
return (
|
|
|
<SwiperItem key={index}>
|
|
|
<View className='ad-img' onClick={this.bannerHandle.bind(this, item)} >
|
|
|
<Image src={item.images} className="img" />
|
|
|
+ <LoginJudge />
|
|
|
</View>
|
|
|
</SwiperItem>
|
|
|
)
|
|
|
})
|
|
|
return (
|
|
|
- <View className="index-banner">
|
|
|
- <Swiper
|
|
|
- className='test-h'
|
|
|
- indicatorColor='#999'
|
|
|
- indicatorActiveColor='#fff'
|
|
|
- circular
|
|
|
- autoplay>
|
|
|
- {adItems}
|
|
|
- </Swiper>
|
|
|
+ <View className={adBannerList.length > 0 ? 'index-banner' : 'index-banner hide'}>
|
|
|
+ {
|
|
|
+ oneObj.ad_link_type === 'chat'
|
|
|
+ ?
|
|
|
+ <View className='ad-img' onClick={this.saleChat.bind(this)} >
|
|
|
+ <Image src={oneObj.images} className="img" />
|
|
|
+ <LoginJudge />
|
|
|
+ </View>
|
|
|
+ :
|
|
|
+ <Swiper
|
|
|
+ className='test-h'
|
|
|
+ indicatorColor='#999'
|
|
|
+ indicatorActiveColor='#fff'
|
|
|
+ circular
|
|
|
+ autoplay>
|
|
|
+ {adItems}
|
|
|
+ </Swiper>
|
|
|
+ }
|
|
|
</View>
|
|
|
)
|
|
|
}
|
|
@@ -233,6 +323,9 @@ class Index extends Component {
|
|
|
url: `${item.link_type_value}`
|
|
|
})
|
|
|
}
|
|
|
+ if (item.ad_link_type === 'chat') {
|
|
|
+ this.saleChat()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
getBannerAd () {
|
|
@@ -1004,7 +1097,8 @@ class Index extends Component {
|
|
|
</View>
|
|
|
}
|
|
|
</View>
|
|
|
- {/* {this.renderBanner()} */}
|
|
|
+ {/* {this.renderAdBanner()} */}
|
|
|
+ {this.renderBanner()}
|
|
|
{/* {this.renderHouseList()} */}
|
|
|
|
|
|
{/*
|