wangfukang 3 weeks ago
parent
commit
136a46f095
  1. 45
      package5/planet/index.vue

45
package5/planet/index.vue

@ -314,6 +314,9 @@
import huntModal from '@/package5/components/planet/hunt-modal.vue' import huntModal from '@/package5/components/planet/hunt-modal.vue'
import planetDailyLoop from '@/package5/components/planet/planet-daily-loop.vue' import planetDailyLoop from '@/package5/components/planet/planet-daily-loop.vue'
import planetAdventureEntry from '@/package5/components/planet/planet-adventure-entry.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 { export default {
components: { components: {
@ -544,6 +547,7 @@
} }
}, },
onLoad() { onLoad() {
this.enableShareMenu()
const sys = uni.getSystemInfoSync() const sys = uni.getSystemInfoSync()
this.statusBarHeight = sys.statusBarHeight || 20 this.statusBarHeight = sys.statusBarHeight || 20
this.initNavHeight() this.initNavHeight()
@ -566,12 +570,46 @@
this.loadHome() this.loadHome()
}, },
onShow() { onShow() {
this.enableShareMenu()
if (!this.hasLogin()) return if (!this.hasLogin()) return
if (this.loadedOnce) { if (this.loadedOnce) {
this.loadHome(true) 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: { 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() { hasLogin() {
const token = uni.getStorageSync('hiver_token') const token = uni.getStorageSync('hiver_token')
return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined') return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined')
@ -1276,7 +1314,12 @@
this.guideVisible = true this.guideVisible = true
}, },
goBack() { goBack() {
uni.reLaunch({ url: '/pages/index/index' }) const pages = getCurrentPages ? getCurrentPages() : []
if (pages.length > 1) {
uni.navigateBack({ delta: 1 })
return
}
this.backHome()
} }
} }
} }

Loading…
Cancel
Save