<template>
  <div class="page flex-col">
    <div class="bd1 flex-row">
      <sass-header />
    </div>
    <div class="bd3 flex-row">
      <div class="box1 flex-col">
        <div class="group1 flex-col">
          <div class="box2 flex-row">
            <img class="section1" src="./assets/img/SketchPng329d30052b53f88c2e061017bc26843e6ce1a55ca454804cf9dc7458066c690c.png" />
            <span class="word1">请输入你要找回登录密码的手机号</span>
          </div>
          <div class="box3 flex-row">
            <a-input v-model="phone" class="section1 flex-col" placeholder="请输入手机号" />
          </div>
          <div class="box3 code flex-row">
            <a-input v-model="code" placeholder="请输入验证码" />
            <a-button @click="sendCode">获取验证码</a-button>
          </div>
          <div class="box3 flex-row">
            <a-input
              v-model="newPass"
              class="section1 flex-col"
              type="password"
              placeholder="请输入新密码"
            />
          </div>
          <div class="box3 flex-row">
            <a-input
              v-model="newPass2"
              class="section1 flex-col"
              type="password"
              placeholder="请再次输入新密码"
            />
          </div>

          <button class="box7 flex-col" @click="submit">
            <span class="txt2">确定</span>
          </button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      code: '',
      newPass: '',
      newPass2: '',
      phone: '',
      constants: {}
    }
  },
  methods: {
    async submit() {
      try {
        const data = {
          user_phone: this.phone,
          new_pwd: this.newPass,
          repass: this.newPass2,
          identifying_code: this.code
        }
        await this.$store.dispatch('modifyPassword', data)
        window.history.back()
      } catch (e) {

      }

    },
    async sendCode() {
      try {
        const data = {
          phone: this.phone
        }
        await this.$store.dispatch('sendCode', data)
        this.$message.success('发送验证码成功')
      } catch (e) {
      }
    }
  }
}
</script>
<style scoped lang="scss" src="./assets/index.scss" />
