Commit 27e1aa78 authored by spc's avatar spc

去除分享朋友圈

parent 9019576f
...@@ -185,7 +185,9 @@ ...@@ -185,7 +185,9 @@
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom", "navigationStyle": "custom",
"enableShare": true "enableShare": true,
"shareAppMessage": true,
"shareTimeline": false
} }
}, },
{ {
......
...@@ -126,7 +126,7 @@ const fetchDetailData = async (id) => { ...@@ -126,7 +126,7 @@ const fetchDetailData = async (id) => {
detailData.value = result.data detailData.value = result.data
recordId.value = id // 保存记录ID recordId.value = id // 保存记录ID
console.log('✅ 详情数据获取成功:', detailData.value) console.log('✅ 详情数据获取成功:', detailData.value)
// 初始化时同步收藏状态到上一页 // 初始化时同步收藏状态到上一页
syncCollectionStatusToPrevPage() syncCollectionStatusToPrevPage()
} else { } else {
...@@ -243,7 +243,7 @@ const handleShareClick = () => { ...@@ -243,7 +243,7 @@ const handleShareClick = () => {
// 手动触发分享(如果需要的话) // 手动触发分享(如果需要的话)
// uni.showShareMenu({ // uni.showShareMenu({
// withShareTicket: true, // withShareTicket: true,
// menus: ['shareAppMessage', 'shareTimeline'] // menus: ['shareAppMessage'] // 仅分享给好友,禁用朋友圈
// }) // })
} }
...@@ -268,7 +268,7 @@ const handleGoBack = () => { ...@@ -268,7 +268,7 @@ const handleGoBack = () => {
} }
// 生命周期 // 生命周期
onMounted(async () => { onMounted(async (options) => {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: "true",
...@@ -305,18 +305,23 @@ onMounted(async () => { ...@@ -305,18 +305,23 @@ onMounted(async () => {
componentContent: "藏品详情页+" + detailData.value.content componentContent: "藏品详情页+" + detailData.value.content
}); });
} else { } else {
console.warn('⚠️ 未获取到页面参数 id') console.warn('⚠️ 未获取到页面参数 id', options, currentPage.options)
uni.showToast({ // uni.showToast({
title: '参数错误', // title: '参数错误',
icon: 'none' // icon: 'none'
}) // })
// uni.redirectTo({
// url: `/pages/xingmaLab/xingmaLab`
// })
} }
uni.hideShareMenu({
// 启用分享菜单 menus: ['shareTimeline']
})
// 启用分享菜单(仅限分享给好友,禁用朋友圈)
uni.showShareMenu({ uni.showShareMenu({
withShareTicket: true, withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'] menus: ['shareAppMessage']
}) })
}) })
...@@ -375,34 +380,18 @@ export default { ...@@ -375,34 +380,18 @@ export default {
// 如果无法获取页面实例,返回默认分享内容 // 如果无法获取页面实例,返回默认分享内容
return { return {
title: '星妈实验室详情', title: '',
path: `/pages/XingmaLabDetailPage/XingmaLabDetailPage?id=${id}`, path: `/pages/XingmaLabDetailPage/XingmaLabDetailPage?id=${id}`,
imageUrl: '' imageUrl: ''
} }
}, },
onShareTimeline() { // 朋友圈分享已禁用
console.log('onShareTimeline 被调用') // onShareTimeline() {
// console.log('onShareTimeline 被调用')
// 获取当前页面的数据 // // 朋友圈分享功能已禁用
const pages = getCurrentPages() // return null
const currentPage = pages[pages.length - 1] // }
const options = currentPage.options || {}
const id = options.id || ''
// 获取页面实例
const pageInstance = currentPage.$vm
if (pageInstance && pageInstance.getShareData) {
return pageInstance.getShareData()
}
// 如果无法获取页面实例,返回默认分享内容
return {
title: '星妈实验室详情',
path: `/pages/XingmaLabDetailPage/XingmaLabDetailPage?id=${id}`,
imageUrl: ''
}
}
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment