From 808ca4866828a33a17c4cfb0b1cddcf123ed6433 Mon Sep 17 00:00:00 2001 From: duanshuwen Date: Tue, 7 Jul 2026 09:25:50 +0800 Subject: [PATCH] feat: add persistent gift toast and responsive aigc layouts update aigc page layouts to use viewport units and dynamic sizing instead of hardcoded 812px height for better device compatibility. replace fixed scss values with css custom properties for easier theming and responsive adjustments. refactor templatecarousel component to calculate dynamic card scale and layout based on screen dimensions. add local storage persistence for gift points toast so it stays closed after dismissal. update home page to respect the persisted toast state. --- src/constant/aigc.js | 13 ++ .../components/TemplateCard/styles/index.scss | 18 +-- .../components/TemplateCarousel/index.vue | 119 +++++++++++++++--- .../TemplateCarousel/styles/index.scss | 8 +- src/pages-aigc/home/home.vue | 4 +- src/pages-aigc/home/styles/index.scss | 6 +- src/pages-aigc/useTemplate/styles/index.scss | 3 +- 7 files changed, 135 insertions(+), 36 deletions(-) diff --git a/src/constant/aigc.js b/src/constant/aigc.js index 705b3cc..f7557eb 100644 --- a/src/constant/aigc.js +++ b/src/constant/aigc.js @@ -2,6 +2,7 @@ import { currentClientType } from "@/constant/base"; const CLIENT_TYPE = currentClientType(); const AIGC_CONSENT_AGREED = `${CLIENT_TYPE}_AIGC_CONSENT_AGREED`; +const AIGC_GIFT_POINTS_TOAST_CLOSED = `${CLIENT_TYPE}_AIGC_GIFT_POINTS_TOAST_CLOSED`; export const getAigcConsentAgreed = () => { return uni.getStorageSync(AIGC_CONSENT_AGREED); @@ -14,3 +15,15 @@ export const setAigcConsentAgreed = (agreed = true) => { export const removeAigcConsentAgreed = () => { return uni.removeStorageSync(AIGC_CONSENT_AGREED); }; + +export const getAigcGiftPointsToastClosed = () => { + return uni.getStorageSync(AIGC_GIFT_POINTS_TOAST_CLOSED); +}; + +export const setAigcGiftPointsToastClosed = (closed = true) => { + return uni.setStorageSync(AIGC_GIFT_POINTS_TOAST_CLOSED, closed); +}; + +export const removeAigcGiftPointsToastClosed = () => { + return uni.removeStorageSync(AIGC_GIFT_POINTS_TOAST_CLOSED); +}; diff --git a/src/pages-aigc/home/components/TemplateCard/styles/index.scss b/src/pages-aigc/home/components/TemplateCard/styles/index.scss index 4cd524f..560f500 100644 --- a/src/pages-aigc/home/components/TemplateCard/styles/index.scss +++ b/src/pages-aigc/home/components/TemplateCard/styles/index.scss @@ -1,23 +1,23 @@ .template-card { position: relative; - flex: 0 0 318px; - width: 318px; - height: 494px; + flex: 0 0 var(--template-card-width, 318px); + width: var(--template-card-width, 318px); + height: var(--template-card-height, 494px); overflow: hidden; display: flex; flex-direction: column; - border-radius: 28px; + border-radius: var(--template-card-radius, 28px); background: linear-gradient(180deg, #0f7069, #082226); color: #ffffff; text-align: left; - box-shadow: 0 18px 34px rgba(24, 37, 50, 0.18); + box-shadow: 0 3px 8px rgba(24, 37, 50, 0.12); transform: scale(0.96); transform-origin: center; transition: box-shadow 0.18s ease, transform 0.18s ease; } .template-card.is-active { - box-shadow: 0 22px 42px rgba(24, 37, 50, 0.2); + box-shadow: 0 5px 12px rgba(24, 37, 50, 0.16); transform: scale(1); } @@ -33,8 +33,8 @@ .template-media { position: relative; - flex: 0 0 358px; - height: 358px; + flex: 0 0 var(--template-card-media-height, 358px); + height: var(--template-card-media-height, 358px); overflow: hidden; background: var(--memory-accent); } @@ -58,7 +58,7 @@ .template-copy { position: relative; - flex: 0 0 136px; + flex: 0 0 var(--template-card-copy-height, 136px); display: flex; flex-direction: column; justify-content: flex-start; diff --git a/src/pages-aigc/home/components/TemplateCarousel/index.vue b/src/pages-aigc/home/components/TemplateCarousel/index.vue index 5366a01..d4c7bee 100644 --- a/src/pages-aigc/home/components/TemplateCarousel/index.vue +++ b/src/pages-aigc/home/components/TemplateCarousel/index.vue @@ -1,5 +1,5 @@