// pages/phonelogin/phonelogin.js
var app = getApp()
const util = require('../../utils/utils.js');
Page({
  data: {
    phoneStatus: '',
    phoneNumber: ''
  },
  inputNumber: function (e) {
    let that = this
    that.setData({
      phoneNumber: e.detail.value
    })

  },
  nextStep: util.throttle(function () {
    let self = this
    if (self.data.phoneNumber.length != 11) {
      my.showToast({
        content: '请输入正确的手机号',
        icon: 'none',
        duration: 2000
      })
    } else {
      // 调用短信验证码接口
      let data = {
        mobile: self.data.phoneNumber,
        type: 2
      }
      app.request('/verification-code', data, 'POST').then(res => {
        console.log(res)
        let phoneNumber = self.data.phoneNumber
        if (res.status == 200) {
          my.navigateTo({
            url: '/pages/phone_verif/phone_verif?phoneNumber=' + phoneNumber,
          })
        }
      })
      //60秒倒计时

    }
  }, 1000),
    skipXieyi:function(){
    my.navigateTo({
      url: '/pages/agreement/agreement',
    })
  },

  onLoad: function (options) {

  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {

  },
  onShareAppMessage: function () {

  }
})