import { Merchant, Investor, Agent } from './updateMenu'
import AllPages from '../../pages.json'
let menu = [{
      pagePath: "/pages/index/index",
      iconPath: "/static/tabbar/home_icon.png",
      selectedIconPath: "/static/tabbar/home_active.png",
      text: "首页"
    }, {
      pagePath: "/pages/me/index",
      iconPath: "/static/tabbar/news_icon.png",
      selectedIconPath: "/static/tabbar/news_active.png",
      text: "我的"
    }]
export function setTabBar(res: any) {
  const pages = getCurrentPages();
  const currentPage: any = pages[pages.length - 1];
  if (currentPage) {
    const tabBar = currentPage?.getTabBar ? currentPage?.getTabBar() : null;
    let list = res?.companyConfig?.config_value?.menu?.map((i:any) =>({...i,iconPath: i.iconPath?.[0]?.url,selectedIconPath: i.selectedIconPath?.[0]?.url}))
    getApp().globalData.menuList = list || menu
    if (tabBar) {
      tabBar.setData({
        list: list  || menu
      });
    }
  }
  console.log('App.globalData.selectedOrg', res?.companyConfig?.config_value?.menu)
}
