diff --git a/src/cms/category/index.tsx b/src/cms/category/index.tsx index 3205c26..fe81623 100644 --- a/src/cms/category/index.tsx +++ b/src/cms/category/index.tsx @@ -1,5 +1,5 @@ import Taro from '@tarojs/taro' -import {useShareAppMessage, useShareTimeline} from "@tarojs/taro" +import {useShareAppMessage} from "@tarojs/taro" import {Loading} from '@nutui/nutui-react-taro' import {useEffect, useState} from "react" import {useRouter} from '@tarojs/taro' @@ -42,22 +42,15 @@ function Category() { }) }, []); - useShareTimeline(() => { - return { - title: `${nav?.categoryName}_时里院子市集`, - path: `/shop/category/index?id=${categoryId}` - }; - }); - useShareAppMessage(() => { return { title: `${nav?.categoryName}_时里院子市集`, path: `/shop/category/index?id=${categoryId}`, - success: function (res) { - console.log('分享成功', res); + success: function () { + console.log('分享成功'); }, - fail: function (res) { - console.log('分享失败', res); + fail: function () { + console.log('分享失败'); } }; }); diff --git a/src/dealer/qrcode/index.tsx b/src/dealer/qrcode/index.tsx index ca482e7..882931b 100644 --- a/src/dealer/qrcode/index.tsx +++ b/src/dealer/qrcode/index.tsx @@ -158,7 +158,7 @@ const DealerQrcode: React.FC = () => { // 小程序分享 Taro.showShareMenu({ withShareTicket: true, - showShareItems: ['shareAppMessage', 'shareTimeline'] + showShareItems: ['shareAppMessage'] }) } diff --git a/src/pages/cart/cart.tsx b/src/pages/cart/cart.tsx index 7a48947..8711e5b 100644 --- a/src/pages/cart/cart.tsx +++ b/src/pages/cart/cart.tsx @@ -1,5 +1,5 @@ import {useEffect, useState} from "react"; -import Taro, {useShareAppMessage, useShareTimeline, useDidShow} from '@tarojs/taro'; +import Taro, {useShareAppMessage, useDidShow} from '@tarojs/taro'; import { NavBar, Checkbox, @@ -39,12 +39,6 @@ function Cart() { nutuiInputnumberButtonBorderRadius: '4px', } - useShareTimeline(() => { - return { - title: '购物车 - 网宿小店' - }; - }); - useShareAppMessage(() => { return { title: '购物车 - 网宿小店', diff --git a/src/pages/index/BestSellers.tsx b/src/pages/index/BestSellers.tsx index 8e14c48..a9c9322 100644 --- a/src/pages/index/BestSellers.tsx +++ b/src/pages/index/BestSellers.tsx @@ -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 ( <> @@ -115,7 +99,7 @@ const BestSellers = () => { {item.price} - + handleShare(item)} diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 5e7dba9..f924d7c 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,7 +1,7 @@ import Header from './Header'; import BestSellers from './BestSellers'; import Taro from '@tarojs/taro'; -import {useShareAppMessage, useShareTimeline} from "@tarojs/taro" +import {useShareAppMessage} from "@tarojs/taro" import {useEffect, useState} from "react"; import {getShopInfo} from "@/api/layout"; import {Sticky} from '@nutui/nutui-react-taro' @@ -16,13 +16,6 @@ function Home() { // 吸顶状态 const [stickyStatus, setStickyStatus] = useState(false) - useShareTimeline(() => { - return { - title: '网宿小店 - 网宿软件', - path: `/pages/index/index` - }; - }); - useShareAppMessage(() => { return { title: '网宿小店 - 网宿软件', diff --git a/src/shop/category/index.tsx b/src/shop/category/index.tsx index 4e959f4..4f81fd7 100644 --- a/src/shop/category/index.tsx +++ b/src/shop/category/index.tsx @@ -1,6 +1,6 @@ import Taro from '@tarojs/taro' import GoodsList from './components/GoodsList' -import {useShareAppMessage, useShareTimeline} from "@tarojs/taro" +import {useShareAppMessage} from "@tarojs/taro" import {Loading} from '@nutui/nutui-react-taro' import {useEffect, useState} from "react" import {useRouter} from '@tarojs/taro' @@ -40,22 +40,15 @@ function Category() { }) }, []); - useShareTimeline(() => { - return { - title: `${nav?.categoryName}_时里院子市集`, - path: `/shop/category/index?id=${categoryId}` - }; - }); - useShareAppMessage(() => { return { title: `${nav?.categoryName}_时里院子市集`, path: `/shop/category/index?id=${categoryId}`, - success: function (res) { - console.log('分享成功', res); + success: function () { + console.log('分享成功'); }, - fail: function (res) { - console.log('分享失败', res); + fail: function () { + console.log('分享失败'); } }; }); diff --git a/src/shop/goodsDetail/index.tsx b/src/shop/goodsDetail/index.tsx index 75f8279..7b39342 100644 --- a/src/shop/goodsDetail/index.tsx +++ b/src/shop/goodsDetail/index.tsx @@ -1,7 +1,7 @@ import {useEffect, useState} from "react"; import {Image, Divider, Badge} from "@nutui/nutui-react-taro"; import {ArrowLeft, Headphones, Share, Cart} from "@nutui/icons-react-taro"; -import Taro, {useShareAppMessage, useShareTimeline} from "@tarojs/taro"; +import Taro, {useShareAppMessage} from "@tarojs/taro"; import {RichText, View} from '@tarojs/components' import {ShopGoods} from "@/api/shop/shopGoods/model"; import {getShopGoods} from "@/api/shop/shopGoods"; @@ -186,15 +186,6 @@ const GoodsDetail = () => { }; }); - // 分享到朋友圈 - useShareTimeline(() => { - return { - title: `${goods?.name || '精选商品'} - 网宿小店`, - path: `/shop/goodsDetail/index?id=${goodsId}`, - imageUrl: goods?.image - }; - }); - if (!goods || loading) { return
加载中...
; } diff --git a/src/utils/common.ts b/src/utils/common.ts index 1137728..5c2b526 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -78,18 +78,6 @@ export function shareGoodsLink(goodsId: string | number) { copyText(shareUrl); } -/** - * 显示分享引导提示 - */ -export function showShareGuide() { - Taro.showModal({ - title: '分享提示', - content: '请点击右上角的"..."按钮,然后选择"转发"来分享给好友,或选择"分享到朋友圈"', - showCancel: false, - confirmText: '知道了' - }); -} - /** * 截取字符串,确保不超过指定的汉字长度 * @param text 原始文本