Эх сурвалжийг харах

东吴报告详情报告内容展示逻辑优化

mayday 7 сар өмнө
parent
commit
16e49cdaf8
1 өөрчлөгдсөн 19 нэмэгдсэн , 29 устгасан
  1. 19 29
      src/views/report/Detail.vue

+ 19 - 29
src/views/report/Detail.vue

@@ -75,13 +75,23 @@ async function getReportInfo() {
 
     await getUserInfo()
     if (res.Data.Status === 4) {
+      let htmlStr=''
+      if(reportInfo.value.HasChapter===1){//章节报告
+        const arr=reportInfo.value.ChapterContent||[]
+        arr.forEach(i=>{
+          const str=`<div class="chapter-item-wrap"><div class="chapter-title"><h3 class="chapter-title-text">${i.Title}</h3></div></div><div>${i.Content}</div>`
+          htmlStr=htmlStr+str
+        })
+      }else{
+        htmlStr=reportInfo.value.Content
+      }
       if (userInfo.Status === 2 && userInfo.HasPermission === '私有权限') {
-        reportInfo.value.Content=modifyReportContentIframeData(reportInfo.value.Content)
-        formatIframeData()
+        htmlStr=modifyReportContentIframeData(htmlStr)
+        htmlStr=formatIframeData(htmlStr)
       }else{
-        reportContent.value = modifyReportContentIframeData(reportInfo.value.Content)
-        splitReportContent(reportContent.value)
+        htmlStr = modifyReportContentIframeData(htmlStr)
       }
+      splitReportContent(htmlStr)
     } else {//无权限
       reportContent.value = modifyReportContentIframeData(reportInfo.value.ContentSub)
     }
@@ -92,13 +102,13 @@ getReportInfo()
 // 修改报告中嵌入的图表地址
 function modifyReportContentIframeData(str){
   let temStr=str.replace(/http:\/\/eta.dwfutures.com:8001/g,'https://dwresearch.dwfutures.com')
+  temStr=str.replace(/http:\/\/192.168.43.22:8001/g,'https://dwresearch.dwfutures.com')
   return temStr.replace(/http:\/\/58.210.74.21:9100\/etastatic/g,'https://dwresearch.dwfutures.com/etastatic')
 }
 
 // 给报告详情中图表加参数
-function formatIframeData() {
-  reportContent.value = reportInfo.value.Content.replace(/\/chartshow\?code=/g, `/chartshow?source=etamini&token=${localStorage.getItem('token')}&reportId=${reportId}&code=`)
-  splitReportContent(reportContent.value)
+function formatIframeData(str) {
+  return str.replace(/\/chartshow\?code=/g, `/chartshow?source=etamini&token=${localStorage.getItem('token')}&reportId=${reportId}&code=`)
 }
 
 // 报告内容分页
@@ -259,33 +269,13 @@ function handleGoLogin(){
       v-html="reportContent"
       v-if="reportStatus !== 4"
     />
-    <template v-else>
     <div
       id="rich-content"
       class="report-content-box rich-content"
-      v-if="reportInfo.HasChapter!==1"
+      v-else
     >
       <div v-for="item in renderContentList" :key="item" v-html="item"></div>
-    </div>
-    <!-- 章节报告 -->
-    <div
-      id="rich-content"
-      class="report-content-box rich-content"
-      v-if="reportInfo.HasChapter===1"
-    >
-      <div 
-        class="chapter-item-wrap" 
-        v-for="chapter,index in reportInfo.ChapterContent"
-        :key="index"
-      >
-        <div class="chapter-title">
-          <h3 class="chapter-title-text">{{chapter.Title}}</h3>
-        </div>
-        <div v-html="chapter.Content"></div>
-      </div>
-    </div>
-    </template>
-    
+    </div>    
 
     <!-- 拼接版尾 -->
     <div class="html-end-img-box" v-if="reportInfo.EndResource.ImgUrl">