<wxs module="filter" src="../../../wxs/exam-fun.wxs"></wxs>

<view class="exam-page p10" wx:if="{{item&& item.answerId>0}}">
	<view class="view-wrap-hidden"> </view>
	<view class="exam-name-title">
      <h1></h1>
  </view>
	<i-panel   i-class="exam-panel-title">   
		<i-cell-group i-class="exam-cell" >
			<!-- 单选题 -->
			<i-cell wx:if="{{item.type==1}}">
				<view>
					<rich-text nodes="[单]{{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}}">
									{{answer}}. {{item['answer'+(index+1)]}}
								</radio>
							</view>
						</label>
					</radio-group>
				</view>
			</i-cell>
			<!-- 多选题 -->
			<i-cell wx:if="{{item.type==2}}">
				<view>
					<text> [多]{{item.title}} </text>
					<checkbox-group class="checkbox-answer" style="margin-top:30rpx" bindchange="checkboxChange"  >
						<label class="checkbox" wx:for="{{preList}}" wx:key="index" wx:for-item="answer" 
							wx:if="{{item['answer'+(index+1)]}}">
							<view class="checkbox-answer">
								<checkbox color="#2d8cf0" value="{{index+1}}" checked="{{filter.isSelect( index+1, item.select)}}">
									{{answer}}. {{item['answer'+(index+1)]}}
								</checkbox>
							</view>
						</label>
					</checkbox-group>
				</view>
			</i-cell>
			<!-- 判断 -->
			<i-cell wx:if="{{item.type==3}}">
				<view>
					<rich-text nodes="[判]{{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>

		<!-- 答案解答 -->
		<view class="exam-clear mt20 " wx:if="{{next}}">
			<view class="exam-extend-item" style="padding-left:0px">
				结果:
				<text class="question-answer-right question-answer-result" wx:if="{{item.correct}}">正确
				</text>
				<text class="question-answer-error question-answer-result" wx:else>错误</text>
			</view>

			<view class="exam-extend-item" style="padding-left:0px" wx:if="{{item.star}}">
				难度:
				<i-rate value="{{item.star}}" i-class="exam-item-rate" />
			</view>

			<view class="exam-extend-item" wx:if="{{item.content}}">
				<rich-text nodes="解析: {{item.content}}" />
			</view>

			<view class="exam-extend-item">
				<text wx:if="{{item.type==1}}"> 正确答案: {{preList[item.result-1]}}</text>
				<text wx:elif="{{item.type==2}}"> 正确答案: {{filter.getMultResult(item.result)}}</text>
				<text wx:else> 正确答案: {{item.result==1?'正确':'错误'}}</text>
			</view>
		</view>


		<view class="mt50">
			<button class="i-btn  i-btn-primary i-btn-square" bindtap='nextAnswer' wx:if="{{next}}">下一题</button>
			<button class="i-btn  i-btn-primary i-btn-square" bindtap='checkAnswer' wx:else>提交</button>
		</view>
	</i-panel>
</view>

<view wx:else style="text-align:center;margin-top:40rpx">
	<view class="padding">没有更多错题</view>
</view>