<template>
  <div class="page">
    <div class="list" v-if="files.length">
      <img v-for="(item, index) in files" :key="index" :src="item.imageUrl" alt="" @click="previewImage(index)">
    </div>
    <AiEmpty :description="`暂无数据`" class="emptyWrap" v-else/>
  </div>
</template>
<script>
import {mapState} from 'vuex'

export default {
  name: "myCertificate",
  appName: "我的证书",
  data() {
    return {
      files: [],
    }
  },
  computed: {
    ...mapState(['user', 'token']),
  },
  onLoad() {
    uni.setNavigationBarTitle({ 
      title: '我的证书'
    })
    uni.setNavigationBarColor({
      frontColor: "#000000",
      backgroundColor: "#F4F6FA",
    })
  },
  onLoad() {
    this.getFile()
  },
  methods: {
    getFile() {
      this.$instance.post(`/app/appcertificateinfo/list?size=100`).then(res => {
        if (res.code == 0) {
          
        }
      })
    },
    previewImage(index) {
      var tempList = []
      for (var i in this.files) {
        tempList.push(this.files[i].imageUrl)
      }

      uni.previewImage({
        current: tempList[index],
        urls: tempList
      });
    },
  },
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";

.page {
  width: 100%;
  background-color: #F4F5FA;
  .list {
    padding: 50px 0 0 32px;
    img {
      width: calc(100%/2 - 13px);
      height: 462px;
      margin: 0 26px 24px 0;
    }
    img:nth-of-type(2n) {
      margin-right: 0;
    }
  }
}
</style>
