xujing vor 5 Jahren
Ursprung
Commit
a05a23ca14

+ 4
- 4
config/dev.js Datei anzeigen

@@ -5,12 +5,12 @@ module.exports = {
5 5
   defineConstants: {
6 6
     // HOST: '"http://47.101.36.130:8085"',//测试
7 7
     // WSS_HOST: '"wss://47.101.36.130:8085"',
8
-    HOST:  '"https://dev.jinchengjiaye.com"',//测试
9
-    WSS_HOST: '"wss://dev.jinchengjiaye.com"',
8
+    // HOST:  '"https://dev.jinchengjiaye.com"',//测试
9
+    // WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10 10
     // HOST: '"https://lt.pawoma.cn"',
11 11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
12
-    // HOST: '"http://192.168.2.52:8080"',
13
-    // WSS_HOST: '"ws://192.168.2.52:8080"',
12
+    HOST: '"http://192.168.2.52:8080"',
13
+    WSS_HOST: '"ws://192.168.2.52:8080"',
14 14
   },
15 15
   weapp: {},
16 16
   h5: {}

+ 2
- 0
src/constants/api.js Datei anzeigen

@@ -181,3 +181,5 @@ export const API_SEX_INFO = resolvePath('genderStatistic')
181 181
 export const API_ECHERTS_DAILY = resolvePath('customerStatisticDaily')
182 182
 export const API_ECHERTS_MONTH = resolvePath('customerStatisticMonthly')
183 183
 export const API_BUILDING_TYPE = resolvePath('getByBuildingIdSelectBuildingProjectType')
184
+export const API_CONSULTANT_VISIT_RECORD = resolvePath('visitRecord')
185
+export const API_MORE_ACTIVITY = resolvePath('visitRecord/activity')

+ 13
- 8
src/pages/activity/activity.js Datei anzeigen

@@ -23,7 +23,7 @@ export default class active extends Component {
23 23
     current: 0,
24 24
     recordId: undefined, // 埋点ID
25 25
   }
26
-  
26
+
27 27
   componentWillMount() {
28 28
     // App.zhuge.track('查看活动列表页面')
29 29
     savePoint({
@@ -38,18 +38,23 @@ export default class active extends Component {
38 38
       console.log('活动列表')
39 39
     })
40 40
   }
41
-  componentDidShow(){
42
-    if(this.$router.params.projectIndex){
43
-         this.setState({
44
-          current: 1
45
-        })
46
-      }
41
+  componentWillMount() {
42
+    if (this.$router.params.projectIndex) {
43
+      this.setState({
44
+        current: 1
45
+      })
46
+    }
47
+    else {
48
+      this.setState({
49
+        current: 0
50
+      })
51
+    }
47 52
   }
48 53
 
49 54
   componentWillUnmount() {
50 55
     const { recordId } = this.state
51 56
     recordId && updatePoint(recordId)
52
- 
57
+
53 58
   }
54 59
 
55 60
   handleClick(value) {

+ 2
- 0
src/pages/card/list/index.js Datei anzeigen

@@ -60,6 +60,8 @@ export default class Index extends Component {
60 60
   }
61 61
 
62 62
   handleChatClick(item, e) {
63
+    console.log(item,"item")
64
+    console.log(e,"eeeeeeeeeeeeeeeeeeeeeeeeeee")
63 65
     e && e.stopPropagation()
64 66
     const { userInfo: { person: { personId, nickname, name } } } = this.props
65 67
     

+ 141
- 32
src/pages/person/accessRecord.js Datei anzeigen

@@ -1,6 +1,12 @@
1 1
 import Taro, { Component } from '@tarojs/taro';
2
+import ListView from '@components/ListView'
3
+import { connect } from '@tarojs/redux'
2 4
 import './index.scss'
5
+import { getConsulantVisitRecord, getMoreVisitRecord } from '@services/person'
6
+import { savePoint, updatePoint } from '@services/common'
7
+import dayjs from 'dayjs';
3 8
 
9
+@connect(state => state.user)
4 10
 export default class Person extends Component {
5 11
   config = {
6 12
     navigationBarTitleText: '访问记录'
@@ -8,64 +14,167 @@ export default class Person extends Component {
8 14
 
9 15
   state = {
10 16
     popVisible: false,
17
+    recordId: undefined, // 埋点ID
18
+    recordList: [],
19
+    hasMore: true,
20
+    isEmpty: false,
21
+    pageIndex: 1,
22
+    moreRecord: []
11 23
   }
12 24
 
13
-  componentDidShow() {
14
-    // Taro.showLoading()
25
+  componentWillMount() {
26
+
27
+    savePoint({
28
+      event: 'list',
29
+      eventType: 'activity',
30
+      propertyName: '访问记录',
31
+      data: '{}'
32
+    }).then(res => {
33
+      this.setState({
34
+        recordId: res.recordId
35
+      })
36
+      console.log('访问记录')
37
+    })
38
+  }
39
+  componentWillUnmount() {
40
+    const { recordId } = this.state
41
+    recordId && updatePoint(recordId)
15 42
   }
43
+
16 44
   handleMaskClose() {
17 45
     this.setState({
18 46
       popVisible: false,
19 47
     })
20 48
   }
21
-  activityList(){
49
+  componentDidShow() {
50
+    Taro.showLoading()
51
+    this.loadList(1)
52
+
53
+  }
54
+  loadList(pageNumber) {
55
+    console.log(this.props, "this.props")
56
+    const { userInfo: { person } } = this.props
57
+    const payload = {
58
+      userId: person.userId,
59
+      pageNumber,
60
+      pageSize: 5
61
+    }
62
+    getConsulantVisitRecord(payload).then(res => {
63
+      const { records, list, total, current, pages } = res || {}
64
+      const _list = records || list || []
65
+      const newList = current <= 1 ? _list : this.state.recordList.concat(_list)
66
+      this.setState({
67
+        recordList: newList,
68
+        isEmpty: total == 0 || !res,
69
+        hasMore: current < pages,
70
+        pageIndex: current >= pages ? pages : current
71
+      })
72
+      Taro.hideLoading()
73
+    })
74
+  }
75
+  onScrollToLower = async (fn) => {
76
+    const { pageIndex } = this.state;
77
+    this.loadList(pageIndex + 1)
78
+    fn && fn();
79
+  }
80
+  onPullDownRefresh = (rest) => {
81
+    // debugger
82
+    if (this.refreshing) return
83
+    this.refreshing = true
84
+    this.loadList(1)
85
+    rest && rest()
86
+    this.refreshing = false
87
+  }
88
+
89
+
90
+  showActivityList(item) {
91
+    Taro.showLoading()
22 92
     this.setState({
23 93
       popVisible: true,
24 94
     })
95
+
96
+    const { userInfo: { person } } = this.props
97
+    const payload = {
98
+      userId: person.userId,
99
+      personId: item.personId,
100
+    }
101
+    getMoreVisitRecord(payload).then(res => {
102
+      Taro.hideLoading()
103
+      this.setState({
104
+        moreRecord: res.records || []
105
+      })
106
+
107
+    }).catch(err => {
108
+      console.log(err, "获取更多访问记录err")
109
+      Taro.hideLoading()
110
+    })
111
+  }
112
+  handleChatClick(item, e) {
113
+    e.stopPropagation()
114
+    const { userInfo: { person: { personId, nickname, name } } } = this.props
115
+    Taro.navigateTo({
116
+      url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.userName)}`
117
+    })
25 118
   }
26 119
   renderPop() {
120
+    const { moreRecord } = this.state
27 121
     return (
28 122
       <View className="pop-box">
29
-
30
-
31 123
         <View className="content">
32 124
           <Icon className="iconfont close icon-buoumaotubiao20" onClick={this.handleMaskClose}></Icon>
33
-          <View className="activity-item">
34
-            <View className="name">
35
-              活动名称展示处活动名称展示处活动名么的事借款部分手机电脑热风
36
-            </View>
37
-            <View className="time">
38
-              2019-12-06 12:23:54
39
-            </View>
125
+          <View className="scroll-con">
126
+            {
127
+              moreRecord.map(item => (
128
+                <View className="activity-item">
129
+                  <View className="name">{item.activityName || ' '}</View>
130
+                  <View className="time">{`${dayjs(item.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</View>
131
+                </View>
132
+              ))
133
+            }
40 134
           </View>
41 135
         </View>
42 136
       </View>
43 137
     )
44 138
   }
45
-
46 139
   render() {
47
-    const {popVisible} = this.state
140
+    const { popVisible, isEmpty, hasMore, recordList } = this.state
48 141
     return (
49 142
       <Block>
50
-        {popVisible&&this.renderPop()}
51
-        <View className='access-page'>
52
-          <View className='item'>
53
-            <View className="tag">我的客户</View>
54
-            <Image className="touxiang" src={require('@assets/default-avatar.png')}></Image>
55
-            <View className="info-top">
56
-              <View className="name">曹建芳</View>
57
-              <View style="display: flex;align-items: center;"><Image className="goutong-icon" src={require('@assets/person/zixun.png')}></Image><Text className="goutong">在线沟通</Text></View>
58
-            </View>
59
-            <View className="activity-name" onClick={this.activityList}>
60
-              活动名称展示处活动名称展示处活动名么的事借款部分手机电脑热风
61
-            </View>
62
-            <Text className="right-icon"></Text>
63
-            <View className="activity-time">
64
-              2019-12-06 12:23:54
65
-            </View>
143
+        {popVisible && this.renderPop()}
144
+
145
+        <ListView
146
+          className="wrap"
147
+          needInit
148
+          isEmpty={isEmpty}
149
+          emptyText="暂无访问记录~"
150
+          hasMore={hasMore}
151
+          onPullDownRefresh={fn => this.onPullDownRefresh(fn)}
152
+          onScrollToLower={fn => this.onScrollToLower(fn)}
153
+        >
154
+          <View className='access-page'>
155
+
156
+            {
157
+              recordList.map(item => (
158
+                <View className='item' key={item + 'more'}>
159
+                  {item.myCustomer == 1 && <View className="tag">我的客户</View>}
160
+                  <Image className="touxiang" src={require('@assets/default-avatar.png')}></Image>
161
+                  <View className="info-top">
162
+                    <View className="name">{item.userName || ' '}</View>
163
+                    <View style="display: flex;align-items: center;" onClick={this.handleChatClick.bind(this, item)}><Image className="goutong-icon" src={require('@assets/person/zixun.png')}></Image><Text className="goutong">在线沟通</Text></View>
164
+                  </View>
165
+                  <View className="activity-name" onClick={this.showActivityList.bind(this, item)}>
166
+                    {item.activityName || ' '}
167
+                  </View>
168
+                  <Text className="right-icon"></Text>
169
+                  <View className="activity-time">
170
+                    {`${dayjs(item.createDate).format('YYYY-MM-DD HH:mm:ss')}`}
171
+                  </View>
172
+                </View>
173
+              ))
174
+            }
66 175
           </View>
67
-        </View>
68
-      </Block>
176
+        </ListView>
177
+      </Block >
69 178
     )
70 179
   }
71 180
 }

+ 23
- 14
src/pages/person/index.scss Datei anzeigen

@@ -338,6 +338,7 @@
338 338
     border-radius: 12px;
339 339
     padding: 30px;
340 340
     position: relative;
341
+    margin-bottom: 20px;
341 342
     .tag{
342 343
       position: absolute;
343 344
       left: 26px;
@@ -432,22 +433,30 @@
432 433
       background-color: #fff;
433 434
       border-radius: 12px;
434 435
       padding: 20px 20px;
435
-      .activity-item{
436
-        padding: 16px 30px;
437
-        border-bottom: 2px solid rgba(0,0,0,0.08);
438
-        .name{
439
-          font-size: 32px;
440
-          color: #353535;
441
-          width: 600px;
442
-          @include text-ellipsis;
443
-        }
444
-        .time{
445
-          font-size: 26px;
446
-          color:rgba(0,0,0,0.33);
447
-          text-align: right;
448
-          margin-top: 20px;
436
+      
437
+      .scroll-con{
438
+        height: 500px;
439
+        width: 100%;
440
+        overflow-y: scroll;
441
+        .activity-item{
442
+          padding: 16px 30px;
443
+          border-bottom: 2px solid rgba(0,0,0,0.08);
444
+          .name{
445
+            font-size: 32px;
446
+            color: #353535;
447
+            width: 600px;
448
+            @include text-ellipsis;
449
+          }
450
+          .time{
451
+            font-size: 26px;
452
+            color:rgba(0,0,0,0.33);
453
+            text-align: right;
454
+            margin-top: 20px;
455
+          }
449 456
         }
457
+
450 458
       }
459
+    
451 460
     }
452 461
     .close{
453 462
       font-size: 48px;

+ 78
- 25
src/pages/project/h5Page.js Datei anzeigen

@@ -6,6 +6,8 @@ import './index.scss'
6 6
 import { getHFiveDetail } from '@services/user'
7 7
 import ready from '@utils/ready'
8 8
 import { reportClient } from '@services/report'
9
+import { ROLE_CODE } from '@constants/user'
10
+import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
9 11
 const bgImg = require('@assets/helpgroup/bg.png')
10 12
 
11 13
 @connect(state => state.user, { ...actions })
@@ -18,9 +20,72 @@ export default class Index extends Component {
18 20
     webViewVisible: false,
19 21
     pageInfo: {}
20 22
   }
23
+
24
+
25
+
26
+  // 埋点
27
+  success() {
28
+    const { userInfo: { person } } = this.props
29
+    const consultant = person.personType == ROLE_CODE['CONSULTANT'] ? person.userId : ""
30
+    const firstShare = this.$router.params.firstShare || ""
31
+    savePoint({
32
+      event: 'detail',
33
+      eventType: 'h5',
34
+      propertyName: 'h5活动',
35
+      consultantId: consultant,
36
+      sharePersonId: this.$router.params.sharePersonId,
37
+      data: '{"firstShare":"' + firstShare + '"}'
38
+    }).then(res => {
39
+      this.setState({
40
+        recordId: res.recordId
41
+      })
42
+      console.log('访问记录')
43
+    })
44
+  }
45
+  onShareAppMessage = () => {
46
+    const { pageInfo } = this.state
47
+    const currentPage = this.currentPageAndParams().join('?')
48
+    return {
49
+      title: pageInfo.shareTitle,
50
+      path: currentPage,
51
+      imageUrl: pageInfo.shareImg
52
+    }
53
+  }
54
+  getQRCode() {
55
+    const [page, scene] = this.currentPageAndParams()
56
+    const payload = { page, scene }
57
+    return new Promise((resolve) => {
58
+      getMiniQrcode(payload).then(qrCode => {
59
+        this.setState({ qrCode }, resolve)
60
+      })
61
+    })
62
+  }
63
+
64
+
65
+  currentPageAndParams() {
66
+    const { userInfo: { person } } = this.props
67
+    const consultant = person.personType == ROLE_CODE['CONSULTANT'] ? person.userId : ""
68
+    const firstShare = this.$router.params.firstShare || person.personId
69
+
70
+    let queryParams = [
71
+      `sharePersonId=${person.personId}`,
72
+      `consultant=${consultant}`,
73
+      `firstShare=${firstShare}`,
74
+      `id=${this.$router.params.id}`
75
+    ]
76
+
77
+
78
+    const res = [
79
+      'pages/project/h5Page',
80
+      queryParams.join('&'),
81
+    ]
82
+
83
+    return res
84
+  }
21 85
   componentWillMount() {
22 86
 
23 87
     ready.queue(() => {
88
+      // h5id 、第一个分享人ID、置业顾问ID、分享人ID 
24 89
       getHFiveDetail(this.$router.params.id).then(res => {
25 90
         this.setState({
26 91
           pageInfo: res
@@ -30,6 +95,7 @@ export default class Index extends Component {
30 95
       if (person.avatarurl) {
31 96
         // 头像手机号都有
32 97
         if (person.phone) {
98
+          this.success()
33 99
           this.setState({
34 100
             avatarVisible: false,
35 101
             phoneVisible: false,
@@ -84,15 +150,7 @@ export default class Index extends Component {
84 150
       }
85 151
     })
86 152
   }
87
-  // onShareAppMessage = () => {
88
-  //   const {pageInfo } = this.state
89
-  //   // const { agent: { nickname, personId, agentCode } } = this.state
90
-  //   return {
91
-  //     // title: `${nickname}邀请你成为经纪人`,
92
-  //     path: `/pages/project/h5Page?id=${personId}&from=share&recommender=${personId}&agentCode=${agentCode}`,//分享地址
93
-  //     imageUrl: pageInfo.shareImg
94
-  //   }
95
-  // }
153
+
96 154
   getPhoneNumber(e) {
97 155
     getUserPhone(e, (phoneNumber) => {
98 156
       if (!phoneNumber) {
@@ -102,6 +160,7 @@ export default class Index extends Component {
102 160
         })
103 161
       } else {
104 162
         console.log('授权手机成功')
163
+        this.success()
105 164
         this.setState({
106 165
           phoneVisible: false,
107 166
           webViewVisible: true,
@@ -122,31 +181,19 @@ export default class Index extends Component {
122 181
       buildingId,
123 182
       phone: realPhone
124 183
     }
125
-    const { cardInfo, userInfo: { person } } = this.props
126 184
     if (person.personId != cardInfo.id) {
127 185
       reportClient(payload).then(res => {
128
-        this.hideModal()
129 186
         console.log('恭喜您绑定成功')
130
-        // this.setState({ bound: true })
131
-        // if (res !== 'bound') {
132
-        //   Taro.showToast({
133
-        //     title: '恭喜您绑定成功'
134
-        //   })
135
-        // }
136 187
       }).catch(err => {
137 188
         console.error(err)
138 189
         this.setState({ bound: true })
139
-
140
-        // Taro.showToast({
141
-        //   title: err.message || err,
142
-        //   icon: 'none'
143
-        // })
144 190
       })
145 191
     }
146 192
   }
147 193
 
148 194
   renderMaskBanner() {
149 195
     const { avatarVisible, phoneVisible, pageInfo } = this.state
196
+
150 197
     return (
151 198
       <View>
152 199
         <Image src={pageInfo.middleImg || bgImg} mode='widthFix' className='bg_img'></Image>
@@ -162,17 +209,23 @@ export default class Index extends Component {
162 209
           {phoneVisible &&
163 210
             <Button className="phone-btn" open-type="getPhoneNumber" lang="zh_CN" onGetphonenumber={this.getPhoneNumber}>点击授权查看详情</Button>
164 211
           }
165
-
166 212
         </View>
167 213
       </View>
168 214
     )
169 215
   }
170 216
   render() {
171
-    const { pageInfo, webViewVisible } = this.state
217
+    const { pageInfo, webViewVisible, qrCode } = this.state
218
+    const { userInfo: { person } } = this.props
219
+    const webUrlParams = [
220
+      `personId=${person.personId}`,
221
+      `h5id=${this.$router.params.id}`,
222
+      `qrCode=${qrCode}`,
223
+    ].join('&')
224
+
172 225
     return (
173 226
       <Block>
174 227
         {this.renderMaskBanner()}
175
-        {webViewVisible && <WebView src={pageInfo.h5Address + '?personid=xxx&h5id=xxx&xxxx'} />}
228
+        {webViewVisible && <WebView src={`${pageInfo.h5Address}?${encodeURIComponent(webUrlParams)}`} />}
176 229
       </Block>
177 230
     )
178 231
   }

+ 13
- 5
src/pages/project/index.js Datei anzeigen

@@ -543,6 +543,12 @@ export default class Index extends Component {
543 543
     this.props.onChange && this.props.onChange(current)
544 544
   }
545 545
 
546
+  handleNoticeClick = (item) => {
547
+    Taro.navigateTo({
548
+      url: '/pages/news/detail/index?id=' + item.newsId
549
+    })
550
+  }
551
+
546 552
   render() {
547 553
     const { curCity } = this.props
548 554
     const { newsList, achieve } = this.state
@@ -607,7 +613,7 @@ export default class Index extends Component {
607 613
                 newsList.length &&
608 614
                 <View style="background-color:#fff">
609 615
                   <View className="notice-box">
610
-                    <View style="  display: flex;align-items: center;">
616
+                    <View style="display: flex;align-items: center;">
611 617
                       <Image className="notice-icon" src={require('@assets/notice.png')}></Image>
612 618
                       <Swiper
613 619
                         className='notice-swiper'
@@ -621,7 +627,7 @@ export default class Index extends Component {
621 627
                           newsList.map((list, inx) => {
622 628
                             return (
623 629
                               <SwiperItem key={`img-${inx}`}>
624
-                                <View className="notice-text">
630
+                                <View className="notice-text" onClick={this.handleNoticeClick.bind(this,list)}>
625 631
                                   {list.newsName}
626 632
                                 </View>
627 633
                               </SwiperItem>
@@ -630,9 +636,11 @@ export default class Index extends Component {
630 636
                         }
631 637
                       </Swiper>
632 638
                     </View>
633
-                    <View className="notice-more" onClick={this.toNewsList}>
634
-                      更多 <Text className="iconfont icon-more"></Text>
635
-                    </View>
639
+                    {newsList.length > 1 &&
640
+                      <View className="notice-more" onClick={this.toNewsList}>
641
+                        更多 <Text className="iconfont icon-more"></Text>
642
+                      </View>
643
+                    }
636 644
                   </View>
637 645
                 </View>
638 646
               }

+ 14
- 0
src/services/person.js Datei anzeigen

@@ -10,6 +10,8 @@ import {
10 10
   API_ECHERTS_DAILY,
11 11
   API_ECHERTS_MONTH,
12 12
   API_BUILDING_TYPE,
13
+  API_CONSULTANT_VISIT_RECORD,
14
+  API_MORE_ACTIVITY
13 15
 } from '@constants/api'
14 16
 
15 17
 
@@ -70,11 +72,23 @@ export const getActivityList = (payload) => fetch({ url: API_ACTIVITY_LIST_CUSTO
70 72
  * @param {*} payload  
71 73
  */
72 74
 export const getFollowRecord = (payload) => fetch({ url: API_FOLLOW_LIST, payload })
75
+
73 76
 /**
74 77
  * 添加跟进记录
75 78
  * @param {*} payload  
76 79
  */
77 80
 export const addFollowRecord = (payload) => fetch({ url: API_FOLLOW_LIST, payload, method: 'POST' })
81
+/**
82
+ * 获取访问记录
83
+ * @param {*} payload  
84
+ */
85
+export const getConsulantVisitRecord = (payload) => fetch({ url: API_CONSULTANT_VISIT_RECORD, payload })
86
+/**
87
+ * 获取访问记录
88
+ * @param {*} payload  
89
+ */
90
+export const getMoreVisitRecord = (payload) => fetch({ url: API_MORE_ACTIVITY, payload })
91
+
78 92
 
79 93
 
80 94