diff --git a/src/components/NTRPTestEntryCard/index.tsx b/src/components/NTRPTestEntryCard/index.tsx
index 8bbfc10..7e2aa82 100644
--- a/src/components/NTRPTestEntryCard/index.tsx
+++ b/src/components/NTRPTestEntryCard/index.tsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect, useCallback, memo } from "react";
import { View, Image, Text } from "@tarojs/components";
+import { requireLoginWithPhone } from "@/utils/helper";
import Taro from "@tarojs/taro";
import { useUserInfo, useUserActions } from "@/store/userStore";
// import { getCurrentFullPath } from "@/utils";
@@ -47,6 +48,12 @@ function NTRPTestEntryCard(props: {
const handleTest = useCallback(
function () {
+ // 没有绑定手机号,线条转登陆
+ if (!requireLoginWithPhone()) {
+ return;
+ }
+
+
switch (type) {
case EvaluateScene.list:
setCallback({
diff --git a/src/user_pages/myself/index.tsx b/src/user_pages/myself/index.tsx
index 1726d30..04a2a98 100644
--- a/src/user_pages/myself/index.tsx
+++ b/src/user_pages/myself/index.tsx
@@ -9,11 +9,14 @@ import ListContainer from "@/container/listContainer";
import { TennisMatch } from "@/../types/list/types";
import { withAuth, NTRPTestEntryCard } from "@/components";
import { EvaluateScene } from "@/store/evaluateStore";
-import { useUserInfo } from "@/store/userStore";
+import { useUserInfo, useUserActions } from "@/store/userStore";
import { usePickerOption } from "@/store/pickerOptionsStore";
+import evaluateService from "@/services/evaluateService";
+import { waitForAuthInit } from "@/utils/authInit";
const MyselfPage: React.FC = () => {
const pickerOption = usePickerOption();
+
// 获取页面参数
const instance = Taro.getCurrentInstance();
const user_id = instance.router?.params?.userid || "";
@@ -33,6 +36,11 @@ const MyselfPage: React.FC = () => {
// 关注状态
const [is_following, setIsFollowing] = useState(false);
+ // 最近一个月是否有测试记录
+ const [has_test_in_last_month, setHasTestInLastMonth] = useState(false);
+
+ const { fetchUserInfo } = useUserActions();
+
// 当前激活的标签页
const [active_tab, setActiveTab] = useState<"hosted" | "participated">(
"hosted"
@@ -70,6 +78,28 @@ const MyselfPage: React.FC = () => {
pickerOption.getProfessions();
}, []);
+ // 获取测试结果,判断最近一个月是否有测试记录
+ useEffect(() => {
+ const init = async () => {
+ if (!is_current_user) return; // 只对当前用户获取测试记录
+ // 先等待静默登录完成
+ await waitForAuthInit();
+ // 然后再获取用户信息
+ if (!user_info.id) {
+ await fetchUserInfo();
+ }
+
+
+ // 获取测试结果
+ const res = await evaluateService.getLastResult();
+ if (res.code === 0) {
+ console.log( "getLastResult", res.data);
+ setHasTestInLastMonth(res.data.has_test_in_last_month);
+ }
+ };
+ init();
+ }, [is_current_user, user_info.id]);
+
// 页面加载时获取数据
// useEffect(() => {
// load_user_data();
@@ -215,9 +245,11 @@ const MyselfPage: React.FC = () => {
-
-
-
+ {has_test_in_last_month && is_current_user && (
+
+
+
+ )}
{/* 球局类型标签页 */}
diff --git a/src/utils/helper.ts b/src/utils/helper.ts
index 24d062e..d5eaf1d 100644
--- a/src/utils/helper.ts
+++ b/src/utils/helper.ts
@@ -58,7 +58,6 @@ export const requireLogin = (): boolean => {
export const requireLoginWithPhone = (): boolean => {
// 先检查登录状态
const isLoggedIn = check_login_status();
-
if (!isLoggedIn) {
navigateToLogin();
return false;