Browse Source

自由研报预览不继承公共样式

cldu 1 month ago
parent
commit
aa557658dd
1 changed files with 16 additions and 4 deletions
  1. 16 4
      src/views/report/freeReport/freeReportPreview.vue

+ 16 - 4
src/views/report/freeReport/freeReportPreview.vue

@@ -168,6 +168,15 @@ const getIframeMessage = (e) => {
         });
     }
 };
+const handleHtmlStr = (data) => {
+    const htmlString = data.replace(
+        /class="([^"]*\breport-html-wrap\b[^"]*)"/,
+        (match, p1) => {
+            return `class="${p1.replace('report-html-wrap', 'report-html-wrap-free')}"`;
+        }
+    );
+   return htmlString
+}
 onMounted(() => {
     window.addEventListener('message',getIframeMessage);
 })
@@ -177,15 +186,15 @@ onUnmounted(() => {
 </script>
 
 <template>
-    <div class="free-report-scale-outer" :style="{ height: contentHeight + 'px' }">
+    <div class="free-report-scale-outer" :style="{ height: contentHeight + 'px',fontSize:'14px', }">
         <div class="free-report-detail" ref="scaleContainer" :style="scaleStyle">
-            <div id="reportdtl" class="main-box" style="width: 1200px;">
+            <div id="reportdtl" class="main-box" style="width: 1202px;">
                 <div v-for="(item,index) in pageList" :key="index + 1" class="report-content-box" :style="{backgroundColor:bgColor,height:'1698px'}">
                     <!-- 版头 -->
                     <div class="border-wrap" style="min-height: 30px;max-height: 100px;" v-if="showHeaderWrap(item)">
                         <div class="page-header-wrap" style="min-height: 30px;max-height: 100px;" v-html="pageConfig.pageEditObject.header.html"></div>
                     </div>
-                    <div v-html="item.Content" class="content-wrap"></div>
+                    <div v-html="handleHtmlStr(item.Content)" class="content-wrap"></div>
                     <div class="border-wrap" style="min-height: 30px;max-height: 100px;" v-if="showFooterWrap(item)">
                         <div
                             v-if="showFooterPage(item)"
@@ -230,6 +239,9 @@ div{
   .free-report-scale-outer{
     position: relative;
     overflow: hidden;
+    line-height: normal;
+    font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
+       Microsoft YaHei, SimSun, sans-serif;
   }
   .free-report-detail{
     position: absolute;
@@ -256,7 +268,7 @@ div{
               flex-direction: column;
               position: relative;
             }
-            .report-html-wrap{
+            .report-html-wrap-free{
                 height: 100%;
                 position: relative;
                 overflow: hidden;