Your Name пре 3 година
родитељ
комит
0363b753e7

+ 2
- 2
config/dev.js Прегледај датотеку

@@ -3,8 +3,8 @@ 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:8088"',
6
+    HOST: '"https://xlk.njyz.tech"',
7
+    // HOST: '"http://127.0.0.1:8088"',
8 8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9 9
     OSS_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',
10 10
     OSS_FAST_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',

+ 55
- 27
src/pages/index/buildingDetail/components/Periphery/index.jsx Прегледај датотеку

@@ -1,10 +1,25 @@
1 1
 
2
-import { Map } from '@tarojs/components'
2
+import { useEffect, useMemo, useState } from 'react'
3
+import { Map, CoverView } from '@tarojs/components'
3 4
 import '@/assets/css/iconfont.css'
4 5
 import './index.scss'
5 6
 
7
+const poiTypes = [
8
+  { label: '交通', value: 'Transport', class: 'iconfont icon-jiaotong' },
9
+  { label: '商业', value: 'Mall', class: 'iconfont icon-shangye' },
10
+  { label: '学校', value: 'Edu', class: 'iconfont icon-xuexiao' },
11
+  { label: '医院', value: 'Hospital', class: 'iconfont icon-yiyuan' },
12
+  { label: '银行', value: 'Bank', class: 'iconfont icon-yinhang' },
13
+  { label: '餐饮', value: 'Restaurant', class: 'iconfont icon-canyin' },
14
+]
15
+
6 16
 export default function Periphery (props) {
7
-  const { List = [] } = props
17
+  const { Info } = props
18
+
19
+  const [pois, setPois] = useState([])
20
+  const [markers, setMarkers] = useState([])
21
+
22
+  const loc = useMemo(() => (Info?.coordinate ? Info.coordinate.split(',') : []), [Info?.coordinate])
8 23
 
9 24
   const CutTab = () => {
10 25
     return () => {
@@ -12,24 +27,31 @@ export default function Periphery (props) {
12 27
     }
13 28
   }
14 29
 
15
-  const ClassName = (label) => {
16
-    switch (label) {
17
-      case '交通':
18
-        return 'iconfont icon-jiaotong'
19
-      case '商业':
20
-        return 'iconfont icon-shangye'
21
-      case '学校':
22
-        return 'iconfont icon-xuexiao'
23
-      case '医院':
24
-        return 'iconfont icon-yiyuan'
25
-      case '银行':
26
-        return 'iconfont icon-yinhang'
27
-      case '餐饮':
28
-        return 'iconfont icon-canyin'
29
-      default:
30
-        return ''
30
+  useEffect(() => {
31
+    if (!Info?.coordinate) {
32
+      setMarkers([])
33
+      return;
31 34
     }
32
-  }
35
+
36
+    const mks = []
37
+    // 项目位置
38
+    mks.push({
39
+      id: -1,
40
+      longitude: loc[0],
41
+      latitude: loc[1],
42
+      iconPath: '',
43
+      width: 24,
44
+      height: 36,
45
+      customCallout: {
46
+        anchorY: 0,
47
+        anchorX: 0,
48
+        display: 'ALWAYS',
49
+      }
50
+    })
51
+
52
+    setMarkers(mks)
53
+
54
+  }, [Info, loc])
33 55
 
34 56
   return (
35 57
     <view className='components Periphery'>
@@ -46,19 +68,25 @@ export default function Periphery (props) {
46 68
             id='poi-around'
47 69
             show-location
48 70
             scale={12}
49
-            markers={[]}
50
-            enable-enableScroll
51
-            enable-zoom
52
-          ></Map>
71
+            markers={markers}
72
+            longitude={loc[0]}
73
+            latitude={loc[1]}
74
+            // enable-enableScroll
75
+            // enable-zoom
76
+          >
77
+            <CoverView slot='callout' className='marker-callout'>
78
+              <CoverView markerId={-1} className='marker-project'>{Info.buildingName}</CoverView>
79
+            </CoverView>
80
+          </Map>
53 81
         </view>
54 82
       </view>
55 83
 
56 84
       <view className='List flex-h'>
57 85
         {
58
-          List.map((item, index) => (
59
-            <view className='flex-item' key={`Item-${index}`} onClick={CutTab(index)}>
60
-              <text className={ClassName(item.label)}></text>
61
-              <text>{item.label}({item.data.length})</text>
86
+          poiTypes.map((item) => (
87
+            <view className='flex-item' key={item.value} onClick={CutTab(item.value)}>
88
+              <text className={item.class}></text>
89
+              <text>{item.label}(123)</text>
62 90
             </view>
63 91
           ))
64 92
         }

+ 9
- 0
src/pages/index/buildingDetail/components/Periphery/index.scss Прегледај датотеку

@@ -59,4 +59,13 @@
59 59
       }
60 60
     }
61 61
   }
62
+
63
+}
64
+
65
+.marker-callout {
66
+  .marker-project {
67
+    color: #1A3B83;
68
+    font-weight: 700;
69
+    // font-size: 100px;
70
+  }
62 71
 }

+ 9
- 11
src/pages/index/buildingDetail/components/ProjectDynamic/index.jsx Прегледај датотеку

@@ -3,8 +3,11 @@ import '@/assets/css/iconfont.css'
3 3
 import './index.scss'
4 4
 
5 5
 export default function ProjectDynamic (props) {
6
-  const { Data = {} } = props
7
-  return (
6
+  const { List = [] } = props
7
+
8
+  const info = List[0]
9
+
10
+  return info ? (
8 11
     <view className='components ProjectDynamic'>
9 12
 
10 13
       <view className='Title flex-h'>
@@ -15,17 +18,12 @@ export default function ProjectDynamic (props) {
15 18
         <text className='iconfont icon-jiantouright'></text>
16 19
       </view>
17 20
 
18
-      <view className='Nav'>
19
-        <text>楼盘资讯(8)</text>
20
-        <text>最新活动(1)</text>
21
-      </view>
22
-
23 21
       <view className='Info'>
24
-        <text className='Time'>2020年5月20日</text>
25
-        <text className='Title'>山和九著府预计5月加推5号楼</text>
26
-        <text className='Desc'>山和九著府预计5月加推5号楼,目前在售房源位于89号楼,均价26400元/㎡,户型建筑面积82、89、112㎡,预计2023年6月交付。</text>
22
+        <text className='Time'>{info.trendTime}</text>
23
+        <text className='Title'>{info.trendTitle}</text>
24
+        <text className='Desc'>{info.trendContent}</text>
27 25
       </view>
28 26
 
29 27
     </view>
30
-  )
28
+  ) : null
31 29
 }

+ 12
- 33
src/pages/index/buildingDetail/components/ProjectDynamic/index.scss Прегледај датотеку

@@ -7,60 +7,39 @@
7 7
     >.flex-item {
8 8
       >text {
9 9
         display: block;
10
-        font-size: 34px;
10
+        font-size: 34rpx;
11 11
         color: #333;
12 12
         line-height: 1;
13 13
         letter-spacing: 4px;
14
-        font-weight: bold;
14
+        font-weight: 500;
15 15
       }
16 16
     }
17 17
     >text {
18
-      font-size: 26px;
18
+      font-size: 26rpx;
19 19
       color: #A1A1A1;
20 20
     }
21 21
   }
22
-  >.Nav {
23
-    font-size: 0;
24
-    white-space: nowrap;
25
-    margin-top: 30px;
26
-    >text {
27
-      display: inline-block;
28
-      vertical-align: middle;
29
-      font-size: 28px;
30
-      line-height: 56px;
31
-      color: #333;
32
-      border-radius: 56px;
33
-      background: #F8F8F8;
34
-      padding: 0 20px;
35
-      min-width: 148px;
36
-      text-align: center;
37
-      margin-left: 30px;
38
-      &:first-child {
39
-        margin-left: 0;
40
-      }
41
-    }
42
-  }
43 22
   >.Info {
44 23
     position: relative;
45 24
     overflow: hidden;
46 25
     >text {
47 26
       display: block;
48 27
       &.Time {
49
-        font-size: 28px;
50
-        line-height: 40px;
51
-        margin-top: 28px;
28
+        font-size: 28rpx;
29
+        line-height: 40rpx;
30
+        margin-top: 28rpx;
52 31
         color: #1A3B83;
53 32
       }
54 33
       &.Title {
55
-        font-size: 32px;
56
-        line-height: 44px;
57
-        margin-top: 20px;
34
+        font-size: 32rpx;
35
+        line-height: 44rpx;
36
+        margin-top: 20rpx;
58 37
         font-weight: bold;
59 38
       }
60 39
       &.Desc {
61
-        font-size: 28px;
62
-        line-height: 40px;
63
-        margin-top: 20px;
40
+        font-size: 28rpx;
41
+        line-height: 40rpx;
42
+        margin-top: 20rpx;
64 43
         color: #A1A1A1;
65 44
         text-indent: 2em;
66 45
       }

+ 6
- 6
src/pages/index/buildingDetail/components/SpecialPriceHouse/index.jsx Прегледај датотеку

@@ -9,16 +9,16 @@ const toW = n => `${Number(n / 10000).toFixed(1)}万`
9 9
 const itFmt = it => `${it.unitType} ${Number(it.currentPrice / it.area).toFixed(0)}元/㎡`
10 10
 
11 11
 export default function SpecialPriceHouse (props) {
12
-  const { dataSource } = props
13
-  const [leftTime] = useTimer(dataSource)
12
+  const { List } = props
13
+  const [leftTime] = useTimer(List)
14 14
 
15 15
   const handleMore = () => {
16 16
     Taro.navigateTo({ url: '/pages/index/specialPriceHouse/index' })
17 17
   }
18 18
 
19
-  const len = dataSource ? dataSource.length : 0
19
+  const len = List ? List.length : 0
20 20
 
21
-  return len > 0 && (
21
+  return len > 0 ? (
22 22
     <view className='components SpecialPriceHouse'>
23 23
       <view className='Title flex-h'>
24 24
         <view className='flex-item'>
@@ -32,7 +32,7 @@ export default function SpecialPriceHouse (props) {
32 32
       <view className='List'>
33 33
         <ScrollView scrollX>
34 34
           {
35
-            dataSource.map((item, index) => (
35
+            List.map((item, index) => (
36 36
               <view className='ListItem' key={`List-${index}`}>
37 37
                 <text className='Tips'>{`${toW(item.thriftPrice)}`}</text>
38 38
                 <view className='Price'>
@@ -49,5 +49,5 @@ export default function SpecialPriceHouse (props) {
49 49
       </view>
50 50
 
51 51
     </view>
52
-  )
52
+  ) : null
53 53
 }

+ 5
- 8
src/pages/index/buildingDetail/index.jsx Прегледај датотеку

@@ -28,7 +28,7 @@ export default withLayout((props) => {
28 28
   const [PictureList, setPictureList] = useState([])
29 29
   const [NewsList, setNewsList] = useState([])
30 30
   const [LiveList, setLiveList] = useState([])
31
-  const [MapList, setMapList] = useState([])
31
+
32 32
   const [IsPull, setPull] = useState(false)
33 33
   const [PullTimer, setPullTimer] = useState(null)
34 34
 
@@ -53,9 +53,6 @@ export default withLayout((props) => {
53 53
       const List = DetailInfo.buildingApartment.filter(item => item.apartmentType === 'photo')
54 54
       setPictureList(List.filter(item => item.buildingImgList.length > 0))
55 55
     }
56
-    if(DetailInfo.mapJson) {
57
-      setMapList(JSON.parse(DetailInfo.mapJson))
58
-    }
59 56
   }, [DetailInfo])
60 57
 
61 58
   const GetBuildingDetail = () => { // 获取楼盘信息
@@ -137,12 +134,12 @@ export default withLayout((props) => {
137 134
 
138 135
                 {/* 特价房源 */}
139 136
                 <view className='SpecialPriceHouse' style={{minHeight: 0}}>
140
-                  <SpecialPriceHouse dataSource={DetailInfo?.specialRoomList}></SpecialPriceHouse>
137
+                  <SpecialPriceHouse List={DetailInfo?.specialRoomList}></SpecialPriceHouse>
141 138
                 </view>
142 139
 
143 140
                 {/* 项目动态 */}
144
-                <view className='ProjectDynamic'>
145
-                  <ProjectDynamic></ProjectDynamic>
141
+                <view className='ProjectDynamic' style={{minHeight: 0}}>
142
+                  <ProjectDynamic List={DetailInfo?.trendList}></ProjectDynamic>
146 143
                 </view>
147 144
 
148 145
                 {/* 置业顾问 */}
@@ -152,7 +149,7 @@ export default withLayout((props) => {
152 149
 
153 150
                 {/* 位置及周边 */}
154 151
                 <view className='Periphery'>
155
-                  <Periphery List={MapList} Info={DetailInfo}></Periphery>
152
+                  <Periphery Info={DetailInfo}></Periphery>
156 153
                 </view>
157 154
 
158 155
                 {/* 户型介绍 */}