张延森 3 年前
父节点
当前提交
a9bd99a095

+ 2
- 2
config/dev.js 查看文件

3
     NODE_ENV: '"development"'
3
     NODE_ENV: '"development"'
4
   },
4
   },
5
   defineConstants: {
5
   defineConstants: {
6
-    // HOST: '"https://xlk.njyz.tech"',
7
-    HOST: '"http://127.0.0.1:8088"',
6
+    HOST: '"https://xlk.njyz.tech"',
7
+    // HOST: '"http://127.0.0.1:8088"',
8
     WSS_HOST: '"wss://xlk.njyz.tech"',
8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9
     OSS_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',
9
     OSS_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',

+ 32
- 8
src/pages/index/buildingDetail/components/DetailBottom/index.jsx 查看文件

1
-import React, { useState, useEffect } from 'react'
2
-import './index.scss'
1
+import React from 'react'
2
+import Taro from '@tarojs/taro'
3
 import { Image } from '@tarojs/components'
3
 import { Image } from '@tarojs/components'
4
+import useConsultant from '@/utils/hooks/useConsultant'
5
+import './index.scss'
4
 
6
 
5
 export default function DetailBottom (props) {
7
 export default function DetailBottom (props) {
6
-  const { Data = {} } = props
8
+  const { Info = {} } = props
9
+
10
+  // 当前推荐置业
11
+  const { consultant } = useConsultant(Info?.buildingId)
12
+
13
+  const handleCall = () => {
14
+    if (consultant) {
15
+      Taro.makePhoneCall({ phoneNumber: consultant.phone })
16
+      return
17
+    }
18
+
19
+    if (Info.tel) {
20
+      Taro.makePhoneCall({ phoneNumber: Info.tel })
21
+      return
22
+    }
23
+
24
+    Taro.showToast({ title: '暂无联系电话', icon: 'none' })
25
+  }
26
+
27
+  const handleChat = () => {
28
+    
29
+  }
30
+
7
   return (
31
   return (
8
     <view className='components DetailBottom flex-h'>
32
     <view className='components DetailBottom flex-h'>
9
       <view className='Item'>
33
       <view className='Item'>
10
-        <Image mode="heightFix" src={require('../../../../../assets/buildingDetail-icon3.png')}></Image>
34
+        <Image mode='heightFix' src={require('@/assets/buildingDetail-icon3.png')}></Image>
11
         <text>一键海报</text>
35
         <text>一键海报</text>
12
       </view>
36
       </view>
13
       <view className='Item'>
37
       <view className='Item'>
14
-        <Image mode="heightFix" src={require('../../../../../assets/buildingDetail-icon1.png')}></Image>
38
+        <Image mode='heightFix' src={require('@/assets/buildingDetail-icon1.png')}></Image>
15
         <text>一键带看</text>
39
         <text>一键带看</text>
16
       </view>
40
       </view>
17
       <view className='Item'>
41
       <view className='Item'>
18
-        <Image mode="heightFix" src={require('../../../../../assets/buildingDetail-icon2.png')}></Image>
42
+        <Image mode='heightFix' src={require('@/assets/buildingDetail-icon2.png')}></Image>
19
         <text>一键推荐</text>
43
         <text>一键推荐</text>
20
       </view>
44
       </view>
21
       <view className='flex-item'></view>
45
       <view className='flex-item'></view>
22
       <view className='Btn'>
46
       <view className='Btn'>
23
-        <text>一键咨询</text>
24
-        <text className='active'>一键电话</text>
47
+        <text onClick={handleChat}>一键咨询</text>
48
+        <text className='active' onClick={handleCall}>一键电话</text>
25
       </view>
49
       </view>
26
     </view>
50
     </view>
27
   )
51
   )

+ 8
- 7
src/pages/index/buildingDetail/components/MarketingActivity/index.jsx 查看文件

13
   const [dataList, setDataList] = useState([])
13
   const [dataList, setDataList] = useState([])
14
 
14
 
15
   const goMore = () => Taro.navigateTo({ url: `/pages/index/activityList/index?type=house&buildingId=${buildingId}` })
15
   const goMore = () => Taro.navigateTo({ url: `/pages/index/activityList/index?type=house&buildingId=${buildingId}` })
16
+  const goDetail = (id) => Taro.navigateTo({ url: `/pages/index/activityDetail/index?id=${id}` })
16
 
17
 
17
   useEffect(() => {
18
   useEffect(() => {
18
-    queryActivityList({ buildingId, pageSize: 3 }).then((res) => {
19
-      const { list } = res || {}
20
-      setDataList(list || [])
21
-    })
19
+    if (buildingId) {
20
+      queryActivityList({ buildingId, pageSize: 3, type: 'house' }).then((res) => {
21
+        const { list } = res || {}
22
+        setDataList(list || [])
23
+      })
24
+    }
22
   }, [buildingId])
25
   }, [buildingId])
23
 
26
 
24
-  console.log('----------->', dataList)
25
-
26
   return dataList.length > 0 && (
27
   return dataList.length > 0 && (
27
     <view className='components MarketingActivity'>
28
     <view className='components MarketingActivity'>
28
 
29
 
40
             {
41
             {
41
               dataList.map((item, index) => (
42
               dataList.map((item, index) => (
42
                 <SwiperItem key={`Banner-${index}`}>
43
                 <SwiperItem key={`Banner-${index}`}>
43
-                  <view className='swiper-item'>
44
+                  <view className='swiper-item' onClick={() => goDetail(item.dynamicId)}>
44
                     <Image mode='aspectFill' className='centerLabel' src={getImgURL(item.bannerListImg || item.image || item.url || item.img || item.imgUrl || item.detailImg)} />
45
                     <Image mode='aspectFill' className='centerLabel' src={getImgURL(item.bannerListImg || item.image || item.url || item.img || item.imgUrl || item.detailImg)} />
45
                   </view>
46
                   </view>
46
                 </SwiperItem>
47
                 </SwiperItem>

+ 1
- 1
src/pages/index/buildingDetail/index.jsx 查看文件

139
       </view>
139
       </view>
140
 
140
 
141
       <view className='PageBottom'>
141
       <view className='PageBottom'>
142
-        <DetailBottom></DetailBottom>
142
+        <DetailBottom Info={DetailInfo}></DetailBottom>
143
       </view>
143
       </view>
144
 
144
 
145
     </view>
145
     </view>

+ 17
- 0
src/reducers/system.js 查看文件

8
   userInfo: {},
8
   userInfo: {},
9
   settings: [],
9
   settings: [],
10
   systemInfo: {},
10
   systemInfo: {},
11
+
12
+  // 当前推荐人信息
13
+  recommender: {},
14
+  // 当前推荐置业顾问信息
15
+  consultant: {},
11
 };
16
 };
12
 
17
 
13
 export default function(state = INITIAL_STATE, action) {
18
 export default function(state = INITIAL_STATE, action) {
24
         systemInfo: action.payload
29
         systemInfo: action.payload
25
       };
30
       };
26
     }
31
     }
32
+    case 'SYNC_RECOMMENDER': {
33
+      return {
34
+        ...state,
35
+        recommender: action.payload
36
+      };
37
+    }
38
+    case 'SYNC_CONSULTANT': {
39
+      return {
40
+        ...state,
41
+        consultant: action.payload
42
+      };
43
+    }
27
 
44
 
28
     default:
45
     default:
29
       return state;
46
       return state;

+ 18
- 0
src/utils/hooks/useConsultant.js 查看文件

1
+import { useSelector } from 'react-redux'
2
+
3
+/**
4
+ * 获取当前推荐置业
5
+ * @param {*} buildingId 
6
+ * @returns 
7
+ */
8
+export default function useConsultant(buildingId) {
9
+  const { consultant } = useSelector(s => s.system)
10
+
11
+  if (consultant?.id) {
12
+    if (consultant.projects && consultant.projects.indexOf(buildingId) > -1) {
13
+      return { consultant }
14
+    }
15
+  }
16
+
17
+  return {}
18
+}

+ 3
- 1
src/utils/im/sdk.js 查看文件

22
     current: {}
22
     current: {}
23
   }
23
   }
24
 
24
 
25
+  let connected = false
26
+
25
   return {
27
   return {
26
     STATE,
28
     STATE,
27
     getState,
29
     getState,
47
   function connect(options) {
49
   function connect(options) {
48
     Object.assign(paramsRef.current, options || {})
50
     Object.assign(paramsRef.current, options || {})
49
     
51
     
50
-    if (instanceRef.current && instanceRef.current.readyState === STATE.OPEN) {
52
+    if (instanceRef.current && instanceRef.current.readyState <= STATE.CLOSING) {
51
       return Promise.resolve()
53
       return Promise.resolve()
52
     }
54
     }
53
 
55
 

+ 13
- 1
src/utils/login.js 查看文件

1
 import Taro from '@tarojs/taro';
1
 import Taro from '@tarojs/taro';
2
 import store from "@/store";
2
 import store from "@/store";
3
 import { dispatchCitySelected } from '@/actions/city'
3
 import { dispatchCitySelected } from '@/actions/city'
4
-import { USER_INFO, ASSIGN_UNREADNUM } from '@/constants/user'
4
+import { USER_INFO, ASSIGN_UNREADNUM, ROLE_CODE } from '@/constants/user'
5
 import { ifNull } from '@/utils/tools'
5
 import { ifNull } from '@/utils/tools'
6
 import { wxLogin } from '@/services/login'
6
 import { wxLogin } from '@/services/login'
7
+import { getCardDetail } from '@/services/card'
7
 import { queryUserInfo } from '@/services/user'
8
 import { queryUserInfo } from '@/services/user'
8
 
9
 
9
 export default (payload) => {
10
 export default (payload) => {
46
             dispatch({ type: ASSIGN_UNREADNUM, payload: true });
47
             dispatch({ type: ASSIGN_UNREADNUM, payload: true });
47
             resolve(data)
48
             resolve(data)
48
           }).catch(reject)
49
           }).catch(reject)
50
+
51
+          // 如果有推荐人信息
52
+          if (loginParams.recommender && loginParams.recommender !== person.personId) {
53
+            getCardDetail(loginParams.recommender).then((res) => {
54
+              dispatch({ type: 'SYNC_RECOMMENDER', payload: res });
55
+              if (res.personType === ROLE_CODE.CONSULTANT) {
56
+                dispatch({ type: 'SYNC_CONSULTANT', payload: res });
57
+              }
58
+            })
59
+          }
60
+
49
         }).catch(reject)
61
         }).catch(reject)
50
       }
62
       }
51
     })
63
     })