1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
| <template>
| <div class="login-container" @keyup.enter="handleLogin">
| <div class="login-time">
| {{ time }}
| </div>
| <div class="login-weaper">
| <div class="login-left animate__animated animate__fadeInLeft">
| <img class="img" src="/img/logo.png" alt="" />
| <p class="title">{{ $t('login.info') }}</p>
| </div>
| <div class="login-border animate__animated animate__fadeInRight">
| <div class="login-main">
| <div class="lock-form animate__animated animate__bounceInDown">
| <div
| class="animate__animated"
| :class="{ shake: passwdError, animate__bounceOut: pass }"
| >
| <h3 style="color: #333">{{ userInfo.username }}</h3>
| <el-input
| placeholder="请输入登录密码"
| type="password"
| class="input-with-select animated"
| v-model="passwd"
| @keyup.enter="handleLogin"
| >
| <template #append>
| <i class="icon-bofangqi-suoping" @click="handleLogin"></i>
|
| <i class="icon-tuichu" @click="handleLogout"></i>
| </template>
| </el-input>
| </div>
| </div>
| </div>
| </div>
| </div>
| </div>
| </template>
| <script>
| import { mapGetters } from 'vuex';
| import { removeRefreshToken, removeToken } from '@/utils/auth';
|
| export default {
| name: 'lock',
| data() {
| return {
| time: '',
| passwd: '',
| passwdError: false,
| pass: false,
| };
| },
| created() {
| this.getTime();
| setInterval(() => {
| this.getTime();
| }, 1000);
| },
| mounted() {},
| computed: {
| ...mapGetters(['userInfo', 'tag', 'lockPasswd']),
| },
| props: [],
| methods: {
| getTime() {
| this.time = this.$dayjs().format('YYYY年MM月DD日 HH:mm:ss');
| },
| handleLogout() {
| this.$confirm('是否退出系统, 是否继续?', '提示', {
| confirmButtonText: '确定',
| cancelButtonText: '取消',
| type: 'warning',
| }).then(() => {
| this.$store.dispatch('LogOut').then(() => {
| // 清除token信息
| removeToken();
| removeRefreshToken();
| this.$router.push({ path: '/login' });
| });
| });
| },
| handleLogin() {
| if (this.passwd !== this.lockPasswd) {
| this.passwd = '';
| this.$message({
| message: '解锁密码错误,请重新输入',
| type: 'error',
| });
| this.passwdError = true;
| setTimeout(() => {
| this.passwdError = false;
| }, 1000);
| return;
| }
| this.pass = true;
| setTimeout(() => {
| this.$store.commit('CLEAR_LOCK');
| this.$router.push({
| path: this.tag.path,
| });
| }, 1000);
| },
| },
| components: {},
| };
| </script>
|
| <style lang="scss"></style>
|
|