Sfoglia il codice sorgente

Merge branch 'yb_back5.8.1'

cxmo 1 anno fa
parent
commit
0579945861
5 ha cambiato i file con 69 aggiunte e 0 eliminazioni
  1. 9 0
      api/report.js
  2. 55 0
      pages-report/previewPDF.vue
  3. 3 0
      pages.json
  4. 1 0
      pages/pc.vue
  5. 1 0
      utils/config.js

+ 9 - 0
api/report.js

@@ -152,4 +152,13 @@ export const apiReportChapterAudioSet=params=>{
  */
 export const apiRddpShareImg=params=>{
     return httpPost('/report/detail/rddp_share_img',{source:'rddp_share_img',...params})
+}
+
+/**
+ * 获取PDF详情
+ * @param pdf_id 
+ * @returns 
+ */
+export const apiGetPDFDetail = params=>{
+    return httpGet('/report/pdf/detail',params)
 }

+ 55 - 0
pages-report/previewPDF.vue

@@ -0,0 +1,55 @@
+<template>
+    <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:'',
+            pdf_id:0,
+            pdf_name:'',
+            pdf_url:''
+        };
+    },
+    onLoad(options) {
+        this.init(options)
+        wx.setVisualEffectOnCapture({visualEffect:'hidden'})
+    },
+    onShareAppMessage() {
+        return {
+            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.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]
+            console.log('h5传来的数据',data);
+            this.msgObj=data
+        },
+    },
+};
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 3 - 0
pages.json

@@ -303,6 +303,9 @@
 					"style":{
 						"navigationBarTitleText": "播放列表 "
 					}
+				},
+				{
+					"path": "previewPDF"
 				}
 			]
 		},

+ 1 - 0
pages/pc.vue

@@ -27,6 +27,7 @@ const mapObj=new Map([
     ['pages/positionAnalysis/index','/positionanalysis/index'],
     ['pages/positionAnalysis/detail','/positionanalysis/detail'],
     ['pages-report/chapterList','/report/detail'],
+    ['pages-report/previewPDF','/report/previewPDF']
 ])//map映射小程序页面路径对应h5页面路径
 import {apiUserInfo} from '@/api/user'
 import {apiGetSceneToParams} from '@/api/common'

+ 1 - 0
utils/config.js

@@ -35,6 +35,7 @@ const globalImgUrls={
 	sandBoxNoAuthor:'https://hzstatic.hzinsights.com/static/icon/hzyb/sandbox_no_author.png', //沙盘无权限 无数据
 	sandBoxShareDefault1:'https://hzstatic.hzinsights.com/static/images/yb/sandbox_20220705160455.png', //沙盘分享时 默认图片1
 	sandBoxShareDefault2:'https://hzstatic.hzinsights.com/static/images/yb/sandbox_20220705160533.png', //沙盘分享时 默认图片2
+    pdfShareImg:'https://hzstatic.hzinsights.com/static/images/yb/report_pdf_share_cover.png',//PDF报告分享图
 }
 
 // 默认tabbar数据