|
@@ -11,11 +11,11 @@ import weibaozan from '@/assets/icons/housemantj/未赞.png'
|
11
|
11
|
import withLayout from '@/layouts'
|
12
|
12
|
import { useState, useEffect, useRef } from 'react'
|
13
|
13
|
import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
|
14
|
|
-import { Swiper, SwiperItem,Button } from '@tarojs/components';
|
|
14
|
+import { Swiper, SwiperItem, Button } from '@tarojs/components';
|
15
|
15
|
import useSave from "@/utils/hooks/useSave"
|
16
|
16
|
import useLike from "@/utils/hooks/useLike"
|
17
|
17
|
import Cards from '@/components/foodCards/foodCards.jsx'
|
18
|
|
-import Taro,{ useShareAppMessage } from '@tarojs/taro'
|
|
18
|
+import Taro, { useShareAppMessage } from '@tarojs/taro'
|
19
|
19
|
import { getTouristDistance } from '@/services/home'
|
20
|
20
|
import Extend from '../components/Extend/extend'
|
21
|
21
|
import './sceneryDetails.less'
|
|
@@ -23,13 +23,12 @@ import './sceneryDetails.less'
|
23
|
23
|
|
24
|
24
|
|
25
|
25
|
export default withLayout((props) => {
|
26
|
|
- const { router, person ,location } = props
|
27
|
|
- const { id} = props.router.params
|
|
26
|
+ const { router, person, location } = props
|
|
27
|
+ const { id } = props.router.params
|
28
|
28
|
const [detail, setDetail] = useState({})
|
29
|
29
|
const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
|
30
|
30
|
const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
|
31
|
|
- const [distance,setDistance]=useState()
|
32
|
|
- const [tslocation,setTsLocation]=useState('')
|
|
31
|
+ const [distance, setDistance] = useState()
|
33
|
32
|
//banner图集数组
|
34
|
33
|
const [imglist, setimglist] = useState([])
|
35
|
34
|
const [index, setIndex] = useState(0)
|
|
@@ -73,37 +72,35 @@ export default withLayout((props) => {
|
73
|
72
|
lat.current = (res.locaton).toString().split(',')[1]
|
74
|
73
|
setDetail(res)
|
75
|
74
|
setimglist(res.imageList || [])
|
76
|
|
-
|
77
|
75
|
})
|
78
|
76
|
getExtendContent('tourist', id).then((res) => {
|
79
|
77
|
setExtend(res.records || [])
|
80
|
78
|
setAllextNum(res.total)
|
81
|
79
|
setNewextNum(res.records.length)
|
82
|
80
|
})
|
83
|
|
- getTouristDistance('tourist',id,{location:location}).then((res)=>{
|
|
81
|
+ getTouristDistance('tourist', id, { location: location }).then((res) => {
|
84
|
82
|
setDistance((res.distance / 1000).toFixed(2))
|
85
|
|
- setTsLocation(res.lng + ',' + res.lat)
|
86
|
|
- })
|
87
|
|
- getRecommendList({ location: tslocation }).then((res) => {
|
88
|
|
- setRecommend(res || [])
|
|
83
|
+ getRecommendList({ location: res.lng + ',' + res.lat }).then((res2) => {
|
|
84
|
+ setRecommend(res2 || [])
|
|
85
|
+ })
|
89
|
86
|
})
|
90
|
|
- }, [])
|
|
87
|
+ }, [])
|
91
|
88
|
// 分享
|
92
|
|
- useShareAppMessage(()=>{
|
|
89
|
+ useShareAppMessage(() => {
|
93
|
90
|
return {
|
94
|
91
|
title: detail.touristName,
|
95
|
92
|
path: `/pages/details/mjDetails/sceneryDetails?id=${id}`,
|
96
|
93
|
imageUrl: detail.poster,
|
97
|
94
|
}
|
98
|
|
-
|
99
|
|
-})
|
|
95
|
+
|
|
96
|
+ })
|
100
|
97
|
return (
|
101
|
98
|
<view className='page-index'>
|
102
|
99
|
<view className='index-navbar'>
|
103
|
100
|
<CustomNav title='十公里' />
|
104
|
101
|
</view>
|
105
|
|
- <view style={{ overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
|
106
|
|
- <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
|
|
102
|
+ <view style={{ overflow: 'hidden', padding: '0 30rpx', height: '100%', background: '#F8F8F8' }}>
|
|
103
|
+ <scroll-view scroll-y="true" style={{ height: '100%' }}>
|
107
|
104
|
<view className='storeDetails'>
|
108
|
105
|
<Swiper
|
109
|
106
|
className='.swiper'
|
|
@@ -150,7 +147,7 @@ export default withLayout((props) => {
|
150
|
147
|
<view className='title'>
|
151
|
148
|
<image src={titlejd} />景点介绍
|
152
|
149
|
</view>
|
153
|
|
- {(extend||[]).map((item) => <Extend item={item} />)}
|
|
150
|
+ {(extend || []).map((item) => <Extend item={item} />)}
|
154
|
151
|
<view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
|
155
|
152
|
<view>点击查看更多</view>
|
156
|
153
|
<image src={showMore} className='moreTip' />
|
|
@@ -160,13 +157,13 @@ export default withLayout((props) => {
|
160
|
157
|
<view className='title'>
|
161
|
158
|
<image src={titlems} />老板推荐好吃的
|
162
|
159
|
</view>
|
163
|
|
- {(recommend||[]).map((item) => <Cards item={item} />)}
|
|
160
|
+ {(recommend || []).map((item) => <Cards item={item} />)}
|
164
|
161
|
</view>
|
165
|
162
|
<view className='bottom'>已经到底了~</view>
|
166
|
163
|
</scroll-view>
|
167
|
164
|
</view>
|
168
|
165
|
<view className='bottomTab'>
|
169
|
|
- <Button openType='share' className='sharebtn'>分享</Button>
|
|
166
|
+ <Button openType='share' className='sharebtn'>分享</Button>
|
170
|
167
|
<view className='tab'>
|
171
|
168
|
<image className='share' src={share} />分享
|
172
|
169
|
</view>
|
|
@@ -177,7 +174,6 @@ export default withLayout((props) => {
|
177
|
174
|
<image className='collection' src={isSaved > 0 ? ax : good} />{isSaved > 0 ? '已收藏' : '加入收藏'}
|
178
|
175
|
</view>
|
179
|
176
|
</view>
|
180
|
|
-
|
181
|
177
|
</view>
|
182
|
178
|
)
|
183
|
179
|
})
|