From 72eb440504d68420de351e292f81da696f129037 Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Wed, 25 Feb 2026 14:50:47 +0800 Subject: [PATCH] fix: check-in --- api/user.js | 8 ++++++++ pages/index/index.vue | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 api/user.js diff --git a/api/user.js b/api/user.js new file mode 100644 index 0000000..2dfe350 --- /dev/null +++ b/api/user.js @@ -0,0 +1,8 @@ +import { request } from "@/utils/request.js"; + +export const getUserSignInfo = async (data) => { + return request({ + url: "/api/sign/info", + method: "GET", + }); +}; diff --git a/pages/index/index.vue b/pages/index/index.vue index 6d6b7b3..a9c1b94 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -213,6 +213,7 @@ import { getStatusBarHeight } from "@/utils/system"; import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app"; import { useUserStore } from "@/stores/user"; import { getRecommendList } from "@/api/system"; +import { getUserSignInfo } from "@/api/user"; import LoginPopup from "@/components/LoginPopup/LoginPopup.vue"; import LuckyPopup from "@/components/LuckyPopup/LuckyPopup.vue"; @@ -223,6 +224,7 @@ const loginPopupRef = ref(null); const luckyPopupRef = ref(null); const userInfo = computed(() => userStore?.userInfo || {}); const isLoggedIn = computed(() => !!userStore.userInfo.nickName); +const signInfo = ref({}); // 用户签到信息 const greetingText = computed(() => { const hour = new Date().getHours(); @@ -262,6 +264,7 @@ const lunarDate = ref({ const rankingList = ref([]); onMounted(() => { + fetchUserSingInfo(); // 获取用户签到信息 fetchRankingData(); }); @@ -271,6 +274,12 @@ onShow(() => { } }); +const fetchUserSingInfo = async () => { + if (!isLoggedIn.value) return; + const res = await getUserSignInfo(); + signInfo.value = res || {}; +}; + const fetchRankingData = async () => { // 模拟数据或调用 API // 实际项目中可以调用 getRecommendList 并根据 currentTab 筛选