fix(minerU): 修复 PDF 识别状态和Markdown 加载问题

- 在 getPDFDetailBbox 方法中添加 iframe 刷新和 Markdown 加载
- 完善 getMinerUStatus 方法,增加识别失败的错误提示
- 优化代码结构,提高可读性和维护性
This commit is contained in:
陈昱达
2025-04-16 17:51:13 +08:00
parent a220919485
commit b4b8674487
2 changed files with 9 additions and 4 deletions

View File

@@ -7,6 +7,7 @@
<iframe
v-if="isShowPdf"
id="iframe"
ref="iframe"
:src="`${iframeSrc}/pdfjs-dist/web/viewer.html?file=${encodeURIComponent(prdUrl)}`"
class="miner-u el-card is-always-shadow ml20"
></iframe>
@@ -221,6 +222,9 @@ export default {
getPDFDetailBbox() {
minerUBbox({ documentId: this.documentId }).then(res => {
this.bboxList = this.formatJson(JSON.parse(JSON.stringify(res.content.content)))
// this.$refs.iframe 重新刷新iframe
this.$refs.iframe.contentWindow.location.reload()
this.getPDFDetailMarkDown()
})
},
changeTab() {
@@ -263,8 +267,6 @@ export default {
getMinerUStatus() {
this.finishedMiner = true
minerUQuery({ id: this.documentId }).then(res => {
console.log(res)
let mineruStatus = res.content.content.mineruStatus
switch (mineruStatus) {
case 0:
@@ -277,10 +279,13 @@ export default {
case '1':
this.finishedMiner = false
this.getPDFDetailBbox()
this.getPDFDetailMarkDown()
break
default:
this.finishedMiner = false
this.$message({
message: '识别失败',
type: 'error'
})
break
}
})