|
@@ -10,6 +10,7 @@ import baozan from '@/assets/icons/housemantj/bgood.png'
|
10
|
10
|
import weibaozan from '@/assets/icons/housemantj/unLike.png'
|
11
|
11
|
import zhuandao from "@/assets/icons/housemantj/backTop.png";
|
12
|
12
|
import withLayout from '@/layouts'
|
|
13
|
+import SpinBox from "@/components/Spin/SpinBox";
|
13
|
14
|
import { useState, useEffect } from 'react'
|
14
|
15
|
import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
|
15
|
16
|
import { Swiper, SwiperItem, Button } from '@tarojs/components';
|
|
@@ -26,6 +27,8 @@ export default withLayout((props) => {
|
26
|
27
|
const [detail, setDetail] = useState({})
|
27
|
28
|
const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
|
28
|
29
|
const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
|
|
30
|
+ const [loading, setLoading] = useState(false)
|
|
31
|
+
|
29
|
32
|
//banner图集数组
|
30
|
33
|
const [imglist, setimglist] = useState([])
|
31
|
34
|
const [index, setIndex] = useState(0)
|
|
@@ -42,10 +45,15 @@ export default withLayout((props) => {
|
42
|
45
|
//指南当前页数
|
43
|
46
|
const [epage, setepage] = useState(2)
|
44
|
47
|
const extendMore = () => {
|
|
48
|
+ setLoading(true)
|
45
|
49
|
setepage(epage + 1)
|
46
|
50
|
getExtendContent('tourist', id, { pageNum: epage }).then((res) => {
|
47
|
51
|
setExtend([...extend, ...res.records])
|
48
|
52
|
setNewextNum(newextNum + res.records.length)
|
|
53
|
+ setLoading(false)
|
|
54
|
+ }).catch(e => {
|
|
55
|
+ setLoading(false)
|
|
56
|
+
|
49
|
57
|
})
|
50
|
58
|
}
|
51
|
59
|
|
|
@@ -66,6 +74,7 @@ export default withLayout((props) => {
|
66
|
74
|
|
67
|
75
|
useEffect(() => {
|
68
|
76
|
if (id) {
|
|
77
|
+ setLoading(true)
|
69
|
78
|
getTouristDetail(id, { location }).then((res) => {
|
70
|
79
|
setDetail(res)
|
71
|
80
|
setimglist(res.imageList || [])
|
|
@@ -77,10 +86,15 @@ export default withLayout((props) => {
|
77
|
86
|
setExtend(res.records || [])
|
78
|
87
|
setAllextNum(res.total)
|
79
|
88
|
setNewextNum(res.records.length)
|
|
89
|
+ setLoading(false)
|
|
90
|
+
|
80
|
91
|
})
|
81
|
92
|
} else {
|
82
|
93
|
getRecommendList({ location }).then((res2) => {
|
83
|
94
|
setRecommend(res2 || [])
|
|
95
|
+ setLoading(false)
|
|
96
|
+ }).catch(e => {
|
|
97
|
+ setLoading(false)
|
84
|
98
|
})
|
85
|
99
|
}
|
86
|
100
|
}, [id, location])
|
|
@@ -98,7 +112,8 @@ export default withLayout((props) => {
|
98
|
112
|
<view className='index-navbar'>
|
99
|
113
|
<CustomNav title='十公里' />
|
100
|
114
|
</view>
|
101
|
|
- <view style={{ overflow: 'hidden', padding: '0 30rpx', height: '100%', background: '#F8F8F8' }}>
|
|
115
|
+
|
|
116
|
+ <SpinBox loading={loading} style={{ overflow: 'hidden', padding: '0 30rpx', height: '100%', background: '#F8F8F8' }}>
|
102
|
117
|
<scroll-view scrollY style={{ height: '100%' }}>
|
103
|
118
|
<view className='storeDetails'>
|
104
|
119
|
<Swiper
|
|
@@ -160,7 +175,7 @@ export default withLayout((props) => {
|
160
|
175
|
</view>
|
161
|
176
|
<view className='bottom'>这是我的底线</view>
|
162
|
177
|
</scroll-view>
|
163
|
|
- </view>
|
|
178
|
+ </SpinBox>
|
164
|
179
|
<view className='bottomTab'>
|
165
|
180
|
<Button openType='share' className='sharebtn'>分享</Button>
|
166
|
181
|
<view className='tab'>
|