李志伟 3 anos atrás
pai
commit
2e8f133457

+ 1
- 1
src/components/foodCards/foodCards.jsx Ver arquivo

@@ -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/pages/details/foodDetails/foodDetails.config.js Ver arquivo

@@ -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 Ver arquivo

@@ -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'
@@ -76,10 +76,6 @@ export default withLayout((props) => {
76 76
       setNewextNum(newextNum + res.records.length)
77 77
     })
78 78
   }
79
-  const toShare = () => {
80
-    console.log(222222222222)
81
-    onShareAppMessage()
82
-  }
83 79
   const openMap = () => {
84 80
     Taro.openLocation({
85 81
       longitude: log.current - 0,
@@ -111,6 +107,17 @@ export default withLayout((props) => {
111 107
     })
112 108
   }, [])
113 109
   const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
110
+  
111
+  // 分享
112
+  useShareAppMessage(()=>{
113
+      return {
114
+        title: detail.shopName,
115
+        path: `/pages/details/foodDetails/foodDetails?id=${id}`,
116
+        imageUrl: detail.poster,
117
+      }
118
+    
119
+  })
120
+
114 121
   return (
115 122
     <view className='page-index'>
116 123
       <view className='index-navbar'>
@@ -193,7 +200,8 @@ export default withLayout((props) => {
193 200
         </scroll-view>
194 201
       </view>
195 202
       <view className='bottomTab'>
196
-        <view className='tab' onClick={toShare}>
203
+        <Button openType='share' className='sharebtn'>分享</Button>
204
+        <view className='tab'>
197 205
           <image className='share' src={share} />分享
198 206
         </view>
199 207
         <view className='tab' onClick={toggleLike}>

+ 5
- 0
src/pages/details/foodDetails/foodDetails.less Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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;