|
|
|
@ -1,6 +1,6 @@
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { ref } from 'vue'
|
|
|
|
import { ref, watch } from 'vue'
|
|
|
|
import { Dialog } from '@/components/Dialog'
|
|
|
|
import { Dialog } from '@/components/Dialog'
|
|
|
|
import { Form } from '@/components/Form'
|
|
|
|
import { Form } from '@/components/Form'
|
|
|
|
import { useForm } from '@/hooks/web/useForm'
|
|
|
|
import { useForm } from '@/hooks/web/useForm'
|
|
|
|
@ -35,6 +35,20 @@ const dialogVisible = computed({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 自动聚焦输入框
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
|
|
dialogVisible,
|
|
|
|
|
|
|
|
async (val) => {
|
|
|
|
|
|
|
|
if (val) {
|
|
|
|
|
|
|
|
const formExposeInput = await getComponentExpose('password')
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
formExposeInput?.focus()
|
|
|
|
|
|
|
|
}, 10)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const dialogTitle = ref(t('lock.lockScreen'))
|
|
|
|
const dialogTitle = ref(t('lock.lockScreen'))
|
|
|
|
|
|
|
|
|
|
|
|
const rules = reactive({
|
|
|
|
const rules = reactive({
|
|
|
|
@ -48,14 +62,20 @@ const schema: FormSchema[] = reactive([
|
|
|
|
component: 'Input',
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
componentProps: {
|
|
|
|
type: 'password',
|
|
|
|
type: 'password',
|
|
|
|
showPassword: true
|
|
|
|
showPassword: true,
|
|
|
|
|
|
|
|
// 按下enter键触发登录
|
|
|
|
|
|
|
|
onKeydown: (_e: any) => {
|
|
|
|
|
|
|
|
if (_e.key === 'Enter') {
|
|
|
|
|
|
|
|
handleLock()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
const { formRegister, formMethods } = useForm()
|
|
|
|
const { formRegister, formMethods } = useForm()
|
|
|
|
|
|
|
|
|
|
|
|
const { getFormData, getElFormExpose } = formMethods
|
|
|
|
const { getFormData, getElFormExpose, getComponentExpose } = formMethods
|
|
|
|
|
|
|
|
|
|
|
|
const handleLock = async () => {
|
|
|
|
const handleLock = async () => {
|
|
|
|
const formExpose = await getElFormExpose()
|
|
|
|
const formExpose = await getElFormExpose()
|
|
|
|
|