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 () => {