Blame view

src/views/demo/system/password/index.vue 1.4 KB
Vben authored
1
<template>
2
3
4
5
6
  <PageWrapper title="修改当前用户密码" content="修改成功后会自动退出当前登录!">
    <div class="py-8 bg-white flex flex-col justify-center items-center">
      <BasicForm @register="register" />
      <div class="flex justify-center">
        <a-button @click="resetFields"> 重置 </a-button>
Vben authored
7
        <a-button class="!ml-4" type="primary" @click="handleSubmit"> 确认 </a-button>
8
      </div>
Vben authored
9
    </div>
10
  </PageWrapper>
Vben authored
11
12
13
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
14
  import { PageWrapper } from '/@/components/Page';
Vben authored
15
16
17
18
19
  import { BasicForm, useForm } from '/@/components/Form';

  import { formSchema } from './pwd.data';
  export default defineComponent({
    name: 'ChangePassword',
20
    components: { BasicForm, PageWrapper },
Vben authored
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    setup() {
      const [register, { validate, resetFields }] = useForm({
        size: 'large',
        labelWidth: 100,
        showActionButtonGroup: false,
        schemas: formSchema,
      });

      async function handleSubmit() {
        try {
          const values = await validate();
          const { passwordOld, passwordNew } = values;

          // TODO custom api
          console.log(passwordOld, passwordNew);
          // const { router } = useRouter();
          // router.push(pageEnum.BASE_LOGIN);
        } catch (error) {}
      }

      return { register, resetFields, handleSubmit };
    },
  });
</script>