2025-10-10 10:56:33 +08:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
|
|
|
|
|
|
import { navigateToInterceptor } from '@/router/interceptor'
|
2025-10-15 16:03:42 +08:00
|
|
|
|
import { useAppStore } from './store'
|
|
|
|
|
|
|
|
|
|
|
|
const appStore = useAppStore()
|
2025-10-10 10:56:33 +08:00
|
|
|
|
|
|
|
|
|
|
onLaunch((options) => {
|
|
|
|
|
|
console.log('App Launch', options)
|
|
|
|
|
|
})
|
|
|
|
|
|
onShow((options) => {
|
|
|
|
|
|
console.log('App Show', options)
|
|
|
|
|
|
// 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等
|
|
|
|
|
|
// https://github.com/unibest-tech/unibest/issues/192
|
|
|
|
|
|
if (options?.path) {
|
|
|
|
|
|
navigateToInterceptor.invoke({ url: `/${options.path}`, query: options.query })
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
navigateToInterceptor.invoke({ url: '/' })
|
|
|
|
|
|
}
|
2025-12-24 16:42:49 +08:00
|
|
|
|
appStore.autoLogin(options.path)
|
2025-10-10 10:56:33 +08:00
|
|
|
|
})
|
|
|
|
|
|
onHide(() => {
|
|
|
|
|
|
console.log('App Hide')
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
swiper,
|
|
|
|
|
|
scroll-view {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|