diff --git a/main.py b/main.py index 3df3842..77b8260 100644 --- a/main.py +++ b/main.py @@ -187,6 +187,7 @@ def save_image(url,file_name): if response.status_code == 200: with open(f'{save_path}/{valid_file_name}.jpg', 'wb') as f: f.write(response.content) + log(f"图片保存成功:{save_path}/{valid_file_name}.jpg") except Exception as e: log(e,"error") @@ -219,12 +220,16 @@ class PaginatedContainer(ft.Column): items=[ ft.PopupMenuItem(text="导出为JSON", on_click=self.export_json), ft.PopupMenuItem(text="导出为Excel", on_click=self.export_excel), - # ft.PopupMenuItem(text="导出为HTML", on_click=self.export_html), ft.PopupMenuItem(text="导出为Markdown", on_click=self.export_markdown), ], tooltip="导出为", ) + if isinstance(self.data[0], Message): + export_control.items.append( + ft.PopupMenuItem(text="导出为HTML", on_click=self.export_html) + ) + return ft.Column( [ ft.Row( @@ -328,9 +333,141 @@ class PaginatedContainer(ft.Column): log(f"导出成功 请查看 {now_login_user.uin}_{self.title}_data.xlsx","success") - def export_html(self,e): - print("Exporting HTML...") + def export_html(self, e): + # HTML 头部和样式 + html_start = ''' + + +
+ + +{item.content}
+ {f'' if item.images and 'http' in item.images else ''} +