// pages/mine/mine.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      name: wx.getStorageSync('userName'),
      mobile: wx.getStorageSync('mobile')
    })
  },
  onShow(){
    //自定义tab图标选中设置
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      if(wx.getStorageSync('userType') == 'PLATFORM_EMP'){
        this.getTabBar().setData({
          selected:2, 
        })
      }else{
        this.getTabBar().setData({
          selected:1, 
        })
      }
    }
  },
  /**
   * 
   * 联系我们
   * 
   * @param {*} e 
   */
  customerService(e) {
    wx.navigateTo({
      url: '/mine/pages/contactUs/contactUs',
    })
  },


  /**
   * 
   * 退出登录
   * 
   * @param {*} e 
   */
  exit(e) {
    wx.showModal({
      title: '提示',
      content: '确定退出登录吗?',
      complete: (res) => {
        if (res.cancel) {

        }

        if (res.confirm) {
          wx.clearStorage()
          wx.reLaunch({
            url: '/pages/index/index',
          })
        }
      }
    })
  },
})