From 400fabef6fe83f0968e6d3f73d14ec91991ac3f8 Mon Sep 17 00:00:00 2001 From: H1d3rOne Date: Tue, 10 Mar 2026 22:39:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8FonShareAppMessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 八字结果页:添加onShareAppMessage分享功能 - 紫微结果页:添加onShareAppMessage分享功能 - 塔罗结果页:添加onShareAppMessage分享功能 - 用户点击分享按钮后提示使用右上角转发 --- xuan-deduct-uniapp/src/pages/bazi/result.vue | 28 ++++--- xuan-deduct-uniapp/src/pages/taluo/result.vue | 82 ++++++++++--------- xuan-deduct-uniapp/src/pages/ziwei/result.vue | 26 +++--- 3 files changed, 70 insertions(+), 66 deletions(-) diff --git a/xuan-deduct-uniapp/src/pages/bazi/result.vue b/xuan-deduct-uniapp/src/pages/bazi/result.vue index 5b69b0e..e9ccf1b 100644 --- a/xuan-deduct-uniapp/src/pages/bazi/result.vue +++ b/xuan-deduct-uniapp/src/pages/bazi/result.vue @@ -176,7 +176,15 @@ import api from '@/utils/api.js' export default { data() { return { - result: {} + result: {}, + shareId: '' + } + }, + onShareAppMessage() { + return { + title: `${this.result.name || '八字命盘'}的测算结果`, + path: `/pages/share/view?shareId=${this.shareId}`, + imageUrl: '/static/share.png' } }, computed: { @@ -287,20 +295,14 @@ export default { uni.hideLoading() if (res.success) { - const shareUrl = `/pages/share/view?shareId=${res.shareId}` + this.shareId = res.shareId + // 使用微信小程序的分享功能 + // 用户点击右上角分享按钮时会自动调用 onShareAppMessage uni.showModal({ - title: '分享成功', - content: '点击确定转发给微信好友', - success: (modalRes) => { - if (modalRes.confirm) { - uni.shareAppMessage({ - title: `${this.result.name || '八字命盘'}的测算结果`, - path: shareUrl, - imageUrl: '/static/share.png' - }) - } - } + title: '分享提示', + content: '请点击右上角"..."按钮,选择"转发"分享给好友', + showCancel: false }) } else { uni.showToast({ diff --git a/xuan-deduct-uniapp/src/pages/taluo/result.vue b/xuan-deduct-uniapp/src/pages/taluo/result.vue index 4a10ae4..e441918 100644 --- a/xuan-deduct-uniapp/src/pages/taluo/result.vue +++ b/xuan-deduct-uniapp/src/pages/taluo/result.vue @@ -116,11 +116,20 @@