<template>
  <div>
      <el-dialog
        v-dialogDrag
        :visible.sync="showModal"
        width="700px"
        title="用户详情"
      >
      <div class="maxHeight">
        <table class="tableClass">
          <tbody>
          <tr>
            <th>帐号</th>
            <td>{{obj.username}}</td>
            <th>真实姓名</th>
            <td>{{obj.realname}}</td>
          </tr>
          <tr>
            <th>QQ</th>
            <td colspan="3">{{obj.qq}}</td>
          </tr>
          <tr>
            <th>手机号</th>
            <td>{{obj.mobile}}</td>
            <th>邮箱</th>
            <td>{{obj.email}}</td>
          </tr>
          <tr>
            <th>性别</th>
            <td>{{obj.sex == 0 ? '男':'女'}}</td>
            <th>授权</th>
            <td>{{obj.accredit == 0 ? '普通':'允许进入后台'}}</td>
          </tr>
          <tr>
            <th>通知微信</th>
            <td v-if="obj.notifyWechat == 1">是</td>
            <td v-if="obj.notifyWechat == 0">否</td>
            <th>状态</th>
            <td>{{obj.status?obj.status.display:''}}</td>
          </tr>
          <tr>
            <th>注册 IP</th>
            <td>{{obj.regip}}</td>
            <th>注册时间</th>
            <td>{{obj.ctimeStr}}</td>
          </tr>
          <tr>
            <th>电子签名</th>
            <td colspan="3">
              <img :src="imgUrl" alt="电子签名" style="width:120px;height:60px">
            </td>
          </tr>
          </tbody>
        </table>
      </div>
      </el-dialog>
  </div>
</template>
<script>
/**
 * 用户详情
 */
import { sysUser } from '../../../api'
import global from '../../../api/config'

export default {
  data() {
    return {
      obj: {},
      showModal: false,
      imgUrl: ''
    }
  },
  methods: {
    _open: async function(id) {
      this.showModal = true
      this.obj = await sysUser.getById(id)
      this.imgUrl =
        global.baseURL +
        '/v1/file_signature/download/' +
        id +
        '?' +
        Math.random()
    }
  }
}
</script>
