zhangzengfei
2020-09-02 73c423a9eb390a41242331df97a27a6760938237
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
  <div class="container">
    <span>ip:</span>
    <el-input v-model="ip" style="width:200px"></el-input>
    <el-table :data="response" border>
      <el-table-column label="抓拍图" width="160" align="center">
        <template slot-scope="scope">
          <div>
            <img
              v-if="scope.row.faceImg"
              :src="`data:image/png;base64,`+scope.row.faceImg"
              style="max-height:84px;width:84px;object-fit:contain;background:rgba(0,0,0,0.35);"
              class="avatar"
            />
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="faceId" label="faceId" align="center"></el-table-column>
    </el-table>
  </div>
</template>
 
<script>
import { capture } from './api'
export default {
  data() {
    return {
      ip: "",
      response: []
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    getData() {
      if (this.ip.length) {
        capture({ ip: this.ip }).then(rsp => {
          if (rsp && rsp.rtnCode === '1') {
            this.response.push(rsp.rtnData)
          }
        })
      }
 
      setTimeout(() => {
        this.getData()
      }, 1000)
    }
 
  }
}
</script>
<style lang="scss">
.container {
  width: 100%;
  height: 100%;
  background: #e9ebf2;
}
</style>