Procházet zdrojové kódy

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

吃个甘蔗嚼一年 před 3 roky
rodič
revize
202d4c079a

+ 1
- 1
src/components/foodCards/foodCards.jsx Zobrazit soubor

@@ -63,7 +63,7 @@ export default (props) => {
63 63
             <image src={msTip} className='mstip'></image>
64 64
           </view>
65 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 67
             <view className='jiage' onClick={() => { goFood() }} >
68 68
               <text className='rmb' >¥&nbsp;&nbsp;</text>
69 69
               <text className='p1'><text className='price' >{item.actualPrice / 100}</text>元&nbsp;&nbsp;</text>

+ 1
- 0
src/components/foodCards/style.less Zobrazit soubor

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

+ 23
- 16
src/hotel/components/HouseManage/houseManage.jsx Zobrazit soubor

@@ -3,13 +3,12 @@ import see from '@/assets/icons/landlord/查看入住人.png'
3 3
 import share from '@/assets/icons/landlord/分享链接.png'
4 4
 import del from '@/assets/icons/landlord/删除.png'
5 5
 import addImg from '@/assets/icons/landlord/添加.png'
6
-import iconsearch from '@/assets/icons/housemantj/search.png'
7 6
 import React, { useState, useEffect, useRef, useImperativeHandle } from 'react'
8 7
 import { getRoomList, deleteRoom } from '@/services/landlord'
8
+import SearchBar from '@/components/SearchBar'
9 9
 import ShareRoom from '../shareRoom/ShareRoom.jsx'
10 10
 import ShareCard from '../shareCard/shareCard'
11 11
 import './houseManage.less'
12
-import SearchBar from '@/components/SearchBar'
13 12
 
14 13
 
15 14
 export default React.forwardRef((props, ref) => {
@@ -24,16 +23,25 @@ export default React.forwardRef((props, ref) => {
24 23
   const handelClick = () => {
25 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 47
   const [showCutover, setShowCutover] = useState(false)
@@ -97,16 +105,15 @@ export default React.forwardRef((props, ref) => {
97 105
       getRoomList({ hotelId: hotel.hotelId,roomName:e.detail.value }).then((res) => {
98 106
       setDetail(res.records || [])
99 107
     })
100
-    }
101
-    
108
+    }    
102 109
   }
103 110
   return (
104 111
     <view>
105 112
       <view style={{ padding: '0 30rpx', height: '100%' }}>
106
-        <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch} />
113
+        <SearchBar placeholder='请输入房源名搜索' onBlur={onSearch}/>
107 114
         <ShareRoom showCutover={showCutover} onClose={onClose} room={room} onFinish={handleFinish} />
108 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 118
             detail?.map((item) =>
112 119
               <view className='houseCard'>
@@ -114,7 +121,7 @@ export default React.forwardRef((props, ref) => {
114 121
                 <view className='operation'>
115 122
                   <view onClick={() => handelOrder(item)}><image src={see} />查看入住人</view>
116 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 125
                 </view>
119 126
               </view>
120 127
             )

+ 2
- 2
src/hotel/components/HouseManage/houseManage.less Zobrazit soubor

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

+ 2
- 1
src/hotel/components/Income/income.less Zobrazit soubor

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

+ 32
- 1
src/hotel/components/shareRoom/ShareRoom.jsx Zobrazit soubor

@@ -31,6 +31,37 @@ export default (props) => {
31 31
   return (
32 32
     <Popup show={showCutover} onClose={onClose}>
33 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 65
         <Label style={{ color: 'black' }}>请输入入住人信息</Label>
35 66
         <View className='flex'>
36 67
           <Label>入住人数:</Label><Input focus dataField='nm' onInput={(e) => setRoomNum(e.detail.value)} value={roomNum} type='number' placeholder='请输入入住人数' /></View>
@@ -47,7 +78,7 @@ export default (props) => {
47 78
           </Picker>
48 79
         </View>
49 80
         <View><Button className='cancel' onClick={onClose}>取消</Button><Button className='btn' onClick={handelShare}>分享</Button></View>
50
-      </View>
81
+      </View> */}
51 82
     </Popup>
52 83
   )
53 84
 }

+ 23
- 33
src/hotel/components/shareRoom/ShareRoom.less Zobrazit soubor

@@ -1,38 +1,28 @@
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 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 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 Zobrazit soubor

@@ -5,7 +5,10 @@ export default {
5 5
   usingComponents: {
6 6
     "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
7 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 13
   enableShareAppMessage: true
11 14
 }

+ 1
- 0
src/pages/details/foodDetails/foodDetails.config.js Zobrazit soubor

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

+ 15
- 7
src/pages/details/foodDetails/foodDetails.jsx Zobrazit soubor

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

+ 5
- 0
src/pages/details/foodDetails/foodDetails.less Zobrazit soubor

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

+ 23
- 12
src/pages/details/mjDetails/sceneryDetails.jsx Zobrazit soubor

@@ -1,22 +1,22 @@
1 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 11
 import withLayout from '@/layouts'
12 12
 import { useState, useEffect, useRef } from 'react'
13 13
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
14
-import { Swiper, SwiperItem } from '@tarojs/components';
14
+import { Swiper, SwiperItem,Button } from '@tarojs/components';
15 15
 import useSave from "@/utils/hooks/useSave"
16 16
 import useLike from "@/utils/hooks/useLike"
17
-import Extend from '../components/Extend/extend'
18 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 20
 import './sceneryDetails.less'
21 21
 
22 22
 
@@ -84,6 +84,16 @@ export default withLayout((props) => {
84 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 97
   return (
88 98
     <view className='page-index'>
89 99
       <view className='index-navbar'>
@@ -153,6 +163,7 @@ export default withLayout((props) => {
153 163
         </scroll-view>
154 164
       </view>
155 165
       <view className='bottomTab'>
166
+      <Button openType='share' className='sharebtn'>分享</Button>
156 167
         <view className='tab'>
157 168
           <image className='share' src={share} />分享
158 169
         </view>

+ 6
- 1
src/pages/details/mjDetails/sceneryDetails.less Zobrazit soubor

@@ -276,7 +276,12 @@
276 276
   background: #FFF;
277 277
   border-radius: 12px;
278 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 285
   .tab{
281 286
     line-height: 96px;
282 287
     font-size: 28px;     

+ 1
- 4
src/pages/index/index.jsx Zobrazit soubor

@@ -1,7 +1,6 @@
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 4
 import CustomNav from '@/components/CustomNav'
6 5
 import logo from '@/assets/icons/comm/logo_small.png'
7 6
 import withLayout from '@/layouts'
@@ -10,8 +9,6 @@ import Guide from './tabs/Guide'
10 9
 import Mine from './tabs/Mine'
11 10
 import Recommend from './tabs/Recommend'
12 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 Zobrazit soubor

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

+ 3
- 0
src/pages/search/search.config.js Zobrazit soubor

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

+ 30
- 19
src/pages/search/search.jsx Zobrazit soubor

@@ -1,33 +1,43 @@
1
-import React from 'react'
2
-import iconsearch from '../../assets/icons/housemantj/search.png'
3
-import './search.less'
4 1
 import CustomNav from '@/components/CustomNav'
5
-import '../index/index.less'
6 2
 import Taro from '@tarojs/taro'
7 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 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 27
         <view className='page-index'>
17 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 30
             </view>
31
+
32
+            <SearchBar placeholder='请输入景区/城市搜索' onBlur={onSearch} />
33
+
26 34
             <view className='content'>
27 35
                 <view className='hotSearch'>热门搜索</view>
28 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 41
                     <view>小笼包</view>
32 42
                     <view>小笼包</view>
33 43
                     <view>小笼包</view>
@@ -41,8 +51,9 @@ return (
41 51
                     <view>小笼包</view>
42 52
                     <view>小笼包</view>
43 53
                     <view>小笼包</view>
54
+                    <view>小笼包</view> */}
44 55
                 </view>
45
-            </view>  
56
+            </view>
46 57
 
47 58
         </view>
48 59
     )

+ 0
- 28
src/pages/search/search.less Zobrazit soubor

@@ -1,31 +1,3 @@
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 1
 .content{
30 2
   padding: 60px 30px;
31 3
   .hotSearch{

+ 22
- 232
src/pages/searchResult/searchResult.jsx Zobrazit soubor

@@ -1,7 +1,6 @@
1 1
 import { React, useState, useEffect, } from 'react'
2 2
 // .就是当前路径
3 3
 import iconsearch from '../../assets/icons/housemantj/search.png'
4
-import location from '../../assets/icons/housemantj/location.png'
5 4
 import msImage from '../../assets/icons/housemantj/ms.jpg'
6 5
 import mjImage from '../../assets/icons/housemantj/mj.jpg'
7 6
 import glImage from '../../assets/icons/housemantj/gl.jpg'
@@ -10,45 +9,44 @@ import mjTip from '../../assets/icons/housemantj/mjtip.png'
10 9
 import glTip from '../../assets/icons/housemantj/gltip.png'
11 10
 import onlove from '../../assets/icons/housemantj/onlove.png'
12 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 15
 import './searchResult.less'
15 16
 import withLayout from '@/layouts'
16 17
 
17 18
 
18 19
 
19 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 25
   // 横向tab
23 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 31
   const tabs = [
33 32
     {
34 33
       title: '全部',
35 34
     },
36 35
     {
37 36
       title: '美食',
38
-
39 37
     },
40 38
     {
41 39
       title: '景点',
42
-
43
-    },
44
-    {
45
-      title: '攻略',
46
-
47 40
     },
48 41
   ]
49 42
   const handleTabChange = (e) => {
50 43
     const { index } = e.detail
51 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,7 +56,11 @@ export default withLayout((props) => {
58 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,221 +89,9 @@ export default withLayout((props) => {
87 89
 
88 90
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" >
89 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 95
           </view>
306 96
           <view className='botton'>已经到底了~</view>
307 97
         </scroll-view>

+ 1
- 2
src/services/home.js Zobrazit soubor

@@ -127,7 +127,6 @@ export const saveLike = (targetType, targetId) => request(`/${targetType}/like/$
127 127
  */
128 128
 export const removeLike = (targetType, targetId) => request(`/${targetType}/like/${targetId}`, { method: 'delete' })
129 129
 
130
-//缺少套餐订单生成
131 130
 
132 131
 
133 132
 
@@ -135,4 +134,4 @@ export const removeLike = (targetType, targetId) => request(`/${targetType}/like
135 134
  * 获取搜索列表
136 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 Zobrazit soubor

@@ -1,26 +0,0 @@
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
-}