瀏覽代碼

解码options.scene

cxmo 1 年之前
父節點
當前提交
73a7cda265
共有 1 個文件被更改,包括 17 次插入3 次删除
  1. 17 3
      pages-report/previewPDF.vue

+ 17 - 3
pages-report/previewPDF.vue

@@ -27,11 +27,25 @@ export default {
         }
     },
     methods: {
-        init(options){
-            this.pdf_id = Number(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)
+                    this.pdf_id = Number(obj.pdf_id)
+                    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||''