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 @@