feat: 分享

This commit is contained in:
黄泽群
2026-07-23 14:02:58 +08:00
committed by charles
parent 4b52120145
commit b8dd02b4a7
2 changed files with 44 additions and 2 deletions
@@ -99,7 +99,7 @@
}, },
onWxBtn(index){ onWxBtn(index){
console.log('微信分享',index); console.log('微信分享',index);
this.$emit('share',index) this.$emit('wxShare',index)
}, },
onBtn(index){ onBtn(index){
if(index == 2){ if(index == 2){
@@ -551,6 +551,49 @@ export default {
}); });
}, },
getValue, getValue,
// 微信小程序环境分享
onWxShare(index) {
console.log("分享", index);
// const shareParams = {
// title: this.orderInfo.name || "商品分享",
// path: `/pages/other_package/productInfo/productInfo?id=${this.id}${this.orderInfo.name}`,
// imageUrl: this.swiperList.length > 0 ? this.swiperList[0] : "",
// };
// if (index == 0) {
// uni.share({
// provider: "weixin",
// scene: "WXSceneSession", // 好友场景
// title: shareParams.title,
// path: shareParams.path,
// imageUrl: shareParams.imageUrl,
// success: (res) => {
// console.log("分享好友成功", res);
// uni.showToast({ title: "分享成功", icon: "success" });
// },
// fail: (err) => {
// console.log("分享好友失败", err);
// uni.showToast({ title: "分享取消", icon: "none" });
// },
// });
// } else {
// // 分享到微信朋友圈
// uni.share({
// provider: "weixin",
// scene: "WXSceneTimeline", // 朋友圈场景
// title: shareParams.title,
// path: shareParams.path,
// imageUrl: shareParams.imageUrl,
// success: (res) => {
// console.log("分享朋友圈成功", res);
// uni.showToast({ title: "分享成功", icon: "success" });
// },
// fail: (err) => {
// console.log("分享朋友圈失败", err);
// uni.showToast({ title: "分享取消", icon: "none" });
// },
// });
// }
},
onShare(index) { onShare(index) {
let tmp = `【信任桥】消费共享数字化权益 ${SHARE_URL}/#/pages/other_package/productInfo/productInfo?id=${this.id} ${this.orderInfo.name}`; let tmp = `【信任桥】消费共享数字化权益 ${SHARE_URL}/#/pages/other_package/productInfo/productInfo?id=${this.id} ${this.orderInfo.name}`;
if (index == 0) { if (index == 0) {
@@ -907,7 +950,6 @@ export default {
/<img([^>]*?)>/gi, /<img([^>]*?)>/gi,
'<img$1 style="max-width:100%;height:auto;display:block;">' '<img$1 style="max-width:100%;height:auto;display:block;">'
); );
} }
}, },
/** /**