浏览代码

练题除多选题默认问题其他完成

Your Name 3 月之前
父节点
当前提交
34ff3d7f6a
共有 4 个文件被更改,包括 19 次插入13 次删除
  1. 4 2
      pages/online/online.js
  2. 7 4
      pages/online/online.wxml
  3. 2 1
      pages/subject/subject.js
  4. 6 6
      pages/subject/subject.wxml

+ 4 - 2
pages/online/online.js

@@ -29,11 +29,13 @@ Page({
       this.setData({
         signup_id: options.id,
         class_id: options.class_id,
-        order_id:options.order_id
+        order_id:options.id
       })
     }
     this.setData({
-      openid: app.globalData.openid
+      openid: app.globalData.openid,
+      class_id: options.class_id,
+      order_id:options.id
     })
     if(options.tab){
       this.setData({

+ 7 - 4
pages/online/online.wxml

@@ -14,7 +14,7 @@
         <view style="opacity:0;"> {{item.class_hour}}学时 </view>
         <text>{{item.class_hour}}学时</text>
         <!-- <text>{{item.finished_time}}/{{item.total_time}}</text> -->
-        <view class="check" style="color:#FF5E4E;" wx:if='{{item.status != 1}}'>未完成</view>
+        <view class="check" style="color:#FF5E4E;" wx:if='{{item.mark_status != 1}}'>未完成</view>
         <view class="check" wx:else><image src="../../images/gou.png" mode="widthFix"></image>已完成</view>
       </view>
   </navigator>
@@ -28,14 +28,17 @@
       </view>
     </picker>
   </view> -->
-    <navigator  class="test"  wx:for="{{papers}}" wx:key="*this" url="../subject/subject?id={{item.id}}&status={{item.status}}&class_id={{class_id}}&order_id={{order_id}}">
+    <navigator  class="test"  wx:for="{{papers}}" wx:key="*this" url="../subject/subject?id={{item.id}}&status={{item.mark_status}}&class_id={{class_id}}&order_id={{order_id}}">
         <view class="title">{{item.title}}</view>
         <text>{{item.class_hour}}学时/{{item.full_mark}}分/{{item.time_limit}}分钟</text>
-        <view class="score" wx:if='{{item.status == 1}}'>
+        <view class="score" wx:if='{{item.mark_status == 1}}'>
             <image  src="../../images/score.png" mode="widthFix"></image> <text>  {{item.mark}}分</text>
             <image src="../../images/gou.png" mode="widthFix"></image>  已完成
         </view> 
-        <navigator wx:else >开始练习</navigator>
+        <view class="score" wx:else>
+           <image wx:if="{{item.mark_count>0}}"  src="../../images/score.png" mode="widthFix"></image> <text wx:if="{{item.mark_count>0}}">  {{item.mark}}分</text>
+          <navigator>开始练习</navigator>
+        </view>
     </navigator>
 </view>
 <navigator url="../clocklist/clocklist?id={{signup_id}}" style="position:fixed;bottom:100rpx;background-color: rgba(53,139,255,1);" wx:if="{{show&&signup_id}}"

+ 2 - 1
pages/subject/subject.js

@@ -35,6 +35,7 @@ Page({
         success:res=>{
           this.setData({
             data:res.data.data,
+            ans:res.data.data.post_answer,
             id:options.id,
             status:res.data.data.mark_status,
             time:res.data.data.time_limit,
@@ -186,7 +187,7 @@ Page({
                   success(res) {
                     if (res.confirm) {
                       wx.navigateTo({
-                        url: '../online/online?tab=1&class_id='+_this.data.class_id+'&id=1'+_this.data.order_id,
+                        url: '../online/online?tab=1&class_id='+_this.data.class_id+'&id='+_this.data.order_id,
                       })
                     }
                   }

+ 6 - 6
pages/subject/subject.wxml

@@ -63,20 +63,20 @@
     <view class="ans" wx:if="{{!status}}">
     
       <radio-group class="option"  wx:if="{{item.qtype == 3}}" bindchange='answer' data-id='{{item.id}}'>
-              <view><radio color="#358BFF"   value="对">正确</radio></view>
-              <view><radio color="#358BFF"   value="错">错误</radio></view>
+              <view><radio color="#358BFF" checked="{{item.post_answer=='对'}}"   value="对">正确</radio></view>
+              <view><radio color="#358BFF" checked="{{item.post_answer=='错'}}"  value="错">错误</radio></view>
         </radio-group>
         <checkbox-group  class="option" wx:elif="{{item.qtype == 2}}" bindchange='answer' data-id='{{item.id}}'>
-            <view wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this">
-            <checkbox color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox></view>
+            <view wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this" wx:for-index="i">
+                <checkbox color="#358BFF" value="{{opt[0]}}">{{opt}}</checkbox>
+            </view>
         </checkbox-group>
         <radio-group class="option"  wx:else bindchange='answer' data-id='{{item.id}}'>
             <view wx:for="{{item.options}}" wx:for-item="opt" wx:key="*this">
-              <radio color="#358BFF"  value="{{opt[0]}}">{{opt}}</radio>
+              <radio color="#358BFF" checked="{{item.post_answer==opt[0]}}"  value="{{opt[0]}}">{{opt}}</radio>
             </view>
         </radio-group> 
     </view>
-
 </view> 
 
 <view class="btn">