Commit 79b320bd authored by Jennie Shi's avatar Jennie Shi

解决合同预览显示空白

parent f65230b6
......@@ -8,10 +8,10 @@ module.exports = merge(prodEnv, {
debug: true,
isMobilePlatform: false,
loginPath: '"http://180.104.121.66:8088/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=appadmin&password=" ',
basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_DEV&apiName="',
basePath: '"http://180.104.121.66:8088/r/api/interface?sysName=XCMG_UAT&apiName="',
rootPath: '"http://180.104.121.66:8088/r/api"',
filePath: '"http://180.104.121.66:8088/r/api/app/fileViewSvc?sysName=XCMG_DEV&apiName=file_view&"',
filePath: '"http://180.104.121.66:8088/r/api/app/fileViewSvc?sysName=XCMG_UAT&apiName=file_view&"',
ocrPath: '"http://180.104.121.66:8088/r/api"',
appId: '"com.xcmg.app.dev"',
currentVersion: '"1.8.1"',
currentVersion: '"1.8.4"',
})
......@@ -11,5 +11,5 @@ module.exports = {
ocrPath:'"http://180.104.121.66:8088/r/api"',
fileUploadSvcPath:'"http://180.104.121.66:8088/r/api/app/fileUploadSvc?sysName=XCMG_UAT&apiName="',
appId: '"com.xcmg.app"',
currentVersion: '"1.4.3"'
currentVersion: '"1.4.4"'
}
<template>
<div v-if="hidden" style="height: 75vh;overflow-y: auto;overflow-x: hidden;">
<pdf :src="src"/>
</div>
</template>
<script>
import axios from 'axios'
import pdf from 'vue-pdf'
export default {
components: {pdf},
data () {
return {
src: '',
hidden: false,
}
},
methods: {
// 预览pdf
previewPDF (url) {
this.src = pdf.createLoadingTask(url)
},
// 下载PDF
downloadPDF (url, fileName) {
axios({
method: 'get',
responseType: 'arraybuffer',
url: url,
}).then(function (res) {
// 调用下载方法,把后端传过来的流传给fileDownload方法
this.fileDownload(res.data, fileName)
}.bind(this)
)
.catch(
function (error) {
hlsPopup.showLongCenter('网络请求出错')
console.log(error)
}
)
},
fileDownload: function (data, fileName) {
let blob = new Blob([data], {
// type类型后端返回来的数据中会有,根据自己实际进行修改
// type: 'application/vnd.ms-excel',
type: 'application/json',
})
let filename = fileName + '.pdf' || '合同.pdf'
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(blob, filename)
} else {
var blobURL = window.URL.createObjectURL(blob)
// 创建隐藏<a>标签进行下载
var tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = blobURL
tempLink.setAttribute('download', filename)
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)
window.URL.revokeObjectURL(blobURL)
}
},
},
}
</script>
<style lang="less" scoped>
</style>
......@@ -92,18 +92,13 @@
</list-item>
</scroll>
</h-content>
<PDFDown ref="pdf"/>
</h-view>
</template>
<script>
import PDFDown from '@/components/PDFDownload'
export default {
name: 'RepayDetail',
components: {
PDFDown,
},
filters: {
lengthCheck: function (value) {
if ((value.toString()).length === 1) {
......
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><script type=text/javascript src=./static/vuePlatform.js></script><script type=text/javascript src=./static/prototype.js></script><script type=text/javascript src=cordova.js></script><script type=text/javascript src="http://api.map.baidu.com/api?v=2.0&ak=Eoo0EtfjYCdAy7r8D19gZ0vMojdZpHqU"></script><title>徐工金服</title><link href=./static/css/app.5492293c65c2eebfcafa283a8c948cde.css rel=stylesheet></head><body><div id=app-box></div><script type=text/javascript src=./static/js/manifest.5b23605dc2d9cfefc737.js></script><script type=text/javascript src=./static/js/vendor.9516a64f4eb2c109f0d8.js></script><script type=text/javascript src=./static/js/app.179b65375f80947d84ac.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><script type=text/javascript src=./static/vuePlatform.js></script><script type=text/javascript src=./static/prototype.js></script><script type=text/javascript src=cordova.js></script><script type=text/javascript src="http://api.map.baidu.com/api?v=2.0&ak=Eoo0EtfjYCdAy7r8D19gZ0vMojdZpHqU"></script><title>徐工金服</title><link href=./static/css/app.25d8ab4fa9a9b84e32668d1acf234cd3.css rel=stylesheet></head><body><div id=app-box></div><script type=text/javascript src=./static/js/manifest.6a178e8d77c32e3c385d.js></script><script type=text/javascript src=./static/js/vendor.0a4e11017ea45af58444.js></script><script type=text/javascript src=./static/js/app.1c3e37182172494499eb.js></script></body></html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment