subject.wxml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <wxs module="util" src="../../utils/pub.wxs"></wxs>
  2. <view class="top" wx:if="{{status != 1}}">
  3. <text bindtap="openAns">答题卡</text>
  4. 总题数:{{idx}}/{{data.questions.length}}
  5. <view>{{time}}</view>
  6. </view>
  7. <view class="top" wx:else>
  8. <text bindtap="reDo">重做试卷</text>
  9. <text bindtap="openAns" style="margin-right: 5px;">答题卡</text>
  10. 总题数:{{idx}}/{{data.questions.length}}
  11. </view>
  12. <!-- 判断 -->
  13. <view class="content" wx:for="{{data.questions}}" hidden="{{idx != index+1}}" wx:key="idx">
  14. <view class="num">{{index+1}}、
  15. <view>
  16. <image wx:if="{{item.qtype == 1}}" src="../../images/danx.svg" mode="widthFix"></image>
  17. <image wx:if="{{item.qtype == 2}}" src="../../images/duox.svg" mode="widthFix"></image>
  18. <image wx:if="{{item.qtype == 3}}" src="../../images/pd.svg" mode="widthFix"></image>
  19. {{item.title}}
  20. </view>
  21. </view>
  22. <!-- <view class="ques"> {{item.title}} </view> -->
  23. <view class="ans" wx:if="{{status}}">
  24. <view class="option" wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this" wx:if='{{item.qtype == 1}}'>
  25. <view wx:if='{{opt[0] == item.answer}}' class="correct">
  26. {{opt}}
  27. </view>
  28. <view wx:elif='{{opt[0] == item.post_answer && !item.correct}}' class="error">
  29. {{opt}}
  30. </view>
  31. <view wx:else>
  32. {{opt}}
  33. </view>
  34. </view>
  35. <view class="option" wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this" wx:if='{{item.qtype == 2}}'>
  36. <view wx:if='{{util.includes(item.post_answer, opt[0]) && item.correct}}' class="correct">
  37. {{opt}}
  38. </view>
  39. <view wx:elif='{{util.includes(item.post_answer, opt[0]) && !item.correct}}' class="error">
  40. {{opt}}
  41. </view>
  42. <view wx:else>
  43. {{opt}}
  44. </view>
  45. </view>
  46. <view class="option" wx:if='{{item.qtype == 3}}' wx:for="{{flag}}" wx:for-item="opt">
  47. <view wx:if='{{opt.value == item.answer}}' class="correct">{{opt.name}}</view>
  48. <view wx:elif='{{opt.value == item.post_answer && !item.correct}}' class="error">{{opt.name}}</view>
  49. <view wx:else>{{opt.name}}</view>
  50. </view>
  51. <view>
  52. <view style="color:#000;margin-bottom: 15rpx;"><text style="color: #666;">正确答案:</text>{{item.answer}}
  53. <text style="padding: 0 10px;"></text>
  54. <text style="color: #666;">您的答案:</text>{{item.post_answer?item.post_answer:''}}
  55. </view>
  56. <view style="color:#666">答案解析:</view>
  57. <view class="analysis">{{item.analysis}}</view>
  58. </view>
  59. </view>
  60. <view class="ans" wx:if="{{!status}}">
  61. <radio-group class="option" wx:if="{{item.qtype == 3}}" bindchange='answer' data-id='{{item.id}}'>
  62. <view><radio color="#358BFF" checked="{{item.post_answer=='对'}}" value="对">正确</radio></view>
  63. <view><radio color="#358BFF" checked="{{item.post_answer=='错'}}" value="错">错误</radio></view>
  64. </radio-group>
  65. <checkbox-group class="option" wx:elif="{{item.qtype == 2}}" bindchange='answer' data-id='{{item.id}}'>
  66. <view wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this" wx:for-index="i">
  67. <!-- <view wx:for="{{item.post_answer}}" wx:for-item="ans" wx:key="*this">
  68. {{ans==opt[0]}}
  69. <checkbox checked="{{ans==opt[0]}}" color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox>
  70. </view> -->
  71. <!-- <view wx:if="{{item.post_answer.indexOf(opt[0])!=-1}}" wx:key="*this">
  72. <checkbox checked="true" color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox>
  73. </view> -->
  74. <checkbox color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox>
  75. </view>
  76. </checkbox-group>
  77. <radio-group class="option" wx:else bindchange='answer' data-id='{{item.id}}'>
  78. <view wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this">
  79. <radio color="#358BFF" checked="{{item.post_answer==opt[0]}}" value="{{opt[0]}}">{{opt}}</radio>
  80. </view>
  81. </radio-group>
  82. </view>
  83. </view>
  84. <view class="btn">
  85. <text class="{{idx<=1?'hide':''}}" bindtap="prev">上一题</text>
  86. <text class="{{idx>=data.questions.length?'hide':''}}" bindtap="next">下一题</text>
  87. <view bindtap="post" wx:if='{{status != 1}}'>交卷</view>
  88. </view>
  89. <view class="ans_bg" wx:if='{{show}}'>
  90. <view class="ans_card">
  91. <view>答题卡 <image bindtap="closeAns" class="close" mode="widthFix" src="../../images/close.png"></image></view>
  92. <block wx:if='{{status}}'>
  93. <block wx:for="{{data.questions}}">
  94. <text wx:if='{{item.post_answer}}' class="{{item.correct ? 'right':'error'}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
  95. <text wx:else bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
  96. </block>
  97. </block>
  98. <block wx:else>
  99. <text wx:for="{{data.questions}}" class="{{item.post_answer ? 'act':''}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
  100. </block>
  101. </view>
  102. </view>