Blame view

antis-ncc-net-core/admin-web/src/layout/index.vue 1.17 KB
4aba9b59   wwk   1
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
  <template>
    <component :is="layoutType" />
  </template>
  
  <script>
  import { mapState, mapGetters } from "vuex";
  import classic from './classic/index.vue'
  import functional from './functional/index.vue'
  import plain from './plain/index.vue'
  import blend from './blend/index.vue'
  
  export default {
    name: 'Layout',
    components: { classic, functional, plain, blend },
    computed: {
      ...mapState({
        layoutType: state => state.settings.layoutType
      }),
      ...mapGetters(['userInfo'])
    },
    beforeRouteEnter(to, from, next) {
      next((vm) => {
        if (vm.userInfo.prevLogin == 1 && from.path == '/login') {
          //右下角提示上次登录信息
          vm.openNotify()
        }
      })
    },
    methods: {
      openNotify() {
        this.$notify({
          title: '上次登录信息',
          dangerouslyUseHTMLString: true,
          duration: 2000,
          position: 'bottom-right',
          message: `<div style='padding: 10px 0 0 ;'>
          <p>时间: ${this.ncc.toDate(this.userInfo.prevLoginTime)} </p>
          <p>地点: ${this.userInfo.prevLoginIPAddressName || ''} </p>
          <p>IP: ${this.userInfo.prevLoginIPAddress || ''}  </p></div>
          `
        });
      }
    }
  }
  </script>