<template>
  <div class="app-container">
    <search-form
      :list-loading="listLoading"
      @change="searchHandle"
    />
    <table-list
      :list-loading="listLoading"
      :data="tableData2"
      :columns="listConfig"
      :current-page="currentPage"
      :page-size="pageSize"
      :total-records="totalRecords"
      @currentChange="pageHandle"
    />
  </div>
</template>
<script>
import { arrToObj } from '@/utils'
import SearchForm from './components/searchForm/AppLog'
import baseTable from '_m/baseTable.js'
import xData from './mixin'
export default {
  name: 'index',
  components: {
    SearchForm,
  },
  provide() {
    return {
      parentData: this
    }
  },
  mixins: [baseTable],
  data() {
    return {
      apiStr: 'base.admwechatuserloginlist',
      searchForm: null,
      isDtlShow: false,
      curObj: {},
      ...xData
    }
  },
  computed: {
    tableData2() {
      const arr = [...this.tableData]
      arr.map(item => {
        const fpUser = window.sessionStorage.getItem('fp_user') ? JSON.parse(window.sessionStorage.getItem('fp_user')) : {}
        if (fpUser.username === 'admin') {
          item.phones = item.phone
        } else {
          item.phones = item.phone.substring(0, 7) + '****'
        }
      })
      return arr
    }
  },
  created() {},
  mounted() {
    this.listConfig = {
      rows: [
        { label: '头像', prop: 'avatar', type: 'img' },
        { label: '昵称', prop: 'nickname' },
        { label: '手机号', prop: 'phones' },
        { label: '登录时间', prop: 'create_at' },
        { label: '登录IP', prop: 'remote_ip' },
      ]
    }
  },
  methods: {
  }
}
</script>
