pwd.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <Modal width="400px" title="访问密码" :visible="visible" centered class="model-table" :closable="false">
  3. <template #footer>
  4. <Button key="submit" type="primary" @click="okHandler">确定</Button>
  5. </template>
  6. <FormItem label="访问密码" name="password">
  7. <InputPassword v-model:value="password" placeholder="请输入" />
  8. </FormItem>
  9. </Modal>
  10. </template>
  11. <script lang="ts" setup>
  12. import { Modal, FormItem, InputPassword, Button } from 'ant-design-vue'
  13. import { createLoadPack } from '@/utils'
  14. import { ref } from 'vue';
  15. import { authSharePassword } from '@/api';
  16. import { Message } from 'bill/index'
  17. const visible = ref(true)
  18. const password = ref('')
  19. const emit = defineEmits<{ (e: 'close'): void }>()
  20. const okHandler = createLoadPack(async () => {
  21. if (!password.value) {
  22. Message.error("请输入密码!")
  23. return;
  24. }
  25. const pass = await authSharePassword(password.value)
  26. if (pass) {
  27. emit('close')
  28. } else {
  29. Message.error("密码错误,请重新输入。")
  30. }
  31. })
  32. </script>