|
@@ -1,13 +1,18 @@
|
|
|
<template>
|
|
|
- <web-view :src="url" />
|
|
|
+ <web-view :src="url" @message="handleGetMessage"/>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {h5BaseUrl} from '@/utils/config'
|
|
|
+import {apiGetPDFDetail} from '@/api/report.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
msgObj:{},
|
|
|
- url:''
|
|
|
+ url:'',
|
|
|
+ pdf_id:0,
|
|
|
+ pdf_name:'',
|
|
|
+ pdf_url:''
|
|
|
};
|
|
|
},
|
|
|
onLoad(options) {
|
|
@@ -16,13 +21,25 @@ export default {
|
|
|
},
|
|
|
onShareAppMessage() {
|
|
|
return {
|
|
|
- title:this.msgObj.title,
|
|
|
- path:`/pages-report/previewPDF?Id=${this.msgObj.Id}`,
|
|
|
+ title:this.msgObj.title||this.pdf_name||'',
|
|
|
+ path:`/pages-report/previewPDF?pdf_id=${this.pdf_id}`,
|
|
|
+ imageUrl:this.msgObj.imgUrl||this.globalImgUrls.pdfShareImg
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
init(options){
|
|
|
- this.url = `http://192.168.77.31:3000/xcx_h5/hzyb/report/previewpdf`
|
|
|
+ this.pdf_id = options.pdf_id
|
|
|
+ this.getPDFDetail()
|
|
|
+ },
|
|
|
+ getPDFDetail(){
|
|
|
+ apiGetPDFDetail({pdf_id:this.pdf_id}).then(res=>{
|
|
|
+ if(res.code!==200) return
|
|
|
+ this.pdf_name=res.data.pdf_name||''
|
|
|
+ this.pdf_url=res.data.pdf_url||''
|
|
|
+ const token=this.$store.state.user.token
|
|
|
+ this.url = `${h5BaseUrl}/hzyb/report/previewpdf?pdfSrc=${this.pdf_url}&token=${token}#wechat_redirect`
|
|
|
+ //this.url = `http://192.168.77.31:3000/xcx_h5/hzyb/report/previewpdf?pdfSrc=${this.pdf_url}&token=${token}#wechat_redirect`
|
|
|
+ })
|
|
|
},
|
|
|
handleGetMessage(e){
|
|
|
const data=e.detail.data[e.detail.data.length-1]
|