|
|
@ -2,7 +2,7 @@ import {useEffect, useState} from "react"; |
|
|
|
import {Image} from '@nutui/nutui-react-taro' |
|
|
|
import {Share} from '@nutui/icons-react-taro' |
|
|
|
import {View, Text} from '@tarojs/components'; |
|
|
|
import Taro, {useShareAppMessage, useShareTimeline} from "@tarojs/taro"; |
|
|
|
import Taro, {useShareAppMessage} from "@tarojs/taro"; |
|
|
|
import {ShopGoods} from "@/api/shop/shopGoods/model"; |
|
|
|
import {pageShopGoods} from "@/api/shop/shopGoods"; |
|
|
|
import './BestSellers.scss' |
|
|
@ -24,7 +24,7 @@ const BestSellers = () => { |
|
|
|
|
|
|
|
// 显示分享选项菜单
|
|
|
|
Taro.showActionSheet({ |
|
|
|
itemList: ['分享给好友', '分享到朋友圈'], |
|
|
|
itemList: ['分享给好友'], |
|
|
|
success: (res) => { |
|
|
|
if (res.tapIndex === 0) { |
|
|
|
// 分享给好友 - 触发转发
|
|
|
@ -39,13 +39,6 @@ const BestSellers = () => { |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (res.tapIndex === 1) { |
|
|
|
// 分享到朋友圈
|
|
|
|
Taro.showToast({ |
|
|
|
title: '请点击右上角分享到朋友圈', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
@ -83,15 +76,6 @@ const BestSellers = () => { |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
// 分享到朋友圈
|
|
|
|
useShareTimeline(() => { |
|
|
|
return { |
|
|
|
title: `${goods?.name || '精选商品'} - 网宿小店`, |
|
|
|
path: `/shop/goodsDetail/index?id=${goods?.goodsId}`, |
|
|
|
imageUrl: goods?.image |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
|
<View className={'py-3'}> |
|
|
@ -115,7 +99,7 @@ const BestSellers = () => { |
|
|
|
<Text className={'font-bold text-2xl'}>{item.price}</Text> |
|
|
|
</View> |
|
|
|
<View className={'buy-btn'}> |
|
|
|
<View className={'cart-icon flex items-center'}> |
|
|
|
<View className={'cart-icon flex items-center hidden'}> |
|
|
|
<View |
|
|
|
className={'flex flex-col justify-center items-center text-white px-3 gap-1 text-nowrap whitespace-nowrap cursor-pointer'} |
|
|
|
onClick={() => handleShare(item)} |
|
|
|