<template>
  <div class="mainContainer">
    <div class="mainTableTools">
      <el-row>
        <el-form :inline="true">
          <el-form-item label="用户">
            <el-input v-model="keyword" placeholder="uid/昵称/姓名"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="searchUser">查询</el-button>
          </el-form-item>
          <el-form-item>
            <el-tag>当前设置总人数：<b>{{total}}</b></el-tag>
          </el-form-item>
        </el-form>
      </el-row>
    </div>
    <el-table :data="tableData" border style="width:600px">
      <el-table-column label="用户">
        <template slot-scope="scope">
          <span class="lblue point">
            <a target="_blank" :href="scope.row.host+'/rooter/user/'+scope.row.uid">{{scope.row.nickname}}（{{scope.row.uid}}）</a>
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="home_pwd" label="主页访问密码"></el-table-column>
    </el-table>

    <div class="mainPageBox">
      <el-pagination
        @current-change="changePagination"
        :page-size="20"
        :total="Number(total)"
        layout="total, prev, pager, next"
        background
      ></el-pagination>
    </div>

  </div>
</template>

<script>

  export default {
    data() {
      return {
        page: 1,
        total: 0,
        tableData: [],
        keyword: ''
      }
    },
    computed: {
      
    },
    mounted() {
      this.getList();
    },
    methods: {
      async getList() {
        const data = {
          page: this.page,
          keyword: this.keyword
        };
        let res = await this.$post("/api/admin/UserSetting/getHomepwd", data);
        if (res && res.status === 1) {
          this.tableData = res.data.list;
          this.total = res.data.counter;
        }
      },
      changePagination(val) {
        this.page = val;
        this.getList();
      },
      searchUser() {
        this.getList();
      }

    }
  };
</script>

<style scoped>
  
</style>