vben
authored
|
1
|
<template>
|
vben
authored
|
2
3
4
5
6
7
|
<div
:class="prefixCls"
class="fixed inset-0 flex h-screen w-screen bg-black items-center justify-center"
>
<div
:class="`${prefixCls}__unlock`"
|
vben
authored
|
8
|
class="absolute top-0 left-1/2 flex pt-5 h-16 items-center justify-center sm:text-md xl:text-xl text-white flex-col cursor-pointer transform translate-x-1/2"
|
vben
authored
|
9
10
11
|
@click="handleShowForm(false)"
v-show="showDate"
>
|
vben
authored
|
12
13
14
15
|
<LockOutlined />
<span>{{ t('sys.lock.unlock') }}</span>
</div>
|
vben
authored
|
16
17
18
19
20
21
|
<div class="flex w-screen h-screen justify-center items-center">
<div :class="`${prefixCls}__hour`" class="relative mr-5 md:mr-20 w-2/5 h-2/5 md:h-4/5">
<span>{{ hour }}</span>
<span class="meridiem absolute left-5 top-5 text-md xl:text-xl" v-show="showDate">
{{ meridiem }}
</span>
|
vben
authored
|
22
|
</div>
|
vben
authored
|
23
24
|
<div :class="`${prefixCls}__minute w-2/5 h-2/5 md:h-4/5 `">
<span> {{ minute }}</span>
|
vben
authored
|
25
|
</div>
|
vben
authored
|
26
27
28
29
|
</div>
<transition name="fade-slide">
<div :class="`${prefixCls}-entry`" v-show="!showDate">
<div :class="`${prefixCls}-entry-content`">
|
vben
authored
|
30
|
<div :class="`${prefixCls}-entry__header enter-x`">
|
|
31
|
<img :src="userinfo.avatar || headerImg" :class="`${prefixCls}-entry__header-img`" />
|
vben
authored
|
32
|
<p :class="`${prefixCls}-entry__header-name`">
|
|
33
|
{{ userinfo.realName }}
|
vben
authored
|
34
|
</p>
|
vben
authored
|
35
|
</div>
|
vben
authored
|
36
37
38
39
40
|
<InputPassword
:placeholder="t('sys.lock.placeholder')"
class="enter-x"
v-model:value="password"
/>
|
Vben
authored
|
41
|
<span :class="`${prefixCls}-entry__err-msg enter-x`" v-if="errMsg">
|
vben
authored
|
42
43
|
{{ t('sys.lock.alert') }}
</span>
|
vben
authored
|
44
|
<div :class="`${prefixCls}-entry__footer enter-x`">
|
vben
authored
|
45
46
47
|
<a-button
type="link"
size="small"
|
vben
authored
|
48
|
class="mt-2 mr-2 enter-x"
|
Vben
authored
|
49
|
:disabled="loading"
|
vben
authored
|
50
51
|
@click="handleShowForm(true)"
>
|
vben
authored
|
52
|
{{ t('common.back') }}
|
vben
authored
|
53
54
55
56
|
</a-button>
<a-button
type="link"
size="small"
|
vben
authored
|
57
|
class="mt-2 mr-2 enter-x"
|
Vben
authored
|
58
|
:disabled="loading"
|
vben
authored
|
59
60
61
62
|
@click="goLogin"
>
{{ t('sys.lock.backToLogin') }}
</a-button>
|
Vben
authored
|
63
|
<a-button class="mt-2" type="link" size="small" @click="unLock()" :loading="loading">
|
vben
authored
|
64
65
66
67
68
69
70
|
{{ t('sys.lock.entry') }}
</a-button>
</div>
</div>
</div>
</transition>
|
vben
authored
|
71
72
73
|
<div class="absolute bottom-5 w-full text-gray-300 xl:text-xl 2xl:text-3xl text-center enter-y">
<div class="text-5xl mb-4 enter-x" v-show="!showDate">
{{ hour }}:{{ minute }} <span class="text-3xl">{{ meridiem }}</span>
|
vben
authored
|
74
|
</div>
|
vben
authored
|
75
|
<div class="text-2xl">{{ year }}/{{ month }}/{{ day }} {{ week }}</div>
|
vben
authored
|
76
77
78
|
</div>
</div>
</template>
|
vben
authored
|
79
80
|
<script lang="ts" setup>
import { ref, computed } from 'vue';
|
vben
authored
|
81
|
import { Input } from 'ant-design-vue';
|
Vben
authored
|
82
83
|
import { useUserStore } from '/@/store/modules/user';
import { useLockStore } from '/@/store/modules/lock';
|
vben
authored
|
84
85
86
87
|
import { useI18n } from '/@/hooks/web/useI18n';
import { useNow } from './useNow';
import { useDesign } from '/@/hooks/web/useDesign';
import { LockOutlined } from '@ant-design/icons-vue';
|
vben
authored
|
88
|
import headerImg from '/@/assets/images/header.jpg';
|
vben
authored
|
89
|
|
vben
authored
|
90
|
const InputPassword = Input.Password;
|
vben
authored
|
91
|
|
vben
authored
|
92
93
94
95
|
const password = ref('');
const loading = ref(false);
const errMsg = ref(false);
const showDate = ref(true);
|
vben
authored
|
96
|
|
vben
authored
|
97
98
99
|
const { prefixCls } = useDesign('lock-page');
const lockStore = useLockStore();
const userStore = useUserStore();
|
vben
authored
|
100
|
|
vben
authored
|
101
|
const { hour, month, minute, meridiem, year, day, week } = useNow(true);
|
vben
authored
|
102
|
|
vben
authored
|
103
|
const { t } = useI18n();
|
vben
authored
|
104
|
|
vben
authored
|
105
106
107
|
const userinfo = computed(() => {
return userStore.getUserInfo || {};
});
|
vben
authored
|
108
|
|
vben
authored
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/**
* @description: unLock
*/
async function unLock() {
if (!password.value) {
return;
}
let pwd = password.value;
try {
loading.value = true;
const res = await lockStore.unLock(pwd);
errMsg.value = !res;
} finally {
loading.value = false;
}
}
|
vben
authored
|
125
|
|
vben
authored
|
126
127
128
129
|
function goLogin() {
userStore.logout(true);
lockStore.resetLockInfo();
}
|
vben
authored
|
130
|
|
vben
authored
|
131
132
133
|
function handleShowForm(show = false) {
showDate.value = show;
}
|
vben
authored
|
134
135
136
137
138
|
</script>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-lock-page';
.@{prefix-cls} {
|
vben
authored
|
139
|
z-index: @lock-page-z-index;
|
vben
authored
|
140
141
142
143
144
145
146
147
148
149
|
&__unlock {
transform: translate(-50%, 0);
}
&__hour,
&__minute {
display: flex;
font-weight: 700;
color: #bababa;
|
Vben
authored
|
150
|
background-color: #141313;
|
vben
authored
|
151
152
153
154
|
border-radius: 30px;
justify-content: center;
align-items: center;
|
vben
authored
|
155
156
157
158
|
@media screen and (max-width: @screen-md) {
span:not(.meridiem) {
font-size: 160px;
}
|
vben
authored
|
159
|
}
|
vben
authored
|
160
|
|
vben
authored
|
161
162
163
|
@media screen and (min-width: @screen-md) {
span:not(.meridiem) {
font-size: 160px;
|
vben
authored
|
164
|
}
|
vben
authored
|
165
|
}
|
vben
authored
|
166
|
|
vben
authored
|
167
168
169
|
@media screen and (max-width: @screen-sm) {
span:not(.meridiem) {
font-size: 90px;
|
vben
authored
|
170
|
}
|
vben
authored
|
171
|
}
|
vben
authored
|
172
173
174
|
@media screen and (min-width: @screen-lg) {
span:not(.meridiem) {
font-size: 220px;
|
vben
authored
|
175
176
177
|
}
}
|
vben
authored
|
178
179
180
181
182
183
184
185
186
|
@media screen and (min-width: @screen-xl) {
span:not(.meridiem) {
font-size: 260px;
}
}
@media screen and (min-width: @screen-2xl) {
span:not(.meridiem) {
font-size: 320px;
}
|
vben
authored
|
187
188
189
190
191
192
193
194
195
196
|
}
}
&-entry {
position: absolute;
top: 0;
left: 0;
display: flex;
width: 100%;
height: 100%;
|
vben
authored
|
197
|
background-color: rgb(0 0 0 / 50%);
|
vben
authored
|
198
199
200
201
202
203
204
205
206
207
208
209
210
|
backdrop-filter: blur(8px);
justify-content: center;
align-items: center;
&-content {
width: 260px;
}
&__header {
text-align: center;
&-img {
width: 70px;
|
vben
authored
|
211
|
margin: 0 auto;
|
vben
authored
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
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>
|