Browse Source

Merge branch 'yb_back5.8.1'

cxmo 1 year ago
parent
commit
8edfbbfcff
1 changed files with 23 additions and 4 deletions
  1. 23 4
      pages-report/previewPDF.vue

+ 23 - 4
pages-report/previewPDF.vue

@@ -5,6 +5,7 @@
 <script>
 import {h5BaseUrl} from '@/utils/config'
 import {apiGetPDFDetail} from '@/api/report.js'
+import {apiGetSceneToParams} from '@/api/common'
 export default {
     data() {
         return {
@@ -23,15 +24,33 @@ export default {
         return {
             title:this.msgObj.title||this.pdf_name||'',
             path:`/pages-report/previewPDF?pdf_id=${this.pdf_id}`,
-            imageUrl:this.msgObj.imgUrl||this.globalImgUrls.pdfShareImg
+            imageUrl:this.msgObj.shareImg||this.globalImgUrls.pdfShareImg
         }
     },
     methods: {
-        init(options){
-            this.pdf_id = options.pdf_id
-            this.getPDFDetail()
+        async init(options){
+            if(options.scene){
+                const res=await apiGetSceneToParams({scene_key:options.scene})
+                if(res.code==200){
+                    const obj=JSON.parse(res.data)
+                    options.pdf_id = obj.pdf_id
+                    this.pdf_id = Number(obj.pdf_id)
+                    this.getPDFDetail()
+                }
+            }else{
+                this.pdf_id = Number(options.pdf_id)||0
+                this.getPDFDetail()
+            }
+            
         },
         getPDFDetail(){
+            if(!this.pdf_id){
+                uni.showToast({
+                    title: '未找到PDF',
+                    icon: 'none'
+                })
+                return
+            }
             apiGetPDFDetail({pdf_id:this.pdf_id}).then(res=>{
                 if(res.code!==200) return 
                 this.pdf_name=res.data.pdf_name||''