🎨 格式化LockPage.vue避免eslint报错

pull/6896/head
Caffeine19 2024-07-15 14:16:59 +08:00
parent 4477f03cf3
commit 4be0f376cb
1 changed files with 18 additions and 13 deletions

View File

@ -30,15 +30,21 @@
{{ userinfo.realname }} {{ userinfo.realname }}
</p> </p>
</div> </div>
<InputPassword @change="unLock('change')" @keyup.enter="unLock('enter')" :placeholder="t('sys.lock.placeholder')" class="enter-x" v-model:value="password" /> <InputPassword
@change="unLock('change')"
@keyup.enter="unLock('enter')"
:placeholder="t('sys.lock.placeholder')"
class="enter-x"
v-model:value="password"
/>
<span :class="`${prefixCls}-entry__err-msg enter-x`" v-if="errMsg"> <span :class="`${prefixCls}-entry__err-msg enter-x`" v-if="errMsg">
{{ t('sys.lock.alert') }} {{ t('sys.lock.alert') }}
</span> </span>
<div :class="`${prefixCls}-entry__footer enter-x`" style="justify-content:center;margin-top: 4px"> <div :class="`${prefixCls}-entry__footer enter-x`" style="justify-content: center; margin-top: 4px">
<!-- <a-button type="link" size="small" class="mt-2 mr-2 enter-x" :disabled="loading" @click="handleShowForm(true)"> <!-- <a-button type="link" size="small" class="mt-2 mr-2 enter-x" :disabled="loading" @click="handleShowForm(true)">
{{ t('common.back') }} {{ t('common.back') }}
</a-button>--> </a-button>-->
<a-button type="link" size="small" :disabled="loading" @click="goLogin"> <a-button type="link" size="small" :disabled="loading" @click="goLogin">
{{ t('sys.lock.backToLogin') }} {{ t('sys.lock.backToLogin') }}
</a-button> </a-button>
<!-- <a-button class="mt-2" type="link" size="small" @click="unLock()" :loading="loading"> <!-- <a-button class="mt-2" type="link" size="small" @click="unLock()" :loading="loading">
@ -58,7 +64,7 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref, computed, onMounted, onUnmounted} from 'vue'; import { ref, computed, onMounted, onUnmounted } from 'vue';
import { Input } from 'ant-design-vue'; import { Input } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import { useLockStore } from '/@/store/modules/lock'; import { useLockStore } from '/@/store/modules/lock';
@ -89,7 +95,7 @@ import {ref, computed, onMounted, onUnmounted} from 'vue';
/** /**
* @description: unLock * @description: unLock
* *
* @param type enter 回车 change input值发生改变 不提示锁屏密码错误 * @param type enter 回车 change input值发生改变 不提示锁屏密码错误
*/ */
async function unLock(type) { async function unLock(type) {
@ -100,7 +106,7 @@ import {ref, computed, onMounted, onUnmounted} from 'vue';
try { try {
loading.value = true; loading.value = true;
const res = await lockStore.unLock(pwd); const res = await lockStore.unLock(pwd);
if(type === 'enter'){ if (type === 'enter') {
errMsg.value = !res; errMsg.value = !res;
} }
} finally { } finally {
@ -119,7 +125,7 @@ import {ref, computed, onMounted, onUnmounted} from 'vue';
/** /**
* 监听键盘触发事件 * 监听键盘触发事件
* *
* @param event * @param event
*/ */
function handleKeyDown(event) { function handleKeyDown(event) {
@ -129,15 +135,14 @@ import {ref, computed, onMounted, onUnmounted} from 'vue';
password.value = ''; password.value = '';
} }
} }
onMounted(()=>{ onMounted(() => {
window.addEventListener('keydown', handleKeyDown); window.addEventListener('keydown', handleKeyDown);
}) });
onUnmounted(()=>{ onUnmounted(() => {
window.removeEventListener('keydown', handleKeyDown); window.removeEventListener('keydown', handleKeyDown);
}) });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@prefix-cls: ~'@{namespace}-lock-page'; @prefix-cls: ~'@{namespace}-lock-page';