pwd.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <Modal width="400px" :title="$t('sys.viewPWD')" :visible="visible" centered class="model-table" :closable="false">
  3. <template #footer>
  4. <Button key="submit" type="primary" @click="okHandler">{{$t('sys.enter')}}</Button>
  5. </template>
  6. <FormItem :label="$t('sys.viewPWD')" name="password">
  7. <InputPassword v-model:value="password" :placeholder="$t('sys.placeInput')" />
  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. import { ui18n } from '@/lang';
  18. const visible = ref(true)
  19. const password = ref('')
  20. const emit = defineEmits<{ (e: 'close'): void }>()
  21. const okHandler = createLoadPack(async () => {
  22. if (!password.value) {
  23. Message.error(ui18n.t('sys.placPWD'))
  24. return;
  25. }
  26. const pass = await authSharePassword(password.value)
  27. if (pass) {
  28. emit('close')
  29. } else {
  30. Message.error(ui18n.t('sys.pwdErr'))
  31. }
  32. })
  33. </script>