yangys
2025-05-27 81060ec4cc3ead9080d4bdb3875920e257583de4
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
<template>
  <div class="mac_bg"></div>
  <div class="login animate__animated" :class="{ animate__bounceOut: pass }">
    <div class="head">
      <img
        src="https://bladex.cn/images/logo-small.png"
        alt=""
      />
    </div>
    <div class="message">{{ userInfo.username }}</div>
    <div class="form">
      <div class="item" style="width: 320px" :class="passwdError ? 'error' : ''">
        <input class="password" placeholder="password here..." v-model="passwd" type="password" />
        <i class="iconfont el-icon-unlock" @click="handleLogin"></i>
        <i class="iconfont icon-tuichu" @click="handleLogout"></i>
      </div>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex';
 
export default {
  data() {
    return {
      passwdError: false,
      passwd: '',
      pass: false,
    };
  },
  computed: {
    ...mapGetters(['userInfo', 'tag', 'lockPasswd']),
  },
  methods: {
    handleLogout() {
      this.$store.dispatch('LogOut').then(() => {
        this.$router.push({ path: '/login' });
      });
    },
    handleLogin() {
      if (this.passwd !== this.lockPasswd) {
        this.passwd = '';
        this.passwdError = true;
        setTimeout(() => {
          this.passwdError = false;
        }, 1000);
        return;
      }
      this.pass = true;
      setTimeout(() => {
        this.$store.commit('CLEAR_LOCK');
        this.$router.push({
          path: this.tag.value,
        });
      }, 1000);
    },
  },
};
</script>
<style lang="scss" scoped>
@use './login.scss';
</style>