Component({
  data: {
    selected: 0,
    color: "#999999",
    selectedColor: "#FF6B35",
    "list": []
  },
  attached() {
    const app = getApp();
    const userId = wx.getStorageSync("userId");
    const userInfodata = wx.getStorageSync("userInfo");
    let ifsel = 0;
    
    if (userId && userInfodata) {
      const userInfo = JSON.parse(userInfodata);
      ifsel = userInfo.bdshEnable;
    }
    
    // 从全局配置获取菜单列表
    this.setData({
      list: ifsel == 1 ? app.globalData.tabBarListBdsh : app.globalData.tabBarList
    });
  },
  methods: {
    switchTab(e) {
      var data = e.currentTarget.dataset
      var url = data.path
      if(data.index==8){
        var userId = wx.getStorageSync("userId")
        var LoginId = wx.getStorageSync("LoginId")
        var userInfodata = wx.getStorageSync("userInfo")
        if(userId&&LoginId&&userInfodata){
          wx.switchTab({
            url: url,
          });
          this.setData({
            selected: data.index
          })
         }else{
             wx.navigateTo({  
                 url: "../login/index"
             }) 
         }
      }else{
       
      wx.switchTab({
        url: url,
      });
      this.setData({
        selected: data.index
      })
      }
    }
  }
})