From 0327dfc0cc65322c7693529179955d3ddd7c09f4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Sep 2024 21:03:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E7=BD=91?= =?UTF-8?q?=E5=9D=80=E8=8E=B7=E5=8F=96=E4=BF=A1=E6=81=AF=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main/commons/index.ts | 6 ++++++ src/pages/item/AddEdit.vue | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/electron/main/commons/index.ts b/electron/main/commons/index.ts index fa357ec..976802e 100644 --- a/electron/main/commons/index.ts +++ b/electron/main/commons/index.ts @@ -209,6 +209,9 @@ function analysisHTML(windowName: string, url: string, data: string) { let $ = cheerio.load(data); // 获取标题 result.name = $("head").find("title").text(); + if (!result.name || result.name.trim() === "") { + result.name = $("title").text(); + } // 获取图标URL let iconURL: string | null = null; let icon = $("link[rel='icon']"); @@ -272,6 +275,9 @@ function analysisHTML(windowName: string, url: string, data: string) { result.status = true; sendUrlInfo(windowName, result); } else { + if (result.name && result.name.trim() !== "") { + result.status = true; + } sendUrlInfo(windowName, result); } } diff --git a/src/pages/item/AddEdit.vue b/src/pages/item/AddEdit.vue index ab941d5..2dab776 100644 --- a/src/pages/item/AddEdit.vue +++ b/src/pages/item/AddEdit.vue @@ -833,8 +833,10 @@ onMounted(() => { getURLInfoLoading.value = false; let res: Result = data; if (res.status) { - form.data.icon = res.icon; - form.data.htmlIcon = null; + if (res.icon && res.icon.trim() !== "") { + form.data.icon = res.icon; + form.data.htmlIcon = null; + } form.name = res.name ?? ""; } else { window.api.showErrorMessageBox(