Your Name 3 år sedan
förälder
incheckning
da78dce3db

+ 2
- 2
src/layout/useAuth.js Visa fil

@@ -12,7 +12,7 @@ export default function useAuth(person) {
12 12
     if (current && current.auth && current.auth.length) {
13 13
       // 如果需要授权手机
14 14
       if (current.auth.indexOf('phone') > -1) {
15
-        if (person && !person.phone) {
15
+        if (person.inited && !person.phone) {
16 16
           setAuthPhone(true)
17 17
         } else {
18 18
           setAuthPhone(false)
@@ -21,7 +21,7 @@ export default function useAuth(person) {
21 21
 
22 22
       // 如果需要授权头像
23 23
       if (current.auth.indexOf('avatar') > -1) {
24
-        if (person && (!person.avatarurl || person.avatarurl.indexOf('default_avatar') > -1)) {
24
+        if (person.inited && (!person.avatarurl || person.avatarurl.indexOf('default_avatar') > -1)) {
25 25
           setAuthAvatar(true)
26 26
         } else {
27 27
           setAuthAvatar(false)

+ 30
- 5
src/pages/index/buildingDetail/components/DetailBottom/index.jsx Visa fil

@@ -1,9 +1,10 @@
1
-import React, { useState } from 'react'
1
+import React, { useState, useEffect } from 'react'
2 2
 import Taro from '@tarojs/taro'
3 3
 import { useSelector } from 'react-redux'
4 4
 import { Image } from '@tarojs/components'
5 5
 import AuthRole from '@/components/auth/AuthRole'
6 6
 import Poster from '@/components/Poster'
7
+import { queryActivityList } from '@/services/activity'
7 8
 import { ROLE_CODE } from '@/constants/user'
8 9
 import './index.scss'
9 10
 
@@ -13,6 +14,7 @@ export default function DetailBottom (props) {
13 14
   // 当前推荐置业
14 15
   const { consultant } = useSelector(s => s.system)
15 16
   const [showPoster, setShowPoster] = useState(false)
17
+  const [actList, setActList] = useState([])
16 18
 
17 19
   const handleCall = () => {
18 20
     if (Info.tel) {
@@ -45,6 +47,25 @@ export default function DetailBottom (props) {
45 47
     })
46 48
   }
47 49
 
50
+  const handleTuanfang = () => {
51
+    const id = actList[0].dynamicId
52
+
53
+    Taro.navigateTo({
54
+      url: `/pages/index/activityDetail/index?id=${id}`
55
+    })
56
+  }
57
+  
58
+  useEffect(() => {
59
+    if (Info.buildingId) {
60
+      queryActivityList({ buildingId: Info.buildingId, pageSize: 1, type: 'house' }).then((res) => {
61
+        const { list } = res || {}
62
+        
63
+        // 只保留已发布的活动
64
+        setActList((list || []))
65
+      })
66
+    }
67
+  }, [Info.buildingId])
68
+
48 69
   return (
49 70
     <view>
50 71
       <view className='components DetailBottom flex-h'>
@@ -52,10 +73,14 @@ export default function DetailBottom (props) {
52 73
           <Image mode='heightFix' src={require('@/assets/buildingDetail-icon3.png')}></Image>
53 74
           <text>一键海报</text>
54 75
         </view>
55
-        <view className='Item'>
56
-          <Image mode='heightFix' src={require('@/assets/buildingDetail-icon1.png')}></Image>
57
-          <text>一键带看</text>
58
-        </view>
76
+        {
77
+          actList.length > 0 && (
78
+            <view className='Item' onClick={handleTuanfang}>
79
+              <Image mode='heightFix' src={require('@/assets/buildingDetail-icon1.png')}></Image>
80
+              <text>一键带看</text>
81
+            </view>
82
+          )
83
+        }
59 84
         <AuthRole role={ROLE_CODE.CONSULTANT}>
60 85
           <view className='Item' onClick={handleRecommender}>
61 86
             <Image mode='heightFix' src={require('@/assets/buildingDetail-icon2.png')}></Image>

+ 4
- 2
src/pages/index/buildingDetail/components/MarketingActivity/index.jsx Visa fil

@@ -17,9 +17,11 @@ export default function MarketingActivity (props) {
17 17
 
18 18
   useEffect(() => {
19 19
     if (buildingId) {
20
-      queryActivityList({ buildingId, pageSize: 3, type: 'house' }).then((res) => {
20
+      queryActivityList({ buildingId, pageSize: 500, type: 'house' }).then((res) => {
21 21
         const { list } = res || {}
22
-        setDataList(list || [])
22
+        
23
+        // 只保留3场在进行中的活动
24
+        setDataList((list || []).filter((x) => (x.activityStatus === 0)).slice(0, 3))
23 25
       })
24 26
     }
25 27
   }, [buildingId])

+ 4
- 3
src/reducers/user.js Visa fil

@@ -12,7 +12,7 @@ import {
12 12
 
13 13
 const INITIAL_STATE = {
14 14
   userInfo: {
15
-    person: {},
15
+    person: { inited: false },
16 16
     extraInfo: {},
17 17
     miniApp: {},
18 18
   },
@@ -40,7 +40,7 @@ export default function user(state = INITIAL_STATE, action) {
40 40
           userInfo: {
41 41
             ...state.userInfo,
42 42
             ...action.payload,
43
-            person: newPerson,
43
+            person: {...newPerson, inited: true},
44 44
             extraInfo: newExtraInfo,
45 45
             miniApp: newMiniApp,
46 46
           }
@@ -69,7 +69,7 @@ export default function user(state = INITIAL_STATE, action) {
69 69
         ...state,
70 70
         userInfo: {
71 71
           extraInfo,
72
-          person: newPerson,
72
+          person: {...newPerson, inited: true},
73 73
           miniApp,
74 74
         }
75 75
       }
@@ -81,6 +81,7 @@ export default function user(state = INITIAL_STATE, action) {
81 81
         userInfo: {
82 82
           person: {
83 83
             ...person,
84
+            inited: true,
84 85
             points: (person.points + 1)
85 86
           },
86 87
           extraInfo: {