From 136a46f095ac5e07bdec63f32d0d7a4141ce1607 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Wed, 2 Sep 2026 15:17:08 +0800 Subject: [PATCH] 1 --- package5/planet/index.vue | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/package5/planet/index.vue b/package5/planet/index.vue index de3e3aa..81f305b 100644 --- a/package5/planet/index.vue +++ b/package5/planet/index.vue @@ -314,6 +314,9 @@ import huntModal from '@/package5/components/planet/hunt-modal.vue' import planetDailyLoop from '@/package5/components/planet/planet-daily-loop.vue' import planetAdventureEntry from '@/package5/components/planet/planet-adventure-entry.vue' + import { buildHomeSharePath } from '@/utils/sharePath.js' + + const SHARE_TARGET_PATH = '/package5/planet/index' export default { components: { @@ -544,6 +547,7 @@ } }, onLoad() { + this.enableShareMenu() const sys = uni.getSystemInfoSync() this.statusBarHeight = sys.statusBarHeight || 20 this.initNavHeight() @@ -566,12 +570,46 @@ this.loadHome() }, onShow() { + this.enableShareMenu() if (!this.hasLogin()) return if (this.loadedOnce) { this.loadHome(true) } }, + onShareAppMessage() { + return this.buildShareInfo() + }, + onShareTimeline() { + const info = this.buildShareInfo() + return { + title: info.title, + query: info.path.split('?')[1] || '', + imageUrl: info.imageUrl + } + }, methods: { + enableShareMenu() { + if (!uni.showShareMenu) return + uni.showShareMenu({ + withShareTicket: true, + menus: ['shareAppMessage', 'shareTimeline'] + }) + }, + buildShareInfo() { + return { + title: '白嫖星球,每天收券参与开奖', + path: buildHomeSharePath(SHARE_TARGET_PATH), + imageUrl: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f7227759d693497a8beab87ff437a875.png' + } + }, + backHome() { + uni.switchTab({ + url: '/pages/index/index', + fail: () => { + uni.reLaunch({ url: '/pages/index/index' }) + } + }) + }, hasLogin() { const token = uni.getStorageSync('hiver_token') return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined') @@ -1276,7 +1314,12 @@ this.guideVisible = true }, goBack() { - uni.reLaunch({ url: '/pages/index/index' }) + const pages = getCurrentPages ? getCurrentPages() : [] + if (pages.length > 1) { + uni.navigateBack({ delta: 1 }) + return + } + this.backHome() } } }