const app = getApp()
var com=require('../com/com.js')
Page({
  data: {
    userInfo: wx.getStorageSync('userInfo'),
    bottomNavList: app.globalData.bottomNavList,
    bootomNavIndex: 4,
    listData: [
      {
        icon: '../../images/icons/icon(25).png',
        title: '我的钱包',
        url: '../wallet/index',
        index:1
      },
      {
        icon: '../../images/icons/icon(61).png',
        title: '日报表',
        url: '../daySheet/index',
        index:1
      },
      {
        icon: '../../images/icons/icon(29).png',
        title: '提现账号',
        url: '../cardList/index',
        index:1
      },
      {
        icon: '../../images/icons/icon(26).png',
        title: '对账单',
        url: '../accountStatement/index',
        index:1
      },
      {
        icon: '../../images/icons/refund.png',
        title: '退款列表',
        url: '../refundList/index',
        index:1
      },
      // {
      //   icon: '../../images/icons/icon(27).png',
      //   title: '解除微信授权',
      //   url: ''
      // },
      {
        icon: '../../images/icons/icon(28).png',
        title: '修改密码',
        url: '../changePassword/index',
        index:0
      },
      {
        icon: '../../images/icons/icon(28).png',
        title: '绑定微信',
        url: '../getWechat/index',
        index:1
      },
      {
        icon: '../../images/icons/wx.png',
        title: '微信用户列表',
        url: '../wxBindList/index',
        index:1
      },
      {
        icon: '../../images/icons/train.png',
        title: '培训资料',
        url: '../trainInfo/index',
        index:1
      },
      {
        icon: '../../images/icons/icon(30).png',
        title: '退出账号',
        url: 'loginOut',
        index:0
      }
    ]
  },
  onLoad(){
    var PageThis = this;
    PageThis.setData({
      userInfo:wx.getStorageSync('userInfo')
    })
  },
  setBindWechat:function(){
    wx.navigateTo({
      url: '../getWechat/index',
    })
  },
  //**页面跳转 */
  navigateTo: function (e) {
    var _url = e.currentTarget.dataset.url;
    switch (_url){
      case "loginOut":
        wx.showModal({
          title: '提示',
          content: '确认要退出登录?',
          success(res) {
            if (res.confirm) {
              try {
                wx.removeStorageSync('userInfo');
                wx.removeStorage({ key: 'userInfo' });
                wx.reLaunch({
                  url: '../login/index',
                })
              } catch (e) {}
            } else if (res.cancel) {
            }
          }
        })
        break;
      default:
        wx.navigateTo({
          url: _url,
        })
        break;
    }
  },
})