230320a303 5 ay önce
ebeveyn
işleme
c44f292a8c

BIN
src/assets/img/ad_ziliao.jpg


+ 13 - 6
src/components/login/Judge.jsx

@@ -15,6 +15,11 @@ export default class SelectSearch extends Component {
 
 
   componentDidMount () {
+    this.getInfo()
+  }
+
+
+  getInfo () {
     let userInfo = Taro.getStorageSync('APP_userInfo')
     let token = Taro.getStorageSync('APP_token')
     if (userInfo) {
@@ -25,6 +30,7 @@ export default class SelectSearch extends Component {
     }
   }
 
+
   openLoginPopup (obj) {
     this.setState({
       isLoginPopupShow: true
@@ -35,6 +41,7 @@ export default class SelectSearch extends Component {
       isLoginPopupShow: false
     })
     if (str && str === 'success') {
+      this.getInfo()
       this.getDtl()
     }
   }
@@ -47,11 +54,11 @@ export default class SelectSearch extends Component {
           userInfo: dtlObj.userInfo
         })
         Taro.setStorageSync('APP_userInfo', dtlObj.userInfo)
-        Taro.$msgConfirm(`登录成功~前往修改资料`, () => {
-          Taro.navigateTo({
-            url: '/pagesMore/center/userEdit'
-          })
-        }, () => {})
+        // Taro.$msgConfirm(`登录成功~前往修改资料`, () => {
+        //   Taro.navigateTo({
+        //     url: '/pagesMore/center/userEdit'
+        //   })
+        // }, () => {})
       }
     })
   }
@@ -60,7 +67,7 @@ export default class SelectSearch extends Component {
     const { userInfo, token, isLoginPopupShow } = this.state
     const uInfo = userInfo || {}
     return (
-      <View style={uInfo && uInfo.avatarUrl && token ? '' : 'position: absolute;height: 100%;width: 100%;'}>
+      <View style={token ? '' : 'position: absolute;top:0;left: 0;height: 100%;width: 100%;'}>
         <LoginPopup show={isLoginPopupShow} close={this.closeLoginPopup.bind(this)} />
         {
           uInfo && uInfo.avatarUrl

+ 16 - 1
src/components/login/Judge.scss

@@ -1 +1,16 @@
-@import '@css/mixin.scss';
+@import '@css/mixin.scss';
+.g-u-btn {
+    position: fixed;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+    z-index: 99999;
+    opacity: 0;
+    outline: none;
+    -webkit-appearance: none;
+    border-radius: 0;
+    &.t2 {
+      position: absolute;
+    }
+  }

+ 104 - 10
src/pages/index/index.jsx

@@ -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()} */}
 
           {/* 

+ 4 - 0
src/pages/index/index.scss

@@ -19,6 +19,10 @@ page {
   overflow: hidden;
   background: #fff;
   box-shadow: 0 0 6px #eee;
+  position: relative;
+  &.hide {
+    display: none;
+  }
   swiper {
     height: 160px;
     border-radius: 10px;

+ 2 - 0
src/pagesQa/msg/chat.jsx

@@ -182,6 +182,8 @@ class Index extends Component {
               if (qId && res.codeMsg === 'Success') that.sendHandle('house')
               const { eTitle, eId } = that.$router.params
               if (eId && res.codeMsg === 'Success') that.sendHandle('estate', `我刚刚浏览了楼盘:${eTitle},想咨询你一下`)
+              const { diyText} = that.$router.params
+              if (diyText && res.codeMsg === 'Success') that.sendHandle('text', diyText)
               setTimeout(() => {
                 that.setState({
                   viewId: `item${msgSocketList.length - 1}`