<template>
  <div class="app-container">
    <van-nav-bar
      title="密码修改"
      fixed
      placeholder
      left-arrow
      @click-left="onClickLeft"
    />
    <van-form validate-first ref="form">
      <div class="tabsBox">
        <van-field
          v-model="user.oldPassword"
          type="password"
          placeholder="请输入原密码"
          :rules="[{ required: true }]"
        >
          <template #left-icon>
            <van-icon name="../../../../static/images/lawEnforcement/icon/icon_xgmm.png"></van-icon>
          </template>
        </van-field>
        <van-field
          v-model="user.newPassword"
          type="password"
          placeholder="请输入新密码"
          :rules="[{ required: true }]"
        >
          <template #left-icon>
            <van-icon name="../../../../static/images/lawEnforcement/icon/icon_xgmm.png"></van-icon>
          </template>
        </van-field>
        <van-field
          v-model="user.confirmPassword"
          type="password"
          placeholder="请确认新密码"
          :rules="[{ required: true }]"
        >
          <template #left-icon>
            <van-icon name="../../../../static/images/lawEnforcement/icon/icon_xgmm.png"></van-icon>
          </template>
        </van-field>
      </div>
      <van-button type="default" class="loginOut" @click="submit">完成</van-button>
    </van-form>
  </div>
</template>
<script>
import { updateUserPwd } from "@/api/lawEnforcement/index";
export default {
  name: "index",
  data() {
    return {
      active:0,
      message:'',
      password:'',
      newPassword:'',
      user: {
        oldPassword: undefined,
        newPassword: undefined,
        confirmPassword: undefined
      },
    };
  },
  created() {

  },
  methods: {
    submit() {
      const data = {
        oldPassword:this.user.oldPassword,
        newPassword:this.user.newPassword
      }
      updateUserPwd(data).then(response => {
        this.$notify({ type: 'success' , message: response.msg });
      });
    },
  },
};
</script>

<style scoped lang="scss">
@font-face {
  font-family: SourceHanSansCNBold;
  src: url("../../../assets/fonts/SourceHanSansCN-Bold.otf");
}
.tabsBox{
  padding: 2% 0;
  margin: 0 auto;
  background-color: #FFF;
  border-radius: 8PX;
  box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  margin-bottom: 15PX;
  margin-top: 15PX;
  width: 92%;
}
.loginOut{
  width: 88%;
  margin: 10PX 6%;
  border-radius: 8Px;
  box-shadow: 0PX 5PX 5PX #cccccc;
  border: none;
  background-color: #1D6FE9;
  color: #FFF;
}
</style>
