const app = getApp()
const httpUtils = require('../../utils/http.js')
const ui = require('../../utils/ui.js')
Page({
  data: {
    phone: ''
  },
  getInputName(e){
    this.setData({
      phone: e.detail.value
    })
  },
  toSubmit() {
    let phoneNumber = this.data.phone;
    let obj = {
      url: '/api/erp/we/phoneInfo',   
      data: {
        phone: phoneNumber,
        openId: wx.getStorageSync('openId')
      }
    }
    httpUtils.request(obj).then(res=>{
      console.log(res)
      wx.setStorageSync('token', res.data.data.token)
      wx.setStorageSync('phone', phoneNumber)
      wx.switchTab({
        url: '/pages/list/index',
      })
    }).catch(err=>{
      console.log('ERROR')
    });
  }
})
