123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- <template>
- <div :class="prefixCls">
- <div :class="`${prefixCls}__unlock`" @click="handleShowForm(false)" v-show="showDate">
- <LockOutlined />
- <span>{{ t('sys.lock.unlock') }}</span>
- </div>
- <div :class="`${prefixCls}__date`">
- <div :class="`${prefixCls}__hour`">
- {{ hour }}
- <span class="meridiem" v-show="showDate">{{ meridiem }}</span>
- </div>
- <div :class="`${prefixCls}__minute`">{{ minute }} </div>
- </div>
- <transition name="fade-slide">
- <div :class="`${prefixCls}-entry`" v-show="!showDate">
- <div :class="`${prefixCls}-entry-content`">
- <div :class="`${prefixCls}-entry__header`">
- <img src="/@/assets/images/header.jpg" :class="`${prefixCls}-entry__header-img`" />
- <p :class="`${prefixCls}-entry__header-name`">{{ realName }}</p>
- </div>
- <InputPassword :placeholder="t('sys.lock.placeholder')" v-model:value="password" />
- <span :class="`${prefixCls}-entry__err-msg`" v-if="errMsgRef">
- {{ t('sys.lock.alert') }}
- </span>
- <div :class="`${prefixCls}-entry__footer`">
- <a-button
- type="link"
- size="small"
- class="mt-2 mr-2"
- :disabled="loadingRef"
- @click="handleShowForm(true)"
- >
- {{ t('sys.lock.back') }}
- </a-button>
- <a-button
- type="link"
- size="small"
- class="mt-2 mr-2"
- :disabled="loadingRef"
- @click="goLogin"
- >
- {{ t('sys.lock.backToLogin') }}
- </a-button>
- <a-button class="mt-2" type="link" size="small" @click="unLock()" :loading="loadingRef">
- {{ t('sys.lock.entry') }}
- </a-button>
- </div>
- </div>
- </div>
- </transition>
- <div :class="`${prefixCls}__footer-date`">
- <div class="time" v-show="!showDate">
- {{ hour }}:{{ minute }} <span class="meridiem">{{ meridiem }}</span>
- </div>
- <div class="date"> {{ year }}/{{ month }}/{{ day }} {{ week }} </div>
- </div>
- </div>
- </template>
- <script lang="ts">
- import { defineComponent, ref, computed } from 'vue';
- import { Alert, Input } from 'ant-design-vue';
- import { userStore } from '/@/store/modules/user';
- import { lockStore } from '/@/store/modules/lock';
- import { useI18n } from '/@/hooks/web/useI18n';
- import { useNow } from './useNow';
- import { useDesign } from '/@/hooks/web/useDesign';
- import { LockOutlined } from '@ant-design/icons-vue';
- export default defineComponent({
- name: 'LockPage',
- components: { Alert, LockOutlined, InputPassword: Input.Password },
- setup() {
- const passwordRef = ref('');
- const loadingRef = ref(false);
- const errMsgRef = ref(false);
- const showDate = ref(true);
- const { prefixCls } = useDesign('lock-page');
- const { start, stop, ...state } = useNow(true);
- const { t } = useI18n();
- const realName = computed(() => {
- const { realName } = userStore.getUserInfoState || {};
- return realName;
- });
- /**
- * @description: unLock
- */
- async function unLock() {
- if (!passwordRef.value) {
- return;
- }
- let password = passwordRef.value;
- try {
- loadingRef.value = true;
- const res = await lockStore.unLockAction({ password });
- errMsgRef.value = !res;
- } finally {
- loadingRef.value = false;
- }
- }
- function goLogin() {
- userStore.loginOut(true);
- lockStore.resetLockInfo();
- }
- function handleShowForm(show = false) {
- showDate.value = show;
- }
- return {
- goLogin,
- realName,
- unLock,
- errMsgRef,
- loadingRef,
- t,
- prefixCls,
- showDate,
- password: passwordRef,
- handleShowForm,
- ...state,
- };
- },
- });
- </script>
- <style lang="less" scoped>
- @import (reference) '../../../design/index.less';
- @prefix-cls: ~'@{namespace}-lock-page';
- .@{prefix-cls} {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 3000;
- display: flex;
- width: 100vw;
- height: 100vh;
- // background: rgba(23, 27, 41);
- background: #000;
- align-items: center;
- justify-content: center;
- &__unlock {
- position: absolute;
- top: 0;
- left: 50%;
- display: flex;
- height: 50px;
- padding-top: 20px;
- font-size: 18px;
- color: #fff;
- cursor: pointer;
- transform: translate(-50%, 0);
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- transition: all 0.3s;
- }
- &__date {
- display: flex;
- width: 100vw;
- height: 100vh;
- align-items: center;
- justify-content: center;
- }
- &__hour {
- position: relative;
- margin-right: 80px;
- .meridiem {
- position: absolute;
- top: 20px;
- left: 20px;
- font-size: 26px;
- }
- @media (max-width: @screen-xs) {
- margin-right: 20px;
- }
- }
- &__hour,
- &__minute {
- display: flex;
- width: 40%;
- height: 74%;
- // font-size: 50em;
- font-weight: 700;
- color: #bababa;
- background: #141313;
- border-radius: 30px;
- justify-content: center;
- align-items: center;
- // .respond-to(large-only, { font-size: 25em;});
- // .respond-to(large-only, { font-size: 30em;});
- @media (min-width: @screen-xxxl-min) {
- font-size: 46em;
- }
- @media (min-width: @screen-xl-max) and (max-width: @screen-xxl-max) {
- font-size: 38em;
- }
- @media (min-width: @screen-lg-max) and (max-width: @screen-xl-max) {
- font-size: 30em;
- }
- @media (min-width: @screen-md-max) and (max-width: @screen-lg-max) {
- font-size: 23em;
- }
- @media (min-width: @screen-sm-max) and (max-width: @screen-md-max) {
- font-size: 19em;
- }
- @media (min-width: @screen-xs-max) and (max-width: @screen-sm-max) {
- font-size: 13em;
- }
- @media (max-width: @screen-xs) {
- height: 50%;
- font-size: 6em;
- border-radius: 20px;
- }
- }
- &__footer-date {
- position: absolute;
- bottom: 20px;
- left: 50%;
- font-family: helvetica;
- color: #bababa;
- transform: translate(-50%, 0);
- .time {
- font-size: 50px;
- .meridiem {
- font-size: 32px;
- }
- }
- .date {
- font-size: 26px;
- }
- }
- &-entry {
- position: absolute;
- top: 0;
- left: 0;
- display: flex;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.5);
- backdrop-filter: blur(10px);
- justify-content: center;
- align-items: center;
- &-content {
- width: 260px;
- }
- &__header {
- text-align: center;
- &-img {
- width: 70px;
- border-radius: 50%;
- }
- &-name {
- margin-top: 5px;
- font-weight: 500;
- color: #bababa;
- }
- }
- &__err-msg {
- display: inline-block;
- margin-top: 10px;
- color: @error-color;
- }
- &__footer {
- display: flex;
- justify-content: space-between;
- }
- }
- }
- </style>
|