fix: index page

This commit is contained in:
zzc
2026-02-24 15:46:42 +08:00
parent 5944f8d011
commit 1d84e34cb3

View File

@@ -14,10 +14,10 @@
mode="aspectFill"
/>
<view class="user-texts">
<text class="year-info">2026 岁在丙午</text>
<text class="user-name"
>您好{{ userInfo.nickName || "新春福星" }}</text
>
<text class="greeting-info">{{ greetingText }}</text>
<text class="user-name" @tap="handleLogin">
{{ userInfo.nickName || "点击登录" }}
</text>
</view>
</view>
</view>
@@ -111,7 +111,7 @@
</view>
<view class="text-content">
<text class="feature-name">制作今日头像</text>
<text class="feature-desc">限定 · 如意边框</text>
<!-- <text class="feature-desc">限定 · 如意边框</text> -->
</view>
</view>
</view>
@@ -126,7 +126,7 @@
</view>
<view class="text-content">
<text class="feature-name">好运祝福壁纸</text>
<text class="feature-desc">高清 · 福气盈门</text>
<!-- <text class="feature-desc">高清 · 福气盈门</text> -->
</view>
</view>
</view>
@@ -145,11 +145,17 @@
@tap="switchTab('all')"
>全部</view
>
<view
class="rank-tab-mini"
:class="{ active: currentTab === 'wallpaper' }"
@tap="switchTab('wallpaper')"
>壁纸</view
>
<view
class="rank-tab-mini"
:class="{ active: currentTab === 'frame' }"
@tap="switchTab('frame')"
>头像</view
>头像</view
>
<view
class="rank-tab-mini"
@@ -157,12 +163,6 @@
@tap="switchTab('card')"
>贺卡</view
>
<view
class="rank-tab-mini"
:class="{ active: currentTab === 'wallpaper' }"
@tap="switchTab('wallpaper')"
>壁纸</view
>
</view>
</view>
@@ -208,7 +208,7 @@
</template>
<script setup>
import { ref, onMounted } from "vue";
import { ref, onMounted, computed } from "vue";
import { getStatusBarHeight } from "@/utils/system";
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app";
import { useUserStore } from "@/stores/user";
@@ -217,7 +217,25 @@ import { getRecommendList } from "@/api/system";
const userStore = useUserStore();
const statusBarHeight = ref(getStatusBarHeight());
const userInfo = ref(userStore?.userInfo || {});
const userInfo = computed(() => userStore?.userInfo || {});
const greetingText = computed(() => {
const hour = new Date().getHours();
if (hour < 6) return "凌晨好";
if (hour < 9) return "早上好";
if (hour < 12) return "上午好";
if (hour < 14) return "中午好";
if (hour < 17) return "下午好";
if (hour < 19) return "傍晚好";
return "晚上好";
});
const handleLogin = () => {
if (!userInfo.value.nickName) {
// 触发全局登录逻辑,假设 LoginPopup 组件已在 App.vue 或全局混入中处理
// 或者跳转到登录页,这里假设通过 userStore 或 eventBus 触发登录弹窗
uni.$emit("show-login-popup");
}
};
const luckyScore = ref(98);
const luckyColor = ref("赤金朱红");
const progressDays = ref(1);
@@ -240,7 +258,7 @@ onMounted(() => {
onShow(() => {
if (userStore.userInfo) {
userInfo.value = userStore.userInfo;
// userInfo.value = userStore.userInfo; // 已改为 computed
}
});
@@ -359,7 +377,7 @@ onShareTimeline(() => {
display: flex;
flex-direction: column;
.year-info {
.greeting-info {
font-size: 20rpx;
color: #999;
margin-bottom: 2rpx;