| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <template>
- <router-view />
- <Notify v-model:show="notify.show" :title="notify.title" :content="notify.content" />
- </template>
- <script lang="ts" setup>
- import { reactive } from 'vue'
- import { useNavigation } from '@mobile/router/navigation'
- import { dialog } from '@/utils/vant'
- import { useLogin } from '@/business/login'
- import eventBus from '@/services/bus'
- import Notify from '@mobile/components/base/notify/index.vue'
- const { userLogout } = useLogin()
- const { backHome } = useNavigation()
- const notify = reactive({
- show: false,
- title: '',
- content: ''
- })
- // 接收用户登出通知
- eventBus.$on('LogoutNotify', (msg) => {
- userLogout(() => {
- if (msg) {
- dialog({
- message: msg as string,
- confirmButtonText: '确定'
- }).then(() => {
- backHome()
- })
- } else {
- backHome()
- }
- })
- })
- // 接收风控通知
- eventBus.$on('RiskToWebNtf', (msg, type) => {
- const res = msg as { title: string, content: string }
- if (type === 1) {
- notify.title = res.title
- notify.content = res.content
- notify.show = true
- } else {
- dialog({
- title: res.title,
- message: res.content,
- confirmButtonText: '确定'
- })
- }
- })
- </script>
|