|
|
@ -59,7 +59,7 @@ function init() {
|
|
|
|
pdfLoad.value = true
|
|
|
|
pdfLoad.value = true
|
|
|
|
DownloadFileByBC(data).then(res => {
|
|
|
|
DownloadFileByBC(data).then(res => {
|
|
|
|
if (res.type === 'application/json') {
|
|
|
|
if (res.type === 'application/json') {
|
|
|
|
const reader = new FileReader()
|
|
|
|
const reader = new FileReader() as any
|
|
|
|
reader.readAsText(res, 'utf-8')
|
|
|
|
reader.readAsText(res, 'utf-8')
|
|
|
|
reader.onload = () => {
|
|
|
|
reader.onload = () => {
|
|
|
|
const _res = JSON.parse(reader.result)
|
|
|
|
const _res = JSON.parse(reader.result)
|
|
|
@ -69,13 +69,14 @@ function init() {
|
|
|
|
pdfRes.value = res
|
|
|
|
pdfRes.value = res
|
|
|
|
var contentDisposition = res.headers['content-disposition']
|
|
|
|
var contentDisposition = res.headers['content-disposition']
|
|
|
|
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
|
|
|
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
|
|
|
var result = patt.exec(contentDisposition)
|
|
|
|
var result = patt.exec(contentDisposition) as any
|
|
|
|
var filename = result[1]
|
|
|
|
console.log(patt,result,contentDisposition,res)
|
|
|
|
var reg = /^["](.*)["]$/g
|
|
|
|
// var filename = result[1]
|
|
|
|
pdfName.value = decodeURI(filename.replace(reg, '$1'))
|
|
|
|
// var reg = /^["](.*)["]$/g
|
|
|
|
if (res.data.size > 150) {
|
|
|
|
// pdfName.value = decodeURI(filename.replace(reg, '$1'))
|
|
|
|
pdfUrl.value = window.URL.createObjectURL(new Blob([res.data], { type: 'application/pdf;charset=utf-8' }))
|
|
|
|
// if (res.data.size > 150) {
|
|
|
|
}
|
|
|
|
// pdfUrl.value = window.URL.createObjectURL(new Blob([res.data], { type: 'application/pdf;charset=utf-8' }))
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pdfLoad.value = false
|
|
|
|
pdfLoad.value = false
|
|
|
|
})
|
|
|
|
})
|
|
|
|