<template>
  <view class="content">
    <view class="card">
      <u-cell-group>
        <u-cell title="证书图片">
          <template #value>
            <u--image :src="info.FILEPATH" width="100rpx" height="100rpx" radius="10rpx" @click="fnPreview"></u--image>
            <u--image v-if="info.FILEPATH_BACK" :src="info.FILEPATH_BACK" width="100rpx" height="100rpx" radius="10rpx"
                      @click="fnPreview"></u--image>
          </template>
        </u-cell>
        <u-cell title="姓名" :value="info.NAME"></u-cell>
        <u-cell title="性别" :value="info.SEX === '1' ? '女' : '男'"></u-cell>
        <u-cell title="手机号码" :value="info.PHONE"></u-cell>
        <u-cell title="身份证号码" :value="info.CARD_ID"></u-cell>
        <u-cell title="证书类型" :value="info.typeName"></u-cell>
        <u-cell title="证书名称" :value="info.CERTIFICATE"></u-cell>
        <u-cell title="证书编号" :value="info.SPECIAL_NUMBER"></u-cell>
        <!--        <u-cell title="工种" :value="info.JOBS_TYPE"></u-cell>-->
        <u-cell v-show="info.typeName === '特种作业'" title="作业类别" :value="info.specialName"></u-cell>
        <u-cell v-show="info.typeName === '特种作业'" title="操作项目" :value="info.operationName"></u-cell>
        <u-cell title="发证机关" :value="info.ISSUING_AUTHORITY"></u-cell>
        <u-cell title="有效期" :value="info.VALIDITY_TIME_START + '至' + info.VALIDITY_TIME_END"></u-cell>
        <u-cell title="复审时间" :value="info.REVIEW_TIME"></u-cell>
      </u-cell-group>
    </view>
  </view>
</template>

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

export default {
  data() {
    return {
      SPECIAL_USER_ID: '',
      info: {}
    }
  },
  onLoad(query) {
    this.SPECIAL_USER_ID = query.SPECIAL_USER_ID
    this.fnGetData()
  },
  methods: {
    async fnGetData() {
      let resData = await getCertificateInformationView({
        SPECIAL_USER_ID: this.SPECIAL_USER_ID
      })
      this.info = resData.pd
      this.$set(this.info, 'FILEPATH', this.$filePath + resData.pd.FILEPATH)
      if (resData.pd.FILEPATH_BACK) {
        this.$set(this.info, 'FILEPATH_BACK', this.$filePath + resData.pd.FILEPATH_BACK)
      }
    },
    fnPreview() {
      uni.previewImage({
        urls: [this.info.FILEPATH]
      })
    }
  },
}


</script>

<style scoped>

</style>
