完善活动运营域与联调标准化
This commit is contained in:
@@ -12,6 +12,8 @@ type HomePageData = {
|
||||
channelText: string
|
||||
ongoingSessionText: string
|
||||
recentSessionText: string
|
||||
ongoingRuntimeText: string
|
||||
recentRuntimeText: string
|
||||
cards: BackendCardResult[]
|
||||
}
|
||||
|
||||
@@ -26,6 +28,18 @@ function formatSessionSummary(session?: BackendEntryHomeResult['ongoingSession']
|
||||
return `${title} / ${status} / ${route}`
|
||||
}
|
||||
|
||||
function formatRuntimeSummary(session?: BackendEntryHomeResult['ongoingSession'] | null): string {
|
||||
if (!session || !session.runtime) {
|
||||
return '运行对象 --'
|
||||
}
|
||||
|
||||
const runtime = session.runtime
|
||||
const placeText = runtime.placeName || runtime.placeId || '--'
|
||||
const mapText = runtime.mapName || runtime.mapId || '--'
|
||||
const variantText = runtime.courseVariantId || session.variantName || session.variantId || '--'
|
||||
return `地点 ${placeText} / 地图 ${mapText} / 赛道 ${variantText}`
|
||||
}
|
||||
|
||||
function requireAuthToken(): string | null {
|
||||
const app = getApp<IAppOption>()
|
||||
const tokens = app.globalData && app.globalData.backendAuthTokens
|
||||
@@ -43,6 +57,8 @@ Page({
|
||||
channelText: '--',
|
||||
ongoingSessionText: '无',
|
||||
recentSessionText: '无',
|
||||
ongoingRuntimeText: '运行对象 --',
|
||||
recentRuntimeText: '运行对象 --',
|
||||
cards: [],
|
||||
} as HomePageData,
|
||||
|
||||
@@ -92,6 +108,8 @@ Page({
|
||||
channelText: `${result.channel.displayName} / ${result.channel.code}`,
|
||||
ongoingSessionText: formatSessionSummary(result.ongoingSession),
|
||||
recentSessionText: formatSessionSummary(result.recentSession),
|
||||
ongoingRuntimeText: formatRuntimeSummary(result.ongoingSession),
|
||||
recentRuntimeText: formatRuntimeSummary(result.recentSession),
|
||||
cards: result.cards || [],
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user