许静 5 lat temu
rodzic
commit
5c24eaeab7

+ 2
- 2
config/dev.js Wyświetl plik

@@ -5,8 +5,8 @@ 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 12
     // HOST: '"http://192.168.0.131:8080"',

+ 4
- 4
config/prod.js Wyświetl plik

@@ -3,10 +3,10 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"https://dev.jinchengjiaye.com"',
7
-    // WSS_HOST: '"wss://dev.jinchengjiaye.com"',
8
-    HOST: '"https://lt.pawoma.cn"',
9
-    WSS_HOST: '"wss://lt.pawoma.cn"',
6
+    HOST: '"http://192.168.0.218:8080"',
7
+    WSS_HOST: '"ws://192.168.0.218:8080"',
8
+    // HOST: '"https://lt.pawoma.cn"',
9
+    // WSS_HOST: '"wss://lt.pawoma.cn"',
10 10
   },
11 11
   weapp: {},
12 12
   h5: {}

+ 8
- 1
project.config.json Wyświetl plik

@@ -2,7 +2,7 @@
2 2
 	"miniprogramRoot": "dist/",
3 3
 	"projectname": "mini-chengjiao",
4 4
 	"description": "知与行",
5
-	"appid": "wxd9ee3a9480a4e544",
5
+	"appid": "wxda1f84b79b3edeb3",
6 6
 	"setting": {
7 7
 		"urlCheck": false,
8 8
 		"es6": false,
@@ -59,6 +59,13 @@
59 59
 					"pathName": "pages/activity/detail/assistance",
60 60
 					"query": "id=85",
61 61
 					"scene": null
62
+				},
63
+				{
64
+					"id": -1,
65
+					"name": "pages/project/detail/index",
66
+					"pathName": "pages/project/detail/index",
67
+					"query": "id=93e6d86b8b48e3ea359084e3ceaf2d03",
68
+					"scene": null
62 69
 				}
63 70
 			]
64 71
 		}

BIN
src/assets/icons/blank.png Wyświetl plik


+ 65
- 0
src/components/amap/PoiAround.js Wyświetl plik

@@ -0,0 +1,65 @@
1
+import Taro, { Component } from '@tarojs/taro'
2
+import { Map } from '@tarojs/components'
3
+
4
+const makerIcon = require('@assets/icons/blank.png')
5
+
6
+export default class PoiAround extends Component {
7
+
8
+  state = {
9
+    current: undefined,
10
+  }
11
+
12
+  handleTap = (e) => {
13
+    const marker = this.props.markers.filter(x => x.id === e.markerId)[0]
14
+
15
+    this.setState({ current: e.markerId })
16
+    this.props.onMarkerClick && this.props.onMarkerClick(marker)
17
+  }
18
+
19
+  render() {
20
+    const { current } = this.state
21
+    const markers =  (this.props.markers || []).map((marker, index) => {
22
+
23
+      return {
24
+        id: marker.id,
25
+        latitude: marker.latitude,
26
+        longitude: marker.longitude,
27
+        iconPath: makerIcon,
28
+        width: 30,
29
+        height: 30,
30
+        alpha: 0.7,
31
+        // title: index + 1,
32
+        // label: {
33
+        //   content: index + 1,
34
+        //   // borderRadius: 1000,
35
+        //   color: '#fff',
36
+        //   bgColor: '#f00',
37
+        //   textAlign: 'center',
38
+        // },
39
+        callout: {
40
+          content: index + 1 > 9 ? `${index + 1}` : `0${index + 1}`,
41
+          borderRadius: 30,
42
+          borderWidth: 2,
43
+          borderColor: '#BB9C79',
44
+          padding: 5,
45
+          color: current === marker.id ? '#fff' : '#BB9C79',
46
+          bgColor: current === marker.id ? '#BB9C79' : '#fff',
47
+          textAlign: 'center',
48
+          display: 'ALWAYS',
49
+        },
50
+      }
51
+    })
52
+
53
+    return this.props.longitude && (
54
+      <Map
55
+        showLocation
56
+        scale={12}
57
+        markers={markers}
58
+        longitude={this.props.longitude}
59
+        latitude={this.props.latitude}
60
+        onCalloutTap={this.handleTap}
61
+        style={this.props.style}
62
+      />
63
+    )
64
+  }
65
+}

+ 1
- 0
src/lib/amap-wx.js
Plik diff jest za duży
Wyświetl plik


+ 13
- 14
src/pages/person/index.js Wyświetl plik

@@ -24,6 +24,7 @@ export default class Person extends Component {
24 24
     consultant: false,//置业顾问
25 25
     tourist: false,//普通用户,
26 26
     menus: [],
27
+    roleName: '普通用户',
27 28
   }
28 29
 
29 30
   componentDidShow() {
@@ -34,14 +35,14 @@ export default class Person extends Component {
34 35
 
35 36
   loadUserInfo() {
36 37
     queryUserInfo().then(user => {
38
+      const [roleSetting, roleName] = this.getRoleName(user.personType)
39
+
37 40
       this.setState({
38 41
         user,
39 42
         phone: user.phone,
40
-        menus: menus.map(group => group.filter(x => x.userTypes.indexOf(user.personType) > -1))
41
-      }, () => {
42
-        if (user.personType != ROLE_CODE['CHANNEL_AGENT'] && user.personType != ROLE_CODE['ESTATE_AGENT'] && user.personType != 'Realty Consultant') {
43
-          this.setState({ tourist: true, phone: user.phone })
44
-        }
43
+        menus: menus.map(group => group.filter(x => x.userTypes.indexOf(user.personType) > -1)),
44
+        roleName,
45
+        ...roleSetting,        
45 46
       })
46 47
     })
47 48
   }
@@ -91,16 +92,13 @@ export default class Person extends Component {
91 92
   getRoleName(type) {
92 93
     switch (type) {
93 94
       case ROLE_CODE['CONSULTANT']:
94
-        this.setState({ consultant: true })
95
-        return '置业顾问'
95
+        return [{ consultant: true }, '置业顾问']
96 96
       case ROLE_CODE['ESTATE_AGENT']:
97
-        this.setState({ isAgent: true })
98
-        return '独立经纪人'
97
+        return [{ isAgent: true }, '独立经纪人']
99 98
       case ROLE_CODE['CHANNEL_AGENT']:
100
-        this.setState({ isAgent: true })
101
-        return '渠道经纪人'
99
+        return [{ isAgent: true }, '渠道经纪人']
102 100
       default:
103
-        return '普通用户'
101
+        return [{ tourist: true }, '普通用户']
104 102
     }
105 103
   }
106 104
 
@@ -133,7 +131,7 @@ export default class Person extends Component {
133 131
   }
134 132
 
135 133
   renderDetail() {
136
-    const { user, menus, isAgent, consultant, tourist } = this.state
134
+    const { user, menus, roleName } = this.state
137 135
     // const showQRCode = user.personType === ROLE_CODE['CONSULTANT'] || ROLE_CODE['ESTATE_AGENT'] || ROLE_CODE['CHANNEL_AGENT']
138 136
     // const isConsultant = user.personType == ROLE_CODE['CONSULTANT']
139 137
     // const isConsultant = user.personType
@@ -146,7 +144,7 @@ export default class Person extends Component {
146 144
             <View className="info-block">
147 145
               <View className="avatar" onClick={this.goPersonDetail}>
148 146
                 <Image className="info__headimg" src={user.avatar} />
149
-                <View className="info-intro">{this.getRoleName(user.personType)}</View>
147
+                <View className="info-intro">{roleName}</View>
150 148
               </View>
151 149
 
152 150
               <View className="info-text" onClick={this.goPersonDetail}>
@@ -179,6 +177,7 @@ export default class Person extends Component {
179 177
         <View>
180 178
           {
181 179
             menus.map((group, ginx) => {
180
+              console.log('----------------')
182 181
               return (
183 182
                 <Block key={`grp-${ginx}`}>
184 183
                   {

+ 26
- 9
src/pages/person/menus.js Wyświetl plik

@@ -43,21 +43,21 @@ const menus = [
43 43
       url: '/pages/person/customerAnalysis/index',
44 44
       icon: icons.homepage,
45 45
       extends: undefined,
46
-      userTypes: [CUSTOMER, CONSULTANT],
47
-    },
48
-    {
49
-      name: '成为经纪人',
50
-      url: '/pages/agent/become/index',
51
-      icon: icons.development,
52
-      extends: undefined,
53
-      userTypes: [CUSTOMER],
46
+      userTypes: [CONSULTANT],
54 47
     },
48
+    // {
49
+    //   name: '成为经纪人',
50
+    //   url: '/pages/agent/become/index',
51
+    //   icon: icons.development,
52
+    //   extends: undefined,
53
+    //   userTypes: [CUSTOMER],
54
+    // },
55 55
     {
56 56
       name: '推荐客户',
57 57
       url: '/pages/agent/client/index',
58 58
       icon: icons.recommend,
59 59
       extends: undefined,
60
-      userTypes: [ESTATE_AGENT, CHANNEL_AGENT],
60
+      userTypes: [CUSTOMER,ESTATE_AGENT, CHANNEL_AGENT],
61 61
     },
62 62
     {
63 63
       name: '发展经纪人',
@@ -141,6 +141,23 @@ const menus = [
141 141
       userTypes: [CUSTOMER, CONSULTANT, ESTATE_AGENT, CHANNEL_AGENT],
142 142
     },
143 143
   ],
144
+  [
145
+    {
146
+      name: '成为专业经纪人',
147
+      url: '/pages/agent/become/index',
148
+      icon: icons.feedback,
149
+      extends: undefined,
150
+      userTypes: [CUSTOMER],
151
+    },
152
+    {
153
+      name: '成为置业顾问',
154
+      url: '',
155
+      icon: icons.feedback,
156
+      extends: undefined,
157
+      userTypes: [CUSTOMER],
158
+    },
159
+
160
+  ]
144 161
 ]
145 162
 
146 163
 export { icons, menus }

+ 41
- 0
src/pages/project/detail/Around/Pannel.js Wyświetl plik

@@ -0,0 +1,41 @@
1
+import Taro from '@tarojs/taro'
2
+import { View } from '@tarojs/components'
3
+import './style.scss'
4
+
5
+export default function Pannel(props) {
6
+  const { data = [], manualData = [] } = props.dataset || {}
7
+  const activeKey = props.active
8
+
9
+  return (
10
+    <View className="around-pannel">
11
+      {
12
+        data.map((item, index) => {
13
+          const { id, name, distance } = item || {}
14
+          const dist = distance >= 1000 ? `${Number(distance / 1000).toFixed(1)}km` : `${distance}m`
15
+          const active = activeKey === id
16
+
17
+          return (
18
+            <View className={`around-cell ${active ? 'active' : ''}`} key={`auto-${id}`}>
19
+              <View className="around-cell__body">{`${index + 1}、${name}`}</View>
20
+              <View className="around-cell__action">{dist}</View>
21
+            </View>
22
+          )
23
+        })
24
+      }
25
+      {
26
+        manualData.length && (
27
+          <View className="around-cell-title">其他</View>
28
+        )
29
+      }
30
+      {
31
+        manualData.map((item, index) => {
32
+          return (
33
+            <View className="around-cell" key={`manual-${index}`}>
34
+              <View className="around-cell__body">{`${index + 1}、${item}`}</View>
35
+            </View>
36
+          )
37
+        })
38
+      }
39
+    </View>
40
+  )
41
+}

+ 31
- 0
src/pages/project/detail/Around/Tab.js Wyświetl plik

@@ -0,0 +1,31 @@
1
+import Taro, { useState } from '@tarojs/taro'
2
+import { View } from '@tarojs/components'
3
+import './style.scss'
4
+
5
+export default function Tab(props) {
6
+  const [current, setCurrent] = useState(props.default || 0)
7
+  const tabList = props.dataset ? props.dataset.filter(x => x.num) : []
8
+  const handleClick = index => () => {
9
+    setCurrent(index)
10
+    if (typeof props.onChange === 'function') {
11
+      props.onChange(index, tabList[index])
12
+    }
13
+  }
14
+
15
+  return (
16
+    <View className="around-tab">
17
+      {tabList.map((item, index) => {
18
+        const { key, label, num } = item || {}
19
+        return (
20
+          <View
21
+            key={key}
22
+            className={`around-tab__item ${current === index ? 'active' : ''}`}
23
+            onClick={handleClick(index)}
24
+          >
25
+            {`${label}(${num})`}
26
+          </View>
27
+        )
28
+      })}
29
+    </View>
30
+  )
31
+}

+ 76
- 0
src/pages/project/detail/Around/index.js Wyświetl plik

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

+ 104
- 0
src/pages/project/detail/Around/style.scss Wyświetl plik

@@ -0,0 +1,104 @@
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
+
13
+  .around-body {
14
+    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
+  }
30
+}
31
+
32
+.around-tab {
33
+  display: flex;
34
+  flex-wrap:nowrap;
35
+  align-items: center;
36
+  overflow-x: scroll;
37
+  scroll-behavior: smooth;
38
+  padding: 24px 0;
39
+
40
+  &__item {
41
+    flex: 1 0 auto;
42
+
43
+    font-size: 32px;
44
+    color:#666;
45
+    line-height: 44px;
46
+    padding: 4px 0;
47
+
48
+    &.active {
49
+      color: #BB9C79;
50
+      border-bottom: 1px solid #C8B299;
51
+    }
52
+
53
+    & + & {
54
+      margin-left: 64px;
55
+    }
56
+  }
57
+}
58
+
59
+.around-hr {
60
+  // width: 200px;
61
+  height: 8px;
62
+  margin: 20px auto 30px auto;
63
+  // background-color:rgba(0,0,0,0.12);
64
+  // border-radius:4px;
65
+}
66
+
67
+.around-pannel {
68
+  margin-top: 30px;
69
+}
70
+
71
+.around-cell {
72
+  display: flex;
73
+  align-items: center;
74
+  width: 100%;
75
+  font-size: 32px;
76
+  font-weight: 400;
77
+  color: #666;
78
+  line-height: 44px;
79
+
80
+  &.active {
81
+    color: #BB9C79;
82
+  }
83
+
84
+  & + .around-cell {
85
+    margin-top: 26px;
86
+  }
87
+
88
+  &__body {
89
+    flex: auto;
90
+  }
91
+
92
+  &__action {
93
+    flex: none;
94
+    width: 200px;
95
+  }
96
+}
97
+
98
+.around-cell-title {
99
+  font-size: 32px;
100
+  font-weight: 700;
101
+  color:#666;
102
+  line-height: 44px;
103
+  margin: 42px auto 20px 0;
104
+}

+ 81
- 96
src/pages/project/detail/index.js
Plik diff jest za duży
Wyświetl plik


+ 4
- 3
src/pages/project/detail/index.scss Wyświetl plik

@@ -19,7 +19,7 @@
19 19
     height: 64px;
20 20
     background: rgba(255, 255, 255, 1);
21 21
     border-radius: 12px;
22
-    top: 440px;
22
+    top: 420px;
23 23
     left: 284px;
24 24
     font-size: 30px;
25 25
     font-family: PingFangSC-Regular, PingFang SC;
@@ -27,7 +27,8 @@
27 27
     text-align: center;
28 28
     line-height: 64px;
29 29
     color: rgba(53, 53, 53, 1);
30
-    display: flex;;
30
+    display: flex;
31
+    position: fixed;
31 32
     .video-btn {
32 33
       width: 92px;
33 34
       height: 64px;
@@ -46,7 +47,7 @@
46 47
 
47 48
 
48 49
   .wrap {
49
-    padding-top: 546px;
50
+    padding-top: 500px;
50 51
     background: transparent;
51 52
   }
52 53
 

+ 99
- 0
src/utils/amap.js Wyświetl plik

@@ -0,0 +1,99 @@
1
+/**
2
+ * 高德地图
3
+ * 
4
+ * POI 类型下载 https://lbs.amap.com/api/webservice/guide/api/search/#around
5
+ * 
6
+ */
7
+const amapLib = require('../lib/amap-wx');
8
+const myAmapKey = '766411323b66f7e876f428d8a23aa83c'
9
+const amap = new amapLib.AMapWX({ key: myAmapKey })
10
+
11
+// key 值会被拿到 building 表中 组合为字段名
12
+const POI_TYPES = [
13
+  {
14
+    key: 'Transport',
15
+    label: '交通',
16
+    types: ['150100', '150200', '150300', '150400', '150500', '150600'],
17
+  },
18
+  {
19
+    key: 'Mall',
20
+    label: '商业',
21
+    types: ['060100', '060200', '060300', '060400', '060500', '060600',
22
+            '060700', '060800', '060900', '061000', '061100', '061200',
23
+            '061300', '061400', '080100', '080200', '080300', '080400',
24
+            '080500', '080600'],
25
+  },
26
+  {
27
+    key: 'Edu',
28
+    label: '学校',
29
+    types: ['141200'],
30
+  },
31
+  {
32
+    key: 'Hospital',
33
+    label: '医院',
34
+    types: ['090100', '090200', '090300', '090400', '090500', '090600', '090700'],
35
+  },
36
+  {
37
+    key: 'Bank',
38
+    label: '银行',
39
+    types: ['160100'],
40
+  },
41
+  {
42
+    key: 'Restaurant',
43
+    label: '餐饮',
44
+    types: ['050100', '050200', '050300', '050400', '050500', '050600',
45
+            '050700', '050800', '050900'],
46
+  },
47
+]
48
+
49
+const getPrefix = str => str.substr(0, 4)
50
+
51
+export function getPoiAround(params) {
52
+  const {
53
+    lng,
54
+    lat
55
+  } = params || {}
56
+
57
+  return new Promise((resolve, reject) => {
58
+    const querytypes = POI_TYPES.reduce((acc, item) => ([ ...acc, ...item.types ]), []).join('|')
59
+    const location = `${lng},${lat}`
60
+    const iconPath = undefined
61
+    const iconPathSelected = undefined
62
+    const resultList = []
63
+
64
+    // 成功回调
65
+    // https://lbs.amap.com/api/webservice/guide/api/search/#around
66
+    const successCall = poiType => res => {
67
+      resultList.push({
68
+        key: poiType.key,
69
+        label: poiType.label,
70
+        poisData: res.poisData,
71
+        markers: res.markers
72
+      })
73
+
74
+      if (resultList.length === POI_TYPES.length) {
75
+        resolve(resultList)
76
+      }
77
+    }
78
+
79
+    // 失败回调
80
+    // https://lbs.amap.com/api/webservice/guide/tools/info/
81
+    const failCall = poiType => info => {
82
+      console.error(poiType, info)
83
+      reject(info)
84
+    }
85
+
86
+    POI_TYPES.forEach((pt) => {
87
+      const querytypes = pt.types.join('|')
88
+
89
+      amap.getPoiAround({
90
+        querytypes,
91
+        location,
92
+        iconPath,
93
+        iconPathSelected,
94
+        success: successCall(pt),
95
+        fail: failCall(pt),
96
+      })
97
+    })
98
+  })
99
+}