<template>
  <app-container title="修改密码">
    <el-form :model="ruleForm" :rules="rules" label-width="90px" ref="ruleForm" class="form">
      <el-form-item label="旧密码" prop="old_password">
        <el-input type="password" v-model="ruleForm.old_password" placeholder="请输入密码"></el-input>
      </el-form-item>
      <el-form-item label="新密码" prop="password">
        <el-input type="password" v-model="ruleForm.password" placeholder="请输入新密码"></el-input>
      </el-form-item>
      <el-form-item label="重复新密码" prop="passwordR">
        <el-input type="password" v-model="ruleForm.passwordR" placeholder="请重复输入新密码"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleSubmit">保存</el-button>
      </el-form-item>
    </el-form>
  </app-container>
</template>

<script>
import AppContainer from '@/components/AppContainer'
export default {
  components: { AppContainer },
  data() {
    return {
      ruleForm: {
        old_password: '',
        password: '',
        passwordR: ''
      },
      rules: {}
    }
  },
  methods: {
    handleSubmit() {
      this.$refs.ruleForm.validate().then(this.handleSubmitRequest)
    },
    handleSubmitRequest() {
      console.log(this.ruleForm)
    }
  }
}
</script>

<style lang="scss" scoped>
.form {
  max-width: 340px;
}
</style>
