<template>
  <view class="content p-10">
    <view class="card">
      <view class="mt-10">
        <u-cell-group :border="false">
          <u-cell>
            <view slot="title" class="title">证书名称：</view>
            <view slot="value">{{ form.NAME }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">证书有效期：</view>
            <view slot="value">{{ form.VALIDITYTIME }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">证书编号：</view>
            <view slot="value">{{ form.NUMBER }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">备注：</view>
            <view slot="label" class="mt-10">{{ form.DESCR }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">已上传证书：</view>
            <view slot="label" class="mt-10">
              <view style="display: flex;flex-wrap: wrap">
                <view v-for="item in hImgs" :key="item" class="ml-10 mt-10">
                  <u--image :showLoading="true" :src="item" width="80px" height="80px"
                            @click="previewImage(item)"></u--image>
                </view>
              </view>
            </view>
          </u-cell>
        </u-cell-group>
      </view>
    </view>
  </view>
</template>

<script>
import {getCorpInfoQualificationGoEdit} from "../../../api";

export default {
  data() {
    return {
      form: {},
      hImgs: [],
      QUALIFICATIONS_ID: ''
    }
  },
  onLoad(event) {
    this.QUALIFICATIONS_ID = event.QUALIFICATIONS_ID
    this.fnGetCorpInfoQualificationGoEdit()
  },
  methods: {
    async fnGetCorpInfoQualificationGoEdit() {
      let resData = await getCorpInfoQualificationGoEdit({QUALIFICATIONS_ID: this.QUALIFICATIONS_ID})
      this.form = resData.pd
      for (let i = 0; i < resData.hImgs.length; i++) {
        this.hImgs.push(this.$store.state.filePath + resData.hImgs[i].FILEPATH)
      }
    },
    previewImage(current) {
      uni.previewImage({
        urls: this.hImgs,
        current
      });
    },
  },
}
</script>

<style scoped>
.title {
  min-width: 150rpx;
}
</style>
