From e13ca6281d03e304ef2043e13e55e993af7691e3 Mon Sep 17 00:00:00 2001 From: "pikachu1995@126.com" Date: Mon, 6 Jul 2026 15:59:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8EAPI=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manager/src/api/common.js | 4 +- manager/src/views/login.vue | 420 ++++++++++++++++++------ manager/src/views/main-parts/header.vue | 34 +- 3 files changed, 335 insertions(+), 123 deletions(-) diff --git a/manager/src/api/common.js b/manager/src/api/common.js index 1fbe6886..f7ec91d7 100644 --- a/manager/src/api/common.js +++ b/manager/src/api/common.js @@ -21,9 +21,9 @@ export const postVerifyImg = (params) => { }; -// 获取系统基础信息 +// 获取系统基础信息(登录页等场景无需 token) export const getBaseSite = () => { - return getRequest(`${commonUrl}/common/common/site`); + return getRequestWithNoToken(`${commonUrl}/common/common/site`); }; // 上传文件 diff --git a/manager/src/views/login.vue b/manager/src/views/login.vue index d60a2092..592ad6d3 100644 --- a/manager/src/views/login.vue +++ b/manager/src/views/login.vue @@ -1,58 +1,74 @@ @@ -84,6 +100,7 @@ export default { }, data() { return { + year: new Date().getFullYear(), loading: false, form: { username: "", @@ -152,62 +169,269 @@ export default { diff --git a/manager/src/views/main-parts/header.vue b/manager/src/views/main-parts/header.vue index 2f64c661..71204322 100644 --- a/manager/src/views/main-parts/header.vue +++ b/manager/src/views/main-parts/header.vue @@ -1,7 +1,7 @@ @@ -12,26 +12,12 @@ import { getBaseSite } from "@/api/common.js"; export default { data() { return { - domainLogo: require("@/assets/logo.png"), + domainLogo: "", }; }, methods: { - init() { - if ( - !localStorage.getItem("icon") || - !localStorage.getItem("title") || - !localStorage.getItem("icontitle_expiration_time") - ) { - this.getSite(); - } else if (new Date() > localStorage.getItem("icontitle_expiration_time")) { - this.getSite(); - } else { - this.domainLogo = localStorage.getItem("icon"); - this.applyFavicon(localStorage.getItem("icon")); - window.document.title = localStorage.getItem("title") + " - 运营后台"; - } - }, applyFavicon(href) { + if (!href) return; let link = document.querySelector("link[rel*='icon']") || document.createElement("link"); @@ -46,20 +32,22 @@ export default { const { domainLogo, domainIcon, siteName } = JSON.parse( res.result.settingValue ); - this.domainLogo = domainLogo; + this.domainLogo = domainLogo || ""; const expirationTime = new Date().setHours(new Date().getHours() + 1); localStorage.setItem("icontitle_expiration_time", expirationTime); - localStorage.setItem("icon", domainLogo); - localStorage.setItem("domainIcon", domainIcon); - localStorage.setItem("title", siteName); + localStorage.setItem("icon", domainLogo || ""); + localStorage.setItem("domainIcon", domainIcon || ""); + localStorage.setItem("title", siteName || ""); this.applyFavicon(domainIcon || domainLogo); - window.document.title = siteName + " - 运营后台"; + if (siteName) { + window.document.title = siteName + " - 运营后台"; + } } }); }, }, mounted() { - this.init(); + this.getSite(); }, };