jwyu 2 gadi atpakaļ
vecāks
revīzija
09e59757d7

+ 9 - 0
src/api/hzyb/report.js

@@ -43,4 +43,13 @@ export const apiChapterTickerValue=params=>{
  */
 export const apiRddpShareImg=params=>{
     return post('/report/detail/rddp_share_img',{source:'rddp_share_img',...params})
+}
+
+/**
+ * 报告对应的ppt图片
+ * @param report_id 报告id
+ * @param report_chapter_id 报告章节id
+ */
+export const apiReportPPtImgs=params=>{
+    return get('/report/ppt_img',params)
 }

+ 32 - 2
src/views/hzyb/report/ChapterDetail.vue

@@ -18,7 +18,7 @@
             <span style="color: #e3b377; margin-left: 20px" @click="showDisclaimers = true">免责声明</span>
           </div>
         </div>
-        
+        <img class="ppt-icon" v-if="hasPPt" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
       </div>
       <div class="rich-content">
         <!-- <div v-html="info.report_chapter_item.content" v-if="info.auth_ok"></div> -->
@@ -130,7 +130,7 @@ import moment from 'moment'
 import 'moment/dist/locale/zh-cn'
 moment.locale('zh-cn')
 
-import {apiChapterDetail,apiChapterTickerValue,apiRddpShareImg} from '@/api/hzyb/report'
+import {apiChapterDetail,apiChapterTickerValue,apiRddpShareImg,apiReportPPtImgs} from '@/api/hzyb/report'
 import {apiApplyPermission} from '@/api/hzyb/user'
 import {Popup,Image as VanImage,PullRefresh,Col, Row} from 'vant'
 import AudioBox from './components/AudioBox.vue'
@@ -192,6 +192,7 @@ export default {
       pageSize: 20,//默认初始加载20个p标签
       total_page: 0,
 
+      hasPPt:false,
     };
   },
   beforeCreate(){
@@ -232,6 +233,24 @@ export default {
     //     this.showToTop=false
     //   }
     // },
+    //跳转ppt预览页
+    goPPtDetail(){
+        wx.miniProgram.navigateTo({
+            url:`/pages-report/previewImage?reportId=${this.info.report_chapter_item.report_id}&chapterId=${this.info.report_chapter_item.report_chapter_id}`
+        })
+    },
+
+    //获取报告对应的ppt图片
+    async getReportPPtImg(){
+        const res=await apiReportPPtImgs({
+            report_id:Number(this.info.report_chapter_item.report_id),
+            report_chapter_id:Number(this.info.report_chapter_item.report_chapter_id)
+        })
+        if(res.code===200&&res.data.length>0){
+            this.hasPPt=true
+        }
+    },
+
 
     async getDetail(){
       const res=await apiChapterDetail({report_chapter_id:Number(this.chapterId)})
@@ -269,6 +288,10 @@ export default {
           }
         }
 
+        if(res.data.auth_ok){
+          this.getReportPPtImg()
+        }
+
         // 处理标题数据
         //【第{{info.report_chapter_item.stage}}期 | {{info.report_chapter_item.classify_name_first}}  | {{info.report_chapter_item.type_name}}】{{info.report_chapter_item.title}}({{moment(info.report_chapter_item.publish_time).format('MMDD')}})
         this.title=`【第${res.data.report_chapter_item.stage}期 | ${res.data.report_chapter_item.classify_name_first} | ${res.data.report_chapter_item.type_name}】${res.data.report_chapter_item.title}(${moment(res.data.report_chapter_item.publish_time).format('MMDD')})`
@@ -529,6 +552,7 @@ export default {
     .tips{
         font-size: 34px;
         margin-bottom: 51px;
+        position: relative;
         &::before{
             content: '';
             width: 10px;
@@ -544,6 +568,12 @@ export default {
             margin-bottom: 20px;
             line-height: 1.5;
         }
+        .ppt-icon{
+            position: absolute;
+            bottom: 14px;
+            right: 10px;
+            width: 30px;
+        }
     }
 
     .disclaimers-box{

+ 20 - 3
src/views/hzyb/report/Detail.vue

@@ -63,7 +63,7 @@
                         <span style="color:#E3B377;margin-left:20px" @click="showDisclaimers=true">免责声明</span>
                     </div>
                 </div>
-                <img class="ppt-icon" v-if="info.report_info.ppt_img_list" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
+                <img class="ppt-icon" v-if="hasPPt" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
             </div>
 
             <div class="rich-content">
@@ -148,7 +148,7 @@ import moment from 'moment'
 import 'moment/dist/locale/zh-cn'
 moment.locale('zh-cn')
 
-import {apiReportDetail,apiRddpShareImg} from '@/api/hzyb/report'
+import {apiReportDetail,apiRddpShareImg,apiReportPPtImgs} from '@/api/hzyb/report'
 import {apiApplyPermission} from '@/api/hzyb/user'
 import {Popup,Image as VanImage,PullRefresh} from 'vant'
 import AudioBox from './components/AudioBox.vue'
@@ -200,6 +200,8 @@ export default {
             pageSize: 20,//默认初始加载20个p标签
             total_page: 0,
             fromPage: '', // message定位到留言板
+
+            hasPPt:false,//是否有ppt
         }
     },
     beforeCreate(){
@@ -244,9 +246,20 @@ export default {
         //跳转ppt预览页
         goPPtDetail(){
             wx.miniProgram.navigateTo({
-                url:`/pages-report/previewImage?reportId=${this.reportId}`
+                url:`/pages-report/previewImage?reportId=${this.reportId}&chapterId=0`
             })
         },
+
+        //获取报告对应的ppt图片
+        async getReportPPtImg(){
+            const res=await apiReportPPtImgs({
+                report_id:Number(this.reportId),
+                report_chapter_id:0
+            })
+            if(res.code===200&&res.data.length>0){
+                this.hasPPt=true
+            }
+        },
         
         //获取报告详情
         async getDetail(){
@@ -283,6 +296,10 @@ export default {
                     }
                 }
 
+                if(res.data.auth_ok){
+                    this.getReportPPtImg()
+                }
+
                 // 处理报告标题数据
                 if(!['晨报','周报'].includes(res.data.report_info.classify_name_first)){
                     //【第{{info.report_info.stage}}期|{{info.report_info.classify_name_second}}】{{info.report_info.title}}