fix: 优化锁屏页面
This commit is contained in:
@@ -1,17 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import { ref, toRaw, onMounted, onUnmounted } from 'vue';
|
||||||
ref,
|
|
||||||
toRaw,
|
|
||||||
onMounted,
|
|
||||||
onUnmounted,
|
|
||||||
getCurrentInstance,
|
|
||||||
reactive,
|
|
||||||
} from 'vue';
|
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { Form, message } from 'ant-design-vue/lib';
|
import { message } from 'ant-design-vue/lib';
|
||||||
import { getToken } from '@/plugins/auth-token';
|
import { getToken } from '@/plugins/auth-token';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
import { localGet, localSet, localRemove } from '@/utils/cache-local-utils';
|
import { localGet, localSet } from '@/utils/cache-local-utils';
|
||||||
import { getConfigKey } from '@/api/system/config';
|
import { getConfigKey } from '@/api/system/config';
|
||||||
import { CACHE_LOCAL_LOCK } from '@/constants/cache-keys-constants';
|
import { CACHE_LOCAL_LOCK } from '@/constants/cache-keys-constants';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
@@ -76,8 +69,9 @@ onMounted(() => {
|
|||||||
window.addEventListener('mousemove', resetTimeout);
|
window.addEventListener('mousemove', resetTimeout);
|
||||||
window.addEventListener('keydown', resetTimeout);
|
window.addEventListener('keydown', resetTimeout);
|
||||||
}
|
}
|
||||||
if (localGet(CACHE_LOCAL_LOCK) && getToken()) {
|
const lockStr = localGet(CACHE_LOCAL_LOCK) || '';
|
||||||
isLocked.value = localGet(CACHE_LOCAL_LOCK) === 'false' ? false : true;
|
if (lockStr && getToken()) {
|
||||||
|
isLocked.value = Boolean(lockStr);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -95,26 +89,25 @@ onUnmounted(() => {
|
|||||||
</a-button>
|
</a-button>
|
||||||
|
|
||||||
<a-modal
|
<a-modal
|
||||||
ref="modalRef"
|
|
||||||
v-model:visible="isLocked"
|
v-model:visible="isLocked"
|
||||||
:wrap-style="{
|
get-container="#app"
|
||||||
overflow: 'hidden',
|
:footer="null"
|
||||||
border: 'none',
|
|
||||||
background: 'rgba(0, 0, 0, 0.5)',
|
|
||||||
}"
|
|
||||||
:closable="false"
|
:closable="false"
|
||||||
:keyboard="false"
|
:keyboard="false"
|
||||||
:centered="true"
|
:centered="true"
|
||||||
:maskStyle="{ backdropFilter: 'blur(10px)' }"
|
|
||||||
:bodyStyle="{ border: 'none', backgroundColor: ' transparent' }"
|
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
wrapClassName="modalContentCss"
|
:maskStyle="{
|
||||||
:footer="null"
|
backdropFilter: 'blur(10px)',
|
||||||
@ok="handleUnlock"
|
WebkitBackdropFilter: 'blur(10px)',
|
||||||
@cancel="backLogin"
|
}"
|
||||||
|
wrapClassName="lock-screen"
|
||||||
|
:wrap-style="{
|
||||||
|
background: 'rgba(0, 0, 0, 0.85)',
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<div class="lock-screen-content">
|
<!-- 锁屏块 -->
|
||||||
<div class="user">
|
<div class="lock-screen_login">
|
||||||
|
<div class="lock-screen_login-user">
|
||||||
<a-avatar
|
<a-avatar
|
||||||
shape="circle"
|
shape="circle"
|
||||||
:size="100"
|
:size="100"
|
||||||
@@ -125,78 +118,72 @@ onUnmounted(() => {
|
|||||||
{{ userStore.nickName }}
|
{{ userStore.nickName }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<a-row>
|
<div class="lock-screen_login-from">
|
||||||
<a-col :span="24">
|
<a-input-group compact>
|
||||||
<a-input
|
<a-input
|
||||||
type="password"
|
type="password"
|
||||||
v-model:value="password"
|
v-model:value="password"
|
||||||
class="passwordCss"
|
:placeholder="t('components.LockScreen.inputPlacePwd')"
|
||||||
placeholder="Enter your password"
|
:maxlength="32"
|
||||||
|
style="width: calc(100% - 50px)"
|
||||||
@keyup.enter="handleUnlock"
|
@keyup.enter="handleUnlock"
|
||||||
/>
|
/>
|
||||||
<a-button type="text" class="backCss" @click="handleUnlock">
|
<a-button type="primary" @click="handleUnlock">
|
||||||
<template #icon
|
<LoginOutlined />
|
||||||
><login-outlined style="font-size: large"
|
|
||||||
/></template>
|
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-col>
|
</a-input-group>
|
||||||
|
<a-button type="text" class="logout" @click="backLogin">
|
||||||
<a-col :span="24">
|
{{ t('components.LockScreen.backLogin') }}
|
||||||
<a-button type="text" class="backCss" @click="backLogin">
|
</a-button>
|
||||||
{{ t('components.LockScreen.backLogin') }}
|
</div>
|
||||||
</a-button>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
</div>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.user {
|
.lock-screen_login {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
.nick {
|
background-color: transparent;
|
||||||
padding-top: 10px;
|
|
||||||
font-size: 28px;
|
&-user {
|
||||||
max-width: 164px;
|
display: flex;
|
||||||
white-space: nowrap;
|
flex-direction: column;
|
||||||
text-align: start;
|
justify-content: center;
|
||||||
text-overflow: ellipsis;
|
align-items: center;
|
||||||
overflow: hidden;
|
.nick {
|
||||||
color: #fff;
|
font-size: 28px;
|
||||||
|
max-width: 164px;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: start;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.lock-screen-content {
|
|
||||||
text-align: center;
|
|
||||||
background-color: transparent; /* 设置为透明背景 */
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lock-screen-content input {
|
&-from {
|
||||||
background-color: transparent !important;
|
display: flex;
|
||||||
margin: 10px 0;
|
flex-flow: column;
|
||||||
padding: 5px;
|
width: 256px;
|
||||||
width: 200px;
|
margin-top: 30px;
|
||||||
}
|
|
||||||
|
|
||||||
.passwordCss {
|
.logout {
|
||||||
color: #fff;
|
margin-top: 8px;
|
||||||
font-weight: bold;
|
color: rgba(255, 255, 255, 0.85);
|
||||||
}
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
|
||||||
|
&:hover {
|
||||||
.backCss {
|
color: var(--ant-primary-color);
|
||||||
color: #fff;
|
}
|
||||||
&:hover {
|
}
|
||||||
color: #4281ff;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.modalContentCss {
|
.lock-screen {
|
||||||
.ant-modal-content {
|
.ant-modal-content {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|||||||
@@ -122,13 +122,10 @@ export default {
|
|||||||
onlyAllow:'Only supports upload file formats',
|
onlyAllow:'Only supports upload file formats',
|
||||||
},
|
},
|
||||||
LockScreen: {
|
LockScreen: {
|
||||||
setTitle:'Set Lock Screen Password',
|
inputPlacePwd:'Please enter login password',
|
||||||
setPwd:'Password',
|
validSucc:'Validation Passed',
|
||||||
unlockTitle:'Unlock Screen',
|
validError:'Validation Failure',
|
||||||
unlock:'Unlock',
|
backLogin:'Logout to Relogin',
|
||||||
validSucc: 'Verification Passed',
|
|
||||||
validError: 'Verification Failed',
|
|
||||||
backLogin:'Return to login',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -122,13 +122,10 @@ export default {
|
|||||||
onlyAllow:'只支持上传文件格式',
|
onlyAllow:'只支持上传文件格式',
|
||||||
},
|
},
|
||||||
LockScreen: {
|
LockScreen: {
|
||||||
setTitle:'设置锁屏密码',
|
inputPlacePwd:'请输入登录密码',
|
||||||
setPwd:'锁屏密码',
|
|
||||||
unlockTitle:'解锁',
|
|
||||||
unlock:'解锁',
|
|
||||||
validSucc:'校验通过',
|
validSucc:'校验通过',
|
||||||
validError:'校验失败',
|
validError:'校验失败',
|
||||||
backLogin:'返回登录页',
|
backLogin:'退出并重新登录',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user