<template>
  <div id="index">
    <p class="TopSystem">
      {{ user.userName }}，欢迎您使用本系统<span style="margin-left: 20px"
        >本次登录的时间：{{ changeDateTime(user.loginDate) }}</span
      >
      <span style="margin-left: 14px"
        >您上次登录的时间：{{ changeDateTime(user.preLoginDate) }}</span
      >
    </p>
  </div>
</template>
<script>
import { getInfo } from "@/api/login";
export default {
  name: "Index",
  data() {
    return {
      user: {},
    };
  },
  computed: {
    changeDateTime: function () {
      return function (date) {
        if (date) {
          let da = this.$methodsTools.onlyForma(
            new Date(date).getTime() / 1000
          );
          return da;
        } else {
          return "没有记录";
        }
      };
    },
  },
  created() {
    getInfo().then((res) => {
      this.user = res.data.user;
    });
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.TopSystem {
  margin: 0px;
  font-size: 14px;
  font-weight: 400;
  color: #999999;
}
</style>
