<template>
  <div class="f-main">
    <div class="content-top">
      <p>密码重置</p>
    </div>
    <div class="f-form">
      <div class="page-part">
        <mt-field placeholder="原手机号"
                  :state="state.mobile"
                  v-mobile="valid.mobile"></mt-field>
      </div>
      <div class="page-part">
        <mt-field placeholder="验证码"
                  :state="state.captcha"
                  auto-complete="off"
                  v-mobile="valid.captcha">
          <img :src="imgSrc" height="45px" width="100px" @click="getCode">
        </mt-field>
      </div>
      <div class="page-part">
        <mt-button size="large" type="primary" @click="sureAccount(2)">下一步</mt-button>
      </div>
    </div>
  </div>
</template>

<script>
    export default {
      name: 'step-one',
      data () {
        return {
          state: {
            mobile: 'error',
            captcha: 'error'
          },
          valid: {
            mobile: '',
            captcha: ''
          },
          imgSrc: ''
        }
      },
      mounted () {
        this.$nextTick(() => {
          this.getCode()
        })
      },
      methods: {
        sureAccount (type) {
          this.$emit('stepEvent', type)
        },
        getCode () {
          this.imgSrc = '/sso/resetPwd/checkCaptcha?timestamp=' + (new Date()).valueOf()
        }
      }
    }
</script>

<style scoped type="text/scss" lang="scss">

</style>
