完善活动运营域与联调标准化

This commit is contained in:
2026-04-03 13:11:41 +08:00
parent 0e28f70bad
commit 129ea935db
56 changed files with 11004 additions and 196 deletions

View File

@@ -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 || [],
})
},

View File

@@ -11,7 +11,9 @@
<view class="panel__title">当前状态</view>
<view class="summary">{{statusText}}</view>
<view class="summary">进行中:{{ongoingSessionText}}</view>
<view class="summary">进行中运行对象:{{ongoingRuntimeText}}</view>
<view class="summary">最近一局:{{recentSessionText}}</view>
<view class="summary">最近一局运行对象:{{recentRuntimeText}}</view>
<view class="actions">
<button class="btn btn--secondary" bindtap="handleRefresh">刷新首页</button>
<button class="btn btn--ghost" bindtap="handleOpenRecentResult">查看结果</button>