Browse Source

宁德小程序修改

y595705120 2 years ago
parent
commit
481126cdee

+ 4 - 4
pages/exam/collection/index.js

@@ -37,7 +37,7 @@ Page({
     let list = this.data.list
     list[index].select = +e.detail.value
     this.setData( {list} );
-    if( list[index].select== list[index].result  ) this.delAnswer(list[index].answerId )
+    if( list[index].select== list[index].result  ) this.delAnswer(list[index].id )
 
   },
   checkboxChange( e ){
@@ -47,7 +47,7 @@ Page({
     let result = ""+list[index].result
     if (list[index].select == result ){
       list[index]._select = true
-      this.delAnswer(list[index].answerId )
+      this.delAnswer(list[index].id )
     }else{
       for( let i in e.detail.value){
         if(result.indexOf( e.detail.value[i] )==-1 ){
@@ -78,8 +78,8 @@ Page({
   stopPullDownRefresh(){
     wx.stopPullDownRefresh()
   },
-  delAnswer( answerId  ){
-    app.formPost('Exam.DelErrorAnswer', {answerId}).then(res => {
+  delAnswer( id  ){
+    app.formPost('Exam.DelErrorAnswer', {id}).then(res => {
     }) 
   }
 })

+ 1 - 1
pages/newExam/mockExam/index.wxml

@@ -29,7 +29,7 @@
 			<!-- 多选题 -->
 			<i-cell wx:if="{{item.type==3}}">
 				<view>
-					<text>{{item.index+1}}、 [多]{{item.title}} </text>
+					<rich-text nodes="{{item.index+1}}、 [多]{{item.title}}"></rich-text> 
 					<checkbox-group class="checkbox-answer" style="margin-top:10rpx" bindchange="checkboxChange">
 						<label class="checkbox" wx:for="{{preList}}" wx:key="index" wx:for-item="answer"
 							wx:if="{{item['answer'+(index+1)]}}">

+ 15 - 11
pages/newExam/orderTest/index.js

@@ -9,6 +9,7 @@ Page({
     answerId:0,
     index:0,
     type:1,
+    answerMap:{},
     showResult: false,
     types:{
       1:'判断题',
@@ -52,22 +53,24 @@ Page({
     })
   },
   checkAnswer( e ){
-    let item = this.data.item;
-    if( !item.select ){
-      app.message("还未作答", 'error')
-      return;
-    }
-    let param = {answerId: item.answerId}
+    let {showResult, info, answerMap, groupId} = this.data;
+    let answerId= info.answerId||0;
+    if( showResult ) return;
+    if(!answerId) return; 
+    let param = {answerId, groupId}
     // 多选
-    if( item.type == mulSelect ){
-      item.correct = item.select.join("") == item.result;
+    if( info.type == 3 ){
+      info.correct = info.select == info.result;
     }else{
-      item.correct = item.select == item.result;
+      info.correct  = info.select == info.result;
     }
-    param.correct = item.correct?1:0
+    param.correct = info.correct?1:0;
+    let result = answerMap[answerId];
+    if( result === param.correct) return;
+    answerMap[answerId] = param.correct;
     // 打开下一题
     app.formPost('Exam.EditErrorAnswer', param).then(res => {
-      this.setData({item, next:true})
+      this.setData({info, next:true, answerMap})
     }) 
   },
   radioChange( e ){
@@ -102,6 +105,7 @@ Page({
     })
   },
   finishAnswer( e ){
+    this.checkAnswer()
     let action = e.currentTarget.dataset.action;
     let {groupId, unfinish, type, showResult, total, index} = this.data
     let correct = this.data.info.select == this.data.info.result?1:0;

+ 1 - 1
pages/newExam/orderTest/index.wxml

@@ -4,7 +4,7 @@
   <view class="view-wrap">
     <view class="exam-count-down">
       {{types[type]}} ({{index+1}}/{{total}})
-      <text style="margin-left:10rpx;margin-right:10rpx">背景模式</text>
+      <text style="margin-left:10rpx;margin-right:10rpx" >{{showResult?'背景模式':'答题模式'}}</text>
       <i-switch value="{{showResult}}" bind:change="onChange"></i-switch>
     </view>
   </view>

+ 1 - 1
pages/train/orderTest/answer.wxml

@@ -4,7 +4,7 @@
   <view class="view-wrap">
     <view class="exam-count-down">
       {{types[type]}} ({{unfinish}}/{{total}})
-      <text style="margin-left:10rpx;margin-right:10rpx">背景模式</text>
+      <text style="margin-left:10rpx;margin-right:10rpx" >{{showResult?'背景模式':'答题模式'}}</text>
       <i-switch value="{{showResult}}" bind:change="onChange"></i-switch>
     </view>
   </view>