From a3bf4513e146446f823af73c24b51d56c6379665 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Fri, 15 Sep 2023 18:02:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E4=B8=8D=E5=85=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#2313)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/response/website.go | 1 + backend/app/service/website.go | 1 + frontend/src/api/interface/website.ts | 1 + .../website/config/log/log-fiile/index.vue | 18 +++++++----------- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/backend/app/dto/response/website.go b/backend/app/dto/response/website.go index 3cfad9acb..bae123317 100644 --- a/backend/app/dto/response/website.go +++ b/backend/app/dto/response/website.go @@ -42,6 +42,7 @@ type WebsiteLog struct { Enable bool `json:"enable"` Content string `json:"content"` End bool `json:"end"` + Path string `json:"path"` } type PHPConfig struct { diff --git a/backend/app/service/website.go b/backend/app/service/website.go index d4f2bd4ac..4c4990336 100644 --- a/backend/app/service/website.go +++ b/backend/app/service/website.go @@ -941,6 +941,7 @@ func (w WebsiteService) OpWebsiteLog(req request.WebsiteLogReq) (*response.Websi return nil, err } res.End = end + res.Path = filePath res.Content = strings.Join(lines, "\n") return res, nil case constant.DisableLog: diff --git a/frontend/src/api/interface/website.ts b/frontend/src/api/interface/website.ts index 536abc302..c5e542751 100644 --- a/frontend/src/api/interface/website.ts +++ b/frontend/src/api/interface/website.ts @@ -90,6 +90,7 @@ export namespace Website { enable: boolean; content: string; end: boolean; + path: string; } export interface Domain { diff --git a/frontend/src/views/website/website/config/log/log-fiile/index.vue b/frontend/src/views/website/website/config/log/log-fiile/index.vue index a27bc7492..9331a96f3 100644 --- a/frontend/src/views/website/website/config/log/log-fiile/index.vue +++ b/frontend/src/views/website/website/config/log/log-fiile/index.vue @@ -4,19 +4,14 @@ -
- +
+ {{ $t('commons.button.watch') }} - + {{ $t('file.download') }} - + {{ $t('commons.button.clean') }}
@@ -46,8 +41,8 @@ import { javascript } from '@codemirror/lang-javascript'; import { oneDark } from '@codemirror/theme-one-dark'; import { computed, nextTick, onMounted, onUnmounted, reactive, ref, shallowRef } from 'vue'; import { OpWebsiteLog } from '@/api/modules/website'; -import { dateFormatForName, downloadWithContent } from '@/utils/util'; import { useDeleteData } from '@/hooks/use-delete-data'; +import { downloadFile } from '@/utils/util'; const extensions = [javascript(), oneDark]; const props = defineProps({ @@ -70,6 +65,7 @@ const loading = ref(false); const data = ref({ enable: false, content: '', + path: '', }); const tailLog = ref(false); let timer: NodeJS.Timer | null = null; @@ -165,7 +161,7 @@ const cleanLog = async () => { }; const onDownload = async () => { - downloadWithContent(data.value.content, logType.value + '-' + dateFormatForName(new Date()) + '.log'); + downloadFile(data.value.path); }; const onCloseLog = async () => {