diff --git a/xuan-deduct-uniapp/src/pages/bazi/result.vue b/xuan-deduct-uniapp/src/pages/bazi/result.vue index e9ccf1b..0e96779 100644 --- a/xuan-deduct-uniapp/src/pages/bazi/result.vue +++ b/xuan-deduct-uniapp/src/pages/bazi/result.vue @@ -162,7 +162,7 @@ - @@ -240,6 +240,8 @@ export default { console.log('this.result.baZi:', this.result.baZi) console.log('this.result.lunar:', this.result.lunar) console.log('this.result.shengXiao:', this.result.shengXiao) + + this.createShareLink() } else { console.log('app.globalData.baziResult 是 undefined 或 null') uni.showToast({ @@ -280,10 +282,8 @@ export default { } return '-' }, - async shareResult() { + async createShareLink() { try { - uni.showLoading({ title: '创建分享链接...' }) - const shareData = { type: 'bazi', resultData: JSON.stringify(this.result), @@ -292,30 +292,12 @@ export default { const res = await api.shareApi.create(shareData) - uni.hideLoading() - if (res.success) { this.shareId = res.shareId - - // 使用微信小程序的分享功能 - // 用户点击右上角分享按钮时会自动调用 onShareAppMessage - uni.showModal({ - title: '分享提示', - content: '请点击右上角"..."按钮,选择"转发"分享给好友', - showCancel: false - }) - } else { - uni.showToast({ - title: res.error || '创建分享失败', - icon: 'none' - }) + console.log('分享链接创建成功:', this.shareId) } } catch (e) { - uni.hideLoading() - uni.showToast({ - title: '分享失败:' + (e.message || '未知错误'), - icon: 'none' - }) + console.error('创建分享链接失败:', e) } } } diff --git a/xuan-deduct-uniapp/src/pages/taluo/result.vue b/xuan-deduct-uniapp/src/pages/taluo/result.vue index e441918..4a10ae4 100644 --- a/xuan-deduct-uniapp/src/pages/taluo/result.vue +++ b/xuan-deduct-uniapp/src/pages/taluo/result.vue @@ -116,20 +116,11 @@