<view class="exam-page">
  <view class="view-wrap">
    <view class="exam-count-down">{{remainTimeStr}}</view>
  </view>
  <view class="view-wrap-hidden">
  </view>

  <view>
    <view class="exam-name-title">
      <h1>{{info.title}}</h1>
    </view>

    <form bindsubmit='formSubmit'>  
      <i-panel title="{{titleItem.title}}" 
        wx:for="{{list}}" 
          wx:for-item="item" 
          wx:key="answerId" 
          i-class="exam-panel-title"> 
        
          <i-cell-group i-class="exam-cell">
          <!-- 单选题 -->
          <i-cell wx:if="{{item.type==1}}"> 
            <view>
              <rich-text nodes="{{index+1}}.[单]{{item.title}}" />
              <radio-group class="radio-answer" bindchange="radioChange" data-index="{{index}}" >
                <label class="radio" wx:for="{{preList}}" wx:for-item="answer" wx:key="anserIndex" wx:if="{{item['answer'+(index+1)]}}">
                  <view class="radio-answer">
                    <radio color="#2d8cf0" value="{{index+1}}" checked="{{item.select==index+1}}" >
                      {{preList[index]}}. {{item['answer'+(index+1)]}}
                    </radio>
                  </view>
                </label>
              </radio-group>
            </view>
          </i-cell>
          <!-- 多选题 -->
          <i-cell wx:if="{{item.type==2}}"> 
            <view >
              <text> {{index+1}}. [多]{{item.title}} </text>
              <checkbox-group class="checkbox-answer" style="margin-top:30rpx" bindchange="checkboxChange" data-index="{{index}}">
                <label class="checkbox" wx:for="{{preList}}" wx:for-item="answer" wx:if="{{item['answer'+(index+1)]}}">
                  <view class="checkbox-answer">
                    <checkbox color="#2d8cf0" value="{{index+1}}">
                      {{answer}}. {{item['answer'+(index+1)]}}
                    </checkbox>
                  </view>
                </label>
              </checkbox-group>
            </view>
          </i-cell>
          <!-- 判断 -->
          <i-cell wx:if="{{item.type==3}}"> 
            <view>
              <rich-text nodes="{{index+1}}.[判]{{item.title}}" />
              <radio-group class="radio-answer" bindchange="radioChange" data-index="{{index}}" >
                <label class="radio" wx:for="{{2}}" wx:for-item="answer" >
                  <view class="radio-answer">
                    <radio color="#2d8cf0" value="{{index+1}}" checked="{{item.select==index+1}}" >
                      {{preList[index]}}. {{item['answer'+(index+1)]}}
                    </radio>
                  </view>
                </label>
              </radio-group>
            </view>
          </i-cell>
        </i-cell-group>
      </i-panel>

      <view>
        <button class="i-btn  i-btn-primary i-btn-square" form-type='submit'>提交</button>
      </view>

      <i-action-sheet visible="true" visible="{{timeOutShow}}" mask-closable="{{ false }}">
        <view slot="header" style="padding: 16px">
          <view class="exam-timeout-title">考试试卷结束，请提交试卷！</view>
          <button class="i-btn  i-btn-primary i-btn-square" form-type='submit'>提交</button>
        </view>
      </i-action-sheet>
    </form>

    <i-modal title="考试结果" visible="{{modalShow}}" bind:ok="returnRecord" bind:cancel="returnRecord">
      <view>我的战绩：{{result.correct}} / {{result.counter}}</view>
    </i-modal>

    <i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
    <i-message id="message" />
  </view>
</view>