소스 검색

Merge branch 'dev' of http://git.ycjcjy.com/shigongli/miniapp-v2 into dev

吃个甘蔗嚼一年 3 년 전
부모
커밋
202d4c079a

+ 1
- 1
src/components/foodCards/foodCards.jsx 파일 보기

63
             <image src={msTip} className='mstip'></image>
63
             <image src={msTip} className='mstip'></image>
64
           </view>
64
           </view>
65
           <view className='neirong'>
65
           <view className='neirong'>
66
-            <view className='textword'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
66
+            <view className='textword'  onClick={() => { goFood() }} >{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
67
             <view className='jiage' onClick={() => { goFood() }} >
67
             <view className='jiage' onClick={() => { goFood() }} >
68
               <text className='rmb' >¥&nbsp;&nbsp;</text>
68
               <text className='rmb' >¥&nbsp;&nbsp;</text>
69
               <text className='p1'><text className='price' >{item.actualPrice / 100}</text>元&nbsp;&nbsp;</text>
69
               <text className='p1'><text className='price' >{item.actualPrice / 100}</text>元&nbsp;&nbsp;</text>

+ 1
- 0
src/components/foodCards/style.less 파일 보기

3
   box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
3
   box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
4
   border-radius: 12px;
4
   border-radius: 12px;
5
   position: relative;
5
   position: relative;
6
+  margin: 15px 5px;
6
   margin-bottom: 30px;
7
   margin-bottom: 30px;
7
   overflow: hidden;
8
   overflow: hidden;
8
   background: radial-gradient(circle at 82% top,transparent 20px,#fff 0) top,
9
   background: radial-gradient(circle at 82% top,transparent 20px,#fff 0) top,

+ 23
- 16
src/hotel/components/HouseManage/houseManage.jsx 파일 보기

3
 import share from '@/assets/icons/landlord/分享链接.png'
3
 import share from '@/assets/icons/landlord/分享链接.png'
4
 import del from '@/assets/icons/landlord/删除.png'
4
 import del from '@/assets/icons/landlord/删除.png'
5
 import addImg from '@/assets/icons/landlord/添加.png'
5
 import addImg from '@/assets/icons/landlord/添加.png'
6
-import iconsearch from '@/assets/icons/housemantj/search.png'
7
 import React, { useState, useEffect, useRef, useImperativeHandle } from 'react'
6
 import React, { useState, useEffect, useRef, useImperativeHandle } from 'react'
8
 import { getRoomList, deleteRoom } from '@/services/landlord'
7
 import { getRoomList, deleteRoom } from '@/services/landlord'
8
+import SearchBar from '@/components/SearchBar'
9
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
9
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
10
 import ShareCard from '../shareCard/shareCard'
10
 import ShareCard from '../shareCard/shareCard'
11
 import './houseManage.less'
11
 import './houseManage.less'
12
-import SearchBar from '@/components/SearchBar'
13
 
12
 
14
 
13
 
15
 export default React.forwardRef((props, ref) => {
14
 export default React.forwardRef((props, ref) => {
24
   const handelClick = () => {
23
   const handelClick = () => {
25
     Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}` });
24
     Taro.navigateTo({ url: `/hotel/pages/landlord/addRoom/addRoom?hotelId=${hotel.hotelId}&hotelName=${hotel.hotelName}` });
26
   }
25
   }
27
-  const handelDelete = (roomId) => {
28
-    deleteRoom(roomId).then(() => {
29
-      Taro.showToast({
30
-        title: '删除房源成功',
31
-        icon: 'none',
32
-      })
33
-      getRoomList({ hotelId: hotel.hotelId }).then((res) => {
34
-        setDetail(res.records || [])
35
-      })
26
+  const handelDelete = (val) => {
27
+    Taro.showModal({
28
+      title: '提示',
29
+      content: `确认删除${val.roomName}?`,
30
+      success: function (res) {
31
+        if (res.confirm) {
32
+          deleteRoom(val.roomId).then(() => {
33
+            Taro.showToast({
34
+              title: '删除房源成功',
35
+              icon: 'none',
36
+            })
37
+            getRoomList({ hotelId: hotel.hotelId }).then((res) => {
38
+              setDetail(res.records || [])
39
+            })
40
+          })       
41
+        } 
42
+      }
36
     })
43
     })
44
+   
37
   }
45
   }
38
 
46
 
39
   const [showCutover, setShowCutover] = useState(false)
47
   const [showCutover, setShowCutover] = useState(false)
97
       getRoomList({ hotelId: hotel.hotelId,roomName:e.detail.value }).then((res) => {
105
       getRoomList({ hotelId: hotel.hotelId,roomName:e.detail.value }).then((res) => {
98
       setDetail(res.records || [])
106
       setDetail(res.records || [])
99
     })
107
     })
100
-    }
101
-    
108
+    }    
102
   }
109
   }
103
   return (
110
   return (
104
     <view>
111
     <view>
105
       <view style={{ padding: '0 30rpx', height: '100%' }}>
112
       <view style={{ padding: '0 30rpx', height: '100%' }}>
106
-        <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
113
+        <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch}/>
107
         <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
114
         <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
108
         <ShareCard showCutover={showCard} onClose={onClose} />
115
         <ShareCard showCutover={showCard} onClose={onClose} />
109
-        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 255px)' }}>
116
+        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 244px)' }}>
110
           {
117
           {
111
             detail?.map((item) =>
118
             detail?.map((item) =>
112
               <view className='houseCard'>
119
               <view className='houseCard'>
114
                 <view className='operation'>
121
                 <view className='operation'>
115
                   <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
122
                   <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
116
                   <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
123
                   <view onClick={() => ShowMoldeOn(item)}><image src={share} />分享链接</view>
117
-                  <view onClick={() => handelDelete(item.roomId)}><image src={del} />删除房源</view>
124
+                  <view onClick={() => handelDelete(item)}><image src={del} />删除房源</view>
118
                 </view>
125
                 </view>
119
               </view>
126
               </view>
120
             )
127
             )

+ 2
- 2
src/hotel/components/HouseManage/houseManage.less 파일 보기

6
   border-radius: 12px;
6
   border-radius: 12px;
7
   padding: 40px 30px 41px 30px;
7
   padding: 40px 30px 41px 30px;
8
   text-align: center;
8
   text-align: center;
9
-  margin: 30px 0;
9
+  margin: 30px 10px;
10
   .houseName{
10
   .houseName{
11
     height: 122px;
11
     height: 122px;
12
     font-size: 32px;
12
     font-size: 32px;
39
   text-align: center;
39
   text-align: center;
40
   line-height: 88px;
40
   line-height: 88px;
41
   position: absolute;
41
   position: absolute;
42
-  bottom: 30px;
42
+  bottom: 18px;
43
   image{
43
   image{
44
     width: 32px;
44
     width: 32px;
45
     height: 32px;
45
     height: 32px;

+ 2
- 1
src/hotel/components/Income/income.less 파일 보기

62
   border-radius: 24px;
62
   border-radius: 24px;
63
   padding: 50px 30px 64px 40px;
63
   padding: 50px 30px 64px 40px;
64
   box-sizing: border-box;
64
   box-sizing: border-box;
65
+  margin: 0 10px;
65
   .storeName{
66
   .storeName{
66
     height: 26px;
67
     height: 26px;
67
     font-size: 28px;
68
     font-size: 28px;
145
   margin: 62px 0 10px 1px;
146
   margin: 62px 0 10px 1px;
146
 }
147
 }
147
 .spreadCard{
148
 .spreadCard{
148
-  margin-bottom: 60px;  
149
+  margin:0 10px 60px 10px;  
149
   .card{
150
   .card{
150
     height: 166px;
151
     height: 166px;
151
     background: #FFF;
152
     background: #FFF;

+ 32
- 1
src/hotel/components/shareRoom/ShareRoom.jsx 파일 보기

31
   return (
31
   return (
32
     <Popup show={showCutover} onClose={onClose}>
32
     <Popup show={showCutover} onClose={onClose}>
33
       <View className='from-room'>
33
       <View className='from-room'>
34
+      <mp-form  >
35
+        <Label style={{color:'black'}}>请输入入住人信息</Label>
36
+        <mp-cells    footer='  ' >
37
+          <mp-cell title='入住人数:' extClass='font'>
38
+            <Input focus dataField='nm' onInput={(e) => setRoomNum(e.detail.value)} value={roomNum} type='number' placeholder='请输入入住人数' />
39
+          </mp-cell>
40
+          <mp-cell title='入住开始时间:' extClass='font'>
41
+            <Picker mode='date' onChange={handelStartDate}>
42
+              {startDate == '' ? '请选择入住开始时间' : startDate}
43
+            </Picker>
44
+          </mp-cell>
45
+          <mp-cell title='入住结束时间:' extClass='font'>
46
+            <Picker  mode='date' onChange={handelEndDate}>
47
+            {endDate == '' ? '请选择入住结束时间' : endDate}
48
+          </Picker>
49
+          </mp-cell>
50
+          <mp-cell>
51
+            <Button className='cancel' onClick={onClose}>取消</Button><Button className='btn' onClick={handelShare}>分享</Button>
52
+            {/* <button className='button-OK' onClick={sumbit}>确定</button> */}
53
+          </mp-cell>
54
+        </mp-cells>
55
+      </mp-form>
56
+      </View>
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+      {/* <View className='from-room'>
34
         <Label style={{ color: 'black' }}>请输入入住人信息</Label>
65
         <Label style={{ color: 'black' }}>请输入入住人信息</Label>
35
         <View className='flex'>
66
         <View className='flex'>
36
           <Label>入住人数:</Label><Input focus dataField='nm' onInput={(e) => setRoomNum(e.detail.value)} value={roomNum} type='number' placeholder='请输入入住人数' /></View>
67
           <Label>入住人数:</Label><Input focus dataField='nm' onInput={(e) => setRoomNum(e.detail.value)} value={roomNum} type='number' placeholder='请输入入住人数' /></View>
47
           </Picker>
78
           </Picker>
48
         </View>
79
         </View>
49
         <View><Button className='cancel' onClick={onClose}>取消</Button><Button className='btn' onClick={handelShare}>分享</Button></View>
80
         <View><Button className='cancel' onClick={onClose}>取消</Button><Button className='btn' onClick={handelShare}>分享</Button></View>
50
-      </View>
81
+      </View> */}
51
     </Popup>
82
     </Popup>
52
   )
83
   )
53
 }
84
 }

+ 23
- 33
src/hotel/components/shareRoom/ShareRoom.less 파일 보기

1
-  .from-room{
2
-    font-size: 34px;
3
-    padding-top: 30px;
4
-    .flex{
5
-      display: flex;
6
-      margin: 10px 0;
7
-      Input{
8
-        width: 345px;
9
-        border-radius: 15px;
10
-        border: solid 1px rgb(121, 116, 116);
11
-        margin-left: 70px;
12
-      }
13
-      .picker{
14
-        width: 345px;
15
-        border-radius: 15px;
16
-        border: solid 1px rgb(121, 116, 116);
17
-      }
18
-    }
1
+.from-room{
2
+  padding-top: 30px;
3
+  .font{
4
+    font-size: 28px;
5
+    color: #202020;
19
   }
6
   }
20
   .cancel{
7
   .cancel{
21
-      width: 150px;
22
-      height: 70px;
23
-      display: inline-block;
24
-      line-height: 70px;
25
-      border-radius: 12px;
26
-      font-size: 36px;
27
-      margin-right: 20px;
8
+    width: 150px;
9
+    height: 70px;
10
+    display: inline-block;
11
+    line-height: 70px;
12
+    border-radius: 12px;
13
+    font-size: 36px;
14
+    margin-right: 20px;
28
   }
15
   }
29
   .btn {
16
   .btn {
30
-      width: 150px;
31
-      height: 70px;
32
-      background: #1A3B83;
33
-      display: inline-block;
34
-      line-height: 70px;
35
-      border-radius: 12px;
36
-      font-size: 36px;
37
-      color: #fff;
17
+    width: 150px;
18
+    height: 70px;
19
+    background: #1A3B83;
20
+    display: inline-block;
21
+    line-height: 70px;
22
+    border-radius: 12px;
23
+    font-size: 36px;
24
+    color: #fff;
38
   }
25
   }
26
+}
27
+  
28
+  

+ 4
- 1
src/hotel/pages/landlord/landlord.config.js 파일 보기

5
   usingComponents: {
5
   usingComponents: {
6
     "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
6
     "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
7
     "mp-dialog": "weui-miniprogram/dialog/dialog",
7
     "mp-dialog": "weui-miniprogram/dialog/dialog",
8
-    "mp-searchbar": "weui-miniprogram/searchbar/searchbar"
8
+    "mp-searchbar": "weui-miniprogram/searchbar/searchbar",    
9
+    "mp-cells": "weui-miniprogram/cells/cells",
10
+    "mp-cell": "weui-miniprogram/cell/cell",
11
+    "mp-form": "weui-miniprogram/form/form"
9
   },
12
   },
10
   enableShareAppMessage: true
13
   enableShareAppMessage: true
11
 }
14
 }

+ 1
- 0
src/pages/details/foodDetails/foodDetails.config.js 파일 보기

1
 export default {
1
 export default {
2
     navigationBarTitleText: '美食详情',
2
     navigationBarTitleText: '美食详情',
3
     navigationStyle: 'custom',
3
     navigationStyle: 'custom',
4
+    enableShareAppMessage: true
4
   }
5
   }

+ 15
- 7
src/pages/details/foodDetails/foodDetails.jsx 파일 보기

2
 import withLayout from '@/layouts'
2
 import withLayout from '@/layouts'
3
 import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
3
 import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
4
 import { useState, useEffect, useRef } from 'react'
4
 import { useState, useEffect, useRef } from 'react'
5
-import { Swiper, SwiperItem } from '@tarojs/components';
5
+import { Button, Swiper, SwiperItem } from '@tarojs/components';
6
 import Star from '@/components/Star/Star.jsx'
6
 import Star from '@/components/Star/Star.jsx'
7
 import Cards from '@/components/foodCards/foodCards.jsx'
7
 import Cards from '@/components/foodCards/foodCards.jsx'
8
 import ax from '@/assets/icons/housemantj/onlove.png'
8
 import ax from '@/assets/icons/housemantj/onlove.png'
15
 import good from '@/assets/icons/housemantj/景点爆赞.png'
15
 import good from '@/assets/icons/housemantj/景点爆赞.png'
16
 import baozan from '@/assets/icons/housemantj/爆赞.png'
16
 import baozan from '@/assets/icons/housemantj/爆赞.png'
17
 import weibaozan from '@/assets/icons/housemantj/未赞.png'
17
 import weibaozan from '@/assets/icons/housemantj/未赞.png'
18
-import Taro from '@tarojs/taro'
18
+import Taro,{ useShareAppMessage } from '@tarojs/taro'
19
 import useSave from "@/utils/hooks/useSave"
19
 import useSave from "@/utils/hooks/useSave"
20
 import useLike from "@/utils/hooks/useLike"
20
 import useLike from "@/utils/hooks/useLike"
21
 import Extend from '../components/Extend/extend'
21
 import Extend from '../components/Extend/extend'
77
       setNewextNum(newextNum + res.records.length)
77
       setNewextNum(newextNum + res.records.length)
78
     })
78
     })
79
   }
79
   }
80
-  const toShare = () => {
81
-    console.log(222222222222)
82
-    onShareAppMessage()
83
-  }
84
   const openMap = () => {
80
   const openMap = () => {
85
     Taro.openLocation({
81
     Taro.openLocation({
86
       longitude: log.current - 0,
82
       longitude: log.current - 0,
112
     })
108
     })
113
   }, [])
109
   }, [])
114
   const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
110
   const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
111
+  
112
+  // 分享
113
+  useShareAppMessage(()=>{
114
+      return {
115
+        title: detail.shopName,
116
+        path: `/pages/details/foodDetails/foodDetails?id=${id}`,
117
+        imageUrl: detail.poster,
118
+      }
119
+    
120
+  })
121
+
115
   return (
122
   return (
116
     <view className='page-index'>
123
     <view className='page-index'>
117
       <view className='index-navbar'>
124
       <view className='index-navbar'>
194
         </scroll-view>
201
         </scroll-view>
195
       </view>
202
       </view>
196
       <view className='bottomTab'>
203
       <view className='bottomTab'>
197
-        <view className='tab' onClick={toShare}>
204
+        <Button openType='share' className='sharebtn'>分享</Button>
205
+        <view className='tab'>
198
           <image className='share' src={share} />分享
206
           <image className='share' src={share} />分享
199
         </view>
207
         </view>
200
         <view className='tab' onClick={toggleLike}>
208
         <view className='tab' onClick={toggleLike}>

+ 5
- 0
src/pages/details/foodDetails/foodDetails.less 파일 보기

175
   border-radius: 12px;
175
   border-radius: 12px;
176
   column-count: 3;
176
   column-count: 3;
177
   text-align: center;  
177
   text-align: center;  
178
+  .sharebtn{
179
+    position: absolute;
180
+    width: 260px;
181
+    opacity: 0;
182
+  }
178
   .tab{
183
   .tab{
179
     line-height: 96px;
184
     line-height: 96px;
180
     font-size: 28px;     
185
     font-size: 28px;     

+ 23
- 12
src/pages/details/mjDetails/sceneryDetails.jsx 파일 보기

1
 import CustomNav from '@/components/CustomNav'
1
 import CustomNav from '@/components/CustomNav'
2
-import ax from '../../../assets/icons/housemantj/onlove.png'
3
-import dw from '../../../assets/icons/housemantj/地址.png'
4
-import titlejd from '../../../assets/icons/housemantj/推荐景点.png'
5
-import titlems from '../../../assets/icons/housemantj/推荐美食.png'
6
-import showMore from '../../../assets/icons/housemantj/查看更多.png'
7
-import share from '../../../assets/icons/housemantj/景点分享.png'
8
-import good from '../../../assets/icons/housemantj/景点爆赞.png'
9
-import baozan from '../../../assets/icons/housemantj/爆赞.png'
10
-import weibaozan from '../../../assets/icons/housemantj/未赞.png'
2
+import ax from '@/assets/icons/housemantj/onlove.png'
3
+import dw from '@/assets/icons/housemantj/地址.png'
4
+import titlejd from '@/assets/icons/housemantj/推荐景点.png'
5
+import titlems from '@/assets/icons/housemantj/推荐美食.png'
6
+import showMore from '@/assets/icons/housemantj/查看更多.png'
7
+import share from '@/assets/icons/housemantj/景点分享.png'
8
+import good from '@/assets/icons/housemantj/景点爆赞.png'
9
+import baozan from '@/assets/icons/housemantj/爆赞.png'
10
+import weibaozan from '@/assets/icons/housemantj/未赞.png'
11
 import withLayout from '@/layouts'
11
 import withLayout from '@/layouts'
12
 import { useState, useEffect, useRef } from 'react'
12
 import { useState, useEffect, useRef } from 'react'
13
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
13
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
14
-import { Swiper, SwiperItem } from '@tarojs/components';
14
+import { Swiper, SwiperItem,Button } from '@tarojs/components';
15
 import useSave from "@/utils/hooks/useSave"
15
 import useSave from "@/utils/hooks/useSave"
16
 import useLike from "@/utils/hooks/useLike"
16
 import useLike from "@/utils/hooks/useLike"
17
-import Extend from '../components/Extend/extend'
18
 import Cards from '@/components/foodCards/foodCards.jsx'
17
 import Cards from '@/components/foodCards/foodCards.jsx'
19
-import Taro from '@tarojs/taro'
18
+import Taro,{ useShareAppMessage } from '@tarojs/taro'
19
+import Extend from '../components/Extend/extend'
20
 import './sceneryDetails.less'
20
 import './sceneryDetails.less'
21
 
21
 
22
 
22
 
84
       setRecommend(res || [])
84
       setRecommend(res || [])
85
     })
85
     })
86
   }, [])
86
   }, [])
87
+  
88
+  // 分享
89
+  useShareAppMessage(()=>{
90
+    return {
91
+      title: detail.touristName,
92
+      path: `/pages/details/mjDetails/sceneryDetails?id=${id}`,
93
+      imageUrl: detail.poster,
94
+    }
95
+  
96
+})
87
   return (
97
   return (
88
     <view className='page-index'>
98
     <view className='page-index'>
89
       <view className='index-navbar'>
99
       <view className='index-navbar'>
153
         </scroll-view>
163
         </scroll-view>
154
       </view>
164
       </view>
155
       <view className='bottomTab'>
165
       <view className='bottomTab'>
166
+      <Button openType='share' className='sharebtn'>分享</Button>
156
         <view className='tab'>
167
         <view className='tab'>
157
           <image className='share' src={share} />分享
168
           <image className='share' src={share} />分享
158
         </view>
169
         </view>

+ 6
- 1
src/pages/details/mjDetails/sceneryDetails.less 파일 보기

276
   background: #FFF;
276
   background: #FFF;
277
   border-radius: 12px;
277
   border-radius: 12px;
278
   column-count: 3;
278
   column-count: 3;
279
-  text-align: center;  
279
+  text-align: center; 
280
+  .sharebtn{
281
+    position: absolute;
282
+    width: 260px;
283
+    opacity: 0;
284
+  }
280
   .tab{
285
   .tab{
281
     line-height: 96px;
286
     line-height: 96px;
282
     font-size: 28px;     
287
     font-size: 28px;     

+ 1
- 4
src/pages/index/index.jsx 파일 보기

1
 
1
 
2
 
2
 
3
-import React, { useState, useEffect, useRef } from 'react'
4
-import Taro from '@tarojs/taro'
3
+import React, { useState, useEffect } from 'react'
5
 import CustomNav from '@/components/CustomNav'
4
 import CustomNav from '@/components/CustomNav'
6
 import logo from '@/assets/icons/comm/logo_small.png'
5
 import logo from '@/assets/icons/comm/logo_small.png'
7
 import withLayout from '@/layouts'
6
 import withLayout from '@/layouts'
10
 import Mine from './tabs/Mine'
9
 import Mine from './tabs/Mine'
11
 import Recommend from './tabs/Recommend'
10
 import Recommend from './tabs/Recommend'
12
 import './index.less'
11
 import './index.less'
13
-import { getLocation } from '@/utils/location'
14
-import { getIndexType, getResourceList } from '@/services/home'
15
 
12
 
16
 
13
 
17
 
14
 

+ 2
- 9
src/pages/index/tabs/Recommend.jsx 파일 보기

1
-import Taro, { useRouter } from '@tarojs/taro'
2
-import { React, useState, useEffect, useRef } from 'react'
1
+import Taro from '@tarojs/taro'
2
+import { React, useState, useEffect } from 'react'
3
 import iconsearch from '@/assets/icons/housemantj/search.png'
3
 import iconsearch from '@/assets/icons/housemantj/search.png'
4
 import locationimg from '@/assets/icons/housemantj/location.png'
4
 import locationimg from '@/assets/icons/housemantj/location.png'
5
 import Tip from '@/components/tip'
5
 import Tip from '@/components/tip'
6
 import { getIndexType,  getResourceList } from '@/services/home'
6
 import { getIndexType,  getResourceList } from '@/services/home'
7
 import Card from '../components/Card'
7
 import Card from '../components/Card'
8
-import { getLocation } from '@/utils/location'
9
-
10
 import './less/Recommend.less'
8
 import './less/Recommend.less'
11
 
9
 
12
 
10
 
13
 export default (props) => {
11
 export default (props) => {
14
   const { router, person, location } = props
12
   const { router, person, location } = props
15
   const [activeTab, setActiveTab] = useState(0)
13
   const [activeTab, setActiveTab] = useState(0)
16
-  const { params } = useRouter()
17
-  const { tabJump } = params || {}
18
   const [typeList, setTypeList] = useState([])
14
   const [typeList, setTypeList] = useState([])
19
   
15
   
20
   
16
   
56
     Taro.navigateTo({ url: '/pages/search/search' });
52
     Taro.navigateTo({ url: '/pages/search/search' });
57
   }
53
   }
58
 
54
 
59
-
60
-
61
-  
62
   return (
55
   return (
63
     <view style={{ height: '100%', overflow: 'auto' }}>
56
     <view style={{ height: '100%', overflow: 'auto' }}>
64
       <view className='search' onClick={onSearch}>
57
       <view className='search' onClick={onSearch}>

+ 3
- 0
src/pages/search/search.config.js 파일 보기

1
 export default {
1
 export default {
2
     navigationBarTitleText: '搜索',
2
     navigationBarTitleText: '搜索',
3
     navigationStyle: 'custom',
3
     navigationStyle: 'custom',
4
+    usingComponents: {
5
+      "mp-searchbar": "weui-miniprogram/searchbar/searchbar", 
6
+    },
4
   }
7
   }

+ 30
- 19
src/pages/search/search.jsx 파일 보기

1
-import React from 'react'
2
-import iconsearch from '../../assets/icons/housemantj/search.png'
3
-import './search.less'
4
 import CustomNav from '@/components/CustomNav'
1
 import CustomNav from '@/components/CustomNav'
5
-import '../index/index.less'
6
 import Taro from '@tarojs/taro'
2
 import Taro from '@tarojs/taro'
7
 import withLayout from '@/layouts'
3
 import withLayout from '@/layouts'
4
+import { getIndexSearch } from '@/services/home'
5
+import { useEffect, useState } from 'react'
6
+import SearchBar from '@/components/SearchBar'
7
+import './search.less'
8
+
8
 
9
 
9
 export default withLayout((props) => {
10
 export default withLayout((props) => {
10
-    const { router, person } = props
11
-    const goLook=()=>{
12
-        Taro.navigateTo({ url:'/pages/searchResult/searchResult'});
11
+    const { router, person } = props    
12
+    const [hotList, setHotList] = useState([])
13
+    const hotSearch = (val) => {
14
+        Taro.navigateTo({ url: `/pages/searchResult/searchResult?q=${val}` });
13
     }
15
     }
14
-    
15
-return (
16
+    const onSearch = (e) => {
17
+        if (e.detail.value !== '') {
18
+            Taro.navigateTo({ url: `/pages/searchResult/searchResult?q=${e.detail.value}` });
19
+        }
20
+    }
21
+    useEffect(() => {
22
+        getIndexSearch().then((res) => {
23
+            setHotList(res || [])
24
+        })
25
+    }, [])
26
+    return (
16
         <view className='page-index'>
27
         <view className='page-index'>
17
             <view className='index-navbar'>
28
             <view className='index-navbar'>
18
-                <CustomNav title='搜索' />                 
19
-            </view>
20
-            
21
-            <view className='search'>
22
-                <input className='searchInput' placeholder='请输入景区/城市搜索'/>
23
-                <image className='searchicon' src={iconsearch} />
24
-                <view className='lineSearch'></view>
29
+                <CustomNav title='搜索' />
25
             </view>
30
             </view>
31
+
32
+            <SearchBar placeholder='请输入景区/城市搜索' onBlur={onSearch} />
33
+
26
             <view className='content'>
34
             <view className='content'>
27
                 <view className='hotSearch'>热门搜索</view>
35
                 <view className='hotSearch'>热门搜索</view>
28
                 <view className='hotSearchtip'>
36
                 <view className='hotSearchtip'>
29
-                    <view onClick={goLook}>小龙虾</view>
30
-                    <view>小笼包</view>
37
+                    {
38
+                        hotList?.map((item) => <view onClick={()=>hotSearch(item.word)}>{item.word}</view>)
39
+                    }
40
+                    {/* <view onClick={goLook}>小龙虾</view>
31
                     <view>小笼包</view>
41
                     <view>小笼包</view>
32
                     <view>小笼包</view>
42
                     <view>小笼包</view>
33
                     <view>小笼包</view>
43
                     <view>小笼包</view>
41
                     <view>小笼包</view>
51
                     <view>小笼包</view>
42
                     <view>小笼包</view>
52
                     <view>小笼包</view>
43
                     <view>小笼包</view>
53
                     <view>小笼包</view>
54
+                    <view>小笼包</view> */}
44
                 </view>
55
                 </view>
45
-            </view>  
56
+            </view>
46
 
57
 
47
         </view>
58
         </view>
48
     )
59
     )

+ 0
- 28
src/pages/search/search.less 파일 보기

1
-.search{
2
-  padding: 10px 30px 0 30px;
3
-  position: relative;
4
-  .searchInput{    
5
-      height: 68px;
6
-      background: #F8F8F8;
7
-      border-radius: 34px;
8
-      padding-left: 86px;
9
-      box-sizing: border-box;
10
-      font-size: 24px;
11
-  }
12
-  .searchicon{
13
-    width: 25px;
14
-    height: 25px;
15
-    position: absolute;
16
-    bottom: 21px;
17
-    left: 50px;
18
-  }
19
-  .lineSearch{      
20
-    position: absolute;
21
-    bottom: 19px;
22
-    left: 95px;
23
-    width: 1px;
24
-    height: 28px;
25
-    background: #000;
26
-    opacity: 0.2;
27
-  }    
28
-}
29
 .content{
1
 .content{
30
   padding: 60px 30px;
2
   padding: 60px 30px;
31
   .hotSearch{
3
   .hotSearch{

+ 22
- 232
src/pages/searchResult/searchResult.jsx 파일 보기

1
 import { React, useState, useEffect, } from 'react'
1
 import { React, useState, useEffect, } from 'react'
2
 // .就是当前路径
2
 // .就是当前路径
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'
5
 import msImage from '../../assets/icons/housemantj/ms.jpg'
4
 import msImage from '../../assets/icons/housemantj/ms.jpg'
6
 import mjImage from '../../assets/icons/housemantj/mj.jpg'
5
 import mjImage from '../../assets/icons/housemantj/mj.jpg'
7
 import glImage from '../../assets/icons/housemantj/gl.jpg'
6
 import glImage from '../../assets/icons/housemantj/gl.jpg'
10
 import glTip from '../../assets/icons/housemantj/gltip.png'
9
 import glTip from '../../assets/icons/housemantj/gltip.png'
11
 import onlove from '../../assets/icons/housemantj/onlove.png'
10
 import onlove from '../../assets/icons/housemantj/onlove.png'
12
 import CustomNav from '@/components/CustomNav'
11
 import CustomNav from '@/components/CustomNav'
13
-import Taro, { useRouter } from '@tarojs/taro'
12
+import Taro from '@tarojs/taro'
13
+import Card from '../index/components/Card'
14
+
14
 import './searchResult.less'
15
 import './searchResult.less'
15
 import withLayout from '@/layouts'
16
 import withLayout from '@/layouts'
16
 
17
 
17
 
18
 
18
 
19
 
19
 export default withLayout((props) => {
20
 export default withLayout((props) => {
20
-  const { router, person } = props
21
+  const { router, person,location } = props
22
+  const { q} = props.router.params
21
 
23
 
24
+console.log(location,q)
22
   // 横向tab
25
   // 横向tab
23
   const [activeTab, setActiveTab] = useState(0)
26
   const [activeTab, setActiveTab] = useState(0)
24
-  const { params } = useRouter()
25
-  const { tabJump } = params || {}
26
-  useEffect(() => {
27
-    if (tabJump) {
28
-      setActiveTab(tabJump - 0)
29
-    }
30
-  }, [tabJump])
27
+  const [queryParams, setQueryParams] = useState({q:q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
31
 
28
 
29
+  // 获取资源表信息
30
+  const [alllist, setAllList] = useState([])
32
   const tabs = [
31
   const tabs = [
33
     {
32
     {
34
       title: '全部',
33
       title: '全部',
35
     },
34
     },
36
     {
35
     {
37
       title: '美食',
36
       title: '美食',
38
-
39
     },
37
     },
40
     {
38
     {
41
       title: '景点',
39
       title: '景点',
42
-
43
-    },
44
-    {
45
-      title: '攻略',
46
-
47
     },
40
     },
48
   ]
41
   ]
49
   const handleTabChange = (e) => {
42
   const handleTabChange = (e) => {
50
     const { index } = e.detail
43
     const { index } = e.detail
51
     setActiveTab(index)
44
     setActiveTab(index)
45
+    if (index == 0) {
46
+      setQueryParams({q:q, location: location, pageNum: 1, pageSize: 10, typeId: '' })
47
+    }
48
+    // else if(index==1){}
49
+    // else{}
52
   }
50
   }
53
 
51
 
54
 
52
 
58
     Taro.navigateTo({ url: '/pages/search/search' });
56
     Taro.navigateTo({ url: '/pages/search/search' });
59
   }
57
   }
60
 
58
 
61
-
59
+  useEffect(() => {
60
+    getResourceList(queryParams).then((res) => {
61
+      setAllList(res.records || [])
62
+    })
63
+  }, [queryParams])
62
 
64
 
63
 
65
 
64
 
66
 
87
 
89
 
88
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" >
90
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" >
89
           <view className="waterfall">
91
           <view className="waterfall">
90
-
91
-            {activeTab === 0 && <>
92
-              <view className='contentCard'>
93
-                <view className='cardTop'>
94
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
95
-                  <image className='lefttips' src={msTip} />
96
-                  <image src={onlove} className='loveharde'></image>
97
-                </view>
98
-                <view className='bContent'>
99
-                  <view className='cCword'>
100
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
101
-                  </view>
102
-                  <view className='cCleft'>
103
-                    <image src={location} className='cCicon'></image>
104
-                    <view className='distance'><text>9.99</text>公里</view>
105
-                  </view>
106
-                  <view className='cCright'>
107
-                    <view className='money'>¥</view>
108
-                    <view className='price'><text>999</text>/人</view>
109
-                  </view>
110
-                </view>
111
-              </view>
112
-              <view className='contentCard'>
113
-                <view className='cardTop'>
114
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
115
-                  <image className='lefttips' src={mjTip} />
116
-                  <image src={onlove} className='loveharde'></image>
117
-                </view>
118
-                <view className='bContent'>
119
-                  <view className='cCword'>
120
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
121
-                  </view>
122
-                  <view className='cCleft'>
123
-                    <image src={location} className='cCicon'></image>
124
-                    <view className='distance'><text>9.99</text>公里</view>
125
-                  </view>
126
-                  <view className='cCright'>
127
-                    <view className='money'>¥</view>
128
-                    <view className='price'><text>999</text>/人</view>
129
-                  </view>
130
-                </view>
131
-              </view>
132
-              <view className='contentCard'>
133
-                <view className='cardTop'>
134
-                  <image mode='widthFix' src={glImage} className='cCardimg' />
135
-                  <image className='lefttips' src={glTip} />
136
-                  <image src={onlove} className='loveharde'></image>
137
-                </view>
138
-                <view className='bContent'>
139
-                  <view className='cCword'>
140
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
141
-                  </view>
142
-                  <view className='cCleft'>
143
-                    <image src={location} className='cCicon'></image>
144
-                    <view className='distance'><text>9.99</text>公里</view>
145
-                  </view>
146
-                  <view className='cCright'>
147
-                    <view className='money'>¥</view>
148
-                    <view className='price'><text>999</text>/人</view>
149
-                  </view>
150
-                </view>
151
-              </view>
152
-              <view className='contentCard'>
153
-                <view className='cardTop'>
154
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
155
-                  <image className='lefttips' src={mjTip} />
156
-                  <image src={onlove} className='loveharde'></image>
157
-                </view>
158
-                <view className='bContent'>
159
-                  <view className='cCword'>
160
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
161
-                  </view>
162
-                  <view className='cCleft'>
163
-                    <image src={location} className='cCicon'></image>
164
-                    <view className='distance'><text>9.99</text>公里</view>
165
-                  </view>
166
-                  <view className='cCright'>
167
-                    <view className='money'>¥</view>
168
-                    <view className='price'><text>999</text>/人</view>
169
-                  </view>
170
-                </view>
171
-              </view>
172
-
173
-            </>}
174
-            {activeTab === 1 && <>
175
-              <view className='contentCard'>
176
-                <view className='cardTop'>
177
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
178
-                  <image className='lefttips' src={msTip} />
179
-                  <image src={onlove} className='loveharde'></image>
180
-                </view>
181
-                <view className='bContent'>
182
-                  <view className='cCword'>
183
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
184
-                  </view>
185
-                  <view className='cCleft'>
186
-                    <image src={location} className='cCicon'></image>
187
-                    <view className='distance'><text>9.99</text>公里</view>
188
-                  </view>
189
-                  <view className='cCright'>
190
-                    <view className='money'>¥</view>
191
-                    <view className='price'><text>999</text>/人</view>
192
-                  </view>
193
-                </view>
194
-              </view>
195
-
196
-            </>}
197
-            {activeTab === 2 && <>
198
-              <view className='contentCard'>
199
-                <view className='cardTop'>
200
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
201
-                  <image className='lefttips' src={mjTip} />
202
-                  <image src={onlove} className='loveharde'></image>
203
-                </view>
204
-                <view className='bContent'>
205
-                  <view className='cCword'>
206
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
207
-                  </view>
208
-                  <view className='cCleft'>
209
-                    <image src={location} className='cCicon'></image>
210
-                    <view className='distance'><text>9.99</text>公里</view>
211
-                  </view>
212
-                  <view className='cCright'>
213
-                    <view className='money'>¥</view>
214
-                    <view className='price'><text>999</text>/人</view>
215
-                  </view>
216
-                </view>
217
-              </view>
218
-              <view className='contentCard'>
219
-                <view className='cardTop'>
220
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
221
-                  <image className='lefttips' src={msTip} />
222
-                  <image src={onlove} className='loveharde'></image>
223
-                </view>
224
-                <view className='bContent'>
225
-                  <view className='cCword'>
226
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
227
-                  </view>
228
-                  <view className='cCleft'>
229
-                    <image src={location} className='cCicon'></image>
230
-                    <view className='distance'><text>9.99</text>公里</view>
231
-                  </view>
232
-                  <view className='cCright'>
233
-                    <view className='money'>¥</view>
234
-                    <view className='price'><text>999</text>/人</view>
235
-                  </view>
236
-                </view>
237
-              </view>
238
-
239
-            </>}
240
-            {activeTab === 3 && <>
241
-              <view className='contentCard'>
242
-                <view className='cardTop'>
243
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
244
-                  <image className='lefttips' src={mjTip} />
245
-                  <image src={onlove} className='loveharde'></image>
246
-                </view>
247
-                <view className='bContent'>
248
-                  <view className='cCword'>
249
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
250
-                  </view>
251
-                  <view className='cCleft'>
252
-                    <image src={location} className='cCicon'></image>
253
-                    <view className='distance'><text>9.99</text>公里</view>
254
-                  </view>
255
-                  <view className='cCright'>
256
-                    <view className='money'>¥</view>
257
-                    <view className='price'><text>999</text>/人</view>
258
-                  </view>
259
-                </view>
260
-              </view>
261
-              <view className='contentCard'>
262
-                <view className='cardTop'>
263
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
264
-                  <image className='lefttips' src={msTip} />
265
-                  <image src={onlove} className='loveharde'></image>
266
-                </view>
267
-                <view className='bContent'>
268
-                  <view className='cCword'>
269
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
270
-                  </view>
271
-                  <view className='cCleft'>
272
-                    <image src={location} className='cCicon'></image>
273
-                    <view className='distance'><text>9.99</text>公里</view>
274
-                  </view>
275
-                  <view className='cCright'>
276
-                    <view className='money'>¥</view>
277
-                    <view className='price'><text>999</text>/人</view>
278
-                  </view>
279
-                </view>
280
-              </view>
281
-              <view className='contentCard'>
282
-                <view className='cardTop'>
283
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
284
-                  <image className='lefttips' src={mjTip} />
285
-                  <image src={onlove} className='loveharde'></image>
286
-                </view>
287
-                <view className='bContent'>
288
-                  <view className='cCword'>
289
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
290
-                  </view>
291
-                  <view className='cCleft'>
292
-                    <image src={location} className='cCicon'></image>
293
-                    <view className='distance'><text>9.99</text>公里</view>
294
-                  </view>
295
-                  <view className='cCright'>
296
-                    <view className='money'>¥</view>
297
-                    <view className='price'><text>999</text>/人</view>
298
-                  </view>
299
-                </view>
300
-              </view>
301
-
302
-            </>}
303
-
304
-
92
+            {
93
+              alllist?.map((item) => <Card key={item.resourceNo} item={item} />)
94
+            }
305
           </view>
95
           </view>
306
           <view className='botton'>已经到底了~</view>
96
           <view className='botton'>已经到底了~</view>
307
         </scroll-view>
97
         </scroll-view>

+ 1
- 2
src/services/home.js 파일 보기

127
  */
127
  */
128
 export const removeLike = (targetType, targetId) => request(`/${targetType}/like/${targetId}`, { method: 'delete' })
128
 export const removeLike = (targetType, targetId) => request(`/${targetType}/like/${targetId}`, { method: 'delete' })
129
 
129
 
130
-//缺少套餐订单生成
131
 
130
 
132
 
131
 
133
 
132
 
135
  * 获取搜索列表
134
  * 获取搜索列表
136
  * @returns 
135
  * @returns 
137
  */
136
  */
138
-export const getIndexSearch = (params) => request('/taSearch', { params })
137
+export const getIndexSearch = (params) => request('/hot-word', { params })

+ 0
- 26
src/utils/location.js 파일 보기

1
-
2
-import Taro from '@tarojs/taro'
3
-
4
-export function getLocation() {
5
-  return new Promise((resolve, reject) => {
6
-    Taro.authorize({
7
-      scope: 'scope.userLocation',
8
-      success: () => {
9
-        Taro.getLocation({
10
-          type: 'wgs84',
11
-          success: (res) => {
12
-            resolve(res)
13
-          },
14
-          fail: (err) => {
15
-            console.error(err)
16
-            reject(err)
17
-          }
18
-        })
19
-      },
20
-      fail: (err) => {
21
-        console.error(err)
22
-        reject(err)
23
-      }
24
-    })
25
-  })
26
-}