feat: 修复未登录的测试结果页逻辑
This commit is contained in:
@@ -295,7 +295,7 @@
|
||||
}
|
||||
|
||||
.actions {
|
||||
margin: 74px 22px 0;
|
||||
margin: 52px 22px 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
|
||||
@@ -150,7 +150,9 @@ function Intro() {
|
||||
|
||||
const { last_test_result = null } = ntrpData || {};
|
||||
const { ntrp_level, create_time, id } = last_test_result || {};
|
||||
const lastTestTime = create_time ? dayjs(create_time).format("YYYY年M月D日") : "";
|
||||
const lastTestTime = create_time
|
||||
? dayjs(create_time).format("YYYY年M月D日")
|
||||
: "";
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
@@ -192,15 +194,16 @@ function Intro() {
|
||||
});
|
||||
}
|
||||
Taro.redirectTo({
|
||||
url: `/other_pages/ntrp-evaluate/index?stage=${type}${type === StageType.RESULT ? `&id=${id}` : ""
|
||||
}`,
|
||||
url: `/other_pages/ntrp-evaluate/index?stage=${type}${
|
||||
type === StageType.RESULT ? `&id=${id}` : ""
|
||||
}`,
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.introContainer}>
|
||||
<CommonGuideBar />
|
||||
{ntrpData?.has_ntrp_level ? (
|
||||
{ntrpData?.has_test_record ? (
|
||||
<View className={styles.result}>
|
||||
<View className={styles.avatarWrap}>
|
||||
<View className={styles.avatar}>
|
||||
@@ -234,7 +237,9 @@ function Intro() {
|
||||
</View>
|
||||
<View className={styles.levelWrap}>
|
||||
<Text>NTRP</Text>
|
||||
<Text className={styles.level}>{formatNtrpDisplay(ntrp_level || "")}</Text>
|
||||
<Text className={styles.level}>
|
||||
{formatNtrpDisplay(ntrp_level || "")}
|
||||
</Text>
|
||||
</View>
|
||||
<View className={styles.slogan}>
|
||||
<Text>变线+网前,下一步就是赢比赛!</Text>
|
||||
@@ -495,6 +500,10 @@ function Result() {
|
||||
}
|
||||
|
||||
function handleReTest() {
|
||||
if (!userInfo.phone) {
|
||||
handleAuth();
|
||||
return false;
|
||||
}
|
||||
Taro.redirectTo({
|
||||
url: `/other_pages/ntrp-evaluate/index?stage=${StageType.TEST}`,
|
||||
});
|
||||
@@ -507,6 +516,15 @@ function Result() {
|
||||
}
|
||||
|
||||
async function handleGoon() {
|
||||
if (!userInfo?.phone) {
|
||||
Taro.redirectTo({
|
||||
url: `/login_pages/index/index?redirect=${encodeURIComponent(
|
||||
`/main_pages/index`
|
||||
)}`,
|
||||
});
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
if (type) {
|
||||
next({ flag: false, score: result?.ntrp_level as string });
|
||||
await delay(1500);
|
||||
@@ -566,7 +584,8 @@ function Result() {
|
||||
|
||||
async function handleSaveImage() {
|
||||
console.log(userInfo);
|
||||
if (!userInfo?.id) {
|
||||
if (!userInfo?.phone) {
|
||||
handleAuth();
|
||||
return;
|
||||
}
|
||||
Taro.getSetting().then(async (res) => {
|
||||
@@ -615,16 +634,19 @@ function Result() {
|
||||
});
|
||||
|
||||
function handleAuth() {
|
||||
if (userInfo?.id) {
|
||||
if (userInfo?.phone) {
|
||||
return true;
|
||||
}
|
||||
const currentPage = getCurrentFullPath();
|
||||
Taro.redirectTo({
|
||||
url: `/login_pages/index/index${currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : ""
|
||||
}`,
|
||||
url: `/login_pages/index/index${
|
||||
currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : ""
|
||||
}`,
|
||||
});
|
||||
}
|
||||
|
||||
function handleGo() {}
|
||||
|
||||
return (
|
||||
<View className={styles.resultContainer}>
|
||||
<CommonGuideBar />
|
||||
@@ -652,7 +674,9 @@ function Result() {
|
||||
</View>
|
||||
<View className={styles.levelWrap}>
|
||||
<Text>NTRP</Text>
|
||||
<Text className={styles.level}>{formatNtrpDisplay(result?.ntrp_level)}</Text>
|
||||
<Text className={styles.level}>
|
||||
{formatNtrpDisplay(result?.ntrp_level)}
|
||||
</Text>
|
||||
</View>
|
||||
<View className={styles.slogan}>
|
||||
<Text>变线+网前,下一步就是赢比赛!</Text>
|
||||
@@ -666,9 +690,11 @@ function Result() {
|
||||
<Text>重新测试</Text>
|
||||
</View>
|
||||
</View>
|
||||
{userInfo?.id ? (
|
||||
{userInfo?.phone ? (
|
||||
<View className={styles.updateTip}>
|
||||
<Text>你的 NTRP 水平已更新为 {formatNtrpDisplay(result?.ntrp_level || "")} </Text>
|
||||
<Text>
|
||||
你的 NTRP 水平已更新为 {formatNtrpDisplay(result?.ntrp_level || "")}{" "}
|
||||
</Text>
|
||||
<Text className={styles.grayTip}>(可在个人信息中修改)</Text>
|
||||
</View>
|
||||
) : (
|
||||
@@ -679,14 +705,14 @@ function Result() {
|
||||
<View className={styles.actions}>
|
||||
<View className={styles.viewGame} onClick={handleGoon}>
|
||||
<Button className={styles.viewGameBtn}>
|
||||
{sourceTypeToTextMap.get(type) || "去看看球局"}
|
||||
{sourceTypeToTextMap.get(type) || "去看看适合你的球局"}
|
||||
</Button>
|
||||
</View>
|
||||
<View className={styles.otherActions}>
|
||||
<View className={styles.share}>
|
||||
<Button
|
||||
className={styles.shareBtn}
|
||||
openType={userInfo?.id ? "share" : undefined}
|
||||
openType={userInfo?.phone ? "share" : undefined}
|
||||
onClick={handleAuth}
|
||||
></Button>
|
||||
<View className={styles.shareBtnCover}>
|
||||
|
||||
Reference in New Issue
Block a user