添加最后一个 月 30天的 判定
This commit is contained in:
@@ -19,6 +19,7 @@ function NTRPTestEntryCard(props: {
|
||||
evaluateCallback?: EvaluateCallback;
|
||||
}) {
|
||||
const [testFlag, setTestFlag] = useState(false);
|
||||
const [hasTestInLastMonth, setHasTestInLastMonth] = useState(false);
|
||||
const { type, evaluateCallback } = props;
|
||||
const userInfo = useUserInfo();
|
||||
const { setCallback } = useEvaluate();
|
||||
@@ -36,7 +37,10 @@ function NTRPTestEntryCard(props: {
|
||||
}
|
||||
// 获取测试结果
|
||||
const res = await evaluateService.getLastResult();
|
||||
setTestFlag(res.code === 0 && res.data.has_ntrp_level);
|
||||
if (res.code === 0) {
|
||||
setTestFlag(res.data.has_ntrp_level);
|
||||
setHasTestInLastMonth(res.data.has_test_in_last_month);
|
||||
}
|
||||
};
|
||||
init();
|
||||
}, [userInfo.id]);
|
||||
@@ -115,6 +119,11 @@ function NTRPTestEntryCard(props: {
|
||||
[setCallback, testFlag, type, evaluateCallback]
|
||||
);
|
||||
|
||||
// 如果最近一个月有测试记录,则不展示
|
||||
if (hasTestInLastMonth) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return type === EvaluateScene.list ? (
|
||||
<View className={styles.higher} onClick={handleTest}>
|
||||
<View className={styles.desc}>
|
||||
|
||||
Reference in New Issue
Block a user