refactor(share): 优化首页分享功能并移除商品页分享

- 在 BestSellers 组件中移除商品分享逻辑,避免与首页分享冲突
- 在首页 index.tsx 中添加分享成功和失败的提示
- 更新 invite.ts 中的邀请信息解析逻辑,支持处理首页分享链接
This commit is contained in:
2025-09-01 20:51:29 +08:00
parent 2c31f2a6d7
commit d2fe3a3bd8
3 changed files with 35 additions and 32 deletions

View File

@@ -51,30 +51,8 @@ const BestSellers = () => {
reload()
}, [])
// 分享给好友
useShareAppMessage(() => {
return {
title: goods?.name || '精选商品',
path: `/shop/goodsDetail/index?id=${goods?.goodsId}`,
imageUrl: goods?.image, // 分享图片
success: function (res: any) {
console.log('分享成功', res);
Taro.showToast({
title: '分享成功',
icon: 'success',
duration: 2000
});
},
fail: function (res: any) {
console.log('分享失败', res);
Taro.showToast({
title: '分享失败',
icon: 'none',
duration: 2000
});
}
};
});
// 注意:不在这里配置分享,避免与首页分享冲突
// 商品分享应该在商品详情页处理,首页分享应该分享首页本身
return (
<>