66 lines
2.9 KiB
Plaintext
66 lines
2.9 KiB
Plaintext
<!--pages/test/mbti.wxml - MBTI测试页面(按旧版模板重构)-->
|
||
<view class="test-page">
|
||
<view wx:if="{{loading}}" class="test-loading">
|
||
<text class="test-loading-text">加载题目…</text>
|
||
</view>
|
||
<view wx:elif="{{loadError}}" class="test-error-state">
|
||
<view class="test-error-ic">⚠️</view>
|
||
<text class="test-error-title">加载失败</text>
|
||
<text class="test-error-msg">{{loadErrorMsg || '网络异常,请检查后重试'}}</text>
|
||
<view class="test-error-btn" bindtap="retryLoad">重新加载</view>
|
||
<text class="test-error-hint">若持续失败,请在微信中关闭小程序后再次打开</text>
|
||
</view>
|
||
<block wx:elif="{{currentQuestion}}">
|
||
<view wx:if="{{usingLocalFallback}}" class="fallback-banner">
|
||
<text class="fallback-banner-ic">📶</text>
|
||
<text class="fallback-banner-text">当前使用本地题库(网络异常自动切换),结果仍会在本机完成</text>
|
||
</view>
|
||
<view class="progress-section">
|
||
<view class="progress-info">
|
||
<text class="question-count">问题 {{currentIndex + 1}}/{{total}}</text>
|
||
<text class="time-remaining">剩余时间: {{formatTime}}</text>
|
||
</view>
|
||
<view class="progress-bar-container">
|
||
<view class="progress-bar" style="width: {{progress}}%"></view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="content-area">
|
||
<view class="question-card">
|
||
<text class="question-text">{{currentQuestion.question}}</text>
|
||
<view class="options-container">
|
||
<view
|
||
class="option-item {{answers[currentQuestion.id] === option.value ? 'selected' : ''}}"
|
||
wx:for="{{currentQuestion.options}}"
|
||
wx:for-item="option"
|
||
wx:for-index="optIdx"
|
||
wx:key="optIdx"
|
||
bindtap="selectAnswer"
|
||
data-value="{{option.value}}"
|
||
>
|
||
<view class="radio-button {{answers[currentQuestion.id] === option.value ? 'checked' : ''}}">
|
||
<view wx:if="{{answers[currentQuestion.id] === option.value}}" class="radio-inner"></view>
|
||
</view>
|
||
<text class="option-text">{{option.text}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view wx:if="{{currentIndex === total - 1}}" class="last-hint">
|
||
<text class="last-hint-text">最后一题:选择后约 0.3 秒自动跳转结果页;若未跳转,请点右下角「查看结果」。</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="footer-buttons">
|
||
<view class="nav-button secondary {{currentIndex === 0 ? 'disabled' : ''}}" bindtap="prevQuestion">
|
||
<text class="button-text">上一题</text>
|
||
</view>
|
||
<view wx:if="{{currentIndex < total - 1}}" class="nav-button secondary" bindtap="nextQuestion">
|
||
<text class="button-text">跳过</text>
|
||
</view>
|
||
<view wx:else class="nav-button primary {{isSubmitting ? 'disabled' : ''}}" bindtap="finishTest">
|
||
<text class="button-text button-text-on-primary">{{isSubmitting ? '正在生成…' : '查看结果'}}</text>
|
||
</view>
|
||
</view>
|
||
</block>
|
||
</view>
|