mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-09-12 16:40:40 +08:00
5f22f4fa01
- 新增公告全流程功能:首页公告轮播、公告列表页、公告详情页 - 新增统一数据加载状态hook useDataLoading与配套测试 - 重构配置加载逻辑,新增统一bootstrap静态配置拉取 - 新增维护模式、恋爱模块支持与验证码防刷功能 - 优化投票卡片、联系页、关于页UI样式 - 新增测试页面与全局玻璃卡片样式 - 修复markdown容器内边距与首页生命周期逻辑
56 lines
1.6 KiB
Vue
56 lines
1.6 KiB
Vue
<script setup lang="ts">
|
|
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
|
|
import { getCurrentInstance, onMounted, onUnmounted } from 'vue'
|
|
import { navigateToInterceptor } from '@/router/interceptor'
|
|
import { tabbarStore } from '@/tabbar/store'
|
|
import { permission } from '@/router/permission'
|
|
import { useAppConfigStore } from '@/store/appConfig'
|
|
|
|
const { proxy } = (getCurrentInstance() || {}) as any
|
|
const router = proxy?.$router
|
|
|
|
router && permission.install(router)
|
|
|
|
onLaunch((options) => {
|
|
// 初始化获取配置
|
|
useAppConfigStore()
|
|
|
|
console.log('App.vue onLaunch', options)
|
|
})
|
|
onShow((options) => {
|
|
console.log('App.vue onShow', 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: '/' })
|
|
}
|
|
})
|
|
onHide(() => {
|
|
console.log('App Hide')
|
|
})
|
|
|
|
// #ifdef H5
|
|
function syncTabbarWhenPageVisible() {
|
|
if (document.visibilityState === 'visible') {
|
|
tabbarStore.syncCurIdxByCurrentPageAsync()
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
document.addEventListener('visibilitychange', syncTabbarWhenPageVisible)
|
|
window.addEventListener('pageshow', syncTabbarWhenPageVisible)
|
|
})
|
|
|
|
onUnmounted(() => {
|
|
document.removeEventListener('visibilitychange', syncTabbarWhenPageVisible)
|
|
window.removeEventListener('pageshow', syncTabbarWhenPageVisible)
|
|
})
|
|
// #endif
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
|
|
</style> |