<template>
  <a-layout-content>
    <a-result
        :status="formState.status"
        :title="formState.cyjgxx"
    >
      <template #subTitle >
        <p v-if="formState.status === 'success'">查验次数: {{formState.inspectionAmount}}</p>
        <p v-if="formState.status === 'success'">已存入发票库</p>
      </template>
    </a-result>
  </a-layout-content>
</template>
<script lang="ts" setup>
import {ref,onMounted } from 'vue';
import request  from "../../utils/request.ts";
const props = defineProps({ filePath: String });
import {baseURL} from "../../utils/baseurl.ts";

const fileType = ref<string>('img')
onMounted(() => {
  // alert(props.filePath)
  if(props.filePath){
    fileType.value = props.filePath.split('.').pop() ==='pdf'?'pdf':'img'
    request.get('/verify?filePath='+encodeURIComponent(props.filePath)).then((res) => {
      console.log(res)
      formState.value = res.data
    })
    fileUrl.value =  baseURL+"/"+props.filePath
  }
})

//
const fileUrl = ref('')

let formState = ref({
  status:"",
  inspectionAmount: "",
  cyjgxx: "",
  verify_time: "",
});

</script>
<style scoped>
.pdf{
  width: 100%;
  height: 100%;
}
</style>
