瀏覽代碼

fix: 报告详情海报

hsun 3 年之前
父節點
當前提交
0baf321c38

+ 12 - 1
services/share_poster.go

@@ -361,7 +361,18 @@ func fillContent2Html(source, pars, sunCodeUrl string, height int) (contentStr s
 			err = tmpErr
 			return
 		}
-		abstract := doc.Text()
+		abstract := ""
+		doc.Find("p").Each(func(i int, s *goquery.Selection) {
+			phtml, tmpErr := s.Html()
+			if tmpErr != nil {
+				err = tmpErr
+				return
+			}
+			st := s.Text()
+			if st != "" && st != "<br>" && st != "<br style=\"max-width: 100%;\">" && !strings.Contains(st, "iframe") {
+				abstract = abstract + "<p>" + phtml + "</p>"
+			}
+		})
 		contentStr = strings.Replace(contentStr, "{{REPORT_TYPE}}", params.ReportType, 1)
 		contentStr = strings.Replace(contentStr, "{{REPORT_TITLE}}", params.ReportTitle, 1)
 		contentStr = strings.Replace(contentStr, "{{REPORT_ABSTRACT}}", abstract, 1)

+ 4 - 2
static/htm2img/activity_detail.html

@@ -53,13 +53,15 @@
             margin-left: auto;
             margin-right: auto;
         }
-        
-        
         .xcx-img{
             width: 256px;
             height: 256px;
             float: right;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>

+ 4 - 3
static/htm2img/activity_list.html

@@ -92,14 +92,15 @@
             padding: 8px 32px;
             border-top-right-radius: 24px;
         }
-        
-        
-        
         .xcx-img{
             width: 256px;
             height: 256px;
             float: right;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>

+ 4 - 0
static/htm2img/chart_detail.html

@@ -52,6 +52,10 @@
             height: 256px;
             float: right;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>

+ 4 - 0
static/htm2img/chart_list.html

@@ -72,6 +72,10 @@
             height: 256px;
             float: right;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>

+ 4 - 0
static/htm2img/report_detail.html

@@ -85,6 +85,10 @@
         .content-box iframe {
           display: none;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>

+ 4 - 2
static/htm2img/report_list.html

@@ -81,13 +81,15 @@
             position: relative;
             top: 12px;
         }
-        
-        
         .xcx-img{
             width: 256px;
             height: 256px;
             float: right;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>

+ 4 - 0
static/htm2img/special_column_detail.html

@@ -59,6 +59,10 @@
             height: 256px;
             float: right;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>

+ 4 - 3
static/htm2img/special_column_list.html

@@ -116,14 +116,15 @@
             border-bottom-left-radius: 32px;
             border-top-right-radius: 24px;
         }
-        
-        
-        
         .xcx-img{
             width: 256px;
             height: 256px;
             float: right;
         }
+        p,span{
+            margin: 0 !important;
+            padding: 0 !important;
+        }
     </style>
 </head>
 <body>