From 654f317c59b83f38fe21a2843b8a2a687f4584f0 Mon Sep 17 00:00:00 2001 From: wikiboss Date: Mon, 21 Sep 2026 11:15:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(hall):=20=E6=94=AF=E6=8C=81=E5=B1=95?= =?UTF-8?q?=E4=BC=9A=E6=B4=BB=E5=8A=A8=E7=A0=81=E7=8E=B0=E5=9C=BA=E4=BA=92?= =?UTF-8?q?=E6=8D=A2=E4=B8=8E=E6=A6=9C=E5=8D=95API=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mpuniapp/common/api.uts | 39 +++++++++++++ mpuniapp/pages/owner/hall/useHall.uts | 79 +++++++++++++++++++++++---- 2 files changed, 108 insertions(+), 10 deletions(-) diff --git a/mpuniapp/common/api.uts b/mpuniapp/common/api.uts index 828d2c7..2eb9f5b 100644 --- a/mpuniapp/common/api.uts +++ b/mpuniapp/common/api.uts @@ -7,6 +7,8 @@ import { AiChatReply, AiChatRequest, CardContact, + CardEvent, + CardEventJoinResult, CardProfile, CardPortalDetail, LeadEntity, @@ -17,7 +19,9 @@ import { OwnerPageData, OwnerPageQuery, QuotaCheckResult, + RadarHotInbox, RadarTrack, + TeamRankItem, SubmitLeadParams, RecordRadarTrackParams, } from './types.uts'; @@ -185,6 +189,41 @@ export function fetchTeamWallPage( return httpPost>('/admin/card/contact/teamWall', query); } +export function fetchEventFloorPage( + query: OwnerPageQuery +): Promise> { + return httpPost>('/admin/card/event/floorPage', query); +} + +export function joinHallEvent( + code: string, + cardId?: string | number +): Promise { + const payload: Record = { code }; + if (cardId != null) { + payload.cardId = cardId; + } + return httpPost('/admin/card/event/join', payload); +} + +export function fetchCurrentEvent(): Promise { + return httpPost('/admin/card/event/current', {}); +} + +export function fetchRadarHotInbox(): Promise { + return httpPost('/admin/crm/radar/hotInbox', {}); +} + +export function fetchTeamLiveRank( + eventId?: string +): Promise { + const payload: Record = {}; + if (eventId != null && eventId !== '') { + payload.eventId = eventId; + } + return httpPost('/admin/team/members/live-rank', payload); +} + export function fetchCardQuota( tenantId?: string | number ): Promise { diff --git a/mpuniapp/pages/owner/hall/useHall.uts b/mpuniapp/pages/owner/hall/useHall.uts index e869203..4dca1a7 100644 --- a/mpuniapp/pages/owner/hall/useHall.uts +++ b/mpuniapp/pages/owner/hall/useHall.uts @@ -10,8 +10,10 @@ import { import { collectHallContact, confirmHallExchange, + fetchEventFloorPage, fetchHallContactPage, fetchTeamWallPage, + joinHallEvent, } from '../../../common/api.uts'; import { getCurrentLocale, getOmniText } from '../../../common/locale.uts'; @@ -28,7 +30,11 @@ export type HallCopyKey = | 'scan' | 'tabContacts' | 'tabTeam' - | 'teamEmpty'; + | 'tabEvent' + | 'teamEmpty' + | 'eventEmpty' + | 'eventPlaceholder' + | 'eventJoin'; export type HallContactItem = { id?: string | number; @@ -40,7 +46,7 @@ export type HallContactItem = { source?: string; }; -export type HallTab = 'contacts' | 'team'; +export type HallTab = 'contacts' | 'team' | 'event'; export type HallState = { tab: HallTab; @@ -50,6 +56,7 @@ export type HallState = { total: number; keyWord: string; exchangeCode: string; + eventCode: string; loading: boolean; empty: boolean; errorMessage: string; @@ -66,6 +73,12 @@ export type LoadHallApi = { exchangeCode: string ) => Promise<{ status: string; isDualSynced: boolean }>; collectHallContact?: (peerCardId: string | number) => Promise; + fetchEventFloorPage?: ( + query: OwnerPageQuery + ) => Promise>; + joinHallEvent?: ( + code: string + ) => Promise<{ event: { code: string }; member: { cardId: number } }>; }; function isZhLocale(): boolean { @@ -115,6 +128,18 @@ export function resolveHallText(key: HallCopyKey): string { if (key === 'teamEmpty') { return zh ? '还没有同事发布名片' : 'No published teammate cards yet'; } + if (key === 'tabEvent') { + return zh ? '现场' : 'Floor'; + } + if (key === 'eventEmpty') { + return zh ? '输入活动码加入现场' : 'Enter an event code to join the floor'; + } + if (key === 'eventPlaceholder') { + return zh ? '输入 6 位活动码' : '6-character event code'; + } + if (key === 'eventJoin') { + return zh ? '加入现场' : 'Join floor'; + } return ''; } @@ -139,6 +164,7 @@ export function createHallState(): HallState { total: 0, keyWord: '', exchangeCode: '', + eventCode: '', loading: false, empty: false, errorMessage: '', @@ -175,13 +201,17 @@ export async function refreshHall( state.loading = true; state.errorMessage = ''; const fetchPage = - state.tab === 'team' - ? api != null && api.fetchTeamWallPage != null - ? api.fetchTeamWallPage - : fetchTeamWallPage - : api != null - ? api.fetchHallContactPage - : fetchHallContactPage; + state.tab === 'event' + ? api != null && api.fetchEventFloorPage != null + ? api.fetchEventFloorPage + : fetchEventFloorPage + : state.tab === 'team' + ? api != null && api.fetchTeamWallPage != null + ? api.fetchTeamWallPage + : fetchTeamWallPage + : api != null + ? api.fetchHallContactPage + : fetchHallContactPage; try { const query: OwnerPageQuery = { page: state.page, @@ -246,11 +276,40 @@ export async function collectPeerCard( } export function applyHallTab(state: HallState, tab: HallTab): void { - state.tab = tab === 'team' ? 'team' : 'contacts'; + if (tab === 'team') { + state.tab = 'team'; + } else if (tab === 'event') { + state.tab = 'event'; + } else { + state.tab = 'contacts'; + } state.page = 1; state.errorMessage = ''; } +export async function submitHallEventJoin( + state: HallState, + api?: LoadHallApi +): Promise { + const code = state.eventCode.trim(); + if (!/^[A-Za-z0-9]{6}$/.test(code)) { + state.errorMessage = resolveHallText('eventPlaceholder'); + return false; + } + const join = + api != null && api.joinHallEvent != null ? api.joinHallEvent : joinHallEvent; + try { + await join(code); + state.eventCode = ''; + state.tab = 'event'; + await refreshHall(state, api); + return true; + } catch (err) { + state.errorMessage = readErrorMessage(err); + return false; + } +} + export const PENDING_COLLECT_KEY = 'omni_pending_collect_card'; export function setPendingCollectCard(cardId: string | number): void {