fix: index page
This commit is contained in:
@@ -14,10 +14,10 @@
|
|||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
<view class="user-texts">
|
<view class="user-texts">
|
||||||
<text class="year-info">2026 岁在丙午</text>
|
<text class="greeting-info">{{ greetingText }}</text>
|
||||||
<text class="user-name"
|
<text class="user-name" @tap="handleLogin">
|
||||||
>您好,{{ userInfo.nickName || "新春福星" }}</text
|
{{ userInfo.nickName || "点击登录" }}
|
||||||
>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="text-content">
|
<view class="text-content">
|
||||||
<text class="feature-name">制作今日头像</text>
|
<text class="feature-name">制作今日头像</text>
|
||||||
<text class="feature-desc">限定 · 如意边框</text>
|
<!-- <text class="feature-desc">限定 · 如意边框</text> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="text-content">
|
<view class="text-content">
|
||||||
<text class="feature-name">好运祝福壁纸</text>
|
<text class="feature-name">好运祝福壁纸</text>
|
||||||
<text class="feature-desc">高清 · 福气盈门</text>
|
<!-- <text class="feature-desc">高清 · 福气盈门</text> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -145,11 +145,17 @@
|
|||||||
@tap="switchTab('all')"
|
@tap="switchTab('all')"
|
||||||
>全部</view
|
>全部</view
|
||||||
>
|
>
|
||||||
|
<view
|
||||||
|
class="rank-tab-mini"
|
||||||
|
:class="{ active: currentTab === 'wallpaper' }"
|
||||||
|
@tap="switchTab('wallpaper')"
|
||||||
|
>壁纸</view
|
||||||
|
>
|
||||||
<view
|
<view
|
||||||
class="rank-tab-mini"
|
class="rank-tab-mini"
|
||||||
:class="{ active: currentTab === 'frame' }"
|
:class="{ active: currentTab === 'frame' }"
|
||||||
@tap="switchTab('frame')"
|
@tap="switchTab('frame')"
|
||||||
>头像框</view
|
>头像</view
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
class="rank-tab-mini"
|
class="rank-tab-mini"
|
||||||
@@ -157,12 +163,6 @@
|
|||||||
@tap="switchTab('card')"
|
@tap="switchTab('card')"
|
||||||
>贺卡</view
|
>贺卡</view
|
||||||
>
|
>
|
||||||
<view
|
|
||||||
class="rank-tab-mini"
|
|
||||||
:class="{ active: currentTab === 'wallpaper' }"
|
|
||||||
@tap="switchTab('wallpaper')"
|
|
||||||
>壁纸</view
|
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted, computed } from "vue";
|
||||||
import { getStatusBarHeight } from "@/utils/system";
|
import { getStatusBarHeight } from "@/utils/system";
|
||||||
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app";
|
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
@@ -217,7 +217,25 @@ import { getRecommendList } from "@/api/system";
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const statusBarHeight = ref(getStatusBarHeight());
|
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 luckyScore = ref(98);
|
||||||
const luckyColor = ref("赤金朱红");
|
const luckyColor = ref("赤金朱红");
|
||||||
const progressDays = ref(1);
|
const progressDays = ref(1);
|
||||||
@@ -240,7 +258,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
if (userStore.userInfo) {
|
if (userStore.userInfo) {
|
||||||
userInfo.value = userStore.userInfo;
|
// userInfo.value = userStore.userInfo; // 已改为 computed
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -359,7 +377,7 @@ onShareTimeline(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.year-info {
|
.greeting-info {
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
margin-bottom: 2rpx;
|
margin-bottom: 2rpx;
|
||||||
|
|||||||
Reference in New Issue
Block a user