<template>
  <div class="main">
    <h3>{{$t('rencently_sign_in')}}</h3>
    <div class="content">
       <Table border :columns="columns1" :data="data1" :width=660></Table>
    </div>
  </div>
</template>

<script>
import { GetLoginRecord } from '@/api/account.js'
import { getToken } from '@/libs/util'
export default {
  name: 'loginRecord',
  data () {
    return {
      token: getToken(),
      columns1: [
        {
          title: this.$t('index'),
          key: 'name',
          type: 'index',
          width: 80,
          align: 'center'
        },
        {
          title: this.$t('login_time'),
          key: 'login_time',
          align: 'center'
        },
        {
          title: this.$t('login_ip'),
          key: 'login_ip',
          align: 'center'
        }
      ],
      data1: []
    }
  },
  created () {
    this.getRecord()
  },
  methods: {
    getRecord () {
      const data = new FormData()
      data.append('access_token', this.token)
      GetLoginRecord(data).then(res => {
        // console.log(res)
        if (res.ret === 200) {
          this.data1 = res.data.records
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.main {
  padding: 18px;
  background-color: #fff;
  height: 800px;

  h3{
    font-size: 18px;
    padding-bottom: 20px;
  }

  .content {
  width: 660px;
  margin: 5px 20px;
  }
}

</style>
