From 8884f9c4160fbc9c6168329f1c0ad0deb16e9d82 Mon Sep 17 00:00:00 2001 From: www Date: Sun, 19 Apr 2026 21:29:51 +0800 Subject: [PATCH] feat: open storage artifacts via admin preview --- src/api/interface/site/list.ts | 4 ++ src/utils/adminArtifact.ts | 54 +++++++++++++++++++ ...xternalSeoAizhanKeywordAttentionDialog.vue | 5 +- .../domainExternalSeoAizhanKeywordDialog.vue | 5 +- ...ainExternalSeoAizhanKeywordTrendDialog.vue | 5 +- .../domainExternalSeoBaiduFeedbackDialog.vue | 5 +- .../site/domainExternalSeoBaiduPlanDialog.vue | 5 +- ...ainExternalSeoBaiduPushAttentionDialog.vue | 5 +- .../site/domainExternalSeoBaiduPushDialog.vue | 5 +- .../domainExternalSeoBaiduPushTrendDialog.vue | 5 +- .../domainExternalSeoFailedQueueDialog.vue | 5 +- ...domainExternalSeoManualImportRunDialog.vue | 7 +-- .../site/domainExternalSeoProviderDialog.vue | 9 ++-- .../domainExternalSeoRealSummaryDialog.vue | 4 +- .../domainExternalSeoResultObserveDialog.vue | 4 +- ...ainExternalSeoSearchConsoleFetchDialog.vue | 5 +- ...mainExternalSeoSearchConsolePlanDialog.vue | 5 +- .../site/domainExternalSeoSiteQueryDialog.vue | 5 +- .../domainExternalSeoSnapshotRunDialog.vue | 5 +- ...inExternalSeoSnapshotValidateRunDialog.vue | 5 +- .../site/domainExternalSeoSummaryDialog.vue | 7 +-- .../site/domainExternalSeoTrendDialog.vue | 5 +- 22 files changed, 101 insertions(+), 63 deletions(-) create mode 100644 src/utils/adminArtifact.ts diff --git a/src/api/interface/site/list.ts b/src/api/interface/site/list.ts index fcd9e01..36edbd7 100644 --- a/src/api/interface/site/list.ts +++ b/src/api/interface/site/list.ts @@ -264,6 +264,7 @@ export namespace SiteList { export interface DomainSeoCopyHistoryRollbackData { host?: string; rollback_from_job_id?: string; + job?: DomainImportAsyncJobStatusData; written_pages?: Array<{ scene?: string; page_key?: string; @@ -1518,6 +1519,7 @@ export namespace SiteList { run_id?: string; generated_at?: string; status?: string; + mode?: string; run_root?: string; domain_count?: number; aggregate_count?: number; @@ -1897,6 +1899,7 @@ export namespace SiteList { generated_at?: string; mode?: string; note?: string; + hero_summary?: string; real_external_metrics?: boolean; host_count?: number; ready_count?: number; @@ -1962,6 +1965,7 @@ export namespace SiteList { generated_at?: string; mode?: string; note?: string; + hero_summary?: string; real_external_metrics?: boolean; host_count?: number; ready_count?: number; diff --git a/src/utils/adminArtifact.ts b/src/utils/adminArtifact.ts new file mode 100644 index 0000000..8870f0e --- /dev/null +++ b/src/utils/adminArtifact.ts @@ -0,0 +1,54 @@ +import axios from "axios"; +import { ElMessage } from "element-plus"; +import { useUserStore } from "@/stores/modules/user"; + +const BASE_URL = import.meta.env.VITE_API_URL as string; + +const STORAGE_PREFIXES = ["external-seo/", "video-metadata-missing/"]; + +const buildDirectUrl = (path: string) => `${BASE_URL}/${String(path).replace(/^\/+/, "")}`; + +const normalizePath = (path?: string) => String(path || "").replace(/^\/+/, "").trim(); + +const shouldReadByStorageProxy = (path: string) => { + return STORAGE_PREFIXES.some(prefix => path.startsWith(prefix)); +}; + +const buildStoragePreviewUrl = (path: string) => { + const url = new URL(`${BASE_URL}/system/storage/file`); + url.searchParams.set("path", path); + return url.toString(); +}; + +export const openAdminArtifact = async (path?: string) => { + const normalizedPath = normalizePath(path); + if (!normalizedPath) return; + + if (!shouldReadByStorageProxy(normalizedPath)) { + window.open(buildDirectUrl(normalizedPath), "_blank", "noopener"); + return; + } + + const userStore = useUserStore(); + const token = String(userStore.token || "").trim(); + if (!token) { + ElMessage.error("当前登录态已失效,请重新登录后再打开产物"); + return; + } + + try { + const response = await axios.get(buildStoragePreviewUrl(normalizedPath), { + headers: { + "admin-token": token + }, + responseType: "blob" + }); + + const blob = response.data instanceof Blob ? response.data : new Blob([response.data]); + const blobUrl = URL.createObjectURL(blob); + window.open(blobUrl, "_blank", "noopener"); + window.setTimeout(() => URL.revokeObjectURL(blobUrl), 60_000); + } catch (_error) { + ElMessage.error("打开产物失败,请稍后重试"); + } +}; diff --git a/src/views/site/domainExternalSeoAizhanKeywordAttentionDialog.vue b/src/views/site/domainExternalSeoAizhanKeywordAttentionDialog.vue index 13fc452..d03c2fa 100644 --- a/src/views/site/domainExternalSeoAizhanKeywordAttentionDialog.vue +++ b/src/views/site/domainExternalSeoAizhanKeywordAttentionDialog.vue @@ -55,15 +55,14 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoAizhanKeywordAttentionQueue } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const queue = ref({}); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadQueue = async () => { diff --git a/src/views/site/domainExternalSeoAizhanKeywordDialog.vue b/src/views/site/domainExternalSeoAizhanKeywordDialog.vue index 04710d1..34ab067 100644 --- a/src/views/site/domainExternalSeoAizhanKeywordDialog.vue +++ b/src/views/site/domainExternalSeoAizhanKeywordDialog.vue @@ -69,10 +69,10 @@ import { computed, ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoAizhanKeywordProbeSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; import DomainExternalSeoAizhanKeywordAttentionDialog from "./domainExternalSeoAizhanKeywordAttentionDialog.vue"; import DomainExternalSeoAizhanKeywordTrendDialog from "./domainExternalSeoAizhanKeywordTrendDialog.vue"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); @@ -80,8 +80,7 @@ const attentionDialogRef = ref(); const trendDialogRef = ref(); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const alertTitle = computed(() => { diff --git a/src/views/site/domainExternalSeoAizhanKeywordTrendDialog.vue b/src/views/site/domainExternalSeoAizhanKeywordTrendDialog.vue index 1f54d32..e46e23d 100644 --- a/src/views/site/domainExternalSeoAizhanKeywordTrendDialog.vue +++ b/src/views/site/domainExternalSeoAizhanKeywordTrendDialog.vue @@ -59,8 +59,8 @@ import { computed, ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoAizhanKeywordTrendSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); @@ -74,8 +74,7 @@ const alertType = computed(() => { }); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadSummary = async () => { diff --git a/src/views/site/domainExternalSeoBaiduFeedbackDialog.vue b/src/views/site/domainExternalSeoBaiduFeedbackDialog.vue index 4d36505..f8b312f 100644 --- a/src/views/site/domainExternalSeoBaiduFeedbackDialog.vue +++ b/src/views/site/domainExternalSeoBaiduFeedbackDialog.vue @@ -65,15 +65,14 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoBaiduFeedbackSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadSummary = async () => { diff --git a/src/views/site/domainExternalSeoBaiduPlanDialog.vue b/src/views/site/domainExternalSeoBaiduPlanDialog.vue index 5e808c7..6854c01 100644 --- a/src/views/site/domainExternalSeoBaiduPlanDialog.vue +++ b/src/views/site/domainExternalSeoBaiduPlanDialog.vue @@ -61,6 +61,7 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoBaiduProviderPlan } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; import DomainExternalSeoBaiduPushDialog from "./domainExternalSeoBaiduPushDialog.vue"; import DomainExternalSeoBaiduFeedbackDialog from "./domainExternalSeoBaiduFeedbackDialog.vue"; import DomainExternalSeoSiteQueryDialog from "./domainExternalSeoSiteQueryDialog.vue"; @@ -68,7 +69,6 @@ import DomainExternalSeoBaiduPushTaskDialog from "./domainExternalSeoBaiduPushTa import DomainExternalSeoBaiduPushAttentionDialog from "./domainExternalSeoBaiduPushAttentionDialog.vue"; import DomainExternalSeoBaiduPushTrendDialog from "./domainExternalSeoBaiduPushTrendDialog.vue"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); @@ -80,8 +80,7 @@ const attentionDialogRef = ref(); const trendDialogRef = ref(); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const openPushSummaryDialog = () => { diff --git a/src/views/site/domainExternalSeoBaiduPushAttentionDialog.vue b/src/views/site/domainExternalSeoBaiduPushAttentionDialog.vue index 496e1c8..cacc5d1 100644 --- a/src/views/site/domainExternalSeoBaiduPushAttentionDialog.vue +++ b/src/views/site/domainExternalSeoBaiduPushAttentionDialog.vue @@ -68,15 +68,14 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoBaiduPushAttentionQueue } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const queue = ref({}); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadQueue = async () => { diff --git a/src/views/site/domainExternalSeoBaiduPushDialog.vue b/src/views/site/domainExternalSeoBaiduPushDialog.vue index 0dec727..79114bd 100644 --- a/src/views/site/domainExternalSeoBaiduPushDialog.vue +++ b/src/views/site/domainExternalSeoBaiduPushDialog.vue @@ -70,11 +70,11 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoBaiduPushSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; import DomainExternalSeoBaiduPushTaskDialog from "./domainExternalSeoBaiduPushTaskDialog.vue"; import DomainExternalSeoBaiduPushAttentionDialog from "./domainExternalSeoBaiduPushAttentionDialog.vue"; import DomainExternalSeoBaiduPushTrendDialog from "./domainExternalSeoBaiduPushTrendDialog.vue"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); @@ -83,8 +83,7 @@ const attentionDialogRef = ref(); const trendDialogRef = ref(); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadSummary = async () => { diff --git a/src/views/site/domainExternalSeoBaiduPushTrendDialog.vue b/src/views/site/domainExternalSeoBaiduPushTrendDialog.vue index 4e3dde2..a0d0f0c 100644 --- a/src/views/site/domainExternalSeoBaiduPushTrendDialog.vue +++ b/src/views/site/domainExternalSeoBaiduPushTrendDialog.vue @@ -66,8 +66,8 @@ import { computed, ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoBaiduPushTrendSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); @@ -80,8 +80,7 @@ const alertType = computed(() => { }); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadSummary = async () => { diff --git a/src/views/site/domainExternalSeoFailedQueueDialog.vue b/src/views/site/domainExternalSeoFailedQueueDialog.vue index d3b63c7..393f73a 100644 --- a/src/views/site/domainExternalSeoFailedQueueDialog.vue +++ b/src/views/site/domainExternalSeoFailedQueueDialog.vue @@ -43,16 +43,15 @@ import { ref } from "vue"; import { ElMessage, ElMessageBox } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoFailedQueue } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const rows = ref([]); const queue = ref({}); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const showCommand = async (title: string, command?: string) => { diff --git a/src/views/site/domainExternalSeoManualImportRunDialog.vue b/src/views/site/domainExternalSeoManualImportRunDialog.vue index 54f1864..dc8f5d2 100644 --- a/src/views/site/domainExternalSeoManualImportRunDialog.vue +++ b/src/views/site/domainExternalSeoManualImportRunDialog.vue @@ -39,17 +39,14 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoManualImportRuns } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const rows = ref([]); const openPublicPath = (path?: string) => { - if (!path) { - return; - } - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadRuns = async () => { diff --git a/src/views/site/domainExternalSeoProviderDialog.vue b/src/views/site/domainExternalSeoProviderDialog.vue index 2ec183c..8a7446c 100644 --- a/src/views/site/domainExternalSeoProviderDialog.vue +++ b/src/views/site/domainExternalSeoProviderDialog.vue @@ -370,6 +370,7 @@ import { ref } from "vue"; import { ElMessage, UploadRawFile } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; import { getDomainExternalSeoManualImportTemplate, getDomainExternalSeoCnOverview, @@ -606,7 +607,7 @@ const downloadManualTemplate = async () => { ElMessage.warning("模板生成成功,但没有可打开的文件路径"); return; } - window.open(`${import.meta.env.VITE_API_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + await openAdminArtifact(path); } catch (_error) { ElMessage.error("生成站外手工导入模板失败"); } @@ -620,7 +621,7 @@ const downloadSearchConsolePropertyMapTemplate = async () => { ElMessage.warning("映射模板生成成功,但没有可打开的文件路径"); return; } - window.open(`${import.meta.env.VITE_API_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + await openAdminArtifact(path); } catch (_error) { ElMessage.error("生成 Search Console 映射模板失败"); } @@ -663,7 +664,7 @@ const uploadManualReport = async (param: any) => { ElMessage.success(`导入完成:共 ${res.data.rows_total || 0} 行,写入 ${res.data.imported_count || 0} 行`); const summaryHtmlPath = res.data.summary_html_path; if (summaryHtmlPath) { - window.open(`${import.meta.env.VITE_API_URL}/${String(summaryHtmlPath).replace(/^\/+/, "")}`, "_blank", "noopener"); + await openAdminArtifact(summaryHtmlPath); } await loadSummary(); openRealSummaryDialog(); @@ -697,7 +698,7 @@ const uploadSearchConsolePropertyMap = async (param: any) => { ElMessage.success(`Search Console 映射上传完成:${res.data.mapped_hosts_count || 0} 个 host`); const summaryHtmlPath = res.data.summary_html_path; if (summaryHtmlPath) { - window.open(`${import.meta.env.VITE_API_URL}/${String(summaryHtmlPath).replace(/^\/+/, "")}`, "_blank", "noopener"); + await openAdminArtifact(summaryHtmlPath); } await loadSummary(); openRealSummaryDialog(); diff --git a/src/views/site/domainExternalSeoRealSummaryDialog.vue b/src/views/site/domainExternalSeoRealSummaryDialog.vue index 40722d1..819610f 100644 --- a/src/views/site/domainExternalSeoRealSummaryDialog.vue +++ b/src/views/site/domainExternalSeoRealSummaryDialog.vue @@ -52,6 +52,7 @@ import { computed, ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoRealSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; const visible = ref(false); const loading = ref(false); @@ -90,8 +91,7 @@ const loadSummary = async () => { }; const openSummaryFile = (path?: string) => { - if (!path) return; - window.open(`${import.meta.env.VITE_API_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const statusLabel = (status?: string) => { diff --git a/src/views/site/domainExternalSeoResultObserveDialog.vue b/src/views/site/domainExternalSeoResultObserveDialog.vue index 4a72540..224362c 100644 --- a/src/views/site/domainExternalSeoResultObserveDialog.vue +++ b/src/views/site/domainExternalSeoResultObserveDialog.vue @@ -145,6 +145,7 @@ import { computed, ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoRealSummary, getDomainExternalSeoSnapshotRuns, getDomainExternalSeoSummary, getDomainExternalSeoTrendSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; import DomainExternalSeoSnapshotRunDialog from "./domainExternalSeoSnapshotRunDialog.vue"; const visible = ref(false); @@ -215,8 +216,7 @@ const formatDateTime = (value?: string) => { }; const openSummaryFile = (path?: string) => { - if (!path) return; - window.open(`${import.meta.env.VITE_API_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const openSnapshotRunsDialog = () => { diff --git a/src/views/site/domainExternalSeoSearchConsoleFetchDialog.vue b/src/views/site/domainExternalSeoSearchConsoleFetchDialog.vue index 2275c78..ef838a2 100644 --- a/src/views/site/domainExternalSeoSearchConsoleFetchDialog.vue +++ b/src/views/site/domainExternalSeoSearchConsoleFetchDialog.vue @@ -71,15 +71,14 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoSearchConsoleFetchSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadSummary = async () => { diff --git a/src/views/site/domainExternalSeoSearchConsolePlanDialog.vue b/src/views/site/domainExternalSeoSearchConsolePlanDialog.vue index 6ff61f2..6589f0f 100644 --- a/src/views/site/domainExternalSeoSearchConsolePlanDialog.vue +++ b/src/views/site/domainExternalSeoSearchConsolePlanDialog.vue @@ -66,17 +66,16 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoSearchConsoleProviderPlan } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; import DomainExternalSeoSearchConsoleFetchDialog from "./domainExternalSeoSearchConsoleFetchDialog.vue"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); const fetchDialogRef = ref(); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const openFetchDialog = () => { diff --git a/src/views/site/domainExternalSeoSiteQueryDialog.vue b/src/views/site/domainExternalSeoSiteQueryDialog.vue index c7bdb67..7b4b60e 100644 --- a/src/views/site/domainExternalSeoSiteQueryDialog.vue +++ b/src/views/site/domainExternalSeoSiteQueryDialog.vue @@ -62,15 +62,14 @@ import { computed, ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoSiteQueryProbeSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const alertTitle = computed(() => { diff --git a/src/views/site/domainExternalSeoSnapshotRunDialog.vue b/src/views/site/domainExternalSeoSnapshotRunDialog.vue index 9248015..a886aac 100644 --- a/src/views/site/domainExternalSeoSnapshotRunDialog.vue +++ b/src/views/site/domainExternalSeoSnapshotRunDialog.vue @@ -130,16 +130,15 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoSnapshotRuns } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const rows = ref([]); const summary = ref(null); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadRuns = async () => { diff --git a/src/views/site/domainExternalSeoSnapshotValidateRunDialog.vue b/src/views/site/domainExternalSeoSnapshotValidateRunDialog.vue index 192593f..39dd48d 100644 --- a/src/views/site/domainExternalSeoSnapshotValidateRunDialog.vue +++ b/src/views/site/domainExternalSeoSnapshotValidateRunDialog.vue @@ -137,16 +137,15 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoSnapshotValidateRuns } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const rows = ref([]); const summary = ref(null); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const loadRuns = async () => { diff --git a/src/views/site/domainExternalSeoSummaryDialog.vue b/src/views/site/domainExternalSeoSummaryDialog.vue index 13f226a..cd61fac 100644 --- a/src/views/site/domainExternalSeoSummaryDialog.vue +++ b/src/views/site/domainExternalSeoSummaryDialog.vue @@ -81,13 +81,13 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; import DomainExternalSeoFailedQueueDialog from "./domainExternalSeoFailedQueueDialog.vue"; import DomainExternalSeoTrendDialog from "./domainExternalSeoTrendDialog.vue"; import DomainExternalSeoRealSummaryDialog from "./domainExternalSeoRealSummaryDialog.vue"; import DomainExternalSeoProviderDialog from "./domainExternalSeoProviderDialog.vue"; import DomainExternalSeoSearchConsolePlanDialog from "./domainExternalSeoSearchConsolePlanDialog.vue"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const rows = ref([]); @@ -99,10 +99,7 @@ const providerDialogRef = ref(); const searchConsolePlanDialogRef = ref(); const openPublicPath = (path?: string) => { - if (!path) { - return; - } - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const trendLabel = () => { diff --git a/src/views/site/domainExternalSeoTrendDialog.vue b/src/views/site/domainExternalSeoTrendDialog.vue index 28a5ed3..e6eb629 100644 --- a/src/views/site/domainExternalSeoTrendDialog.vue +++ b/src/views/site/domainExternalSeoTrendDialog.vue @@ -72,15 +72,14 @@ import { ref } from "vue"; import { ElMessage } from "element-plus"; import { SiteList } from "@/api/interface/site/list"; import { getDomainExternalSeoTrendSummary } from "@/api/modules/site/list"; +import { openAdminArtifact } from "@/utils/adminArtifact"; -const BASE_URL = import.meta.env.VITE_API_URL as string; const visible = ref(false); const loading = ref(false); const summary = ref({}); const openPublicPath = (path?: string) => { - if (!path) return; - window.open(`${BASE_URL}/${String(path).replace(/^\/+/, "")}`, "_blank", "noopener"); + void openAdminArtifact(path); }; const trendLabel = () => {