fix: 锁屏密码base处理,无密码进入

This commit is contained in:
TsMask
2025-04-22 14:22:06 +08:00
parent 6ab4e80b38
commit ceea517613
2 changed files with 7 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ type MaskStateType = {
const useMaskStore = defineStore('mask', {
state: (): MaskStateType => ({
type: (localGet(CACHE_LOCAL_MASK) || 'none') as MaskStateType['type'],
lockPasswd: localGet(CACHE_LOCAL_LOCK_PASSWD) || '',
lockPasswd: atob(localGet(CACHE_LOCAL_LOCK_PASSWD) || ''),
lockTimeout: 0,
}),
getters: {},
@@ -59,7 +59,7 @@ const useMaskStore = defineStore('mask', {
}, 5_000);
}
if (type === 'lock') {
localSet(CACHE_LOCAL_LOCK_PASSWD, this.lockPasswd);
localSet(CACHE_LOCAL_LOCK_PASSWD, btoa(this.lockPasswd));
} else {
localRemove(CACHE_LOCAL_LOCK_PASSWD);
}

View File

@@ -79,7 +79,7 @@ onMounted(() => {
</span>
</div>
<div class="lock-screen_login-from">
<a-input-group compact>
<a-input-group compact v-if="maskStore.lockPasswd">
<a-input
type="password"
v-model:value="password"
@@ -87,7 +87,10 @@ onMounted(() => {
:maxlength="32"
style="width: calc(100% - 50px)"
@keyup.enter="handleUnlock"
/>
></a-input>
<a-button type="primary" block @click="handleUnlock" v-else>
{{ t('components.LockScreen.enter') }}
</a-button>
<a-button type="primary" @click="handleUnlock">
<LoginOutlined />
</a-button>