From 6596b537720eba1c171e7d387be21d986e5383a7 Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Mon, 24 Feb 2025 15:49:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20cookie=E5=90=8C=E6=84=8F=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E7=89=88=E6=9C=AC=E5=88=A4=E6=96=AD=E3=80=81lite?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/css/docdetail.css | 6 +++--- static/js/cookie-notice.js | 12 ++---------- static/js/docdetail.js | 13 +++++++++---- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/static/css/docdetail.css b/static/css/docdetail.css index 726ec3b55..92dcb9826 100644 --- a/static/css/docdetail.css +++ b/static/css/docdetail.css @@ -192,17 +192,17 @@ .switch-version span{ cursor: pointer; } -.lite .switch-version input::after{ +.lite.switch-version input::after{ left: auto; right: 2px; } .switch-version .enterprise{ color: #feb32a; } -.lite .switch-version .enterprise,.switch-version .lite{ +.lite.switch-version .enterprise,.switch-version .lite{ color: var(--o-color-white); } -.lite .switch-version .lite{ +.lite.switch-version .lite{ color: #feb32a; } @media screen and (max-width: 1100px){ diff --git a/static/js/cookie-notice.js b/static/js/cookie-notice.js index 2ea8fa062..820241907 100644 --- a/static/js/cookie-notice.js +++ b/static/js/cookie-notice.js @@ -3,7 +3,6 @@ $(function () { const body = $("body"); const pathname = window.location.pathname; const isEn = pathname.includes("/en/"); - const COOKIE_VERSION = "20241230"; const COOKIE_DOMAIN = ".opengauss.org"; const theme = localStorage.getItem("opengauss-theme") || "light"; // 弹窗 @@ -228,14 +227,7 @@ $(function () { getUserCookieStatus: () => { const { COOKIE_AGREED_STATUS, COOKEY_KEY } = cookieNotice; const cookieVal = cookieNotice.getCookieByKey(COOKEY_KEY) ?? "0"; - const cookieStatusVal = cookieVal[0]; - const cookieVersionVal = cookieVal.slice(1); - - if (cookieVersionVal !== COOKIE_VERSION) { - return COOKIE_AGREED_STATUS.NOT_SIGNED; - } - if (cookieStatusVal === COOKIE_AGREED_STATUS.ALL_AGREED) { return COOKIE_AGREED_STATUS.ALL_AGREED; } else if (cookieStatusVal === COOKIE_AGREED_STATUS.NECCESSARY_AGREED) { @@ -313,7 +305,7 @@ $(function () { } = cookieNotice; setCustomCookie( COOKEY_KEY, - `${COOKIE_AGREED_STATUS.ALL_AGREED}${COOKIE_VERSION}`, + COOKIE_AGREED_STATUS.ALL_AGREED, 180 ); toggleNoticeVisible(false); @@ -330,7 +322,7 @@ $(function () { } = cookieNotice; setCustomCookie( COOKEY_KEY, - `${COOKIE_AGREED_STATUS.NECCESSARY_AGREED}${COOKIE_VERSION}`, + COOKIE_AGREED_STATUS.NECCESSARY_AGREED, 180 ); toggleNoticeVisible(false); diff --git a/static/js/docdetail.js b/static/js/docdetail.js index fc1d90eb3..fdd01e35d 100644 --- a/static/js/docdetail.js +++ b/static/js/docdetail.js @@ -327,15 +327,20 @@ $(function ($) { }, }); } + + if (location.pathname.split("/")[3]?.includes("-lite")) { + $(".switch-version").addClass("lite"); + } + // 企业版与轻量版选择 $(".switch-version>input").click(function () { const version = location.pathname.split("/")[3]; if (version.includes("-lite")) { - $(this).removeClass("lite"); + $(".switch-version").removeClass("lite"); const targetUrl = location.href.replace("-lite", ""); switchLiteEnterprise(targetUrl); } else { - $(this).addClass("lite"); + $(".switch-version").addClass("lite"); const targetUrl = location.href.replace(version, version + "-lite"); switchLiteEnterprise(targetUrl); } @@ -343,7 +348,7 @@ $(function ($) { $(".switch-version>.enterprise").click(function () { const version = location.pathname.split("/")[3]; if (version.includes("-lite")) { - $(".switch-version>input").removeClass("lite"); + $(".switch-version").removeClass("lite"); const targetUrl = location.href.replace("-lite", ""); switchLiteEnterprise(targetUrl); } @@ -351,7 +356,7 @@ $(function ($) { $(".switch-version>.lite").click(function () { const version = location.pathname.split("/")[3]; if (!version.includes("-lite")) { - $(".switch-version>input").addClass("lite"); + $(".switch-version").addClass("lite"); const targetUrl = location.href.replace(version, version + "-lite"); switchLiteEnterprise(targetUrl); } -- Gitee