| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <template>
- <router-view />
- </template>
- <script lang="ts" setup>
- import { useNavigation } from '@mobile/router/navigation'
- import { dialog } from '@/utils/vant'
- import { useLogin } from '@/business/login'
- import eventBus from '@/services/bus'
- const { userLogout } = useLogin()
- const { backHome } = useNavigation()
- // 接收用户登出通知
- eventBus.$on('LogoutNotify', (msg) => {
- // ---待优化---
- // 登出后应该回退到首页,如果回退后非首页,会导致路由拦截而跳转到登录页面,此时因为 tabIndex = 0 的问题,登录页被 replace 成首页,导致路由还能继续后退
- // 临时解决方案是先退回首页后再进行登出操作
- backHome()
- setTimeout(() => {
- userLogout()
- if (msg) {
- dialog({
- message: msg as string,
- confirmButtonText: '确定'
- })
- }
- }, 0)
- })
- // 接收风控通知
- eventBus.$on('RiskToWebNtf', (msg) => {
- const notify = msg as { title: string, content: string }
- dialog({
- title: notify.title,
- message: notify.content,
- confirmButtonText: '确定'
- })
- })
- </script>
|