|
@@ -0,0 +1,199 @@
|
|
1
|
+import CustomNav from '@/components/CustomNav'
|
|
2
|
+import ax from '@/assets/icons/housemantj/onlove.png'
|
|
3
|
+import dw from '@/assets/icons/housemantj/loc-o.png'
|
|
4
|
+import TextMentioned from '@/assets/icons/housemantj/TextMentioned.png'
|
|
5
|
+import NoteasICO from '@/assets/icons/housemantj/NoteasICO.png'
|
|
6
|
+import { compressImage } from '@/utils'
|
|
7
|
+import MoreGuide from "@/components/MoreGuide";//视频
|
|
8
|
+
|
|
9
|
+import share from '@/assets/icons/housemantj/touristShare.png'
|
|
10
|
+import good from '@/assets/icons/housemantj/touristGood.png'
|
|
11
|
+import baozan from '@/assets/icons/housemantj/bgood.png'
|
|
12
|
+import weibaozan from '@/assets/icons/housemantj/unLike.png'
|
|
13
|
+import zhuandao from "@/assets/icons/housemantj/backTop.png";
|
|
14
|
+import withLayout from '@/layouts'
|
|
15
|
+import SpinBox from "@/components/Spin/SpinBox";
|
|
16
|
+import TabIcon from '@/components/HorTabbar/TabIcon'
|
|
17
|
+import { useState, useEffect } from 'react'
|
|
18
|
+import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
|
|
19
|
+import logo from "@/assets/icons/UserCenter/laba.png"
|
|
20
|
+import { Swiper, SwiperItem, Button, View, Ad } from '@tarojs/components';
|
|
21
|
+import useSave from "@/utils/hooks/useSave"
|
|
22
|
+import useLike from "@/utils/hooks/useLike"
|
|
23
|
+import Cards from '@/components/foodCards/foodCards.jsx'
|
|
24
|
+import Taro, { useShareAppMessage } from '@tarojs/taro'
|
|
25
|
+import Extend from '../components/Extend/extend'
|
|
26
|
+import './index.less'
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+export default withLayout((props) => {
|
|
31
|
+ const { router, person, location } = props
|
|
32
|
+ const { id } = props.router.params
|
|
33
|
+ const [detail, setDetail] = useState({})
|
|
34
|
+ const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
|
|
35
|
+ const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
|
|
36
|
+ const [loading, setLoading] = useState(false)
|
|
37
|
+
|
|
38
|
+ //banner图集数组
|
|
39
|
+ const [imglist, setimglist] = useState([])
|
|
40
|
+ const [index, setIndex] = useState(0)
|
|
41
|
+ const handchange = (e) => {
|
|
42
|
+ setIndex(e.detail.current)
|
|
43
|
+ }
|
|
44
|
+
|
|
45
|
+ //本店指南
|
|
46
|
+ const [extend, setExtend] = useState([])
|
|
47
|
+
|
|
48
|
+ // 推荐套餐列表
|
|
49
|
+ const [recommend, setRecommend] = useState([])
|
|
50
|
+
|
|
51
|
+ const openMap = () => {
|
|
52
|
+ const [lng, lat] = detail.locaton.split(',')
|
|
53
|
+
|
|
54
|
+ Taro.openLocation({
|
|
55
|
+ longitude: lng - 0,
|
|
56
|
+ latitude: lat - 0,
|
|
57
|
+ name: detail.touristName,
|
|
58
|
+ address: detail.address,
|
|
59
|
+ scale: 12,
|
|
60
|
+ })
|
|
61
|
+ }
|
|
62
|
+ //引导显隐
|
|
63
|
+ const [guidance, setGuidance] = useState('shareOff')
|
|
64
|
+ useEffect(() => {
|
|
65
|
+ if (router.params.enterType === "share") {
|
|
66
|
+ setGuidance('shareOn')
|
|
67
|
+ }
|
|
68
|
+ }, [router.params.enterType])
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+ useEffect(() => {
|
|
72
|
+ if (id) {
|
|
73
|
+ setLoading(true)
|
|
74
|
+ getTouristDetail(id, { location }).then((res) => {
|
|
75
|
+ setDetail(res)
|
|
76
|
+ setimglist(res.imageList || [])
|
|
77
|
+ getRecommendList({ location: res.locaton }).then((res2) => {
|
|
78
|
+ setRecommend(res2 || [])
|
|
79
|
+ })
|
|
80
|
+ })
|
|
81
|
+ getExtendContent('tourist', id, { pageSize: 500 }).then((res) => {
|
|
82
|
+ setExtend(res.records || [])
|
|
83
|
+ setLoading(false)
|
|
84
|
+
|
|
85
|
+ })
|
|
86
|
+ } else {
|
|
87
|
+ getRecommendList({ location }).then((res2) => {
|
|
88
|
+ setRecommend(res2 || [])
|
|
89
|
+ setLoading(false)
|
|
90
|
+ }).catch(e => {
|
|
91
|
+ setLoading(false)
|
|
92
|
+ })
|
|
93
|
+ }
|
|
94
|
+ }, [id, location])
|
|
95
|
+ // 分享
|
|
96
|
+ useShareAppMessage(() => {
|
|
97
|
+ return {
|
|
98
|
+ title: detail.touristName,
|
|
99
|
+ path: `/pages/details/mjDetails/sceneryDetails?id=${id}&enterType=share`,
|
|
100
|
+ imageUrl: detail.poster,
|
|
101
|
+ }
|
|
102
|
+
|
|
103
|
+ })
|
|
104
|
+ return (
|
|
105
|
+ <view className='page-index'>
|
|
106
|
+ {
|
|
107
|
+ guidance === 'shareOn' ? <view className='index-navbar'>
|
|
108
|
+ <add-tipsFood logo={logo} custom duration={-1} />
|
|
109
|
+ <CustomNav title='十公里' noback />
|
|
110
|
+ </view> :
|
|
111
|
+ <view className='index-navbar'>
|
|
112
|
+ <CustomNav title='十公里' />
|
|
113
|
+ </view>
|
|
114
|
+ }
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+ <SpinBox loading={loading} className='index-container' style={{ padding: '0 30rpx', background: '#F8F8F8' }}>
|
|
118
|
+ <scroll-view scrollY style={{ height: '100%' }}>
|
|
119
|
+ <view className='storeDetails'>
|
|
120
|
+ <View className='huadong'>
|
|
121
|
+ <Swiper
|
|
122
|
+ className='swiper'
|
|
123
|
+ circular
|
|
124
|
+ onChange={handchange}
|
|
125
|
+ >
|
|
126
|
+ {
|
|
127
|
+ imglist.map((item, key) => (
|
|
128
|
+ item.noteType == 'image' ?
|
|
129
|
+ <SwiperItem key={key}>
|
|
130
|
+ <image src={compressImage(item.url)} mode='aspectFit' className='storeImage' />
|
|
131
|
+ </SwiperItem> : <MoreGuide key={key} item={item} />
|
|
132
|
+ ))}
|
|
133
|
+ </Swiper>
|
|
134
|
+ <view className='tpPage'>
|
|
135
|
+ <text>
|
|
136
|
+ {index + 1}/{imglist.length}
|
|
137
|
+ </text>
|
|
138
|
+ </view>
|
|
139
|
+ </View>
|
|
140
|
+
|
|
141
|
+ <view className='storeJs'>
|
|
142
|
+ <view className='introduce'>
|
|
143
|
+ <text className='storeName'>{detail.touristName}</text>
|
|
144
|
+ </view>
|
|
145
|
+ <view className='bz'>
|
|
146
|
+ <image src={baozan} style={{ width: '15px', height: '15px', marginRight: '10px', marginBottom: '-2px' }} />
|
|
147
|
+ <text className='bzRight'>爆赞{detail.likeNum}</text>
|
|
148
|
+ </view>
|
|
149
|
+ <view className='wz'>{detail.address}</view>
|
|
150
|
+ <view className='dpPosition' onClick={openMap}>
|
|
151
|
+ <image src={dw} className='dwTip' />
|
|
152
|
+ <view className='distance'>{(detail.distance / 1000).toFixed(2)}公里<image src={zhuandao} className='zhuandao' /></view>
|
|
153
|
+ </view>
|
|
154
|
+ </view>
|
|
155
|
+ </view>
|
|
156
|
+ <view className='jdjs'>
|
|
157
|
+ <view>{detail.description}</view>
|
|
158
|
+ <view className='line'></view>
|
|
159
|
+ <view className='sc' onClick={toggleSave}>
|
|
160
|
+ <image className='scTip' src={isSaved > 0 ? ax : good} /><text>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
|
|
161
|
+ </view>
|
|
162
|
+ </view>
|
|
163
|
+ <view class='adContainer'>
|
|
164
|
+ <Ad unit-id='adunit-a0f97bb7ec8ec7bb' ad-intervals='30' />
|
|
165
|
+ </view>
|
|
166
|
+ <view style={{ position: 'relative', display: extend == '' ? 'none' : '' }}>
|
|
167
|
+ <view className='title'>
|
|
168
|
+ <image src={NoteasICO} />笔记详情
|
|
169
|
+ </view>
|
|
170
|
+ <View style={{ background: '#FFF' }}>
|
|
171
|
+ {(extend || []).map((item) => <Extend item={item} />)}
|
|
172
|
+ </View>
|
|
173
|
+ </view>
|
|
174
|
+ <view style={{ display: recommend == '' ? 'none' : '' }}>
|
|
175
|
+ <view className='title'>
|
|
176
|
+ <image src={TextMentioned} />文中提及
|
|
177
|
+ </view>
|
|
178
|
+ {(recommend || []).map((item) => <Cards item={item} det={item} st={parseFloat(item.score.toFixed(1))} />)}
|
|
179
|
+ </view>
|
|
180
|
+ <view className='botton'>这是我的底线</view>
|
|
181
|
+ </scroll-view>
|
|
182
|
+ </SpinBox>
|
|
183
|
+
|
|
184
|
+ <view className='index-tabber weui-tabbar' style={{ background: '#fff' }}>
|
|
185
|
+ <view className='weui-tabbar__item'>
|
|
186
|
+ <Button openType='share' className='purebtn'><TabIcon icon={share} text='分享' /></Button>
|
|
187
|
+ </view>
|
|
188
|
+ <view className='weui-tabbar__item' onClick={toggleLike}>
|
|
189
|
+ <TabIcon icon={isLike > 0 ? baozan : weibaozan} text={isLike > 0 ? "已爆赞" : "爆赞"} />
|
|
190
|
+ </view>
|
|
191
|
+ <view className='weui-tabbar__item' onClick={toggleSave}>
|
|
192
|
+ <TabIcon icon={isSaved > 0 ? ax : good} text={isSaved > 0 ? "已收藏" : "加入收藏"} />
|
|
193
|
+ </view>
|
|
194
|
+ </view>
|
|
195
|
+ </view>
|
|
196
|
+ )
|
|
197
|
+})
|
|
198
|
+
|
|
199
|
+
|