import { TabesItem } from '@/service/app'
import { sysDictType } from '@/service/index/api'

const tabbarList = ref<TabesItem[]>([])
const app = getApp()

sysDictType({ id: 619330547859525 }).then((res) => {
  const { code, result } = res
  const _tabbarList = [
    {
      id: 0,
      path: '../../home/index/index',
      icon: '/static/tabBar/home.png',
      selectIcon: '/static/tabBar/home-active.png',
      text: '首页',
      centerItem: false,
    },
    {
      id: 3,
      path: '../../news/index/index',
      icon: '/static/tabBar/news.png',
      selectIcon: '/static/tabBar/news-active.png',
      text: '测评',
      centerItem: false,
    },
    {
      id: 2,
      path: '../../aiService/index/index',
      icon: '/static/tabBar/ai.png',
      selectIcon: '/static/tabBar/ai-active.png',
      text: '',
      centerItem: true,
    },
    {
      id: 1,
      path: '../../place/index/index',
      icon: '/static/tabBar/place.png',
      selectIcon: '/static/tabBar/place-active.png',
      text: '专家',
      centerItem: false,
    },
    {
      id: 4,
      path: '../../ucenter/index/index',
      icon: '/static/tabBar/center.png',
      selectIcon: '/static/tabBar/center-active.png',
      text: '我的',
      centerItem: false,
    },
  ]
  const { status } = result as { status: number }
  if (code === 200) {
    if (status === 1) {
      tabbarList.value = _tabbarList.filter((item) => item.id !== 2)
    } else {
      tabbarList.value = _tabbarList
    }
  }
})

export { tabbarList }
