From 22c2b1564d3d7ce99fba70a359d8d92d10207993 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 18 Aug 2025 02:18:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ui=20=E4=BC=98=E5=8C=96+=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend_nuxt/components/GlobalPopups.vue | 39 +++++++++++++++++++ .../InviteCodeActivityComponent.vue | 4 +- frontend_nuxt/pages/activities.vue | 2 +- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/frontend_nuxt/components/GlobalPopups.vue b/frontend_nuxt/components/GlobalPopups.vue index 9992889a9..f5d87b2eb 100644 --- a/frontend_nuxt/components/GlobalPopups.vue +++ b/frontend_nuxt/components/GlobalPopups.vue @@ -8,6 +8,13 @@ /> + + @@ -21,7 +28,10 @@ const config = useRuntimeConfig() const API_BASE_URL = config.public.apiBaseUrl const showMilkTeaPopup = ref(false) +const showInviteCodePopup = ref(false) const milkTeaIcon = ref('') +const inviteCodeIcon = ref('') + const showNotificationPopup = ref(false) const showMedalPopup = ref(false) const newMedals = ref([]) @@ -30,6 +40,9 @@ onMounted(async () => { await checkMilkTeaActivity() if (showMilkTeaPopup.value) return + await checkInviteCodeActivity() + if (showInviteCodePopup.value) return + await checkNotificationSetting() if (showNotificationPopup.value) return @@ -53,12 +66,38 @@ const checkMilkTeaActivity = async () => { // ignore network errors } } + +const checkInviteCodeActivity = async () => { + if (!process.client) return + if (localStorage.getItem('inviteCodeActivityPopupShown')) return + try { + const res = await fetch(`${API_BASE_URL}/api/activities`) + if (res.ok) { + const list = await res.json() + const a = list.find((i) => i.type === 'INVITE_POINTS' && !i.ended) + if (a) { + inviteCodeIcon.value = a.icon + showInviteCodePopup.value = true + } + } + } catch (e) { + // ignore network errors + } +} + +const closeInviteCodePopup = () => { + if (!process.client) return + localStorage.setItem('inviteCodeActivityPopupShown', 'true') + showInviteCodePopup.value = false +} + const closeMilkTeaPopup = () => { if (!process.client) return localStorage.setItem('milkTeaActivityPopupShown', 'true') showMilkTeaPopup.value = false checkNotificationSetting() } + const checkNotificationSetting = async () => { if (!process.client) return if (!authState.loggedIn) return diff --git a/frontend_nuxt/components/InviteCodeActivityComponent.vue b/frontend_nuxt/components/InviteCodeActivityComponent.vue index 9fef7cfbc..bdc778a70 100644 --- a/frontend_nuxt/components/InviteCodeActivityComponent.vue +++ b/frontend_nuxt/components/InviteCodeActivityComponent.vue @@ -6,11 +6,11 @@ 邀请规则说明
-

邀请好友注册并登录,每次可以获得500积分

+

⚠️邀请好友注册并登录,每次可以获得500积分🎉🎉🎉

邀请链接的有效期为1个月

每一个邀请链接的邀请人数上限为3人

通过邀请链接注册,无需注册审核

-

每人每天仅能生产3个邀请链接

+

每人每天仅能生产1个邀请链接

diff --git a/frontend_nuxt/pages/activities.vue b/frontend_nuxt/pages/activities.vue index 79c93db53..5f0180334 100644 --- a/frontend_nuxt/pages/activities.vue +++ b/frontend_nuxt/pages/activities.vue @@ -145,7 +145,7 @@ onMounted(async () => { } .activity-card-normal-right { - width: calc(100% - 150px); + width: 100%; } @media screen and (max-width: 768px) {