const app = getApp()
const util = require("../../../utils/util");
const api = require('../../../api/api.js');
const user = require('../../../utils/user.js');




Page({
  data: {
    NewFarmerStatus:'',//新农保
    backInvestigateState:'',//背调
    faceCheckState:'',//实名认证
    healthState:'',//健康证
		signContractState:'',//签约
		onlineInvestigateState:'',
		signKeepSecretState:'',			//保密协议
    ofJz:293,//不是293鲸致，隐藏新农保

  },

  /**
   * 生命周期函数--监听页面加载
   */
    onLoad: function (options) {
		    //  this.getStatus();
		    let userInfo= wx.getStorageSync('userInfo');
		    console.log(userInfo);
		    if(userInfo&&userInfo!=null){
		      this.setData({
		        ofJz: userInfo.ofJz
		      })
		    }
		},
  getStatus(){
    util.request(api.getNewFarmerStatus, {
    
    }, 'GET').then(res=> {
      if (res.errno === 0) {
          this.setData({
           status:res.data.status
          });
      }
  }).catch(err=>{
  });
  },
getStateInfo(){
  let userInfo = wx.getStorageSync('userInfo');
    util.request(api.getStateInfo, {
      workerNo:userInfo.workerNo
    }, 'GET').then(res=> {
      if (res.errno === 0) {
          this.setData({
          NewFarmerStatus:res.data.NewFarmerStatus,
          // backInvestigateState:res.data.backInvestigateState,
          // faceCheckState:res.data.faceCheckState,
          healthState:res.data.healthState,
					signContractState:res.data.signContractState,
					onlineInvestigateState:res.data.onlineInvestigateState,
					signKeepSecretState:res.data.signKeepSecretState
         
          });
      }
  }).catch(err=>{
  });
  },
  getPerfect(){
    wx.navigateTo({
      url: '/pages/servant/perfect/perfectWorkerInfo'
    })
   },
  goDetail(){
    wx.navigateTo({
      url: '/pages/upgrade/xnbInfo/xnbInfo',
    });
  },
  goHealth(){
    wx.navigateTo({
      url: '/pages/upgrade/addHealth/addHealth',
    });
  },
 goXnb(){
  //  if(this.data.status=='生效中'||this.data.status=='审核中'){
  //   wx.navigateTo({
  //     url: '/pages/upgrade/editXnb/editXnb',
  //   });
  //  }else{
  //   wx.navigateTo({
  //     url: '/pages/upgrade/addXnb/addXnb',
  //   });
  //  }
  wx.navigateTo({
    url: '/pages/upgrade/editXnb/editXnb',
  });
  
 },
 goSign(){
  wx.navigateTo({
    url: '/pages/upgrade/signInfo/signInfo',
  });
},
goFacecheck(){
  app.globalData.isFirstFace=false;
  wx.navigateTo({
    url: '/pages/upgrade/facecheckInfo/facecheckInfo',
  });
},
goEntryAuth(){
	wx.navigateTo({
    url: '/pages/upgrade/entryAuth/entryAuth',
  });
},
goVestigation(){
  wx.navigateTo({
    url: '/pages/upgrade/investigationInfo/investigationInfo',
  });
},
goSign2(){
  wx.navigateTo({
    url: '/pages/upgrade/baomiSignInfo/baomiSignInfo',
  });
},
  onReachBottom() {
  
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
    // this.getStatus();
    this.getStateInfo();
  },
 
  onHide: function () {

  },

  onUnload: function () {

  },
  

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
   
  },
  
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  
})