From 9b17737ca86900f9d33de9455d159f010b22f0b5 Mon Sep 17 00:00:00 2001 From: 170-carry Date: Tue, 28 Apr 2026 20:57:04 +0800 Subject: [PATCH] fix: render searched agency profile --- h5/hyapp/join-agency/index.html | 2 +- h5/hyapp/join-agency/script.js | 42 ++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/h5/hyapp/join-agency/index.html b/h5/hyapp/join-agency/index.html index 83ee471..ac94a24 100644 --- a/h5/hyapp/join-agency/index.html +++ b/h5/hyapp/join-agency/index.html @@ -85,6 +85,6 @@ - + diff --git a/h5/hyapp/join-agency/script.js b/h5/hyapp/join-agency/script.js index 918ab7a..9133842 100644 --- a/h5/hyapp/join-agency/script.js +++ b/h5/hyapp/join-agency/script.js @@ -292,7 +292,43 @@ } function pickProfile(body) { - return body?.teamProfile || body?.ownUserProfile || body?.userProfile || body || null; + return body?.ownUserProfile || body?.userProfile || body?.teamProfile || body || null; + } + + function pickSpecialAccount(profile) { + return profile?.ownSpecialId?.account || + profile?.specialId?.account || + profile?.specialAccount || + profile?.shortAccount || + profile?.shortId || + ""; + } + + function pickSearchAgency(body) { + const teamProfile = body?.teamProfile || null; + const userProfile = body?.ownUserProfile || body?.userProfile || teamProfile?.ownUserProfile || teamProfile?.userProfile || null; + if (!teamProfile?.id) return null; + + const specialAccount = pickSpecialAccount(userProfile) || pickSpecialAccount(teamProfile); + + return { + ...(teamProfile || {}), + ...(userProfile || {}), + id: teamProfile.id, + teamId: teamProfile.id, + teamName: teamProfile.teamName || userProfile?.teamName || "", + userNickname: userProfile?.userNickname || teamProfile.userNickname || teamProfile.name || teamProfile.teamName || "", + name: userProfile?.name || teamProfile.name || teamProfile.teamName || "", + userAvatar: userProfile?.userAvatar || teamProfile.userAvatar || userProfile?.avatar || teamProfile.avatar || "", + avatar: userProfile?.avatar || teamProfile.avatar || userProfile?.userAvatar || teamProfile.userAvatar || "", + displayAccount: specialAccount || userProfile?.account || teamProfile.account || "", + account: userProfile?.account || teamProfile.account || "", + ownSpecialId: userProfile?.ownSpecialId || teamProfile.ownSpecialId || (specialAccount ? { account: specialAccount } : null), + specialId: userProfile?.specialId || teamProfile.specialId || null, + specialAccount, + shortAccount: userProfile?.shortAccount || teamProfile.shortAccount || "", + shortId: userProfile?.shortId || teamProfile.shortId || "" + }; } function pickName(profile) { @@ -300,7 +336,7 @@ } function pickAccount(profile) { - return profile?.ownSpecialId?.account || profile?.account || profile?.id || "-"; + return pickSpecialAccount(profile) || profile?.displayAccount || profile?.account || profile?.id || "-"; } function initials(name) { @@ -395,7 +431,7 @@ try { const body = await apiRequest(`/team/search-account?account=${encodeURIComponent(account)}`); - const profile = body?.teamProfile || null; + const profile = pickSearchAgency(body); if (!profile?.id) { foundAgency = null; renderFoundAgency(null);