Commit f8a9ec96 authored by 王炽's avatar 王炽

Merge branch 'xingmaLab20250820' of http://gitlab2.dui88.com/fh/20250528_FHQ1...

Merge branch 'xingmaLab20250820' of http://gitlab2.dui88.com/fh/20250528_FHQ1 into xingmaLab20250820
parents bf69e3d2 359cf8ba
......@@ -203,7 +203,7 @@ const handleShareClick = () => {
// 使用 open-type="share" 时,点击事件可以为空
// 分享内容通过页面配置自动设置
console.log('分享按钮被点击')
// 手动触发分享(如果需要的话)
// uni.showShareMenu({
// withShareTicket: true,
......@@ -217,16 +217,21 @@ const handleGoBack = () => {
const pages = getCurrentPages()
console.log('pages', pages)
if (pages.length > 1) {
let prevPage = pages[pages.length - 2]
prevPage.setData({
isFavorite: detailData.value.collection ? 1 : -1
})
// 有上一页,返回上一页
uni.navigateBack({
delta: 1
})
} else {
// 没有上一页,跳转到星妈实验室页面
// 没有上一页,跳转到星妈实验室页面,并传递index参数
uni.redirectTo({
url: '/pages/xingmaLab/xingmaLab'
url: `/pages/xingmaLab/xingmaLab`
})
}
}
......@@ -236,11 +241,10 @@ onMounted(async () => {
// 调用 home 接口获取登录状态
await homeStore.loadHomeInfo()
// 获取页面跳转参数中的 id
// 获取页面跳转参数中的 id 和 index
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const id = currentPage.options?.id || ''
if (id) {
console.log('🔍 获取到页面参数 id:', id)
recordId.value = id // 立即保存ID,确保分享时能获取到
......@@ -300,19 +304,19 @@ export default {
// 自定义分享内容
onShareAppMessage() {
console.log('onShareAppMessage 被调用')
// 获取当前页面的数据
const pages = getCurrentPages()
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: '星妈实验室详情',
......@@ -323,19 +327,19 @@ export default {
onShareTimeline() {
console.log('onShareTimeline 被调用')
// 获取当前页面的数据
const pages = getCurrentPages()
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: '星妈实验室详情',
......
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