1002884655 vor 3 Jahren
Ursprung
Commit
1ee2739e27
37 geänderte Dateien mit 723 neuen und 336 gelöschten Zeilen
  1. 3
    3
      config/dev.js
  2. 4
    4
      config/prod.js
  3. BIN
      src/assets/logo.png
  4. 1
    1
      src/components/FixedConsultant/index.jsx
  5. 1
    1
      src/components/Loading/index.jsx
  6. 2
    0
      src/components/Loading/style.scss
  7. 2
    1
      src/components/ProjectListItem/index.jsx
  8. 4
    1
      src/constants/api.js
  9. 30
    0
      src/pages/chat/chatDetail/Card.jsx
  10. 184
    79
      src/pages/chat/chatDetail/index.jsx
  11. 21
    0
      src/pages/chat/chatDetail/useScrollTop.js
  12. 37
    9
      src/pages/chat/index.jsx
  13. 5
    19
      src/pages/index/activityDetail/index.jsx
  14. 2
    0
      src/pages/index/activityDetail/index.scss
  15. 118
    19
      src/pages/index/buildingAround/index.jsx
  16. 5
    0
      src/pages/index/buildingAround/index.scss
  17. 3
    3
      src/pages/index/buildingDetail/components/DetailBottom/index.jsx
  18. 3
    3
      src/pages/index/buildingDetail/components/MarketingActivity/index.jsx
  19. 12
    17
      src/pages/index/buildingDetail/components/Periphery/index.jsx
  20. 1
    1
      src/pages/index/buildingDetail/components/PropertyConsultant/index.jsx
  21. 1
    1
      src/pages/index/buildingDetail/index.jsx
  22. 1
    1
      src/pages/index/buildingPropertyConsultant/index.jsx
  23. 2
    2
      src/pages/index/components/ActivityListItem/index.jsx
  24. 2
    2
      src/pages/index/components/NewsListItem/index.jsx
  25. 2
    7
      src/pages/index/encyDetail/index.jsx
  26. 142
    34
      src/pages/index/findHouseFromMap/index.jsx
  27. 7
    0
      src/pages/index/findHouseFromMap/index.scss
  28. 20
    5
      src/pages/index/helpToFindHouse/components/SubmitBuyHouseResult/index.jsx
  29. 2
    1
      src/pages/index/helpToFindHouse/components/SubmitBuyHouseResult/index.scss
  30. 8
    2
      src/pages/index/helpToFindHouse/index.jsx
  31. 2
    7
      src/pages/index/newsDetail/index.jsx
  32. 5
    14
      src/pages/index/specialPriceHouse/index.jsx
  33. 1
    3
      src/pages/mine/components/UserDetailFollowRecord/index.jsx
  34. 4
    6
      src/pages/video/videoDetail/index.jsx
  35. 5
    2
      src/services/common.js
  36. 71
    71
      src/utils/chatDate.js
  37. 10
    17
      src/utils/im/index.js

+ 3
- 3
config/dev.js Datei anzeigen

@@ -3,9 +3,9 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"https://xlk.njyz.tech"',
7
-    // HOST: '"http://127.0.0.1:8081"',
8
-    WSS_HOST: '"wss://xlk.njyz.tech"',
6
+    // HOST: '"https://xlk.njyz.tech"',
7
+    HOST: '"http://127.0.0.1:8081"',
8
+    WSS_HOST: '"ws://127.0.0.1:8081"',
9 9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10 10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11 11
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',

+ 4
- 4
config/prod.js Datei anzeigen

@@ -3,10 +3,10 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"https://xlj.newlandsh.com"', //正式
7
-    // WSS_HOST: '"wss://xlj.newlandsh.com"',
8
-    HOST: '"https://xlk.njyz.tech"', //正式
9
-    WSS_HOST: '"wss://xlk.njyz.tech"',
6
+    HOST: '"https://xlj.newlandsh.com"', //正式
7
+    WSS_HOST: '"wss://xlj.newlandsh.com"',
8
+    // HOST: '"https://xlk.njyz.tech"', //正式
9
+    // WSS_HOST: '"wss://xlk.njyz.tech"',
10 10
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11 11
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
12 12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',

BIN
src/assets/logo.png Datei anzeigen


+ 1
- 1
src/components/FixedConsultant/index.jsx Datei anzeigen

@@ -17,7 +17,7 @@ export default function FixedCard (props) {
17 17
 
18 18
   const handleChat = () => {
19 19
     Taro.navigateTo({
20
-      url: `/pages/chat/chatDetail/index?targetPerson=${consultantId}}`
20
+      url: `/pages/chat/chatDetail/index?friend=${consultantId}`
21 21
     })
22 22
   }
23 23
   

+ 1
- 1
src/components/Loading/index.jsx Datei anzeigen

@@ -3,7 +3,7 @@ import logo from '@/assets/logo.png'
3 3
 import './style.scss'
4 4
 
5 5
 export default (props) => {
6
-  const { width = '80px', logoVisible } = props
6
+  const { width = '64px', logoVisible } = props
7 7
   const height = width
8 8
 
9 9
   return (

+ 2
- 0
src/components/Loading/style.scss Datei anzeigen

@@ -4,6 +4,8 @@
4 4
   position: relative;
5 5
 
6 6
   &-logo {
7
+    box-sizing: border-box;
8
+    padding: 12px;
7 9
     position: absolute;
8 10
     left: 0;
9 11
     transform: scale(.75, .75);

+ 2
- 1
src/components/ProjectListItem/index.jsx Datei anzeigen

@@ -3,6 +3,7 @@ import './index.scss'
3 3
 import '@/assets/css/iconfont.css'
4 4
 import Taro from '@tarojs/taro'
5 5
 import { Image } from '@tarojs/components'
6
+import { getImgURL } from '@/utils/image'
6 7
 
7 8
 export default function ProjectListItem (props) {
8 9
   const { Data = {} } = props
@@ -11,7 +12,7 @@ export default function ProjectListItem (props) {
11 12
     <view className='components ProjectListItem flex-h' onClick={() => {Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${Data.buildingId}` })}}>
12 13
       <view className='Img'>
13 14
         <view>
14
-          <Image mode='aspectFill' className='centerLabel' src={Data.buildingListImg?.length ? Data.buildingListImg[0].url : null} />
15
+          <Image mode='aspectFill' className='centerLabel' src={getImgURL(Data.buildingListImg?.length ? Data.buildingListImg[0].url : null)} />
15 16
         </view>
16 17
       </view>
17 18
       <view className='flex-item'>

+ 4
- 1
src/constants/api.js Datei anzeigen

@@ -276,4 +276,7 @@ export const API_BUILDINGSPECIALROOM_LIST = resolvePath('buildingSpecialRoom')
276 276
 export const API_BUILDINGSPECIALROOM_BUILDING_LIST = resolvePath('buildingSpecialRoom/building')
277 277
 
278 278
 // video
279
-export const API_VIDEO_DETAIL = resolvePath('detail')
279
+export const API_VIDEO_DETAIL = resolvePath('detail')
280
+
281
+// 客服热线
282
+export const API_FEEDBACK_SETTING = resolvePath('/searchHouse/setting')

+ 30
- 0
src/pages/chat/chatDetail/Card.jsx Datei anzeigen

@@ -0,0 +1,30 @@
1
+import React from 'react'
2
+import Taro from '@tarojs/taro'
3
+import './index.scss'
4
+
5
+export default (props) => {
6
+  const { person, onLeavePhone } = props
7
+
8
+  const callPhone = () => {
9
+    if (person.tel || person.phone) {
10
+      Taro.makePhoneCall({
11
+        phoneNumber: person.tel || person.phone
12
+      })
13
+    }
14
+  }
15
+
16
+  return (
17
+    <view className='SystemModel'>
18
+      <text className='Msg'>{`您好,我是${person.name || person.nickname},有什么可以帮您吗?您可以在这里跟我实时沟通哦~`}</text>
19
+      <text className='Tips'>您还可以通过以下方式快速联系我:</text>
20
+      <view onClick={callPhone}>
21
+        <text className='iconfont icon-dianhua'></text>
22
+        <text>拨打我的电话</text>
23
+      </view>
24
+      <view onClick={onLeavePhone}>
25
+        <text className='iconfont icon-shouji'></text>
26
+        <text>留下您的电话</text>
27
+      </view>
28
+    </view>
29
+  )
30
+}

+ 184
- 79
src/pages/chat/chatDetail/index.jsx Datei anzeigen

@@ -1,100 +1,205 @@
1
-import { useState } from 'react'
2
-import { ScrollView, Input, Image } from '@tarojs/components'
1
+import { useEffect, useState } from 'react'
2
+import Taro from '@tarojs/taro'
3
+import { ScrollView, Input, Image, Button } from '@tarojs/components'
4
+import withLayout from '@/layout'
5
+import { API_QUERY_USERINFO_BYID } from '@/constants/api'
6
+import { ROLE_CODE } from '@/constants/user'
7
+import { uploadFiles, fetch } from '@/utils/request'
8
+import { queryChatHistory } from '@/services/chat'
9
+import im from '@/utils/im'
10
+import { getDateForHumans } from '@/utils/chatDate'
3 11
 import '@/assets/css/iconfont.css'
12
+import Card from './Card'
13
+import useScrollTop from './useScrollTop'
4 14
 import './index.scss'
5 15
 
6
-export default function MyCollectForActivity () {
7
-
8
-  const [PageList, setPageList] = useState([{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}])
16
+export default withLayout((props) => {
17
+  const { router, person } = props;
18
+  const { friend } = router.params
19
+
20
+  const [submitting, setSubmitting] = useState(false)
21
+  const [text, setText] = useState()
22
+  const [receiver, setReceiver] = useState({})
23
+  const [PageList, setPageList] = useState([])
24
+  const [scrollTop, scroll] = useScrollTop('#chat-scroll')
25
+
26
+  const sendMessage = (msg, type = im.MESSAGETYPE.TEXT) => {
27
+    const message = msg
28
+    const messageType = type
29
+
30
+    // 用来回调写入消息列表
31
+    const newMessage = {
32
+      chatId: Math.random().toString(36).substring(2),
33
+      message,
34
+      messageType,
35
+      receivePerson: friend,
36
+      sendPerson: person.personId,
37
+      createDate: new Date(),
38
+    }
39
+
40
+    // 发送消息
41
+    setSubmitting(true)
42
+    im.sendMessage(message, messageType).then(() => {
43
+      // 发送成功
44
+      setText()
45
+      // 立刻回显刚刚发送内容
46
+      setPageList(PageList.concat(newMessage))
47
+      // 滚动到底部
48
+      scroll()
49
+      //
50
+      setSubmitting(false)
51
+    }).catch(() => {
52
+      setSubmitting(false)
53
+      Taro.showToast({
54
+        title: '发送失败, 请重试',
55
+        icon: 'none',
56
+      })
57
+    })
58
+  }
59
+
60
+  const submitText = () => {
61
+    sendMessage(text)
62
+  }
63
+
64
+  const submitImage = () => {
65
+    Taro.chooseImage({
66
+      count: 1,
67
+      sizeType: ['original', 'compressed'],
68
+      sourceType: ['album', 'camera'],
69
+      success: res => {
70
+        uploadFiles(res.tempFilePaths).then(data => {
71
+          sendMessage(data[0], im.MESSAGETYPE.IMAGE)
72
+        })
73
+      }
74
+    })
75
+  }
76
+
77
+  const getChatHistory = (params) => {
78
+    Taro.showLoading()
79
+    queryChatHistory({
80
+      chatWith: friend,
81
+      pageSize: 20,
82
+      ...params || {},
83
+    }).then((res) => {
84
+      const { records } = res;
85
+      Taro.hideLoading()
86
+
87
+      const lst = (records || []).reverse()
88
+
89
+      // 如果聊天对象是有身份的
90
+      if (receiver.personType !== ROLE_CODE.DRIFT && receiver.personType !== ROLE_CODE.CUSTOMER) {
91
+        const mockMessage = {
92
+          chatId: Math.random().toString(36).substring(2),
93
+          message: '',
94
+          messageType: im.MESSAGETYPE.CARD,
95
+          receivePerson: person.personId,
96
+          sendPerson: friend,
97
+          createDate: new Date(),
98
+        }
99
+        lst.push(mockMessage)
100
+      }
101
+
102
+      setPageList(lst)
103
+      scroll()
104
+    })
105
+  }
106
+
107
+  // 留电话
108
+  // 实际上是发送一条文本记录
109
+  const leavePhone = () => {
110
+    sendMessage(person.phone)
111
+  }
112
+
113
+  useEffect(() => {
114
+    if (friend) {
115
+      im.bindReceiver(friend)
116
+      fetch({ url: `${API_QUERY_USERINFO_BYID}/${friend}`, spin: true }).then((res) => {
117
+        setReceiver(res)
118
+        getChatHistory({ pageNumber: 1 })
119
+      })
120
+    } else {
121
+      Taro.showToast({
122
+        title: '无聊天对象,请退出重试',
123
+        icon: 'none',
124
+      })
125
+    }
126
+    // eslint-disable-next-line react-hooks/exhaustive-deps
127
+  }, [friend])
9 128
 
10 129
   return (
11 130
     <view className='chatDetail flex-v'>
12 131
       <view className='flex-item'>
13 132
         <view>
14
-          <ScrollView scroll-y>
133
+          <ScrollView id='chat-scroll' scrollY enhanced scrollTop={scrollTop}>
15 134
             <view className='PageContent'>
16 135
               {
17
-                PageList.map((item, index) => (
18
-                  <view key={`ChatItem-${index}`} className='ChatItem'>
136
+                PageList.map((item) => (
137
+                  <view key={item.chatId} className='ChatItem'>
19 138
 
20 139
                     <view className='Time'>
21
-                      <text>今天 17:50</text>
140
+                      <text>{getDateForHumans(item.createDate, true)}</text>
22 141
                     </view>
23 142
 
24 143
                     <view className='flex-h'>
25
-
26
-                      {/* 对方头像 */}
27 144
                       {
28
-                        index % 2 === 0 &&
29
-                        <view className='Icon'>
30
-                          <Image mode='scaleToFill' src={null}></Image>
31
-                        </view>
32
-                      }
33
-
34
-                      <view className='flex-item'>
35
-
36
-                        {/* 系统模板消息(对方消息) */}
37
-                        {
38
-                          index === 0 &&
39
-                          <view className='SystemModel'>
40
-                            <text className='Msg'>您好,我是陆毅,有什么可以帮您吗?您可以在这里跟我实时沟通哦~</text>
41
-                            <text className='Tips'>您还可以通过以下方式快速联系我:</text>
42
-                            <view>
43
-                              <text className='iconfont icon-dianhua'></text>
44
-                              <text>拨打我的电话</text>
145
+                        item.sendPerson === friend ? (
146
+                          <>
147
+                            <view className='Icon'>
148
+                              <Image mode='scaleToFill' src={receiver.avatarurl}></Image>
45 149
                             </view>
46
-                            <view>
47
-                              <text className='iconfont icon-shouji'></text>
48
-                              <text>留下您的电话</text>
150
+
151
+                            <view className='flex-item'>
152
+                              { /* 如果是文本 */
153
+                                item.messageType === im.MESSAGETYPE.TEXT && (
154
+                                  <view className='Message Left'>
155
+                                    <text>{item.message}</text>
156
+                                  </view>
157
+
158
+                                  // 图片消息
159
+                                  // <view className='Message Left Img'>
160
+                                  //   <view>
161
+                                  //     <Image mode='scaleToFill' src={receiver.avatarurl}></Image>
162
+                                  //   </view>
163
+                                  // </view>
164
+                                )
165
+                              }
166
+                              { /* 如果是卡片 */
167
+                                item.messageType === im.MESSAGETYPE.CARD && (
168
+                                  <Card person={receiver} onLeavePhone={leavePhone} />
169
+                                )
170
+                              }
49 171
                             </view>
50
-                          </view>
51
-                        }
52
-
53
-                        {/* 对方消息(文本) */}
54
-                        {
55
-                          index % 2 === 0 && index > 2 &&
56
-                          <view className='Message Left'>
57
-                            <text>知道了</text>
58
-                          </view>
59
-                        }
60
-
61
-                        {/* 对方消息(图片) */}
62
-                        {
63
-                          index === 2 &&
64
-                          <view className='Message Left Img'>
65
-                            <view>
66
-                              <Image mode='scaleToFill' src={null}></Image>
172
+                          </>
173
+                        ) : (
174
+                          <>
175
+                            <view className='flex-item'>
176
+                              { /* 如果是文本 */
177
+                                item.messageType === im.MESSAGETYPE.TEXT && (
178
+                                  <view className='Message Right'>
179
+                                    <text>{item.message}</text>
180
+                                  </view>
181
+
182
+                                  // 图片消息
183
+                                  // <view className='Message Right Img'>
184
+                                  //   <view>
185
+                                  //     <Image mode='scaleToFill' src={receiver.avatarurl}></Image>
186
+                                  //   </view>
187
+                                  // </view>
188
+                                )
189
+                              }
67 190
                             </view>
68
-                          </view>
69
-                        }
70
-
71
-                        {/* 我方消息(文本) */}
72
-                        {
73
-                          index % 2 === 1 && index !== 1 &&
74
-                          <view className='Message Right'>
75
-                            <text>知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了知道了</text>
76
-                          </view>
77
-                        }
78
-
79
-                        {/* 我方消息(图片) */}
80
-                        {
81
-                          index === 1 &&
82
-                          <view className='Message Right Img'>
83
-                            <view>
84
-                              <Image mode='scaleToFill' src={null}></Image>
191
+                            <view className='Icon'>
192
+                              <Image mode='scaleToFill' src={person.avatarurl}></Image>
85 193
                             </view>
86
-                          </view>
87
-                        }
194
+                          </>
195
+                        )
196
+                      }
88 197
 
89
-                      </view>
90 198
 
91
-                      {/* 我方头像 */}
92
-                      {
93
-                        index % 2 === 1 &&
94
-                        <view className='Icon'>
95
-                          <Image mode='scaleToFill' src={null}></Image>
96
-                        </view>
97
-                      }
199
+                      {/* 系统模板消息(对方消息) */}
200
+                      {/* {
201
+                          index === 0 &&
202
+                        } */}
98 203
 
99 204
                     </view>
100 205
 
@@ -107,11 +212,11 @@ export default function MyCollectForActivity () {
107 212
       </view>
108 213
       <view className='SendContent flex-h'>
109 214
         <view className='flex-item'>
110
-          <Input placeholder='发送消息' />
215
+          <Input placeholder='发送消息' value={text} onInput={(e) => setText(e.detail.value)} />
111 216
         </view>
112
-        <text className='iconfont icon-tianjia'></text>
113
-        <text className='Send'>发送</text>
217
+        <text className='iconfont icon-tianjia' onClick={submitImage}></text>
218
+        <Button loading={submitting} className='Send' onClick={submitText}>发送</Button>
114 219
       </view>
115 220
     </view>
116 221
   )
117
-}
222
+})

+ 21
- 0
src/pages/chat/chatDetail/useScrollTop.js Datei anzeigen

@@ -0,0 +1,21 @@
1
+
2
+import { useEffect, useState, useRef } from 'react';
3
+import Taro from '@tarojs/taro'
4
+
5
+export default function useScrollTop() {
6
+  // 设置一个初始高度
7
+  const [scrollTop, setScrollTop] = useState(1000)
8
+
9
+  const scroll = () => {
10
+    // Taro.createSelectorQuery()
11
+    //     .select(selector)
12
+    //     .boundingClientRect((rect) => {
13
+    //       console.log('-------rect------->', rect)
14
+    //   }).exec();
15
+    Taro.nextTick(() => {
16
+      setScrollTop(scrollTop + 500)
17
+    })
18
+  }
19
+
20
+  return [scrollTop, scroll]
21
+}

+ 37
- 9
src/pages/chat/index.jsx Datei anzeigen

@@ -1,16 +1,44 @@
1 1
 import { useState, useEffect } from 'react'
2
+import Taro from '@tarojs/taro'
2 3
 import { ScrollView, Image } from '@tarojs/components'
3 4
 import withLayout from '@/layout'
5
+import { queryChatFriends } from '@/services/chat'
6
+import { formatDate } from '@/utils/chatDate'
4 7
 import './index.scss'
5 8
 
6 9
 const defaultRuleImage = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon18.jpg'
7 10
 
8
-export default withLayout(() => {
11
+export default withLayout((props) => {
9 12
 
10 13
   // const [PageProps] = useState(props)
11 14
   const [IsPull, setPull] = useState(false)
12 15
   const [PullTimer, setPullTimer] = useState(null)
13
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', ''])
16
+  const [PageList, setPageList] = useState([])
17
+
18
+  const getList = (params) => {
19
+    Taro.showLoading()
20
+    queryChatFriends({
21
+      pageSize: 20,
22
+      ...params || {},
23
+    }).then((res) => {
24
+      Taro.hideLoading()
25
+      const { records } =  res
26
+      setPageList(records || [])
27
+    }).catch((err) => {
28
+      console.error(err)
29
+      Taro.hideLoading()
30
+    })
31
+  }
32
+
33
+  const handleChat = (item) => {
34
+    Taro.navigateTo({
35
+      url: `/pages/chat/chatDetail/index?friend=${item.friendId}`
36
+    })
37
+  }
38
+
39
+  useEffect(() => {
40
+    getList({ pageNumber: 1 })
41
+  }, [])
14 42
 
15 43
   const PageRefresh = () => { // 页面下拉刷新回调
16 44
     setPull(true)
@@ -28,24 +56,24 @@ export default withLayout(() => {
28 56
   return (
29 57
     <view className='Page Chat'>
30 58
 
31
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
59
+      <ScrollView scrollY refresherEnabled refresherTriggered={IsPull} onRefresherrefresh={PageRefresh} refresherBackground='#fff'>
32 60
         <view className='PageContent'>
33 61
           {
34 62
             PageList.map((item, index) => (
35
-              <view className='ListItem flex-h' key={`ListItem-${index}`}>
63
+              <view className='ListItem flex-h' key={item.friendId} onClick={() => handleChat(item)}>
36 64
                 <view className='Icon'>
37 65
                   <view>
38
-                    <Image mode='aspectFill' className='centerLabel' src={item.img || defaultRuleImage} />
66
+                    <Image mode='aspectFill' className='centerLabel' src={item.avatar || defaultRuleImage} />
39 67
                   </view>
40
-                  <text className='Num'>99</text>
68
+                  {!!item.unReadNum && <text className='Num'>{item.unReadNum}</text>}
41 69
                 </view>
42 70
                 <view className='flex-item'>
43 71
                   <view className='flex-h'>
44
-                    <text className='flex-item'>张三</text>
45
-                    <text>刚刚</text>
72
+                    <text className='flex-item'>{item.name}</text>
73
+                    <text>{formatDate(item.createDate, 'yyyy/M/d')}</text>
46 74
                   </view>
47 75
                   <view className='Msg'>
48
-                    <text>户型很好,很满意</text>
76
+                    <text>{item.messageType === 'text' ? item.message : '[图片]'}</text>
49 77
                   </view>
50 78
                 </view>
51 79
               </view>

+ 5
- 19
src/pages/index/activityDetail/index.jsx Datei anzeigen

@@ -18,7 +18,7 @@ import {
18 18
   queryActivityDetail,
19 19
 } from "@/services/activity";
20 20
 import { getImgURL } from "@/utils/image";
21
-import getDateFormat from "@/utils/chatDate";
21
+import { formatDate } from "@/utils/chatDate";
22 22
 import useParams from "@/utils/hooks/useParams";
23 23
 import useShare from "@/utils/hooks/useShare";
24 24
 import useFavor from "@/utils/hooks/useFavor";
@@ -213,11 +213,7 @@ export default withLayout((props) => {
213 213
         </view>
214 214
         <text className='Time'>
215 215
           报名截止时间:
216
-          {getDateFormat(
217
-            new Date(detail.enlistEnd).valueOf(),
218
-            true,
219
-            'yyyy/M/d'
220
-          )}
216
+          {formatDate(detail.enlistEnd, 'yyyy/M/d')}
221 217
         </text>
222 218
         <text className='Name'>{detail.title}</text>
223 219
         <view className='flex-h Address'>
@@ -230,17 +226,7 @@ export default withLayout((props) => {
230 226
           <text>时间:</text>
231 227
           <view className='flex-item'>
232 228
             <text>
233
-              {getDateFormat(
234
-                new Date(detail.startDate).valueOf(),
235
-                true,
236
-                'yyyy/M/d'
237
-              )}{' '}
238
-              -{' '}
239
-              {getDateFormat(
240
-                new Date(detail.endDate).valueOf(),
241
-                true,
242
-                'yyyy/M/d'
243
-              )}
229
+              {`${formatDate(detail.startDate, 'yyyy/M/d')} - ${formatDate(detail.endDate, 'yyyy/M/d')}`}
244 230
             </text>
245 231
           </view>
246 232
         </view>
@@ -267,7 +253,7 @@ export default withLayout((props) => {
267 253
             </view>
268 254
             <text className='Price'>价格待定</text>
269 255
           </view>
270
-          <text className='Time'>时间:{getDateFormat(new Date(detail.startDate).valueOf(), true, 'yyyy/M/d')} - {getDateFormat(new Date(detail.endDate).valueOf(), true, 'yyyy/M/d')}</text>
256
+          <text className='Time'>时间:{formatDate(detail.startDate, 'yyyy/M/d')} - {formatDate(detail.endDate, 'yyyy/M/d')}</text>
271 257
         </view>
272 258
         <view className='Option'>
273 259
           <view>
@@ -326,7 +312,7 @@ export default withLayout((props) => {
326 312
                   </view>
327 313
 
328 314
                   {detail.type == "dymic" && dymic()}
329
-                  {detail.type == "house" && house()}
315
+                  {detail.type !== "dymic" && house()}
330 316
                   <view className='ActivityIntro'>
331 317
                     <view className='Title'>
332 318
                       <text>活动介绍</text>

+ 2
- 0
src/pages/index/activityDetail/index.scss Datei anzeigen

@@ -333,6 +333,8 @@
333 333
               overflow: hidden;
334 334
               text-align: center;
335 335
               font-size: 0;
336
+              margin-bottom: 30rpx;
337
+
336 338
               &::after {
337 339
                 content: '';
338 340
                 display: block;

+ 118
- 19
src/pages/index/buildingAround/index.jsx Datei anzeigen

@@ -1,21 +1,24 @@
1
-import { useState } from 'react'
1
+import { useState, useEffect, useRef } from 'react'
2
+import Taro from '@tarojs/taro'
2 3
 import withLayout from '@/layout'
3
-import { ScrollView } from '@tarojs/components'
4
+import { ScrollView, Map } from '@tarojs/components'
5
+import { fetch } from '@/utils/request'
6
+import { API_ITEMS_DETAIL } from '@/constants/api'
4 7
 import '@/assets/css/iconfont.css'
5 8
 import './index.scss'
6 9
 
7
-export default withLayout(() => {
10
+export default withLayout((props) => {
11
+  const { router, city } = props
12
+  const { id } = router.params
8 13
 
9
-  const [NavList] = useState([
10
-    { name: '交通', id: 1 },
11
-    { name: '商业', id: 2 },
12
-    { name: '医院', id: 3 },
13
-    { name: '学校', id: 4 },
14
-    { name: '银行', id: 5 }
15
-  ])
14
+  const [DetailInfo, setDetailInfo] = useState({})
15
+  const [loc, setLoc] = useState([])
16
+  const [NavList, setNavList] = useState([])
16 17
   const [CurrentNavId, setCurrentNavId] = useState(1)
17 18
   const [List, setList] = useState([{}, {}, {}, {}, {}, {}, {}, {}, {}])
18 19
   const [OtherList, setOtherList] = useState([{}, {}, {}, {}, {}, {}, {}, {}, {}])
20
+  const [markers, setMarkers] = useState([])
21
+  const mapCtx = useRef()
19 22
 
20 23
   const CutNav = (id) => {
21 24
     return () => {
@@ -23,12 +26,108 @@ export default withLayout(() => {
23 26
     }
24 27
   }
25 28
 
29
+  const locationTo = () => {
30
+    if (loc.length) {
31
+      Taro.openLocation({
32
+        longitude: loc[0],
33
+        latitude: loc[1],
34
+        name: DetailInfo.buildingName,
35
+        address: DetailInfo.address,
36
+      })
37
+    }
38
+  }
39
+
40
+  const handlePoi = (poi) => {
41
+    const [longitude, latitude] = poi.location.split(',').map(x => x ? x - 0 : undefined)
42
+
43
+    const marker = {
44
+      id: 1,
45
+      longitude,
46
+      latitude,
47
+      // iconPath: '',
48
+      width: 18,
49
+      height: 27,
50
+      callout: {
51
+        content: poi.name,
52
+        color: '#333333',
53
+        padding: 6,
54
+        display: 'ALWAYS',
55
+      }
56
+    }
57
+
58
+    const center = markers[0]
59
+    setMarkers([center, marker])
60
+
61
+    if (mapCtx.current) {
62
+      // 缩放地图,显示所有 marker
63
+      const points = [
64
+        {longitude: center.longitude, latitude: center.latitude},
65
+        {longitude: marker.longitude, latitude: marker.latitude}
66
+      ]
67
+      mapCtx.current.includePoints({ points, padding: [32] })
68
+    }
69
+  }
70
+
71
+  // 获取地图 Context
72
+  useEffect(() => {
73
+    Taro.nextTick(() => {
74
+      mapCtx.current = Taro.createMapContext('around-map')
75
+    })
76
+  }, [])
77
+
78
+  useEffect(() => {
79
+    // 获取楼盘信息
80
+    fetch({ url: `${API_ITEMS_DETAIL}/${id}`, spin: true }).then((res) => {
81
+      if (res?.coordinate) {
82
+        // 地图中心
83
+        const [longitude, latitude] = res.coordinate.split(',')
84
+        setLoc([longitude - 0, latitude - 0])
85
+        // 中心点标记
86
+        setMarkers([{
87
+          id: -1,
88
+          longitude,
89
+          latitude,
90
+          width: 18,
91
+          height: 27,
92
+          callout: {
93
+            content: res.buildingName,
94
+            color: '#333333',
95
+            padding: 6,
96
+            display: 'ALWAYS',
97
+          }
98
+        }])
99
+        setDetailInfo(res || {})
100
+        if (res.mapJson) {
101
+          const pois = JSON.parse(res.mapJson).map(poi => ({...poi, data: JSON.parse(poi.data)}))
102
+          setNavList(pois)
103
+          setCurrentNavId(pois[0].key)
104
+          setList(pois[0].data)
105
+        }
106
+        
107
+      } else {
108
+        Taro.showToast({
109
+          title: '当前楼盘未设置位置信息',
110
+          icon: 'none',
111
+        })
112
+      }
113
+    }).catch((err) => {
114
+      console.error(err)
115
+    })
116
+
117
+  }, [id])
118
+
26 119
   return (
27 120
     <view className='Page buildingAround'>
28 121
 
29 122
       <view className='MapContainer'>
30 123
         <view>
31
-          
124
+          <Map
125
+            id='around-map'
126
+            showLocation
127
+            longitude={loc[0]}
128
+            latitude={loc[1]}
129
+            markers={markers}
130
+          />
32 131
         </view>
33 132
       </view>
34 133
 
@@ -37,9 +136,9 @@ export default withLayout(() => {
37 136
 
38 137
           <view className='Title flex-h'>
39 138
             <view className='flex-item'>
40
-              <text>香颂·蔚澜半岛</text>
139
+              <text>{DetailInfo.buildingName}</text>
41 140
             </view>
42
-            <view className='Go'>
141
+            <view className='Go' onClick={locationTo}>
43 142
               <text>前往</text>
44 143
               <text className='iconfont icon-qianwang'></text>
45 144
             </view>
@@ -48,15 +147,15 @@ export default withLayout(() => {
48 147
           <view className='Address flex-h'>
49 148
             <text className='iconfont icon-dingwei'></text>
50 149
             <view className='flex-item'>
51
-              <text>建邺区高庙路与保双街交叉路口</text>
150
+              <text>{DetailInfo.address}</text>
52 151
             </view>
53 152
           </view>
54 153
 
55 154
           <view className='Nav flex-h'>
56 155
             {
57 156
               NavList.map((item, index) => (
58
-                <view className={item.id === CurrentNavId ? 'flex-item active' : 'flex-item'} key={`NavItem-${index}`}>
59
-                  <text onClick={CutNav(item.id)}>{item.name}(12)</text>
157
+                <view className={item.key === CurrentNavId ? 'flex-item active' : 'flex-item'} key={item.key}>
158
+                  <text onClick={CutNav(item.key)}>{`${item.label}(${item.data.length})`}</text>
60 159
                 </view>
61 160
               ))
62 161
             }
@@ -70,13 +169,13 @@ export default withLayout(() => {
70 169
                 <view className='List'>
71 170
                   {
72 171
                     List.map((item, index) => (
73
-                      <view className='flex-h' key={`ListItem-${index}`}>
172
+                      <view className='flex-h' key={`ListItem-${index}`} onClick={() => handlePoi(item)}>
74 173
                         <text>{index + 1}、</text>
75 174
                         <view className='flex-item'>
76
-                          <text>南京地铁1号线</text>
175
+                          <text>{item.name}</text>
77 176
                         </view>
78 177
                         <text className='iconfont icon-dingwei'></text>
79
-                        <text className='distance'>200m</text>
178
+                        <text className='distance'>{`${item.distance}m`}</text>
80 179
                       </view>
81 180
                     ))
82 181
                   }

+ 5
- 0
src/pages/index/buildingAround/index.scss Datei anzeigen

@@ -15,6 +15,11 @@
15 15
       height: calc(100vh - 600px);
16 16
       position: relative;
17 17
       overflow: hidden;
18
+
19
+      map {
20
+        width: 100%;
21
+        height: 100%;
22
+      }
18 23
     }
19 24
   }
20 25
   >.TabContainer {

+ 3
- 3
src/pages/index/buildingDetail/components/DetailBottom/index.jsx Datei anzeigen

@@ -29,7 +29,7 @@ export default function DetailBottom (props) {
29 29
 
30 30
     if (consultant?.id) {
31 31
       Taro.navigateTo({
32
-        url: `/pages/chat/chatDetail/index?targetPerson=${consultant.id}}`
32
+        url: `/pages/chat/chatDetail/index?friend=${consultant.id}}`
33 33
       })
34 34
     } else {
35 35
       Taro.navigateTo({
@@ -66,10 +66,10 @@ export default function DetailBottom (props) {
66 66
     if (Info.buildingId) {
67 67
       // 请求看房活动
68 68
       queryActivityList({ buildingId: Info.buildingId, pageSize: 1, type: 'look' }).then((res) => {
69
-        const { list } = res || {}
69
+        const { records } = res || {}
70 70
 
71 71
         // 只保留已发布的活动
72
-        setActList((list || []))
72
+        setActList((records || []))
73 73
       })
74 74
     }
75 75
   }, [Info.buildingId])

+ 3
- 3
src/pages/index/buildingDetail/components/MarketingActivity/index.jsx Datei anzeigen

@@ -18,10 +18,10 @@ export default function MarketingActivity (props) {
18 18
   useEffect(() => {
19 19
     if (buildingId) {
20 20
       queryActivityList({ buildingId, pageSize: 500, type: 'house' }).then((res) => {
21
-        const { list } = res || {}
21
+        const { records } = res || {}
22 22
         
23 23
         // 只保留3场在进行中的活动
24
-        setDataList((list || []).filter((x) => (x.activityStatus === 0)).slice(0, 3))
24
+        setDataList((records || []).filter((x) => (x.activityStatus < 2)).slice(0, 3))
25 25
       })
26 26
     }
27 27
   }, [buildingId])
@@ -44,7 +44,7 @@ export default function MarketingActivity (props) {
44 44
               dataList.map((item, index) => (
45 45
                 <SwiperItem key={`Banner-${index}`}>
46 46
                   <view className='swiper-item' onClick={() => goDetail(item.dynamicId)}>
47
-                    <Image mode='aspectFill' className='centerLabel' src={getImgURL(item.bannerListImg || item.image || item.url || item.img || item.imgUrl || item.detailImg)} />
47
+                    <Image mode='aspectFill' className='centerLabel' src={getImgURL(item.imgUrl || item.image || item.url || item.img || item.imgUrl || item.detailImg)} />
48 48
                   </view>
49 49
                 </SwiperItem>
50 50
               ))

+ 12
- 17
src/pages/index/buildingDetail/components/Periphery/index.jsx Datei anzeigen

@@ -30,10 +30,8 @@ export default function Periphery (props) {
30 30
     return tagLen + poiLen
31 31
   }, [Info, pois])
32 32
 
33
-  const CutTab = () => {
34
-    return () => {
35
-      Taro.navigateTo({url: `/pages/index/buildingAround/index?id=${Info.buildingId}`})
36
-    }
33
+  const handleClick = () => {
34
+    Taro.navigateTo({url: `/pages/index/buildingAround/index?id=${Info.buildingId}`})
37 35
   }
38 36
 
39 37
   useEffect(() => {
@@ -46,11 +44,12 @@ export default function Periphery (props) {
46 44
         longitude: loc[0],
47 45
         latitude: loc[1],
48 46
         iconPath: '',
49
-        width: 24,
50
-        height: 36,
51
-        customCallout: {
52
-          anchorY: 0,
53
-          anchorX: 0,
47
+        width: 18,
48
+        height: 27,
49
+        callout: {
50
+          content: Info.buildingName,
51
+          color: '#333333',
52
+          padding: 6,
54 53
           display: 'ALWAYS',
55 54
         }
56 55
       })
@@ -81,25 +80,21 @@ export default function Periphery (props) {
81 80
         <view>
82 81
           <Map
83 82
             id='poi-around'
84
-            show-location
83
+            // show-location
85 84
             scale={12}
86 85
             markers={markers}
87 86
             longitude={loc[0]}
88 87
             latitude={loc[1]}
89 88
             // enable-enableScroll
90 89
             // enable-zoom
91
-          >
92
-            <CoverView slot='callout' className='marker-callout'>
93
-              <CoverView markerId={-1} className='marker-project'>{Info.buildingName}</CoverView>
94
-            </CoverView>
95
-          </Map>
90
+          />
96 91
         </view>
97 92
       </view>
98 93
 
99
-      <view className='List flex-h'>
94
+      <view className='List flex-h' onClick={handleClick}>
100 95
         {
101 96
           poiTypes.map((item) => (
102
-            <view className='flex-item' key={item.value} onClick={CutTab(item.value)}>
97
+            <view className='flex-item' key={item.value}>
103 98
               <text className={item.class}></text>
104 99
               <text>{item.label}</text>
105 100
               <text>({countLen(item.value)})</text>

+ 1
- 1
src/pages/index/buildingDetail/components/PropertyConsultant/index.jsx Datei anzeigen

@@ -27,7 +27,7 @@ export default function PropertyConsultant (props) {
27 27
 
28 28
   const handleChat = (item) => {
29 29
     Taro.navigateTo({
30
-      url: `/pages/chat/chatDetail/index?targetPerson=${item.id}}`
30
+      url: `/pages/chat/chatDetail/index?friend=${item.id}`
31 31
     })
32 32
   }
33 33
   

+ 1
- 1
src/pages/index/buildingDetail/index.jsx Datei anzeigen

@@ -62,7 +62,7 @@ export default withLayout((props) => {
62 62
       console.error(err)
63 63
     })
64 64
 
65
-  }, [id, router.path])
65
+  }, [id])
66 66
 
67 67
   // 户型图
68 68
   const houseTypeImages = (DetailInfo?.buildingApartment || []).filter(x => x.apartmentType === 'apart')

+ 1
- 1
src/pages/index/buildingPropertyConsultant/index.jsx Datei anzeigen

@@ -15,7 +15,7 @@ export default withLayout((props) => {
15 15
 
16 16
   const handleChat = (item) => {
17 17
     Taro.navigateTo({
18
-      url: `/pages/chat/chatDetail/index?targetPerson=${item.id}}`
18
+      url: `/pages/chat/chatDetail/index?friend=${item.id}`
19 19
     })
20 20
   }
21 21
 

+ 2
- 2
src/pages/index/components/ActivityListItem/index.jsx Datei anzeigen

@@ -3,7 +3,7 @@ import './index.scss'
3 3
 import { Image } from '@tarojs/components'
4 4
 import Taro from '@tarojs/taro'
5 5
 import { getImgURL } from '@/utils/image'
6
-import getDateFormat from '@/utils/chatDate'
6
+import { formatDate } from '@/utils/chatDate'
7 7
 
8 8
 const activityStatusDict={
9 9
   0:{
@@ -38,7 +38,7 @@ export default function ActivityListItem (props) {
38 38
           <text className={activityStatusDict[data.activityStatus]?.className}>{activityStatusDict[data.activityStatus]?.text}</text>
39 39
         </view>
40 40
         <view className='Time'>
41
-          <text>活动时间:{getDateFormat(new Date(data.startDate).valueOf(),true,'yyyy/M/d')} - {getDateFormat(new Date(data.endDate).valueOf(),true,'yyyy/M/d')}</text>
41
+          <text>活动时间:{formatDate(data.startDate, 'yyyy/M/d')} - {formatDate(data.endDate, 'yyyy/M/d')}</text>
42 42
         </view>
43 43
       </view>
44 44
     </view>

+ 2
- 2
src/pages/index/components/NewsListItem/index.jsx Datei anzeigen

@@ -3,7 +3,7 @@ import './index.scss'
3 3
 import { Image } from '@tarojs/components'
4 4
 import Taro from '@tarojs/taro'
5 5
 import { getImgURL } from "@/utils/image";
6
-import getDateFormat from "@/utils/chatDate";
6
+import { formatDate } from "@/utils/chatDate";
7 7
 
8 8
 export default function NewsListItem (props) {
9 9
   const { data = {} } = props
@@ -15,7 +15,7 @@ export default function NewsListItem (props) {
15 15
       </view>
16 16
       <view className='flex-item'>
17 17
         <text>{data.newsName}</text>
18
-        <text>于{getDateFormat(new Date(data.createDate).valueOf(), true,"yyyy-M-d")}发布</text>
18
+        <text>于{formatDate(data.createDate, "yyyy-M-d")}发布</text>
19 19
       </view>
20 20
     </view>
21 21
   )

+ 2
- 7
src/pages/index/encyDetail/index.jsx Datei anzeigen

@@ -6,7 +6,7 @@ import { ScrollView } from "@tarojs/components";
6 6
 import "@/assets/css/iconfont.css";
7 7
 import { Image, RichText } from "@tarojs/components";
8 8
 import { queryPolicyDetail } from "@/services/policy";
9
-import getDateFormat from "@/utils/chatDate";
9
+import { formatDate } from "@/utils/chatDate";
10 10
 
11 11
 export default withLayout((props) => {
12 12
   const { router, shareContent, trackData, person, page } = props;
@@ -44,13 +44,8 @@ export default withLayout((props) => {
44 44
                   <view>
45 45
                   <text>阅读:{data.pvNum}</text>
46 46
                     <text className="Time">
47
-                      {getDateFormat(
48
-                        new Date(data.createDate).valueOf(),
49
-                        true,
50
-                        "yyyy-M-d"
51
-                      )}
47
+                      {formatDate(data.createDate, "yyyy-M-d")}
52 48
                     </text>
53
-                   
54 49
                   </view>
55 50
                 </view>
56 51
               </view>

+ 142
- 34
src/pages/index/findHouseFromMap/index.jsx Datei anzeigen

@@ -1,81 +1,189 @@
1
-import { useState } from 'react'
1
+import { useEffect, useRef, useState } from 'react'
2
+import Taro from '@tarojs/taro'
2 3
 import withLayout from '@/layout'
3
-import { Image } from '@tarojs/components'
4
+import { Image, Map } from '@tarojs/components'
5
+import { getItemList } from '@/services/item'
6
+import { getImgURL } from '@/utils/image'
4 7
 import '@/assets/css/iconfont.css'
5 8
 import './index.scss'
6 9
 
7
-export default withLayout(() => {
10
+export default withLayout((props) => {
11
+  const { city } = props
8 12
 
9 13
   const [ShowInfo, setShowInfo] = useState(false)
14
+  const [list, setList] = useState([])
15
+  const [markers, setMarkers] = useState([])
16
+  const mapCtx = useRef()
17
+  const [current, setCurrent] = useState({})
10 18
 
11
-  const CutInfo = (status) => {
12
-    return () => {
13
-      setShowInfo(!!status)
19
+  const changeCity = () => {
20
+    Taro.navigateTo({ url: '/pages/index/location/index' })
21
+  }
22
+
23
+  const handleMarker = (e) => {
24
+    const { markerId } = e
25
+    const building = list[markerId - 1];
26
+    setCurrent(building||{});
27
+    setShowInfo(true)
28
+  }
29
+
30
+  const gotoDetail = () => {
31
+    if (current.buildingId) {
32
+      Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${current.buildingId}` })
33
+    }
34
+  }
35
+
36
+  const locationTo = () => {
37
+    if (current.buildingId) {
38
+      const loc = current.coordinate.split(',')
39
+      Taro.openLocation({
40
+        longitude: loc[0] - 0,
41
+        latitude: loc[1] - 0,
42
+        name: current.buildingName,
43
+        address: current.address,
44
+        scale: 12,
45
+      })
14 46
     }
15 47
   }
16 48
 
49
+  useEffect(() => {
50
+    Taro.nextTick(() => {
51
+      mapCtx.current = Taro.createMapContext('map-buildings')
52
+    })
53
+  }, [])
54
+
55
+  useEffect(() => {
56
+    if (city?.id) {
57
+      // 先移除页面的 markers
58
+      if (mapCtx.current && markers.length) {
59
+        mapCtx.current.removeMarkers({ markerIds: markers.map(x => x.id) })
60
+        setMarkers([])
61
+      }
62
+
63
+      getItemList({
64
+        cityId: city.id,
65
+        pageSize: 100,
66
+      }).then((res) => {
67
+        const { records } = res
68
+        setList((records || []).filter(x => x.coordinate))
69
+      })
70
+    }
71
+  }, [city?.id])
72
+
73
+  useEffect(() => {
74
+    if (!list.length) return;
75
+
76
+    const mks = list.map((item, index) => {
77
+      const loc = item.coordinate.split(',')
78
+
79
+      return {
80
+        id: index + 1,
81
+        longitude: loc[0] - 0,
82
+        latitude: loc[1] - 0,
83
+        iconPath: '',
84
+        width: 18,
85
+        height: 27,
86
+        callout: {
87
+          content: item.buildingName,
88
+          color: '#333333',
89
+          fontSize: 14,
90
+          display: 'ALWAYS',
91
+          padding: 6,
92
+          borderRadius: 2,
93
+          borderColor: 'rgba(0,0,0, .1)',
94
+        }
95
+        // customCallout: {
96
+        //   anchorY: 0,
97
+        //   anchorX: 0,
98
+        //   display: 'ALWAYS',
99
+        // }
100
+      }
101
+    })
102
+
103
+    const points = mks.map(it => ({ longitude: it.longitude, latitude: it.latitude }))
104
+    setMarkers(mks)
105
+
106
+    const t = setInterval(() => {
107
+      if (mapCtx.current) {
108
+        mapCtx.current.includePoints({ points, padding: [32] })
109
+        clearInterval(t)
110
+      }
111
+    }, 300)
112
+
113
+    return () => clearInterval(t)
114
+  }, [list])
115
+
17 116
   return (
18 117
     <view className='Page findHouseFromMap'>
19 118
 
20 119
       {/* 地图 */}
21 120
       <view className='MapContainer'>
22
-
121
+        <Map
122
+          id='map-buildings'
123
+          show-location
124
+          scale={12}
125
+          longitude={city?.lng}
126
+          latitude={city?.lat}
127
+          markers={markers}
128
+          onMarkertap={handleMarker}
129
+          onTap={() => setShowInfo(false)}
130
+        />
23 131
       </view>
24 132
 
25 133
       {/* 定位 */}
26
-      <view className='Location'>
134
+      <view className='Location' onClick={changeCity}>
27 135
         <text className='iconfont icon-dingwei'></text>
28
-        <text>南京市</text>
136
+        <text>{city.name}</text>
29 137
       </view>
30 138
 
31 139
       {/* 分享 */}
32
-      <view className='Share'>
140
+      <button className='Share' openType='share'>
33 141
         <text className='iconfont icon-fenxiang'></text>
34
-        <text>分享</text>
35
-      </view>
142
+        <text>分 享</text>
143
+      </button>
36 144
 
37 145
       {/* 附近楼盘 */}
38 146
       <view className={ShowInfo ? 'AroundBuilding active' : 'AroundBuilding'}>
39
-        <view className='Go'>
147
+        <view className='Go' onClick={locationTo}>
40 148
           <text>立即</text>
41 149
           <text>前往</text>
42 150
         </view>
43 151
         <view className='InfoContainer'>
44
-          <text className='Title' onClick={CutInfo(true)}>附近楼盘</text>
152
+          {/* <text className='Title' onClick={CutInfo(true)}>附近楼盘</text> */}
45 153
           <view className='InfoContent'>
46
-            <view className='Img'>
47
-              <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
154
+            <view className='Img' onClick={gotoDetail}>
155
+              <Image mode='scaleToFill' src={getImgURL(current.buildingListImg?.length ? current.buildingListImg[0].url : null)} className='centerLabel'></Image>
48 156
             </view>
49 157
             <view className='Name flex-h'>
50 158
               <view className='flex-item'>
51
-                <text>奥园金基天著尚居</text>
159
+                <text>{current.buildingName}</text>
52 160
               </view>
53
-              <text>约</text>
54
-              <text>20000/㎡</text>
161
+              <text></text>
162
+              <text>{current.price}</text>
55 163
             </view>
56
-            <text className='Address'>江宁禄口云熙99路号(诚信大道)</text>
164
+            <text className='Address'>{current.address}</text>
57 165
             <view className='Tag'>
58
-              <text>纯新盘</text>
59
-              <text>纯新盘</text>
60
-              <text>纯新盘</text>
166
+            {
167
+              (current.buildingTag || []).map((item, index) => (
168
+                <text key={`Tags-${index}`}>{item.tagName}</text>
169
+              ))
170
+            }
61 171
             </view>
62 172
             <view className='Views flex-h'>
63 173
               <view className='flex-item'>
64 174
                 <text className='iconfont icon-fenxiang'></text>
65
-                <text>3次分享</text>
175
+                <text>{`${current.shareNum||0}次分享`}</text>
66 176
               </view>
67 177
               <view className='Icons'>
68
-                <view>
69
-                  <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
70
-                </view>
71
-                <view>
72
-                  <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
73
-                </view>
74
-                <view>
75
-                  <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
76
-                </view>
178
+                {
179
+                  (current.uvList?.records || []).slice(0, 3).map((item, index) => (
180
+                    <view key={`uv-${index}`}>
181
+                      <Image mode='scaleToFill' className='centerLabel' src={item.photoOravatar} />
182
+                    </view>
183
+                  ))
184
+                }
77 185
               </view>
78
-              <text>...9人围观</text>
186
+              <text>{`...${current.pvNum}人围观`}</text>
79 187
             </view>
80 188
           </view>
81 189
         </view>

+ 7
- 0
src/pages/index/findHouseFromMap/index.scss Datei anzeigen

@@ -10,6 +10,11 @@
10 10
     overflow: hidden;
11 11
     z-index: 1;
12 12
     background: #eee;
13
+
14
+    map {
15
+      width: 100%;
16
+      height: 100%;
17
+    }
13 18
   }
14 19
   > .Location,
15 20
   > .Share {
@@ -22,6 +27,8 @@
22 27
     top: 30px;
23 28
     right: 30px;
24 29
     border-radius: 12px;
30
+    padding: 0;
31
+
25 32
     > text {
26 33
       display: block;
27 34
       text-align: center;

+ 20
- 5
src/pages/index/helpToFindHouse/components/SubmitBuyHouseResult/index.jsx Datei anzeigen

@@ -1,12 +1,27 @@
1 1
 
2
-import '@/assets/css/iconfont.css'
2
+import { useState } from 'react'
3
+import Taro from '@tarojs/taro'
3 4
 import { Image, Block } from '@tarojs/components'
4 5
 import { getImgURL } from '@/utils/image'
5
-import Taro from '@tarojs/taro'
6
+import '@/assets/css/iconfont.css'
6 7
 import './index.scss'
7 8
 
8 9
 export default function SubmitBuyHouseResult (props) {
9
-  const { List = [] } = props
10
+  const { List = [], setting } = props
11
+
12
+  const handlePhone = () => {
13
+    if (!setting?.phone) {
14
+      Taro.showToast({
15
+        title: '暂不提供相关服务',
16
+        icon: 'none',
17
+      })
18
+    }
19
+
20
+    Taro.makePhoneCall({
21
+      phoneNumber: setting.phone,
22
+    })
23
+  }
24
+
10 25
   return (
11 26
     <view className='components SubmitBuyHouseResult'>
12 27
       <view className='centerLabel'>
@@ -25,8 +40,8 @@ export default function SubmitBuyHouseResult (props) {
25 40
             </view>
26 41
 
27 42
             <view className='Btn flex-h'>
28
-              <text className='flex-item'>一键咨询</text>
29
-              <text className='flex-item active'>一键电话</text>
43
+              <button className='flex-item' openType='contact'>一键咨询</button>
44
+              <text className='flex-item active' onClick={handlePhone}>一键电话</text>
30 45
             </view>
31 46
 
32 47
             {/* 匹配楼盘 */}

+ 2
- 1
src/pages/index/helpToFindHouse/components/SubmitBuyHouseResult/index.scss Datei anzeigen

@@ -58,7 +58,8 @@
58 58
           margin-top: 40px;
59 59
           align-items: center;
60 60
           margin-bottom: 60px;
61
-          >text {
61
+          >text, button {
62
+            padding: 0;
62 63
             font-size: 30px;
63 64
             line-height: 78px;
64 65
             border-radius: 78px;

+ 8
- 2
src/pages/index/helpToFindHouse/index.jsx Datei anzeigen

@@ -1,4 +1,4 @@
1
-import { useState } from 'react'
1
+import { useEffect, useState } from 'react'
2 2
 import withLayout from '@/layout'
3 3
 import { ScrollView, Image } from '@tarojs/components'
4 4
 import { fetch } from '@/utils/request'
@@ -6,6 +6,7 @@ import { API_HELP_FIND_HOUSE_SUBMIT } from '@/constants/api'
6 6
 import '@/assets/css/iconfont.css'
7 7
 import { useSelector } from 'react-redux'
8 8
 import AreaPickerView from '@/components/AreaPickerView/index'
9
+import { getFeedbackSetting } from '@/services/common'
9 10
 import './index.scss'
10 11
 import BuyHouse from './components/BuyHouse/index'
11 12
 import RentingHouse from './components/RentingHouse/index'
@@ -26,6 +27,7 @@ export default withLayout(() => {
26 27
   const [ShowPopup, setShowPopup] = useState(false)
27 28
   const [ShowCitysPopup, setShowCitysPopup] = useState(false)
28 29
   const [AreaInfo, setAreaInfo] = useState({})
30
+  const [setting, setSetting] = useState({})
29 31
 
30 32
   const CutDemandId = (id) => {
31 33
     return () => {
@@ -69,6 +71,10 @@ export default withLayout(() => {
69 71
     })
70 72
   }
71 73
 
74
+  useEffect(() => {
75
+    getFeedbackSetting().then((res) => setSetting(res))
76
+  }, [])
77
+
72 78
   return (
73 79
     <view className='Page helpToFindHouse'>
74 80
 
@@ -76,7 +82,7 @@ export default withLayout(() => {
76 82
 
77 83
       {
78 84
         ShowPopup &&
79
-        <SubmitBuyHouseResult List={ResultList}></SubmitBuyHouseResult>
85
+        <SubmitBuyHouseResult setting={setting} List={ResultList}></SubmitBuyHouseResult>
80 86
       }
81 87
 
82 88
       <ScrollView scroll-y refresher-enabled={false}>

+ 2
- 7
src/pages/index/newsDetail/index.jsx Datei anzeigen

@@ -11,7 +11,7 @@ import {
11 11
   queryNewsDetail,
12 12
   cancelFavorNews,
13 13
 } from "@/services/news";
14
-import getDateFormat from "@/utils/chatDate";
14
+import { formatDate } from "@/utils/chatDate";
15 15
 
16 16
 export default withLayout((props) => {
17 17
   const { id } = props.router.params;
@@ -74,12 +74,7 @@ export default withLayout((props) => {
74 74
                       <text>收藏{data.saveNum || 0}</text>
75 75
                     </view>
76 76
                     <text className="Time">
77
-                      时间:
78
-                      {getDateFormat(
79
-                        new Date(data.createDate).valueOf(),
80
-                        true,
81
-                        "yyyy-M-d"
82
-                      )}{" "}
77
+                      {`时间:${formatDate(data.createDate, "yyyy-M-d")} `}
83 78
                     </text>
84 79
                     <text className="Share">分享好友</text>
85 80
                   </view>

+ 5
- 14
src/pages/index/specialPriceHouse/index.jsx Datei anzeigen

@@ -13,26 +13,17 @@ import './index.scss'
13 13
 
14 14
 const defaultRuleImage = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg'
15 15
 
16
-export default withLayout(() => {
16
+export default withLayout((props) => {
17
+  const { city } = props
17 18
   
18
-  const user = useSelector(state => state.user)
19 19
   const [PageList, setPageList] = useState([])
20 20
   const [IsPull, setPull] = useState(false)
21
-  const [PersonId, setPersonId] = useState(null)
22 21
   const [pageNumber, setPageNumber] = useState(1)
23 22
   const [HasNextPage, setHasNextPage] = useState(true)
24 23
 
25 24
   useEffect(() => {
26
-    if(user?.userInfo?.person?.personId) {
27
-      setPersonId(user.userInfo.person.personId)
28
-    }
29
-  }, [user])
30
-
31
-  useEffect(() => {
32
-    if(PersonId) {
33
-      GetPageList()
34
-    }
35
-  }, [pageNumber, PersonId])
25
+    GetPageList()
26
+  }, [pageNumber])
36 27
 
37 28
   const PageRefresh = () => { // 页面下拉刷新回调
38 29
     setPull(true)
@@ -40,7 +31,7 @@ export default withLayout(() => {
40 31
 
41 32
   const GetPageList = () => {
42 33
     setHasNextPage(false)
43
-    fetch({ url: API_SPECIAL_ROOM_LIST, method: 'get', payload: { pageNumber, pageSize: 10 } }).then((res) => {
34
+    fetch({ url: API_SPECIAL_ROOM_LIST, method: 'get', payload: { pageNumber, pageSize: 10, cityId: city?.id } }).then((res) => {
44 35
       setPageList(pageNumber === 1 ? res.records || [] : PageList.concat(res.records || []))
45 36
       setHasNextPage(res.current < res.pages)
46 37
       setPull(false)

+ 1
- 3
src/pages/mine/components/UserDetailFollowRecord/index.jsx Datei anzeigen

@@ -2,11 +2,9 @@ import { useState, useEffect } from 'react'
2 2
 import { ScrollView } from '@tarojs/components'
3 3
 import { fetch } from '@/utils/request'
4 4
 import { API_FOLLOW_LIST } from '@/constants/api'
5
-import getDateFormat from "@/utils/chatDate";
5
+import { formatDate } from "@/utils/chatDate";
6 6
 import './index.scss'
7 7
 
8
-const formatDate = (dtStr, formatStr) => getDateFormat((new Date(dtStr)).valueOf(), true, formatStr)
9
-
10 8
 export default function UserDetailFollowRecord (props) {
11 9
   const { CustomerId = null, AddFollow = () => {}, AddFollowCounts = 0 } = props
12 10
   const [PageList, setPageList] = useState([])

+ 4
- 6
src/pages/video/videoDetail/index.jsx Datei anzeigen

@@ -5,7 +5,7 @@ import "@/assets/css/iconfont.css";
5 5
 import "./index.scss";
6 6
 import { fetch } from "@/utils/request";
7 7
 import { API_VIDEO_DETAIL } from "@/constants/api";
8
-import getDateFormat from "@/utils/chatDate";
8
+import { formatDate } from "@/utils/chatDate";
9 9
 
10 10
 export default withLayout((props) => {
11 11
   const { id } = props.router.params;
@@ -49,11 +49,9 @@ export default withLayout((props) => {
49 49
           {/* 视频信息 */}
50 50
           <view className="Info">
51 51
             <text className="Name">{data.name}</text>
52
-            <text className="Time">时间:{getDateFormat(
53
-            new Date(data.createdTime).valueOf(),
54
-            true,
55
-            'yyyy年M月d日'
56
-          )}</text>
52
+            <text className="Time">
53
+              {`时间:${formatDate(data.createdTime, 'yyyy年M月d日')}`}
54
+            </text>
57 55
           </view>
58 56
 
59 57
           {/* 详情 */}

+ 5
- 2
src/services/common.js Datei anzeigen

@@ -9,7 +9,8 @@ import {
9 9
   API_TEMPLATE_TYPE,
10 10
   API_BRAND_LIST,
11 11
   API_BRAND_INFO,
12
-  API_INDEX_ICONS
12
+  API_INDEX_ICONS,
13
+  API_FEEDBACK_SETTING,
13 14
 } from "@/constants/api";
14 15
 
15 16
 /**
@@ -102,4 +103,6 @@ export const queryBrandList = (params) => fetch({ url: API_BRAND_LIST, params })
102 103
  * 获取品牌房企列表
103 104
  * @param {*}
104 105
  */
105
- export const queryBrandInfo = (id) => fetch({ url: `${API_BRAND_INFO}/${id}`});
106
+export const queryBrandInfo = (id) => fetch({ url: `${API_BRAND_INFO}/${id}`});
107
+
108
+export const getFeedbackSetting = () => fetch({ url: API_FEEDBACK_SETTING });

+ 71
- 71
src/utils/chatDate.js Datei anzeigen

@@ -12,7 +12,9 @@
12 12
 */
13 13
 
14 14
 //例子 getDateFormat(new Date().valueOf(),true,'yyyy/M/d')
15
-var _formatDate = function (date, fmt) {
15
+export function formatDate(dt, fmt) {
16
+  const date = new Date(dt)
17
+
16 18
   var o = {
17 19
     "M+": date.getMonth() + 1, //月份
18 20
     "d+": date.getDate(), //日
@@ -28,102 +30,100 @@ var _formatDate = function (date, fmt) {
28 30
   return fmt;
29 31
 };
30 32
 
33
+
31 34
 /**
32 35
 * 仿照微信中的消息时间显示逻辑,将时间戳(单位:毫秒)转换为友好的显示格式.
33 36
 *
34 37
 * 1)7天之内的日期显示逻辑是:今天、昨天(-1d)、前天(-2d)、星期?(只显示总计7天之内的星期数,即<=-4d);
35 38
 * 2)7天之外(即>7天)的逻辑:直接显示完整日期时间。
36 39
 *
37
-* @param  {[long]} timestamp 时间戳(单位:毫秒),形如:1550789954260
40
+* @param  {[string|date]} dt 时间
38 41
 * @param {boolean} mustIncludeTime true表示输出的格式里一定会包含“时间:分钟”
39 42
 * ,否则不包含(参考微信,不包含时分的情况,用于首页“消息”中显示时)
40 43
 *
41 44
 * @return {string} 输出格式形如:“刚刚”、“10:30”、“昨天 12:04”、“前天 20:51”、“星期二”、“2019/2/21 12:09”等形式
42 45
 * @since 1.1
43 46
 */
44
-export default function getDateFormat(timestamp, mustIncludeTime,format='yyyy-M-d') {
47
+export function getDateForHumans(dt, mustIncludeTime, format='yyyy-M-d') {
45 48
 
46 49
   // 当前时间
47
-  // var currentDate = new Date();
50
+  var currentDate = new Date();
48 51
   // 目标判断时间
49
-  var srcDate = new Date(parseInt(timestamp));
52
+  var srcDate = new Date(dt);
50 53
 
51
-  // var currentYear = currentDate.getFullYear();
52
-  // var currentMonth = (currentDate.getMonth() + 1);
53
-  // var currentDateD = currentDate.getDate();
54
+  var currentYear = currentDate.getFullYear();
55
+  var currentMonth = (currentDate.getMonth() + 1);
56
+  var currentDateD = currentDate.getDate();
54 57
 
55
-  // var srcYear = srcDate.getFullYear();
56
-  // var srcMonth = (srcDate.getMonth() + 1);
57
-  // var srcDateD = srcDate.getDate();
58
+  var srcYear = srcDate.getFullYear();
59
+  var srcMonth = (srcDate.getMonth() + 1);
60
+  var srcDateD = srcDate.getDate();
58 61
 
59 62
   var ret = "";
60 63
 
61 64
   // 要额外显示的时间分钟
62
-  var timeExtraStr = (mustIncludeTime ? " " + _formatDate(srcDate, "hh:mm") : "");
65
+  var timeExtraStr = (mustIncludeTime ? " " + formatDate(srcDate, "hh:mm") : "");
63 66
 
64
-  // // 当年
65
-  // if (currentYear == srcYear) {
66
-  //   var currentTimestamp = currentDate.getTime();
67
-  //   var srcTimestamp = timestamp;
68
-  //   // 相差时间(单位:毫秒)
69
-  //   var deltaTime = (currentTimestamp - srcTimestamp);
67
+  // 当年
68
+  if (currentYear == srcYear) {
69
+    // 相差时间(单位:毫秒)
70
+    var deltaTime = (currentDate - srcDate);
70 71
 
71
-  //   // 当天(月份和日期一致才是)
72
-  //   if (currentMonth == srcMonth && currentDateD == srcDateD) {
73
-  //     // 时间相差60秒以内
74
-  //     if (deltaTime < 60 * 1000)
75
-  //       ret = "刚刚";
76
-  //     // 否则当天其它时间段的,直接显示“时:分”的形式
77
-  //     else
78
-  //       ret = _formatDate(srcDate, "hh:mm");
79
-  //   }
80
-  //   // 当年 && 当天之外的时间(即昨天及以前的时间)
81
-  //   else {
82
-  //     // 昨天(以“现在”的时候为基准-1天)
83
-  //     var yesterdayDate = new Date();
84
-  //     yesterdayDate.setDate(yesterdayDate.getDate() - 1);
72
+    // 当天(月份和日期一致才是)
73
+    if (currentMonth == srcMonth && currentDateD == srcDateD) {
74
+      // 时间相差60秒以内
75
+      if (deltaTime < 60 * 1000)
76
+        ret = "刚刚";
77
+      // 否则当天其它时间段的,直接显示“时:分”的形式
78
+      else
79
+        ret = formatDate(srcDate, "hh:mm");
80
+    }
81
+    // 当年 && 当天之外的时间(即昨天及以前的时间)
82
+    else {
83
+      // 昨天(以“现在”的时候为基准-1天)
84
+      var yesterdayDate = new Date();
85
+      yesterdayDate.setDate(yesterdayDate.getDate() - 1);
85 86
 
86
-  //     // 前天(以“现在”的时候为基准-2天)
87
-  //     var beforeYesterdayDate = new Date();
88
-  //     beforeYesterdayDate.setDate(beforeYesterdayDate.getDate() - 2);
87
+      // 前天(以“现在”的时候为基准-2天)
88
+      var beforeYesterdayDate = new Date();
89
+      beforeYesterdayDate.setDate(beforeYesterdayDate.getDate() - 2);
89 90
 
90
-  //     // 用目标日期的“月”和“天”跟上方计算出来的“昨天”进行比较,是最为准确的(如果用时间戳差值
91
-  //     // 的形式,是不准确的,比如:现在时刻是2019年02月22日1:00、而srcDate是2019年02月21日23:00,
92
-  //     // 这两者间只相差2小时,直接用“deltaTime/(3600 * 1000)” > 24小时来判断是否昨天,就完全是扯蛋的逻辑了)
93
-  //     if (srcMonth == (yesterdayDate.getMonth() + 1) && srcDateD == yesterdayDate.getDate())
94
-  //       ret = "昨天" + timeExtraStr;// -1d
95
-  //     // “前天”判断逻辑同上
96
-  //     else if (srcMonth == (beforeYesterdayDate.getMonth() + 1) && srcDateD == beforeYesterdayDate.getDate())
97
-  //       ret = "前天" + timeExtraStr;// -2d
98
-  //     else {
99
-  //       // 跟当前时间相差的小时数
100
-  //       var deltaHour = (deltaTime / (3600 * 1000));
91
+      // 用目标日期的“月”和“天”跟上方计算出来的“昨天”进行比较,是最为准确的(如果用时间戳差值
92
+      // 的形式,是不准确的,比如:现在时刻是2019年02月22日1:00、而srcDate是2019年02月21日23:00,
93
+      // 这两者间只相差2小时,直接用“deltaTime/(3600 * 1000)” > 24小时来判断是否昨天,就完全是扯蛋的逻辑了)
94
+      if (srcMonth == (yesterdayDate.getMonth() + 1) && srcDateD == yesterdayDate.getDate())
95
+        ret = "昨天" + timeExtraStr;// -1d
96
+      // “前天”判断逻辑同上
97
+      else if (srcMonth == (beforeYesterdayDate.getMonth() + 1) && srcDateD == beforeYesterdayDate.getDate())
98
+        ret = "前天" + timeExtraStr;// -2d
99
+      else {
100
+        // 跟当前时间相差的小时数
101
+        var deltaHour = (deltaTime / (3600 * 1000));
101 102
 
102
-  //       // 如果小于或等 7*24小时就显示星期几
103
-  //       if (deltaHour <= 7 * 24) {
104
-  //         var weekday = new Array(7);
105
-  //         weekday[0] = "星期日";
106
-  //         weekday[1] = "星期一";
107
-  //         weekday[2] = "星期二";
108
-  //         weekday[3] = "星期三";
109
-  //         weekday[4] = "星期四";
110
-  //         weekday[5] = "星期五";
111
-  //         weekday[6] = "星期六";
103
+        // 如果小于或等 7*24小时就显示星期几
104
+        if (deltaHour <= 7 * 24) {
105
+          var weekday = new Array(7);
106
+          weekday[0] = "星期日";
107
+          weekday[1] = "星期一";
108
+          weekday[2] = "星期二";
109
+          weekday[3] = "星期三";
110
+          weekday[4] = "星期四";
111
+          weekday[5] = "星期五";
112
+          weekday[6] = "星期六";
112 113
 
113
-  //         // 取出当前是星期几
114
-  //         var weedayDesc = weekday[srcDate.getDay()];
115
-  //         ret = weedayDesc + timeExtraStr;
116
-  //       }
117
-  //       // 否则直接显示完整日期时间
118
-  //       else
119
-  //         ret = _formatDate(srcDate, format) + timeExtraStr;
120
-  //     }
121
-  //   }
122
-  // }
123
-  // // 往年
124
-  // else {
125
-  //   ret = _formatDate(srcDate, format) + timeExtraStr;
126
-  // }
127
-  ret = _formatDate(srcDate, format) + timeExtraStr;
114
+          // 取出当前是星期几
115
+          var weedayDesc = weekday[srcDate.getDay()];
116
+          ret = weedayDesc + timeExtraStr;
117
+        }
118
+        // 否则直接显示完整日期时间
119
+        else
120
+          ret = formatDate(srcDate, format) + timeExtraStr;
121
+      }
122
+    }
123
+  }
124
+  // 往年
125
+  else {
126
+    ret = formatDate(srcDate, format) + timeExtraStr;
127
+  }
128 128
   return ret;
129 129
 };

+ 10
- 17
src/utils/im/index.js Datei anzeigen

@@ -13,6 +13,7 @@ function IM() {
13 13
   const listeners = initListeners()
14 14
 
15 15
   let sendPerson;
16
+  let receivePerson;
16 17
   let timer;
17 18
 
18 19
   sdk.listen('onMessage', listeners.getListeners)
@@ -21,32 +22,24 @@ function IM() {
21 22
     MESSAGETYPE,
22 23
     init,
23 24
     listen: listeners.append,
25
+    bindReceiver,
24 26
     connect: sdk.connect,
25
-    send,
26 27
     sendMessage,
27 28
   }
28 29
 
29
-  function bindPerson(person) {
30
-    sendPerson = person
30
+  function bindReceiver(receiver) {
31
+    receivePerson = receiver
31 32
   }
32 33
 
33
-  function send(to) {
34
-    return function(type = MESSAGETYPE.TEXT) {
35
-      return function(message) {
36
-        return sendMessage(to, message, type)
37
-      }
38
-    }
39
-  }
40
-
41
-  function sendMessage(to, message, type = MESSAGETYPE.TEXT) {
42
-    return sdk.send(wrapData(to, message, type))
34
+  function sendMessage(message, type = MESSAGETYPE.TEXT) {
35
+    return sdk.send(wrapData(message, type))
43 36
   }
44 37
 
45
-  function wrapData(to, data, messageType) {
38
+  function wrapData(message, messageType) {
46 39
     return JSON.stringify({
47 40
       sendPerson,
48
-      receivePerson: to,
49
-      message: data,
41
+      receivePerson,
42
+      message,
50 43
       messageType,
51 44
       createDate: new Date().valueOf(),
52 45
     })
@@ -56,7 +49,7 @@ function IM() {
56 49
     // eslint-disable-next-line no-undef
57 50
     const url = `${WSS_HOST}/wx/chat/${personId}`  
58 51
 
59
-    bindPerson(personId)
52
+    sendPerson = personId
60 53
 
61 54
     if (timer) {
62 55
       clearInterval(timer)