Browse Source

答题卡

tanyanfei 6 months ago
parent
commit
a1b0dbe5b6
4 changed files with 31 additions and 5 deletions
  1. BIN
      images/close.png
  2. 8 2
      pages/subject/subject.js
  3. 13 3
      pages/subject/subject.wxml
  4. 10 0
      pages/subject/subject.wxss

BIN
images/close.png


+ 8 - 2
pages/subject/subject.js

@@ -23,7 +23,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    // options.id=65
+    // options.id=58
     // options.status=1
       wx.request({
         url: host+'/api/wx/paper/info',
@@ -70,9 +70,15 @@ Page({
   },
   //重做
   reDo(){
+    let data=this.data.data
+    data.questions.forEach(item=>{
+      item.post_answer=''
+    })
     this.setData({
+      idx:1,
       status:0,
-      rePost:1
+      rePost:1,
+      data:data
     })
     this.countDown(this.data.time)
   },

+ 13 - 3
pages/subject/subject.wxml

@@ -7,7 +7,9 @@
 </view>
 <view class="top" wx:else>
   <text bindtap="reDo">重做试卷</text>
-  总题数 <view>{{idx}}/{{data.questions.length}}</view>
+  <text bindtap="openAns" style="margin-right: 5px;">答题卡</text>
+  
+  总题数:{{idx}}/{{data.questions.length}} 
 </view>
 <!-- 判断 -->
 <view class="content" wx:for="{{data.questions}}"  hidden="{{idx != index+1}}" wx:key="idx">
@@ -85,7 +87,15 @@
 
 <view class="ans_bg" wx:if='{{show}}'>
   <view class="ans_card">
-    <view>答题卡  <image bindtap="closeAns" class="close" mode="widthFix" src="../../images/back.png"></image></view>
-    <text wx:for="{{data.questions}}" class="{{item.post_answer ? 'act':''}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
+    <view>答题卡  <image bindtap="closeAns" class="close" mode="widthFix" src="../../images/close.png"></image></view>
+    <block wx:if='{{status}}'>
+      <block  wx:for="{{data.questions}}">
+        <text wx:if='{{item.post_answer}}' class="{{item.correct ? 'right':'error'}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
+        <text wx:else bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
+      </block>
+    </block>
+    <block wx:else>
+      <text  wx:for="{{data.questions}}" class="{{item.post_answer ? 'act':''}}" bindtap="skip" data-id='{{index}}'>{{index+1}}</text>
+    </block>
   </view>
 </view>

+ 10 - 0
pages/subject/subject.wxss

@@ -165,6 +165,11 @@
   margin:8rpx;
 }
 .ans_card .act{
+  background-color: #0091FF;
+  border-color: #0091FF;
+  color: #fff;
+}
+.ans_card .right{
   background-color: #22CC62;
   border-color: #22CC62;
   color: #fff;
@@ -172,4 +177,9 @@
 .close{
   width: 20px;
   float: right;
+}
+.ans_card .error{
+  background-color: #FF6868;
+  border-color: #FF6868;
+  color: #fff;
 }