xujing 5 лет назад
Родитель
Сommit
56db92fbf3

+ 1
- 0
src/app.js Просмотреть файл

@@ -45,6 +45,7 @@ class App extends Component {
45 45
       // 'pages/person/customerAnalysis/followUpCustomer/index',
46 46
       // 'pages/person/customerAnalysis/transactionCustomer/index',
47 47
       'pages/person/customerAnalysis/myCustomer',
48
+      'pages/project/detail/map',
48 49
       'pages/person/myShare/accessRecord',
49 50
       'pages/person/myShare/index',
50 51
       'pages/shop/index',

+ 2
- 1
src/pages/activity/detail/assemble.js Просмотреть файл

@@ -337,7 +337,7 @@ export default class Detail extends Component {
337 337
 
338 338
 
339 339
   onShareAppMessage = () => {
340
-    const { shares } = this.state
340
+    const { shares, detail: { groupActivityId } } = this.state
341 341
     const currentPage = this.currentPageAndParams().join('?')
342 342
     const { userInfo: { person: { personId, personType, userId } } } = this.props
343 343
     const consultantId = personType == ROLE_CODE['CONSULTANT'] ? userId : ""
@@ -348,6 +348,7 @@ export default class Detail extends Component {
348 348
       propertyName: '拼团详情分享',
349 349
       consultantId: consultantId,
350 350
       sharePersonId: personId,
351
+      targetId: groupActivityId,
351 352
       data: '{}'
352 353
     })
353 354
 

+ 2
- 1
src/pages/activity/detail/assistance.js Просмотреть файл

@@ -338,7 +338,7 @@ export default class Detail extends Component {
338 338
   }
339 339
 
340 340
   onShareAppMessage = () => {
341
-    const { shares } = this.state
341
+    const { shares, id } = this.state
342 342
     const currentPage = this.currentPageAndParams().join('?')
343 343
     const { userInfo: { person: { personId, personType, userId } } } = this.props
344 344
     const consultantId = personType == ROLE_CODE['CONSULTANT'] ? userId : ""
@@ -349,6 +349,7 @@ export default class Detail extends Component {
349 349
       propertyName: '助力详情分享',
350 350
       consultantId: consultantId,
351 351
       sharePersonId: personId,
352
+      targetId: id,
352 353
       data: '{}'
353 354
     })
354 355
 

+ 1
- 0
src/pages/activity/detail/index.js Просмотреть файл

@@ -139,6 +139,7 @@ export default class Detail extends Component {
139 139
       propertyName: '活动详情分享',
140 140
       consultantId: consultantId,
141 141
       sharePersonId: personId,
142
+      targetId: dynamicId,
142 143
       data: '{}'
143 144
     }).then(res => {
144 145
       console.log('活动详情分享')

+ 2
- 1
src/pages/news/detail/index.js Просмотреть файл

@@ -127,10 +127,11 @@ export default class NewsDetail extends Component {
127 127
 
128 128
     savePoint({
129 129
       event: 'share',
130
-      eventType: 'activity',
130
+      eventType: 'news',
131 131
       propertyName: '资讯详情分享',
132 132
       consultantId: consultantId,
133 133
       sharePersonId: personId,
134
+      targetId:newsId,
134 135
       data: '{}'
135 136
     }).then(res => {
136 137
       console.info('资讯详情分享')

+ 2
- 2
src/pages/project/detail/Around/Pannel.js Просмотреть файл

@@ -80,7 +80,7 @@ export default class Pannel extends Component {
80 80
     const fixdHeight = this.props.style || 'height: 300rpx'
81 81
 
82 82
     return (
83
-      <ScrollView scrollY style={fixdHeight} scrollTop={this.state.currentMarkerPos} onScroll={this.bindScroll}>
83
+      // <ScrollView scrollY style={fixdHeight} scrollTop={this.state.currentMarkerPos} onScroll={this.bindScroll}>
84 84
         <View className="around-pannel">
85 85
           {
86 86
             this.state.markerList.map((item, index) => {
@@ -114,7 +114,7 @@ export default class Pannel extends Component {
114 114
             })
115 115
           }
116 116
         </View>
117
-      </ScrollView>
117
+      // </ScrollView>
118 118
     )
119 119
   }
120 120
 }

+ 3
- 3
src/pages/project/detail/Around/Tab.js Просмотреть файл

@@ -7,7 +7,7 @@ export default function Tab(props) {
7 7
   const [current, setCurrent] = useState(props.default || 0)
8 8
   
9 9
   const tabList = props.dataset ? props.dataset : []
10
-  
10
+  const className = props.className
11 11
   const handleClick = index => () => {
12 12
     setCurrent(index)
13 13
     if (typeof props.onChange === 'function') {
@@ -16,14 +16,14 @@ export default function Tab(props) {
16 16
   }
17 17
 
18 18
   return (
19
-    <View className="around-tab">
19
+    <View className={className}>
20 20
       {tabList.map((item, index) => {
21 21
         const { key, label, num } = item || {}
22 22
         
23 23
         return (
24 24
           <View
25 25
             key={key}
26
-            className={`around-tab__item ${current === index ? 'active' : ''}`}
26
+            className={`${className}__item ${current === index ? 'active' : ''}`}
27 27
             onClick={handleClick(index)}
28 28
           >
29 29
             {`${label}(${num})`}

+ 78
- 0
src/pages/project/detail/Around/around.js Просмотреть файл

@@ -0,0 +1,78 @@
1
+import Taro, { useState } from '@tarojs/taro'
2
+import { View, CoverView } from '@tarojs/components'
3
+import PoiAround from '@components/amap/PoiAround'
4
+import Tab from './Tab'
5
+import { POI_TYPES } from '@utils/amap'
6
+import './around.scss'
7
+
8
+export default function Around(props) {
9
+    const detail = props.building || {}
10
+
11
+    const [lat, lng] = (detail.coordinate || '').split(',')
12
+    const poiDatas = typeof detail.mapJson === 'string' ? JSON.parse(detail.mapJson) : []
13
+
14
+    // 展示内容数组
15
+    const dataList = POI_TYPES.map((poi) => {
16
+        const jsonData = poiDatas.filter(x => x.key === poi.key)[0] || {}
17
+        const data = JSON.parse(jsonData.data || '[]')
18
+        const manualData = (detail[`building${poi.key}`] === '' ? [] : (detail[`building${poi.key}`] || '').split(','))
19
+
20
+        return {
21
+            ...poi,
22
+            data,
23
+            manualData,
24
+            num: data.length + manualData.length,
25
+        }
26
+    }).filter(x => x.num)
27
+
28
+    // 所有的 markers
29
+    const markersList = dataList.map((item) => {
30
+        const mapJson = item.data || '[]'
31
+        return (mapJson || []).map((it) => {
32
+            const [longitude, latitude] = (it.location || '').split(',')
33
+
34
+            return {
35
+                id: it.id,
36
+                latitude,
37
+                longitude,
38
+                name: it.name,
39
+                address: it.address,
40
+            }
41
+        })
42
+    })
43
+
44
+    // 部分默认值
45
+    const [curTab, setCurTab] = useState(0)
46
+    const [markers, setMarkers] = useState(markersList[curTab])
47
+    const [curMarker, setCurMarker] = useState()
48
+
49
+    // tab 切换
50
+    const handleTabChange = (index, tabItem) => {
51
+        setCurTab(index)
52
+        setMarkers(markersList[index])
53
+    }
54
+
55
+    // marker 点切换
56
+    const handleMarkerTap = (marker) => {
57
+        setCurMarker(marker.id)
58
+    }
59
+
60
+    const goto = () => {
61
+        if (typeof props.onAction === 'function') {
62
+            props.onAction()
63
+        }
64
+    }
65
+
66
+    return (
67
+        <View className="around-box">
68
+            <View className="around-header">
69
+                <CoverView style="width: 100%; height: 100%;">
70
+                    <PoiAround style="width: 100vw; height: 500rpx;" current={curMarker} markers={markers} longitude={lng} latitude={lat} onMarkerClick={handleMarkerTap} />
71
+                </CoverView>
72
+            </View>
73
+            <View className="around-body">
74
+                <Tab dataset={dataList} className="around-project" onChange={handleTabChange} />
75
+            </View>
76
+        </View>
77
+    )
78
+}

+ 41
- 0
src/pages/project/detail/Around/around.scss Просмотреть файл

@@ -0,0 +1,41 @@
1
+@import "@styles/mixins.scss";
2
+@import "@styles/theme.scss";
3
+
4
+.around-box {
5
+  width: 100vw;
6
+  background-color: #fff;
7
+    
8
+  .around-header {
9
+    width: 100%;
10
+    height: 500px;
11
+  }
12
+  .around-body {
13
+    padding: 0 30px;
14
+  
15
+  }
16
+}
17
+
18
+// .around-project {
19
+//   display: flex;
20
+//   flex-wrap:nowrap;
21
+//   align-items: center;
22
+//   overflow-x: scroll;
23
+//   scroll-behavior: smooth;
24
+//   padding: 24px 0;
25
+
26
+//   &__item {
27
+//     flex: 1 0 auto;
28
+//     font-size: 32px;
29
+//     color:#666;
30
+//     line-height: 44px;
31
+//     padding: 4px 0;
32
+//     &.active {
33
+//         color: #666;
34
+//         border-bottom: none;
35
+//     }
36
+    
37
+//     & + & {
38
+//       margin-left: 64px;
39
+//     }
40
+//   }
41
+// }

+ 26
- 13
src/pages/project/detail/Around/index.js Просмотреть файл

@@ -8,7 +8,7 @@ import './style.scss'
8 8
 
9 9
 export default function Around(props) {
10 10
   const detail = props.building || {}
11
-  
11
+
12 12
   const [lat, lng] = (detail.coordinate || '').split(',')
13 13
   const poiDatas = typeof detail.mapJson === 'string' ? JSON.parse(detail.mapJson) : []
14 14
 
@@ -25,7 +25,7 @@ export default function Around(props) {
25 25
       num: data.length + manualData.length,
26 26
     }
27 27
   }).filter(x => x.num)
28
-  
28
+
29 29
   // 所有的 markers
30 30
   const markersList = dataList.map((item) => {
31 31
     const mapJson = item.data || '[]'
@@ -46,7 +46,7 @@ export default function Around(props) {
46 46
   const [curTab, setCurTab] = useState(0)
47 47
   const [markers, setMarkers] = useState(markersList[curTab])
48 48
   const [curMarker, setCurMarker] = useState()
49
-  
49
+
50 50
   // tab 切换
51 51
   const handleTabChange = (index, tabItem) => {
52 52
     setCurTab(index)
@@ -63,18 +63,31 @@ export default function Around(props) {
63 63
       props.onAction()
64 64
     }
65 65
   }
66
-  
66
+
67 67
   return (
68
-    <View className="around-box">
69
-      <View className="around-header">
70
-        <PoiAround style="width: 100vw; height: 500rpx;" current={curMarker} markers={markers} longitude={lng} latitude={lat} onMarkerClick={handleMarkerTap}/>
71
-      </View>
72
-      <View className="around-body">
73
-        <Tab dataset={dataList} onChange={handleTabChange} />
74
-        <Pannel active={curMarker} dataset={dataList[curTab]} onChange={handleMarkerTap}/>
75
-        <View className="goto-map" onClick={goto}>立即前往</View>
76
-        <View className="around-hr" />
68
+    <View >
69
+      <View style="  position: fixed;top: 0; width: 100%; height: 840rpx;">
70
+        <PoiAround style="width: 100vw; height: 840rpx;" current={curMarker} markers={markers} longitude={lng} latitude={lat} onMarkerClick={handleMarkerTap} />
77 71
       </View>
72
+      <ScrollView
73
+        enableBackToTop
74
+        style=" padding-top: 830rpx; background: transparent;"
75
+        scrollY>
76
+        <View className="around-box" style="border-radius: 40rpx 40rpx 0 0;">
77
+          <View className="building-con">
78
+            <View>
79
+              <View className="building-name">{detail.buildingName}</View>
80
+              <View className="building-address">{detail.address}</View>
81
+            </View>
82
+            <View className="building-go" onClick={goto}>前往</View>
83
+          </View>
84
+          <View className="around-body">
85
+            <Tab dataset={dataList} className="around-tab" onChange={handleTabChange} />
86
+            <Pannel active={curMarker} dataset={dataList[curTab]} onChange={handleMarkerTap} />
87
+            <View className="around-hr" />
88
+          </View>
89
+        </View>
90
+      </ScrollView>
78 91
     </View>
79 92
   )
80 93
 }

+ 48
- 15
src/pages/project/detail/Around/style.scss Просмотреть файл

@@ -9,23 +9,8 @@
9 9
     width: 100%;
10 10
     height: 500px;
11 11
   }
12
-
13 12
   .around-body {
14 13
     padding: 0 30px;
15
-  
16
-    .goto-map {
17
-      width: 670px;
18
-      height: 94px;
19
-      background-color: #F8F8F8;
20
-      border-radius: 8px;
21
-      margin: 0 auto;
22
-      margin-top: 40px;
23
-      text-align: center;
24
-      font-size: 36px;
25
-      font-weight:400;
26
-      color:#BB9C79;
27
-      line-height: 94px;
28
-    }
29 14
   }
30 15
 }
31 16
 
@@ -104,6 +89,30 @@
104 89
     }
105 90
   }
106 91
 }
92
+.around-project {
93
+  display: flex;
94
+  flex-wrap:nowrap;
95
+  align-items: center;
96
+  overflow-x: scroll;
97
+  scroll-behavior: smooth;
98
+  padding: 24px 0;
99
+
100
+  &__item {
101
+    flex: 1 0 auto;
102
+    font-size: 32px;
103
+    color:#666;
104
+    line-height: 44px;
105
+    padding: 4px 0;
106
+    &.active {
107
+        color: #666;
108
+        border-bottom: none;
109
+    }
110
+    
111
+    & + & {
112
+      margin-left: 64px;
113
+    }
114
+  }
115
+}
107 116
 
108 117
 .around-cell-title {
109 118
   font-size: 32px;
@@ -111,4 +120,28 @@
111 120
   color:#666;
112 121
   line-height: 44px;
113 122
   margin: 42px auto 20px 0;
123
+}
124
+
125
+.building-con{
126
+  padding: 30px 30px 0px 30px;
127
+  display: flex;
128
+  justify-content: space-between;
129
+  .building-name{
130
+    font-size: 36px;
131
+    color: #333;
132
+  }
133
+  .building-address{
134
+    font-size: 28px;
135
+    color: #666;
136
+  }
137
+  .building-go{
138
+    width:130px;
139
+    height:72px;
140
+    line-height: 72px;
141
+    background:rgba(246,182,29,1);
142
+    border-radius:40px;
143
+    font-size: 28px;
144
+    color:#fff;
145
+    padding:0 20px;
146
+  }
114 147
 }

+ 23
- 6
src/pages/project/detail/index.js Просмотреть файл

@@ -4,8 +4,8 @@ import './index.scss'
4 4
 import Banner from '../banner'
5 5
 import HelpGroupBanner from '../swiper'
6 6
 import Poster from './poster'
7
-import PoiAround from '@components/amap/PoiAround'
8
-import Around from './Around'
7
+
8
+import Around from './Around/around'
9 9
 import BackHomeBtn from '@components/BackHomeBtn'
10 10
 import AchievePhone from '@components/achievePhone'
11 11
 import {
@@ -292,6 +292,7 @@ export default class Index extends Component {
292 292
   }
293 293
 
294 294
   onShareAppMessage = () => {
295
+    console.log(this.props, "his.props")
295 296
     const {
296 297
       projectDetail: { shareContents, buildingName, buildingId, poster },
297 298
       userInfo: { person: { personId, personType, userId } }
@@ -305,6 +306,7 @@ export default class Index extends Component {
305 306
       propertyName: '项目详情分享',
306 307
       consultantId: consultantId,
307 308
       sharePersonId: personId,
309
+      targetId: buildingId,
308 310
       data: '{}'
309 311
     }).then(res => {
310 312
       console.log('项目详情分享')
@@ -333,13 +335,14 @@ export default class Index extends Component {
333 335
         resolve(posterData)
334 336
         return
335 337
       }
338
+      con
336 339
       const {
337
-        userInfo: { person: { avatarurl, nickname, personId, personType, phone, tel }, miniApp },
340
+        userInfo: { person: { avatarurl, nickname, personId, personType }, miniApp },
338 341
         projectDetail: { posters, buildingId, poster, price, buildingRestaurant, createDate, buildingName, tel, buildingTag, uvList = {} }
339 342
       } = this.props
340 343
       const { total = 0 } = uvList
341 344
       const consultant = personType == ROLE_CODE['CONSULTANT'] ? personId : ""
342
-      const phoneNum = phone || tel
345
+      const phoneNum = person.phone || person.tel
343 346
       const payload = {
344 347
         "scene": `id=${buildingId}&from=building_share&recommender=${personId}&consultant=${consultant}&phoneNum=${phoneNum}`,
345 348
         "page": 'pages/project/detail/index',
@@ -532,6 +535,8 @@ export default class Index extends Component {
532 535
     })
533 536
   }
534 537
 
538
+
539
+
535 540
   handleAuthPhoneSuccess = () => {
536 541
     const { person = {} } = this.props.userInfo || {}
537 542
     if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
@@ -705,19 +710,31 @@ export default class Index extends Component {
705 710
       </Block>
706 711
     )
707 712
   }
713
+  tomapDetail() {
714
+    const { buildingId } = this.state
715
+    Taro.navigateTo({
716
+      url: `/pages/project/detail/map?id=` + buildingId
717
+    })
718
+  }
708 719
   rendercircum() {
709 720
     const building = {
710 721
       ...this.props.projectDetail
711 722
     }
712 723
 
713 724
     return (
714
-      <View style="margin-bottom:-5px">
725
+      <View style="margin-bottom:-5px" onClick={this.tomapDetail}>
715 726
         <View className="section circum">
716 727
           <View className="section-head">
717 728
             <Text className="section-head__title">位置及周边配套</Text>
729
+            <View className="section-head__more">
730
+              更多<Text className="iconfont icon-more"></Text>
731
+            </View>
718 732
           </View>
733
+          {/* <View className="section-head">
734
+            <Text className="section-head__title">位置及周边配套</Text>
735
+          </View> */}
719 736
         </View>
720
-        <Around building={building} onAction={this.openMap.bind(this)}></Around>
737
+        <Around building={building} ></Around>
721 738
       </View>
722 739
     )
723 740
   }

+ 1
- 23
src/pages/project/detail/index.scss Просмотреть файл

@@ -785,7 +785,7 @@
785 785
   position: fixed;
786 786
   top: 0;
787 787
   width: 100%;
788
-  height: 500px;
788
+  height: 600px;
789 789
 
790 790
   &-img {
791 791
     width: 100%;
@@ -1057,29 +1057,7 @@
1057 1057
   }
1058 1058
 }
1059 1059
 
1060
-.around-tab {
1061
-  display: flex;
1062
-  flex-wrap: nowrap;
1063
-  align-items: center;
1064
-  overflow-x: scroll;
1065
-  scroll-behavior: smooth;
1066
-  padding: 24px 0;
1067 1060
 
1068
-  &__item {
1069
-    flex: 1 0 auto;
1070
-    font-size: 32px;
1071
-    color: #666;
1072
-    line-height: 44px;
1073
-    padding: 4px 0;
1074
-    &.active {
1075
-      color: #BB9C79;
1076
-      border-bottom: 1px solid #C8B299;
1077
-    }
1078
-    &+& {
1079
-      margin-left: 64px;
1080
-    }
1081
-  }
1082
-}
1083 1061
 
1084 1062
 .albumimg {
1085 1063
   width: 218px;

+ 149
- 0
src/pages/project/detail/map.js Просмотреть файл

@@ -0,0 +1,149 @@
1
+import Taro, { Component } from '@tarojs/taro';
2
+import { View } from '@tarojs/components'
3
+import './index.scss'
4
+import Around from './Around/index'
5
+import AchievePhone from '@components/achievePhone'
6
+import { savePoint, updatePoint } from '@services/common'
7
+import dayjs from 'dayjs'
8
+import 'dayjs/locale/zh-cn' // 按需加载
9
+import ready from '@utils/ready'
10
+import { getQrCodeParams } from '@utils/qrcode'
11
+import { connect } from '@tarojs/redux'
12
+import { dispatchProjectDetail } from '@actions/project'
13
+
14
+
15
+@connect(
16
+    ({ user, project }) => ({ ...user, ...project }),
17
+    { dispatchProjectDetail }
18
+)
19
+export default class Index extends Component {
20
+    config = {
21
+        navigationBarTitleText: '更多周边设施',
22
+    }
23
+
24
+    state = {
25
+        buildingId: null,
26
+    }
27
+
28
+    componentWillMount() {
29
+        ready.queue(() => {
30
+            const router = Taro.getStorageSync('router')
31
+            const id = this.$router.params.id || router.query.id
32
+            this.initPageData(id)
33
+
34
+        })
35
+    }
36
+    componentWillUnmount() {
37
+        const { recordId } = this.state
38
+        recordId && updatePoint(recordId)
39
+    }
40
+
41
+    initPageData(id) {
42
+
43
+        // const id='82b54f4a1f5b981df572253792afbfa1' 
44
+        this.setState({
45
+            buildingId: id
46
+        }, () => {
47
+            this.loadDetail()
48
+
49
+            // 埋点
50
+            //   savePoint({
51
+            //     event: 'detail',
52
+            //     eventType: 'building',
53
+            //     propertyName: '项目详情',
54
+            //     targetId: id,
55
+            //     buildingId: id,
56
+            //     data: '{}'
57
+            //   }).then(res => {
58
+            //     this.setState({
59
+            //       recordId: res.recordId
60
+            //     })
61
+            //     console.log('项目详情')
62
+            //   })
63
+        })
64
+    }
65
+
66
+
67
+
68
+    loadDetail() {
69
+        const { buildingId } = this.state
70
+        const { dispatchProjectDetail } = this.props
71
+        this.setState({
72
+            loaded: false,
73
+        })
74
+        Taro.showToast({
75
+            title: '正在加载数据',
76
+            icon: 'loading'
77
+        })
78
+
79
+        dispatchProjectDetail(buildingId).then(res => {
80
+            this.setState({
81
+                loaded: true,
82
+                // circumOpts: newCircumOpts,
83
+                isSaved: res.isSave
84
+            }, () => {
85
+                if (res.posters && res.posters.length) {
86
+                    this.setState({
87
+                        posterShow: 'flex'
88
+                    })
89
+                }
90
+            })
91
+            Taro.hideToast()
92
+        })
93
+    }
94
+
95
+
96
+
97
+    openMap() {
98
+        const {
99
+            buildingName,
100
+            address,
101
+            coordinate = ''
102
+        } = this.props.projectDetail
103
+
104
+        const coord = coordinate.split(',')
105
+        const latitude = parseFloat(coord[0])
106
+        const longitude = parseFloat(coord[1])
107
+        Taro.openLocation({
108
+            latitude,
109
+            longitude,
110
+            name: buildingName,
111
+            address,
112
+            scale: 18
113
+        })
114
+        savePoint({
115
+            event: 'navigation',
116
+            eventType: 'building',
117
+            propertyName: '查看项目地图',
118
+            data: '{}'
119
+        }).then(res => {
120
+            console.log('查看项目地图')
121
+        })
122
+    }
123
+
124
+    toViewAlbum(index) {
125
+        const { buildingId } = this.state
126
+        console.log('1111111', index)
127
+        this.navigateTo(`/pages/project/album/index?id=${buildingId}&current=${index}`)
128
+    }
129
+
130
+    HandleCircumTabClick(id) {
131
+        this.setState({
132
+            curTab: id
133
+        })
134
+    }
135
+
136
+
137
+    render() {
138
+        const building = {
139
+            ...this.props.projectDetail
140
+        }
141
+        return (
142
+            <Block>
143
+
144
+                <Around building={building} onAction={this.openMap.bind(this)}></Around>
145
+
146
+            </Block>
147
+        );
148
+    }
149
+}