<template>
  <view class="app-container pb-16">
    <ProfileView />
    <!-- #ifdef H5 || APP-PLUS -->
    <AppTabBar />
    <!-- #endif -->
  </view>
</template>

<script setup lang="ts">
import { onShow } from '@dcloudio/uni-app'
import { useAuthStore } from '@/stores/auth'
import { safeHideTabBar } from '@/utils'
import ProfileView from '@/components/my/ProfileView.vue'
// #ifdef H5 || APP-PLUS
import AppTabBar from '@/components/common/AppTabBar.vue'
// #endif

const authStore = useAuthStore()

onShow(() => {
  // #ifdef H5 || APP-PLUS
  safeHideTabBar({ animation: false, repeat: 10 })
  // #endif
  // #ifdef MP-WEIXIN
  const pages = getCurrentPages()
  const page = pages[pages.length - 1] as any
  const role = authStore.userRole
  const index = role === 'dispatch' ? 3 : 2
  page?.getTabBar?.()?.setSelected?.(index)
  // #endif
})
</script>
