推进活动系统最小成品闭环与游客体验
This commit is contained in:
@@ -6,6 +6,7 @@ type ResultsPageData = {
|
||||
statusText: string
|
||||
results: Array<{
|
||||
sessionId: string
|
||||
eventId: string
|
||||
titleText: string
|
||||
statusText: string
|
||||
scoreText: string
|
||||
@@ -51,6 +52,7 @@ function formatRuntimeSummary(result: BackendSessionResultView): string {
|
||||
function buildResultCardView(result: BackendSessionResultView) {
|
||||
return {
|
||||
sessionId: result.session.id,
|
||||
eventId: result.session.eventId || '',
|
||||
titleText: result.session.eventName || result.session.id,
|
||||
statusText: `${result.result.status} / ${result.session.status}`,
|
||||
scoreText: `得分 ${result.result.finalScore || '--'} / 用时 ${result.result.finalDurationSec || '--'}s`,
|
||||
@@ -115,4 +117,18 @@ Page({
|
||||
url: `/pages/result/result?sessionId=${encodeURIComponent(sessionId)}`,
|
||||
})
|
||||
},
|
||||
|
||||
handleOpenEvent(event: WechatMiniprogram.TouchEvent) {
|
||||
const eventId = event.currentTarget.dataset.eventId as string | undefined
|
||||
if (!eventId) {
|
||||
wx.showToast({
|
||||
title: '当前结果未关联活动',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: `/pages/event/event?eventId=${encodeURIComponent(eventId)}`,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<view class="panel">
|
||||
<view class="panel__title">当前状态</view>
|
||||
<view class="summary">{{statusText}}</view>
|
||||
<view class="summary">你可以回看最近完成的对局,也可以回到对应活动继续查看详情。</view>
|
||||
</view>
|
||||
|
||||
<view class="panel">
|
||||
@@ -20,6 +21,10 @@
|
||||
<view class="result-card__meta">{{item.scoreText}}</view>
|
||||
<view class="result-card__meta">{{item.routeText}}</view>
|
||||
<view class="result-card__meta">{{item.runtimeText}}</view>
|
||||
<view class="actions">
|
||||
<button class="btn btn--secondary" data-session-id="{{item.sessionId}}" catchtap="handleOpenResult">查看单局结果</button>
|
||||
<button class="btn btn--ghost" wx:if="{{item.eventId}}" data-event-id="{{item.eventId}}" catchtap="handleOpenEvent">返回活动</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user