Browse Source

详情v1.1

李志伟 3 years ago
parent
commit
b1af9d3285

+ 1
- 1
config/dev.js View File

3
     NODE_ENV: '"development"'
3
     NODE_ENV: '"development"'
4
   },
4
   },
5
   defineConstants: {
5
   defineConstants: {
6
-    HOST: '"https://sgl-v2.njyunzhi.com"',
6
+    HOST: '"http://192.168.89.147:8080"',
7
   },
7
   },
8
   mini: {},
8
   mini: {},
9
   h5: {}
9
   h5: {}

+ 22
- 6
src/components/foodCards/foodCards.jsx View File

6
 import baixin from '@/assets/icons/housemantj/收藏.png'
6
 import baixin from '@/assets/icons/housemantj/收藏.png'
7
 import './style.less'
7
 import './style.less'
8
 import useSave from "@/utils/hooks/useSave"
8
 import useSave from "@/utils/hooks/useSave"
9
+import {getShopDetail,getShopcity} from '@/services/home'
10
+import { useState, useEffect } from 'react'
11
+
9
 
12
 
10
 
13
 
11
 //套餐卡片
14
 //套餐卡片
12
 export default (props) => {
15
 export default (props) => {
13
-  const { star, item, city } = props
16
+  const { item } = props
14
   const [isSaved, toggleSave] = useSave(item.isSaved,'shop_package', item.packageId)
17
   const [isSaved, toggleSave] = useSave(item.isSaved,'shop_package', item.packageId)
18
+  const [city,setCity]=useState({})
19
+  const [detail,setDetail]=useState({})
20
+
21
+  useEffect(() => {
22
+  getShopDetail(item.shopId).then((res)=>{
23
+    setDetail(res)
24
+    getShopcity(res.cityId).then((res2)=>{
25
+      setCity(res2)
26
+    })
27
+  })
28
+}, [])
29
+const star=parseFloat(((detail.sweetScore+detail.environmentScore+detail.serviceScore)/3).toFixed(1)); 
30
+
15
   return (
31
   return (
16
       <view className='foodCard'>
32
       <view className='foodCard'>
17
         <view className='fCleft'>
33
         <view className='fCleft'>
18
           <view className='backMoney'>
34
           <view className='backMoney'>
19
-            返现¥{item.cashback}
35
+            返现¥{item.cashback/100}
20
           </view>
36
           </view>
21
           <view className='appraise'>
37
           <view className='appraise'>
22
             <Star star={star} />
38
             <Star star={star} />
24
           </view>
40
           </view>
25
           <view>
41
           <view>
26
             <view className='contentImg'>
42
             <view className='contentImg'>
27
-              <image src={item.poster} className='img1' ></image>
43
+              <image src={item.poster} className='img1'></image>
28
               <image src={msTip} className='mstip'></image>
44
               <image src={msTip} className='mstip'></image>
29
             </view>
45
             </view>
30
             <view className='neirong'>
46
             <view className='neirong'>
31
-              <view className='textword'>{item.description}</view>
47
+              <view className='textword'>{(item.description).toString().length>25?(item.description).substring(0, 25)+'...':(item.description)}</view>
32
               <view className='jiage'>
48
               <view className='jiage'>
33
                 <text className='rmb' >¥&nbsp;&nbsp;</text>
49
                 <text className='rmb' >¥&nbsp;&nbsp;</text>
34
-                <text className='p1'><text className='price' >{item.actualPrice}</text>元&nbsp;&nbsp;</text>
35
-                <text className='p2'>门市价<text className='oldprice' >{item.standardPrice}</text>元</text>
50
+                <text className='p1'><text className='price' >{item.actualPrice/100}</text>元&nbsp;&nbsp;</text>
51
+                <text className='p2'>门市价<text className='oldprice' >{item.standardPrice/100}</text>元</text>
36
               </view>
52
               </view>
37
               <view className='address'>
53
               <view className='address'>
38
                 <image className='dw' src={wz} />
54
                 <image className='dw' src={wz} />

+ 1
- 0
src/components/tip/index.jsx View File

21
         interval="3000"        
21
         interval="3000"        
22
         autoplay>
22
         autoplay>
23
           {
23
           {
24
+            tips==''?<SwiperItem>Tip:暂无公告  欢迎使用十公里小程序</SwiperItem>:
24
             tips.map((item)=>
25
             tips.map((item)=>
25
               <SwiperItem>
26
               <SwiperItem>
26
                 <View>Tip:{item.content}</View>
27
                 <View>Tip:{item.content}</View>

+ 37
- 27
src/pages/details/foodDetails/foodDetails.jsx View File

1
 import CustomNav from '@/components/CustomNav'
1
 import CustomNav from '@/components/CustomNav'
2
 import withLayout from '@/layouts'
2
 import withLayout from '@/layouts'
3
-import {getShopDetail,getShopPackage,getShopcity,getExtendContent} from '@/services/home'
3
+import {getShopDetail,getShopPackage,getExtendContent} from '@/services/home'
4
 import { useState,useEffect } from 'react'
4
 import { useState,useEffect } from 'react'
5
 import { Swiper, SwiperItem } from '@tarojs/components';
5
 import { Swiper, SwiperItem } from '@tarojs/components';
6
 import Star from '@/components/Star/Star.jsx'
6
 import Star from '@/components/Star/Star.jsx'
11
 import zhuandao from '@/assets/icons/housemantj/backTop.png'
11
 import zhuandao from '@/assets/icons/housemantj/backTop.png'
12
 import titlezs from '@/assets/icons/housemantj/标题装饰.png'
12
 import titlezs from '@/assets/icons/housemantj/标题装饰.png'
13
 import showMore from '@/assets/icons/housemantj/查看更多.png'
13
 import showMore from '@/assets/icons/housemantj/查看更多.png'
14
+import share from '../../../assets/icons/housemantj/景点分享.png'
15
+import good from '../../../assets/icons/housemantj/景点爆赞.png'
16
+import collection from '../../../assets/icons/housemantj/景点收藏.png'
17
+import hongxin from '../../../assets/icons/housemantj/已收藏.png'
18
+
14
 import './foodDetails.less'
19
 import './foodDetails.less'
15
 import Extend from '../components/extend'
20
 import Extend from '../components/extend'
21
+import useSave from "@/utils/hooks/useSave"
22
+import useLike from "@/utils/hooks/useLike"
16
 
23
 
17
 export default withLayout((props) => {
24
 export default withLayout((props) => {
18
   const { router, person } = props
25
   const { router, person } = props
21
   const [detail,setDetail]=useState({})
28
   const [detail,setDetail]=useState({})
22
   //商铺套餐
29
   //商铺套餐
23
   const [spackage,setPackage]=useState([])
30
   const [spackage,setPackage]=useState([])
24
-  const [city,setCity]=useState({})
25
   //banner图集数组
31
   //banner图集数组
26
-  const [imlist,setimlist]=useState([])
32
+  const [imglist,setimglist]=useState([])
27
   const [index, setIndex] = useState(0)
33
   const [index, setIndex] = useState(0)
28
   const handchange = (e) => {
34
   const handchange = (e) => {
29
     setIndex(e.detail.current)
35
     setIndex(e.detail.current)
30
   }
36
   }
37
+  
38
+  const [isSaved, toggleSave] = useSave(detail.isSaved, 'shop', id)
39
+  const [isLike, toggleLike] = useLike(detail.isLike, 'shop', id)
31
 
40
 
32
   //当前套餐总数
41
   //当前套餐总数
33
   const [newpgNum,setNewpgNum]=useState(0)
42
   const [newpgNum,setNewpgNum]=useState(0)
61
   useEffect(()=>{
70
   useEffect(()=>{
62
     getShopDetail(id).then((res)=>{
71
     getShopDetail(id).then((res)=>{
63
       setDetail(res)
72
       setDetail(res)
64
-      setimlist(res.imageList||[])
65
-      getShopcity(res.cityId).then((res2)=>{
66
-        setCity(res2)
67
-      })
73
+      setimglist(res.imageList||[])
68
     })
74
     })
69
     getShopPackage(id).then((res)=>{
75
     getShopPackage(id).then((res)=>{
70
       setPackage(res.records||[])
76
       setPackage(res.records||[])
93
               onChange={handchange}
99
               onChange={handchange}
94
             >
100
             >
95
               {
101
               {
96
-                imlist.map((item) =>
102
+                imglist.map((item) =>
97
                   <SwiperItem>
103
                   <SwiperItem>
98
                     <image src={item.url} className='storeImage' >
104
                     <image src={item.url} className='storeImage' >
99
                       <view className='tpPage'>
105
                       <view className='tpPage'>
100
-                        <text>{index + 1}</text><text>/</text><text>{imlist.length}</text>
106
+                      <text>{index + 1}/{imglist.length}</text>
101
                       </view>
107
                       </view>
102
                     </image>
108
                     </image>
103
                   </SwiperItem>
109
                   </SwiperItem>
109
                   <view className='storeName'>{detail.shopName}</view>
115
                   <view className='storeName'>{detail.shopName}</view>
110
                   <view className='sprice'>
116
                   <view className='sprice'>
111
                     <text className='t1'>¥</text>
117
                     <text className='t1'>¥</text>
112
-                    {detail.averagePrice}/人                
118
+                    {detail.averagePrice/100}/人                
113
                     <view className='bzRight'>
119
                     <view className='bzRight'>
114
                       <image src={ax} style={{ width: '15px', height: '15px', marginRight: '11rpx', marginBottom: '-2px' }} />
120
                       <image src={ax} style={{ width: '15px', height: '15px', marginRight: '11rpx', marginBottom: '-2px' }} />
115
                     爆赞{detail.likeNum}</view>
121
                     爆赞{detail.likeNum}</view>
116
                   </view>
122
                   </view>
117
               </view>
123
               </view>
118
               <view className='appraise'>
124
               <view className='appraise'>
119
-                <Star star={star}/>
120
-                <text className='storezf'>{star}</text>
125
+                <Star star={star}/>{star}
121
                 <view style={{float:'right',marginTop:'5px'}}>
126
                 <view style={{float:'right',marginTop:'5px'}}>
122
                   <text className='comment'>点评:</text>
127
                   <text className='comment'>点评:</text>
123
                   <text className='t1'>口味:{detail.sweetScore}</text>
128
                   <text className='t1'>口味:{detail.sweetScore}</text>
130
               </view>
135
               </view>
131
               <view className='dpPosition'> 
136
               <view className='dpPosition'> 
132
                 <image src={dw} className='dwTip' />
137
                 <image src={dw} className='dwTip' />
133
-                <view>{detail.address}
134
-                  <image src={zhuandao} className='zhuandao' />
138
+                <view>
139
+                  {detail.address}<image src={zhuandao} className='zhuandao'/>
135
                 </view>
140
                 </view>
136
               </view>
141
               </view>
137
             </view>
142
             </view>
138
           </view>
143
           </view>
139
-          <view style={{ position: 'relative',display:spackage?'':'none'}}>
144
+          <view style={{ position: 'relative',display:spackage==''?'none':''}}>
140
             <view className='title'>
145
             <view className='title'>
141
-              <image src={titlezs}></image>
142
-              <text>返现套餐</text>
143
-            </view>
144
-            
145
-            {
146
-             spackage?.map((item)=><Cards star={star} item={item} city={city} />)
147
-            }
148
-            
146
+              <image src={titlezs}/><text>返现套餐</text>
147
+            </view>            
148
+            {spackage?.map((item)=><Cards star={star} item={item}/>)}            
149
             <view className='showMore' style={{display:newpgNum==AllpgNum?'none':''}} onClick={pgMore}>
149
             <view className='showMore' style={{display:newpgNum==AllpgNum?'none':''}} onClick={pgMore}>
150
               <view>查看更多</view>
150
               <view>查看更多</view>
151
               <image src={showMore} className='moreTip' />
151
               <image src={showMore} className='moreTip' />
152
             </view>
152
             </view>
153
           </view>
153
           </view>
154
-
155
-          <view style={{ position: 'relative',display:extend?'':'none' }}>
154
+          <view style={{ position: 'relative',display:extend==''?'none':'' }}>
156
             <view className='title'>
155
             <view className='title'>
157
-              <image src={titlezs}></image>
156
+              <image src={titlezs}/>
158
               <text>本店指南</text>
157
               <text>本店指南</text>
159
             </view>
158
             </view>
160
             {extend?.map((item)=><Extend item={item} />)}
159
             {extend?.map((item)=><Extend item={item} />)}
163
               <image src={showMore} className='moreTip' />
162
               <image src={showMore} className='moreTip' />
164
             </view>
163
             </view>
165
           </view>
164
           </view>
166
-           <view className='botton'>已经到底了~</view>
165
+           <view className='botton' style={{display:newextNum==AllextNum?'':'none'}}>已经到底了~</view>
167
         </scroll-view>
166
         </scroll-view>
168
       </view>
167
       </view>
168
+      <view className='bottomTab'>
169
+        <view className='tab'>
170
+          <image className='share' src={share} />分享
171
+        </view>
172
+        <view className='tab' onClick={toggleLike}>
173
+          <image className='good' src={isLike > 0 ? ax : good} />{isLike > 0 ? '已爆赞' : '爆赞'}
174
+        </view>
175
+        <view className='tab' onClick={toggleSave}>
176
+          <image className='collection' src={isSaved > 0 ? hongxin : collection} />{isSaved > 0 ? '已收藏' : '加入收藏'}
177
+        </view>
178
+      </view>
169
     </view>
179
     </view>
170
   )
180
   )
171
 })
181
 })

+ 22
- 18
src/pages/details/foodDetails/foodDetails.less View File

49
         float: right;
49
         float: right;
50
       }
50
       }
51
     }
51
     }
52
-
53
-
54
-
55
-
56
-
57
-
58
     .appraise{
52
     .appraise{
59
       line-height: 0;
53
       line-height: 0;
60
       margin-top: 28px;
54
       margin-top: 28px;
61
       margin-bottom: 37px;
55
       margin-bottom: 37px;
62
-      
63
-      text{
64
-        font-size: 24px;         
65
-        font-weight: bold;
66
-        color: #020200;
67
-      }
56
+      font-size: 24px;         
57
+      font-weight: bold;
58
+      color: #020200;
68
       .t1{
59
       .t1{
69
         margin-left: 10px;
60
         margin-left: 10px;
70
       }
61
       }
126
     color: #202020;
117
     color: #202020;
127
     margin-left: 10px;
118
     margin-left: 10px;
128
   }
119
   }
129
-  .gltitle{
130
-    width: 32px;
131
-    height: 32px;
132
-    position: relative;
133
-    top: 5px;
134
-  }
135
 }
120
 }
136
 .cs{
121
 .cs{
137
   height: 500px;
122
   height: 500px;
184
   text-align: center;
169
   text-align: center;
185
   padding:40px 0 68px 0;
170
   padding:40px 0 68px 0;
186
   background-color: #F8F8F8;
171
   background-color: #F8F8F8;
172
+}
173
+.bottomTab{
174
+  background: #FFF;
175
+  border-radius: 12px;
176
+  column-count: 3;
177
+  text-align: center;  
178
+  .tab{
179
+    line-height: 96px;
180
+    font-size: 28px;     
181
+    font-weight: bold;
182
+    color: #202020;
183
+    image{
184
+      width: 31px;
185
+      height: 31px;
186
+      position: relative;
187
+      top: 7px;
188
+      margin-right: 12px;
189
+    }
190
+  }
187
 }
191
 }

+ 66
- 212
src/pages/details/mjDetails/sceneryDetails.jsx View File

1
 import CustomNav from '@/components/CustomNav'
1
 import CustomNav from '@/components/CustomNav'
2
-import mj from '../../../assets/icons/housemantj/mj2.jpg'
3
-import mj3 from '../../../assets/icons/housemantj/mj3.jpg'
4
 import ax from '../../../assets/icons/housemantj/onlove.png'
2
 import ax from '../../../assets/icons/housemantj/onlove.png'
5
-import huangxin from '../../../assets/icons/housemantj/已收藏.png'
3
+import hongxin from '../../../assets/icons/housemantj/已收藏.png'
6
 import baixin from '../../../assets/icons/housemantj/收藏.png'
4
 import baixin from '../../../assets/icons/housemantj/收藏.png'
7
 import dw from '../../../assets/icons/housemantj/地址.png'
5
 import dw from '../../../assets/icons/housemantj/地址.png'
8
 import titlejd from '../../../assets/icons/housemantj/推荐景点.png'
6
 import titlejd from '../../../assets/icons/housemantj/推荐景点.png'
9
 import titlems from '../../../assets/icons/housemantj/推荐美食.png'
7
 import titlems from '../../../assets/icons/housemantj/推荐美食.png'
10
-import pay from '../../../assets/icons/housemantj/pay.png'
11
-import ms2 from '../../../assets/icons/housemantj/ms2.jpg'
12
-import msTip from '../../../assets/icons/housemantj/foodtip.png'
13
-import wz from '../../../assets/icons/housemantj/location.png'
14
 import showMore from '../../../assets/icons/housemantj/查看更多.png'
8
 import showMore from '../../../assets/icons/housemantj/查看更多.png'
15
-import dp from '../../../assets/icons/housemantj/dp.jpg'
16
 import share from '../../../assets/icons/housemantj/景点分享.png'
9
 import share from '../../../assets/icons/housemantj/景点分享.png'
17
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
10
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
18
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
11
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
19
 import './sceneryDetails.less'
12
 import './sceneryDetails.less'
20
 import withLayout from '@/layouts'
13
 import withLayout from '@/layouts'
21
 import { useState, useEffect } from 'react'
14
 import { useState, useEffect } from 'react'
22
-import { getTouristDetail, saveCollection, removeCollection } from '@/services/home'
15
+import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
23
 import { Swiper, SwiperItem } from '@tarojs/components';
16
 import { Swiper, SwiperItem } from '@tarojs/components';
24
-
17
+import useSave from "@/utils/hooks/useSave"
18
+import useLike from "@/utils/hooks/useLike"
19
+import Extend from '../components/extend'
20
+import Cards from '@/components/foodCards/foodCards.jsx'
25
 
21
 
26
 
22
 
27
 
23
 
28
 export default withLayout((props) => {
24
 export default withLayout((props) => {
29
-  const { router, person, id } = props
30
-  const { detail, setDetail } = useState()
31
-  const tips = [
32
-    { src: mj },
33
-    { src: mj3 },
34
-    { src: collection },
35
-    { src: mj },
36
-    { src: mj },
37
-    { src: mj3 },
38
-    { src: titlems },
39
-    { src: mj }
40
-  ]
41
-  const [ jshidden, setHidden]  = useState('none')
42
-  const [ jsclose, setClose ] = useState('none')
43
-  const [ jsmore, setMore ] = useState('block')
44
-  const [ tchidden, tcHidden ] = useState('none')
45
-  const [ tcclose, setTcclose ] = useState('none')
46
-  const [ tcmore, setTcMore ] = useState('block')
47
-  const onClose=()=>{
48
-    setHidden('none')
49
-    setClose('none')
50
-    setMore('block')
51
-  }
52
-  const onShow=()=>{
53
-    setHidden('block')
54
-    setClose('block')
55
-    setMore('none')
56
-  }
57
-
25
+  const { router, person } = props
26
+  const { id, distance, location } = props.router.params
27
+  const [detail, setDetail] = useState({})
28
+  const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
29
+  const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
58
 
30
 
31
+  //banner图集数组
32
+  const [imglist, setimglist] = useState([])
59
   const [index, setIndex] = useState(0)
33
   const [index, setIndex] = useState(0)
60
   const handchange = (e) => {
34
   const handchange = (e) => {
61
     setIndex(e.detail.current)
35
     setIndex(e.detail.current)
62
   }
36
   }
37
+
38
+  //本店指南
39
+  const [extend, setExtend] = useState([])
40
+  //当前指南总数
41
+  const [newextNum, setNewextNum] = useState(0)
42
+  //全部指南个数
43
+  const [AllextNum, setAllextNum] = useState(0)
44
+  //指南当前页数
45
+  const [epage, setepage] = useState(2)
46
+  const extendMore = () => {
47
+    setepage(epage + 1)
48
+    getExtendContent('tourist', id, { pageNum: epage }).then((res) => {
49
+      setExtend([...extend, ...res.records])
50
+      setNewextNum(newextNum + res.records.length)
51
+    })
52
+  }
53
+
54
+  // 推荐套餐列表
55
+  const [recommend, setRecommend] = useState([])
56
+
63
   useEffect(() => {
57
   useEffect(() => {
64
     getTouristDetail(id).then((res) => {
58
     getTouristDetail(id).then((res) => {
65
       setDetail(res)
59
       setDetail(res)
60
+      setimglist(res.imageList || [])
61
+
62
+    })
63
+    getExtendContent('tourist', id).then((res) => {
64
+      setExtend(res.records || [])
65
+      setAllextNum(res.total)
66
+      setNewextNum(res.records.length)
67
+    })
68
+    getRecommendList({ location: location }).then((res) => {
69
+      setRecommend(res || [])
66
     })
70
     })
67
   }, [])
71
   }, [])
72
+  console.log(extend=='')
68
   return (
73
   return (
69
     <view className='page-index'>
74
     <view className='page-index'>
70
       <view className='index-navbar'>
75
       <view className='index-navbar'>
80
               onChange={handchange}
85
               onChange={handchange}
81
             >
86
             >
82
               {
87
               {
83
-                tips.map((item) =>
88
+                imglist.map((item) =>
84
                   <SwiperItem>
89
                   <SwiperItem>
85
-                    <image src={item.src} className='storeImage' >
90
+                    <image src={item.url} className='storeImage' >
86
                       <view className='tpPage'>
91
                       <view className='tpPage'>
87
-                        <text>{index + 1}</text><text>/</text><text>{tips.length}</text>
92
+                        <text>{index + 1}/{imglist.length}</text>
88
                       </view>
93
                       </view>
89
                     </image>
94
                     </image>
90
                   </SwiperItem>
95
                   </SwiperItem>
94
 
99
 
95
             <view className='storeJs'>
100
             <view className='storeJs'>
96
               <view className='introduce'>
101
               <view className='introduce'>
97
-                <text className='storeName'>玄武湖</text>
102
+                <text className='storeName'>{detail.touristName}</text>
98
               </view>
103
               </view>
99
               <view className='bz'>
104
               <view className='bz'>
100
                 <image src={ax} style={{ width: '15px', height: '15px', marginRight: '10px', marginBottom: '-2px' }} />
105
                 <image src={ax} style={{ width: '15px', height: '15px', marginRight: '10px', marginBottom: '-2px' }} />
101
-                <text className='bzRight'>爆赞<text>9999+</text></text>
106
+                <text className='bzRight'>爆赞{detail.likeNum}</text>
102
               </view>
107
               </view>
103
-              <view className='wz'>凤游寺52号悦动新门西15栋111号</view>
108
+              <view className='wz'>{detail.address}</view>
104
               <view className='dpPosition'>
109
               <view className='dpPosition'>
105
                 <image src={dw} className='dwTip' />
110
                 <image src={dw} className='dwTip' />
106
-                <view className='distance'><text>9.99</text>公里</view>
111
+                <view className='distance'>{distance}公里</view>
107
               </view>
112
               </view>
108
             </view>
113
             </view>
109
           </view>
114
           </view>
110
           <view className='jdjs'>
115
           <view className='jdjs'>
111
-            <view>
112
-              到了10月下旬的深秋时节,“不觉初秋夜渐长,清风习习重凄
113
-              凉”,秋天的美,毫不输给繁花似锦的春天11月栖霞山枫叶最
114
-              佳观赏期快要来了,赶紧提前收藏这些吧!
115
-            </view>
116
+            <view>{detail.description}</view>
116
             <view className='line'></view>
117
             <view className='line'></view>
117
-            <view className='sc'>
118
-              <image className='scTip' src={baixin} /><text>加入收藏</text>
118
+            <view className='sc' onClick={toggleSave}>
119
+              <image className='scTip' src={isSaved > 0 ? hongxin : baixin} /><text>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
119
             </view>
120
             </view>
120
           </view>
121
           </view>
121
-          <view style={{ position: 'relative' }}>
122
-
122
+          <view style={{ position: 'relative',display:extend==''?'none':''}}>
123
             <view className='title'>
123
             <view className='title'>
124
-              <image src={titlejd}></image>
125
-              <text>景点介绍</text>
126
-            </view>
127
-            <view className='storezn'>
128
-              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
129
-              sed do eiusmod tempor incididunt ut labore et dolore
130
-              magna aliqua. Quis ipsum suspendisse ultrices gravida.
131
-              Risus commodo viverra maecenas accumsan lacus vel
132
-              facilisis.
124
+              <image src={titlejd} />景点介绍
133
             </view>
125
             </view>
134
-            <image src={dp} mode='widthFix' />
135
-            <view className='storezn'>
136
-              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
137
-              sed do eiusmod tempor incididunt ut labore et dolore
138
-              magna aliqua. Quis ipsum suspendisse ultrices gravida.
139
-            </view>
140
-
141
-
142
-
143
-            <view style={{display:jshidden}} >
144
-              <view className='title'>
145
-                <image src={titlejd}></image>
146
-                <text>景点介绍</text>
147
-              </view>
148
-              <view className='storezn'>
149
-                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
150
-                sed do eiusmod tempor incididunt ut labore et dolore
151
-                magna aliqua. Quis ipsum suspendisse ultrices gravida.
152
-                Risus commodo viverra maecenas accumsan lacus vel
153
-                facilisis.
154
-              </view>
155
-              <image src={dp} mode='widthFix' />
156
-              <view className='storezn'>
157
-                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
158
-                sed do eiusmod tempor incididunt ut labore et dolore
159
-                magna aliqua. Quis ipsum suspendisse ultrices gravida.
160
-              </view>
161
-              <view className='title'>
162
-                <image src={titlejd}></image>
163
-                <text>景点介绍</text>
164
-              </view>
165
-              <view className='storezn'>
166
-                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
167
-                sed do eiusmod tempor incididunt ut labore et dolore
168
-                magna aliqua. Quis ipsum suspendisse ultrices gravida.
169
-                Risus commodo viverra maecenas accumsan lacus vel
170
-                facilisis.
171
-              </view>
172
-              <image src={dp} mode='widthFix' />
173
-              <view className='storezn'>
174
-                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
175
-                sed do eiusmod tempor incididunt ut labore et dolore
176
-                magna aliqua. Quis ipsum suspendisse ultrices gravida.
177
-              </view>
178
-            </view>
179
-            <view className='showMore' style={{display:jsclose}} onClick={onClose}>
180
-              <image src={showMore} className='moreTip2' />
181
-              <view>收起</view>
182
-            </view>
183
-            <view className='showMore'  style={{display:jsmore}} onClick={onShow}>
126
+            {extend?.map((item) => <Extend item={item} />)}
127
+            <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
184
               <view>点击查看更多</view>
128
               <view>点击查看更多</view>
185
               <image src={showMore} className='moreTip' />
129
               <image src={showMore} className='moreTip' />
186
             </view>
130
             </view>
187
-
188
-
189
           </view>
131
           </view>
190
-          <view style={{ position: 'relative' }}>
132
+          <view style={{ position: 'relative', display: recommend=='' ? 'none' : '' }}>
191
             <view className='title'>
133
             <view className='title'>
192
-              <image src={titlems}></image>
193
-              <text>老板推荐好吃的</text>
194
-            </view>
195
-            <view className='foodCard'>
196
-              <view className='fCleft'>
197
-                <view className='backMoney'>
198
-                  返现¥2.04
199
-                </view>
200
-                <view className='appraise'>
201
-                  <image className='star' src={huangxin}></image>
202
-                  <image className='star' src={huangxin}></image>
203
-                  <image className='star' src={huangxin}></image>
204
-                  <image className='star' src={huangxin}></image>
205
-                  <image className='star' src={baixin}></image>
206
-                  <text className='storezf'>4.5</text>
207
-                </view>
208
-                <view style={{ overflow: 'hidden' }}>
209
-                  <view className='contentImg'>
210
-                    <image src={ms2} className='img1' ></image>
211
-                    <image src={msTip} className='mstip'></image>
212
-                  </view>
213
-                  <view className='neirong'>
214
-                    <view className='textword'>
215
-                      探店拥有“蓝色波浪”的咖啡店连手提袋都很特别手绘的...
216
-                    </view>
217
-                    <view className='jiage'>
218
-                      <text className='rmb' >¥&nbsp;&nbsp;</text>
219
-                      <text className='p1'><text className='price' >55</text>元&nbsp;&nbsp;</text>
220
-                      <text className='p2'>门市价<text className='oldprice' >78</text>元</text>
221
-                    </view>
222
-                    <view className='address'>
223
-                      <image className='dw' src={wz} />
224
-                      <text className='wz'>南京市/秦淮区</text>
225
-                      <image className='star' src={huangxin}></image>
226
-                      <text className='collection'>已收藏</text>
227
-                    </view>
228
-                  </view>
229
-                </view>
230
-              </view>
231
-              <view className='fCright'>
232
-                <image src={pay} />
233
-                <view>支付</view>
234
-              </view>
235
-              <view className='columnLine'></view>
236
-            </view>
237
-            <view className='foodCard'>
238
-              <view className='fCleft'>
239
-                <view className='backMoney'>
240
-                  返现¥2.04
241
-                </view>
242
-                <view className='appraise'>
243
-                  <image className='star' src={huangxin}></image>
244
-                  <image className='star' src={huangxin}></image>
245
-                  <image className='star' src={huangxin}></image>
246
-                  <image className='star' src={huangxin}></image>
247
-                  <image className='star' src={baixin}></image>
248
-                  <text className='storezf'>4.5</text>
249
-                </view>
250
-                <view style={{ overflow: 'hidden' }}>
251
-                  <view className='contentImg'>
252
-                    <image src={ms2} className='img1' ></image>
253
-                    <image src={msTip} className='mstip'></image>
254
-                  </view>
255
-                  <view className='neirong'>
256
-                    <view className='textword'>
257
-                      探店拥有“蓝色波浪”的咖啡店连手提袋都很特别手绘的...
258
-                    </view>
259
-                    <view className='jiage'>
260
-                      <text className='rmb' >¥&nbsp;&nbsp;</text>
261
-                      <text className='p1'><text className='price' >55</text>元&nbsp;&nbsp;</text>
262
-                      <text className='p2'>门市价<text className='oldprice' >78</text>元</text>
263
-                    </view>
264
-                    <view className='address'>
265
-                      <image className='dw' src={wz} />
266
-                      <text className='wz'>南京市/秦淮区</text>
267
-                      <image className='star' src={huangxin}></image>
268
-                      <text className='collection'>已收藏</text>
269
-                    </view>
270
-                  </view>
271
-                </view>
272
-              </view>
273
-              <view className='fCright'>
274
-                <image src={pay} />
275
-                <view>支付</view>
276
-              </view>
277
-              <view className='columnLine'></view>
278
-            </view>
279
-            <view className='showMore'>
280
-              <view>查看更多</view>
281
-              <image src={showMore} className='moreTip' />
134
+              <image src={titlems} />老板推荐好吃的
282
             </view>
135
             </view>
136
+            {recommend?.map((item) => <Cards item={item} />)}
283
           </view>
137
           </view>
284
           <view className='bottom'>已经到底了~</view>
138
           <view className='bottom'>已经到底了~</view>
285
         </scroll-view>
139
         </scroll-view>
286
       </view>
140
       </view>
287
       <view className='bottomTab'>
141
       <view className='bottomTab'>
288
         <view className='tab'>
142
         <view className='tab'>
289
-          <image className='share' src={share} /><text>分享</text>
143
+          <image className='share' src={share} />分享
290
         </view>
144
         </view>
291
-        <view className='tab'>
292
-          <image className='good' src={good} /><text>爆赞</text>
145
+        <view className='tab' onClick={toggleLike}>
146
+          <image className='good' src={isLike > 0 ? ax : good} />{isLike > 0 ? '已爆赞' : '爆赞'}
293
         </view>
147
         </view>
294
-        <view className='tab'>
295
-          <image className='collection' src={collection} /><text>加入收藏</text>
148
+        <view className='tab' onClick={toggleSave}>
149
+          <image className='collection' src={isSaved > 0 ? hongxin : collection} />{isSaved > 0 ? '已收藏' : '加入收藏'}
296
         </view>
150
         </view>
297
       </view>
151
       </view>
298
 
152
 

+ 5
- 19
src/pages/details/mjDetails/sceneryDetails.less View File

100
   }
100
   }
101
 }
101
 }
102
 .title{
102
 .title{
103
-  margin: 60px 0 40px 0;
103
+  margin: 60px 0 40px 0; 
104
+  font-size: 34px;      
105
+  font-weight: bold;
106
+  color: #202020;
104
   image{
107
   image{
105
     width: 30px;
108
     width: 30px;
106
     height: 30px;
109
     height: 30px;
107
-  }
108
-  text{
109
-    font-size: 34px;      
110
-    font-weight: bold;
111
-    color: #202020;
112
-    margin-left: 10px;
113
-  }
114
-  .gltitle{
115
-    width: 32px;
116
-    height: 32px;
117
-    position: relative;
118
-    top: 5px;
110
+    margin-right: 10px;
119
   }
111
   }
120
 }
112
 }
121
 .foodCard{
113
 .foodCard{
269
     height: 19px;
261
     height: 19px;
270
     margin-top: 14px;
262
     margin-top: 14px;
271
   }
263
   }
272
-  .moreTip2{
273
-    width: 38px;
274
-    height: 19px;
275
-    margin-top: 14px;
276
-    transform:rotate(180deg);
277
-  }
278
 }
264
 }
279
 .storezn{
265
 .storezn{
280
   font-size: 28px;
266
   font-size: 28px;

+ 2
- 2
src/pages/index/components/Card.js View File

15
   const [isSaved, toggleSave] = useSave(item.isSaved, item.targetType, item.targetId)
15
   const [isSaved, toggleSave] = useSave(item.isSaved, item.targetType, item.targetId)
16
   const Detail=()=>{
16
   const Detail=()=>{
17
     if (item.targetType=='tourist') {
17
     if (item.targetType=='tourist') {
18
-      Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` });
18
+      let location=item.lng+','+item.lat
19
+      Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}&distance=${(item.distance/1000).toFixed(2)}&location=${location}` });
19
     }
20
     }
20
     else{
21
     else{
21
       Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` });
22
       Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` });
22
     }
23
     }
23
   }
24
   }
24
-
25
   return (
25
   return (
26
     <view className='contentCard'>
26
     <view className='contentCard'>
27
       <view className='cardTop'>
27
       <view className='cardTop'>

+ 10
- 10
src/pages/index/tabs/Recommend.jsx View File

1
 import Taro, { useRouter } from '@tarojs/taro'
1
 import Taro, { useRouter } from '@tarojs/taro'
2
-import { React, useState, useEffect } from 'react'
2
+import { React, useState, useEffect, useRef } from 'react'
3
 import iconsearch from '@/assets/icons/housemantj/search.png'
3
 import iconsearch from '@/assets/icons/housemantj/search.png'
4
 import location from '@/assets/icons/housemantj/location.png'
4
 import location from '@/assets/icons/housemantj/location.png'
5
 import Tip from '@/components/tip'
5
 import Tip from '@/components/tip'
16
   const { params } = useRouter()
16
   const { params } = useRouter()
17
   const { tabJump } = params || {}
17
   const { tabJump } = params || {}
18
   const [typeList, setTypeList] = useState([])
18
   const [typeList, setTypeList] = useState([])
19
-  const [location1,setLocation]=useState('')
19
+  
20
+  const locRef = useRef()
20
 
21
 
21
   const [queryParams, setQueryParams] = useState({ location: '', pageNum: 1, pageSize: 10, typeId: '' })
22
   const [queryParams, setQueryParams] = useState({ location: '', pageNum: 1, pageSize: 10, typeId: '' })
22
 
23
 
40
 
41
 
41
   useEffect(() => {
42
   useEffect(() => {
42
     getLocation().then((res) => {
43
     getLocation().then((res) => {
43
-      setLocation(`${res.longitude},${res.latitude}`)
44
+      locRef.current = `${res.longitude},${res.latitude}`
44
       setQueryParams({
45
       setQueryParams({
45
         ...queryParams,
46
         ...queryParams,
46
-        location: `${res.longitude},${res.latitude}`
47
+        location: locRef.current
47
       })
48
       })
48
-      getResourceList(queryParams).then((res2) => {
49
-      setAllList(res2.records || [])
50
-    })
51
     })
49
     })
52
 
50
 
53
     //查询分类标签表
51
     //查询分类标签表
68
 
66
 
69
 
67
 
70
   useEffect(() => {
68
   useEffect(() => {
71
-    getResourceList(queryParams).then((res) => {
72
-      setAllList(res.records || [])
73
-    })
69
+    if (locRef.current) {
70
+      getResourceList(queryParams).then((res) => {
71
+        setAllList(res.records || [])
72
+      })
73
+    }
74
   }, [queryParams])
74
   }, [queryParams])
75
 
75
 
76
   const onSearch = () => {
76
   const onSearch = () => {

+ 1
- 0
src/pages/index/tabs/less/Recommend.less View File

54
         height:37px;
54
         height:37px;
55
         position: absolute;
55
         position: absolute;
56
         left: 0;
56
         left: 0;
57
+        top: 0;
57
       }
58
       }
58
       .loveharde{
59
       .loveharde{
59
         width: 22px;
60
         width: 22px;

+ 18
- 9
src/services/home.js View File

79
  * @param {*} id 
79
  * @param {*} id 
80
  * @returns 
80
  * @returns 
81
  */
81
  */
82
- export const getTouristDetail = (id) => request(`/taTourist/${id}`)
82
+ export const getTouristDetail = (id) => request(`/tourist/${id}`)
83
 
83
 
84
 /**
84
 /**
85
- * 点赞
86
- * @param {*} id 
85
+ * 获取推荐套餐列表
87
  * @returns 
86
  * @returns 
87
+ * params 搜索条件放这里
88
  */
88
  */
89
- export const saveLike = (data) => request(`/taLike `,{ method: 'post', data })
89
+ export const getRecommendList = (params) => request('/package/recommend', { params })
90
 
90
 
91
- /**
92
- * 取消点赞
93
- * @param {*} id 
91
+
92
+
93
+ 
94
+/**
95
+ * 爆赞
96
+ * @param {*} data 
94
  * @returns 
97
  * @returns 
95
  */
98
  */
96
-  export const deldteLike = (id) => request(`/taLike /${id}`,{ method: 'delete' })
99
+ export const saveLike = (targetType,targetId) => request(`/${targetType}/like/${targetId}`, { method: 'post' })
97
 
100
 
98
-//缺少收藏接口
101
+/**
102
+ * 取消爆赞
103
+ * @param {*} data 
104
+ * @returns 
105
+ */
106
+ export const removeLike = (targetType,targetId) => request(`/${targetType}/like/${targetId}`, { method: 'delete'})
107
+ 
99
 //缺少套餐订单生成
108
 //缺少套餐订单生成
100
 
109
 
101
 
110
 

+ 21
- 0
src/utils/hooks/useLike.js View File

1
+import { useEffect, useState } from "react"
2
+import { saveLike, removeLike } from "@/services/home"
3
+
4
+export default function (initailState, targetType, targetId) {
5
+  const [isLike, setIsLike] = useState(initailState)
6
+  useEffect(() => {
7
+    setIsLike(initailState)
8
+  }, [initailState])
9
+  const toggleLike = () => {
10
+    if (isLike) {
11
+      removeLike(targetType, targetId).then(() => {
12
+        setIsLike(false)
13
+      })
14
+    } else {
15
+      saveLike(targetType, targetId).then(() => {
16
+        setIsLike(true)
17
+      })
18
+    }
19
+  }
20
+  return [isLike, toggleLike]
21
+}