From 28f0f83531ed7632e29c880e99e64af9a52ad540 Mon Sep 17 00:00:00 2001
From: zzc <1761997216@qq.com>
Date: Tue, 24 Feb 2026 17:32:45 +0800
Subject: [PATCH] fix: page
---
components/LoginPopup/LoginPopup.vue | 15 +-
components/LuckyPopup/LuckyPopup.vue | 530 +++++++++++++++++++++++++++
pages/index/index.vue | 17 +-
3 files changed, 557 insertions(+), 5 deletions(-)
create mode 100644 components/LuckyPopup/LuckyPopup.vue
diff --git a/components/LoginPopup/LoginPopup.vue b/components/LoginPopup/LoginPopup.vue
index 139ba20..9880cc9 100644
--- a/components/LoginPopup/LoginPopup.vue
+++ b/components/LoginPopup/LoginPopup.vue
@@ -88,7 +88,7 @@
+
+
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 5b2957b..3a45e77 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -201,7 +201,9 @@
-
+
+
+
@@ -213,12 +215,15 @@ import { useUserStore } from "@/stores/user";
import { getRecommendList } from "@/api/system";
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
+import LuckyPopup from "@/components/LuckyPopup/LuckyPopup.vue";
const userStore = useUserStore();
const statusBarHeight = ref(getStatusBarHeight());
const loginPopupRef = ref(null);
-
+const luckyPopupRef = ref(null);
const userInfo = computed(() => userStore?.userInfo || {});
+const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
+
const greetingText = computed(() => {
const hour = new Date().getHours();
if (hour < 6) return "凌晨好";
@@ -232,7 +237,7 @@ const greetingText = computed(() => {
const handleLogin = () => {
if (!userInfo.value.nickName) {
- loginPopupRef.value?.open();
+ uni.$emit("show-login-popup");
}
};
const luckyScore = ref(98);
@@ -316,7 +321,11 @@ const onWalletTap = () => {
};
const onOpenLucky = () => {
- uni.navigateTo({ url: "/pages/fortune/index" });
+ if (!isLoggedIn.value) {
+ uni.$emit("show-login-popup");
+ return;
+ }
+ luckyPopupRef.value?.open();
};
const navTo = (url) => {