y595705120 3 years ago
parent
commit
999e7f6ca1

+ 1 - 0
app.js

@@ -174,6 +174,7 @@ App({
   setUserInfo: function (userInfo) {
     this.globalData.userInfo = userInfo;
     if( userInfo.openid ){
+      console.log("@openid", userInfo.openid)
       wx.setStorageSync('@openid', userInfo.openid )
     }
     wx.setStorageSync('@user', userInfo )

+ 8 - 5
app.json

@@ -1,22 +1,25 @@
 {
   "pages": [
-    "pages/index/index",
-    "pages/exam/do/index",
+    "pages/exam/index/index",
+    "pages/exam/answerIndex/index",
     
+    "pages/exam/answer/answer",
+    "pages/exam/group/group",
+    "pages/exam/paper/paper",
+    "pages/exam/do/index",
+    "pages/index/index",
     "pages/study/exam/index",
-    "pages/user/identify/index",    
+    "pages/user/identify/index",
     "pages/study/course/index",
     "pages/my/index/index",
     "pages/study/index/index",
     "pages/study/sign/index",
     "pages/study/market/index",
-    "pages/exam/index/index",
     "pages/user/bind/index",
     "pages/user/register/index",
     "pages/my/message/info/index",
     "pages/my/message/list/index",
     "pages/exam/read/index",
-    
     "pages/exam/error/index",
     "pages/exam/record/index",
     "pages/train/index/index"

+ 6 - 0
app.wxss

@@ -215,3 +215,9 @@ button::after {
   height:160rpx;
   margin-top:40rpx
 }
+
+
+.slide-image {
+  width: 100%;
+  height: 150px;
+}

+ 104 - 0
pages/exam/answer/answer.js

@@ -0,0 +1,104 @@
+let app = getApp()
+Page({
+  data: {
+    preList:["A","B","C", "D", "E", "F"],
+    info:{},
+    total:0,
+    unfinish:0,
+    answerId:0,
+    type:1,
+    types:{
+      1:'判断题',
+      2:'单选题',
+      3:'多选题',
+      4:'案例题'
+    },
+    groupId:0
+  },
+  onLoad: function(options) {
+    let groupId = +options.groupId||1;
+    let type = +options.type||1;
+    let total = +options.count ||0;
+    this.setData({ groupId, type, total });
+  },
+
+  onShow: function(){
+    app.checkLogin( userInfo =>{
+      this.setData({userInfo, from:0})
+      this.loadAnswer()
+    })
+  },
+  loadAnswer(  ){
+    let {groupId, type} = this.data
+    app.formPost('Exam.LoadAnswer', {groupId, type}).then(res => {
+      if (res.code ==200) {
+        let {unfinish, info} = res.data
+        let answerId = info&&info.answerId||0;
+        this.setData({unfinish, info, answerId})
+      }
+    })
+  },
+  checkAnswer( e ){
+    let item = this.data.item;
+    if( !item.select ){
+      app.message("还未作答", 'error')
+      return;
+    }
+    let param = {answerId: item.answerId}
+    // 多选
+    if( item.type == mulSelect ){
+      item.correct = item.select.join("") == item.result;
+    }else{
+      item.correct = item.select == item.result;
+    }
+    param.correct = item.correct?1:0
+    // 打开下一题
+    app.formPost('Exam.EditErrorAnswer', param).then(res => {
+      this.setData({item, next:true})
+    }) 
+  },
+  radioChange( e ){
+    let info = this.data.info
+    info.select = +e.detail.value
+    this.setData( {info} );
+  },
+  checkboxChange( e ){
+    let info = this.data.info
+    info.select = +e.detail.value.sort().join("")
+    let result = ""+info.result
+    if (info.select == result ){
+      info._select = true
+    }else{
+      for( let i in e.detail.value){
+        if(result.indexOf( e.detail.value[i] )==-1 ){
+          info._select = true
+        }
+      }
+    }
+    this.setData( {info} );
+  },
+  restartAnswer(){
+    let {groupId,  type, total} = this.data
+    let answerId=0
+    let unfinish = total
+    app.formPost('Exam.finishAnswer', {groupId, answerId, type}).then(res => {
+      if (res.code ==200) {
+        let info = res.data
+        let answerId = info.answerId
+        this.setData({info, answerId, unfinish})
+      }
+    })
+  },
+  finishAnswer( ){
+    let {groupId, answerId, unfinish, type} = this.data
+    let correct = this.data.info.select == this.data.info.result?1:0;
+    app.formPost('Exam.finishAnswer', {groupId, answerId, type, correct}).then(res => {
+      if (res.code ==200) {
+        let info = res.data
+        let answerId = info.answerId
+        unfinish = unfinish-1
+        this.setData({info, answerId, unfinish})
+      }
+    })
+  }
+})

+ 17 - 0
pages/exam/answer/answer.json

@@ -0,0 +1,17 @@
+{
+  "usingComponents": {
+    "i-panel": "/component/iView/panel/index",
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index",
+    "i-radio-group": "/component/iView/radio-group/index",
+    "i-radio": "/component/iView/radio/index",
+    "i-input": "/component/iView/input/index",
+    "i-action-sheet": "/component/iView/action-sheet/index",
+    "i-modal": "/component/iView/modal/index",
+    "i-message": "/component/iView/message/index",
+    "i-spin": "/component/iView/spin/index",
+    "i-rate": "/component/iView/rate/index"
+  },
+  "enablePullDownRefresh": false,
+  "navigationBarTitleText": "顺序答题"
+}

+ 116 - 0
pages/exam/answer/answer.wxml

@@ -0,0 +1,116 @@
+<wxs module="filter" src="../../../wxs/exam-fun.wxs"></wxs>
+
+
+
+<view class="exam-page p10" wx:if="{{answerId>0}}">
+
+  <view class="view-wrap">
+    <view class="exam-count-down" >
+     {{types[type]}} ({{unfinish}}/{{total}})
+    </view>
+  </view>
+
+  <i-panel i-class="exam-panel-title">
+    <i-cell-group i-class="exam-cell">
+      <!-- 单选题 -->
+      <i-cell wx:if="{{info.type ==2}}">
+        <view class="single">
+          <rich-text nodes="[单]{{info.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="{{info['answer'+(index+1)]}}">
+              <view class="radio-answer">
+                <radio color="#2d8cf0" value="{{index+1}}" checked="{{info.select==index+1}}"
+                  disabled="{{info.select>0?true:false}}">
+                  {{preList[index]}}. {{info['answer'+(index+1)]}}
+                </radio>
+              </view>
+            </label>
+          </radio-group>
+
+          <view class="exam-clear mt20" wx:if="{{info.select>0}}">
+            <view class="exam-extend-item">
+              答题结果:
+              <text class="question-answer-right question-answer-result" wx:if="{{info.select==info.result}}">正确
+              </text>
+              <text class="question-answer-error question-answer-result" wx:else>错误</text>
+            </view>
+
+            <view class="exam-extend-item">
+              正确答案:
+              <text wx:if="{{info.type==2}}"> {{preList[info.result-1]}}</text>
+            </view>
+          </view>
+        </view>
+      </i-cell>
+      <!-- 多选题 -->
+      <i-cell wx:if="{{info.type==3}}">
+        <view>
+          <rich-text nodes="[多]{{info.title}}" />
+          <checkbox-group class="checkbox-answer" style="margin-top:30rpx" bindchange="checkboxChange"
+            data-index="{{index}}">
+            <label class="checkbox" wx:for="{{preList}}" wx:for-item="answer" wx:key=""
+              wx:if="{{info['answer'+(index+1)]}}">
+              <view class="checkbox-answer">
+                <checkbox color="#2d8cf0" value="{{index+1}}" disabled="{{!!info._select}}"
+                  checked="{{filter.isSelect(index+1,info.select)}}">
+                  {{answer}}. {{info['answer'+(index+1)]}}
+                </checkbox>
+              </view>
+            </label>
+          </checkbox-group>
+        </view>
+
+        <view class="exam-clear mt20" wx:if="{{isFinish || info._select}}">
+          <view class="exam-extend-item">
+            答题结果:
+            <text class="question-answer-right question-answer-result" wx:if="{{info.select==info.result}}">正确
+            </text>
+            <text class="question-answer-error question-answer-result" wx:else>错误</text>
+          </view>
+          <view class="exam-extend-item">
+            正确答案:
+            <text> {{filter.getMultResult(info.result)}}</text>
+          </view>
+        </view>
+
+      </i-cell>
+      <!-- 判断 -->
+      <i-cell wx:if="{{info.type==1}}">
+        <view>
+          <rich-text nodes="[判]{{info.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="{{info.select==index+1}}"
+                  disabled="{{info.select>0?true:false}}">
+                  {{preList[index]}}. {{info['answer'+(index+1)]}}
+                </radio>
+              </view>
+            </label>
+          </radio-group>
+        </view>
+        <view class="exam-clear mt20" wx:if="{{ info.select>0}}">
+          <view class="exam-extend-item">
+            答题结果:
+            <text class="question-answer-right question-answer-result" wx:if="{{info.select==info.result}}">正确
+            </text>
+            <text class="question-answer-error question-answer-result" wx:else>错误</text>
+          </view>
+          <view class="exam-extend-item">
+            正确答案:
+            <text> {{info.result==1?'正确':'错误'}}</text>
+          </view>
+        </view>
+      </i-cell>
+    </i-cell-group>
+  </i-panel>
+
+  <view class="mt50">
+    <button class="i-btn  i-btn-primary i-btn-square" bindtap='finishAnswer'>下一题</button>
+  </view>
+</view>
+
+<view wx:else style="text-align:center;margin-top:40rpx">
+  <button class="i-btn  i-btn-primary i-btn-square" bindtap='restartAnswer'>重新再刷一遍</button>
+</view>

+ 97 - 0
pages/exam/answer/answer.wxss

@@ -0,0 +1,97 @@
+/* pages/exam/paper/paper.wxss */.exam-page {
+  background: white;
+}
+
+.exam-count-down {
+  font-size: 15px;
+  line-height: 35px;
+}
+
+.view-wrap {
+  position: fixed;
+  width: 100%;
+  background: #fff6f6;
+  text-align: center;
+  height: 35px;
+  z-index: 999;
+}
+
+.view-wrap-hidden {
+  height: 35px;
+}
+
+.exam-name-title {
+  text-align: center;
+  margin-top: 10px;
+  font-size: 17px;
+}
+
+.exam-panel-title {
+  margin-top: 30px;
+}
+
+.exam-radio-item-label {
+  float: left;
+  margin-left: 10px;
+  line-height: 35px;
+}
+
+.exam-item-left {
+  float: left;
+}
+
+.exam-input-contain {
+  margin: 10px 2px !important;
+  border-width: 1px;
+  border-color: #dddee1;
+  border-style: solid;
+  width: 95%;
+  height: 40px;
+}
+
+.exam-input-contain-label {
+  float: left;
+  padding: 0px 15px;
+  line-height: 40px;
+}
+
+.exam-input-contain-content {
+  float: left;
+  height: 40px;
+}
+
+.exam-textarea-contain {
+  margin: 10px 2px !important;
+  border-width: 1px;
+  border-color: #dddee1;
+  border-style: solid;
+  width: 100%;
+}
+
+.exam-timeout-title{
+  font-size: 16px;
+  color: red;
+  margin-top: 10px;
+  margin-bottom: 20px;
+}
+
+.exam-clear {
+  clear: both;
+  margin-left: 20rpx;
+}
+
+.exam-extend-item {
+  padding: 4px;
+}
+
+.question-answer-error {
+  background-color: #fef0f0;
+  border-color: #fde2e2;
+  color: #f56c6c;
+}
+
+.question-answer-right {
+  background-color: #f0f9eb;
+  border-color: #e1f3d8;
+  color: #67c23a;
+}

+ 33 - 0
pages/exam/answerIndex/index.js

@@ -0,0 +1,33 @@
+let app = getApp()
+Page({
+  data: {
+    groupId: 0,
+    tableData: [],
+  },
+  onLoad: function(options) {
+    let groupId = +options.groupId||1;
+    this.setData({ groupId });
+  },
+  onShow: function () {
+    app.checkLogin( userInfo =>{
+      this.setData({userInfo, from:0})
+      this.loadData()
+    })
+  },
+  gotoAnswer(e){
+    let item = e.currentTarget.dataset.item;
+    let groupId = this.data.groupId
+    console.log( item )
+    wx.navigateTo({
+      url: `/pages/exam/answer/answer?groupId=${groupId}&type=${item.type}&count=${item.count}`
+    })
+  },
+  loadData: function(){
+    let param= {groupId: this.data.groupId}
+    app.formPost('Exam.InitGroupAnswer', param ).then(res => {
+      if( res.code == 200){
+        this.setData({tableData: res.data})
+      }
+    })
+  }
+})

+ 16 - 0
pages/exam/answerIndex/index.json

@@ -0,0 +1,16 @@
+{
+  "usingComponents": {
+    "i-panel": "/component/iView/panel/index",
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index",
+    "i-collapse": "/component/iView/collapse/index",
+    "i-collapse-item": "/component/iView/collapse-item/index",
+    "i-message": "/component/iView/message/index",
+    "i-spin": "/component/iView/spin/index",
+    "i-icon": "/component/iView/icon/index",
+    "i-button": "/component/iView/button/index",
+    "i-badge": "/component/iView/badge/index"
+  },
+  "enablePullDownRefresh": true,
+  "navigationBarTitleText": "顺序做题"
+}

+ 21 - 0
pages/exam/answerIndex/index.wxml

@@ -0,0 +1,21 @@
+<view wx:for="{{tableData}}" wx:key="item">
+  <i-button wx:if="{{item.type==1}}"
+    bindtap="gotoAnswer" data-item="{{item}}" type="info" open-type="navigate" class="m20">
+    <text type="primary">判断题 【{{item.count}}】</text>
+  </i-button>
+  <i-button wx:if="{{item.type==2}}"
+    bindtap="gotoAnswer" data-item="{{item}}" 
+    type="primary" open-type="navigate" class="m20">
+    <text type="primary"> 单选题 【{{item.count}}】</text>
+  </i-button>
+  <i-button wx:if="{{item.type==3}}"
+    bindtap="gotoAnswer" data-item="{{item}}" 
+    type="warning" open-type="navigate" class="m20">
+    <text type="primary"> 多选题 【{{item.count}}】</text>
+  </i-button>
+  <i-button wx:if="{{item.type==4}}"
+    bindtap="gotoAnswer" data-item="{{item}}" 
+    type="error" open-type="navigate" class="m20">
+    <text type="primary"> 案例题 【{{item.count}}】小题</text>
+  </i-button>
+</view>

+ 3 - 0
pages/exam/answerIndex/index.wxss

@@ -0,0 +1,3 @@
+swiper image {
+  width: 100%;
+}

+ 60 - 43
pages/exam/collection/index.js

@@ -1,5 +1,4 @@
 let app = getApp()
-let mulSelect = 3
 Page({
   data: {
     preList:["A","B","C", "D", "E", "F"],
@@ -7,62 +6,80 @@ Page({
     size:10,
     item: {},
     next: false,
+    loading:false,
+    groupId:0,
     list: [],
   },
   onLoad: function(options) {
-    this.loadData(  true )
+    let groupId = + options.groupId||0
+    this.setData({groupId})
+    this.loadData(  )
   },
-  loadData( firstAnswer ){
-    let {size,from} = this.data
-    app.formPost('Exam.GetErrorAnswerList', {from,size}).then(res => {
+  loadData( cb  ){
+    let {size,from, groupId, list } = this.data
+    this.setData({loading:true})
+    app.formPost('Exam.GetErrorAnswerList', {groupId,from,size}).then(res => {
       if (res.code ==200) {
-        let list = res.data.list||[];
-        list.reverse()
-        if( firstAnswer){
-          let item = list.pop() ||{};
-          this.setData({list, item})
-        }else{
-          this.setData({list})
+        if( from == 0){
+          list = [];
         }
+        this.setData({
+          from: res.data.from,
+          list: list.concat(res.data.list),
+        });
       }
+      this.setData({loading:false})
+      cb&&cb()
     })
   },
-  checkAnswer( e ){
-    let item = this.data.item;
-    if( !item.select ){
-      app.message("还未作答", 'error')
-      return;
-    }
-    let param = {answerId: item.answerId}
-    // 多选
-    if( item.type == mulSelect ){
-      item.correct = item.select.join("") == item.result;
+  radioChange( e ){
+    let index = e.currentTarget.dataset.index;
+    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 )
+
+  },
+  checkboxChange( e ){
+    let index = e.currentTarget.dataset.index;
+    let list = this.data.list
+    list[index].select = +e.detail.value.sort().join("")
+    let result = ""+list[index].result
+    if (list[index].select == result ){
+      list[index]._select = true
+      this.delAnswer(list[index].answerId )
     }else{
-      item.correct = item.select == item.result;
+      for( let i in e.detail.value){
+        if(result.indexOf( e.detail.value[i] )==-1 ){
+          list[index]._select = true
+        }
+      }
     }
-    param.correct = item.correct?1:0
-    // 打开下一题
-    app.formPost('Exam.EditErrorAnswer', param).then(res => {
-      this.setData({item, next:true})
-    }) 
+    this.setData( {list} );
   },
-  radioChange( e ){
-    let item = this.data.item
-    item.select = +e.detail.value;
-    this.setData({item})
+  emptyAnswer(e){
+    let list = this.data.list.map( item =>{
+      item._select = false;
+      item.select = 0
+      return item
+    })
+    this.setData({list})
   },
-  checkboxChange( e ){
-    let item = this.data.item
-    item.select = e.detail.value.sort()
-    this.setData( {item} );
+  onPullDownRefresh() {
+    if (!this.loading) {
+      this.loadData( this.stopPullDownRefresh )
+    }
   },
-  nextAnswer( ){
-    let {list} = this.data;
-    let item = list.pop()||{};
-    delete( item.select )
-    this.setData({item, list, next:false})
-    if( list.length < 1){
-      this.loadData( )
+  onReachBottom() {
+    if (!this.loading && this.data.from > -1) {
+      this.loadData(  )
     }
+  },
+  stopPullDownRefresh(){
+    wx.stopPullDownRefresh()
+  },
+  delAnswer( answerId  ){
+    app.formPost('Exam.DelErrorAnswer', {answerId}).then(res => {
+    }) 
   }
 })

+ 2 - 1
pages/exam/collection/index.json

@@ -10,8 +10,9 @@
     "i-modal": "/component/iView/modal/index",
     "i-message": "/component/iView/message/index",
     "i-spin": "/component/iView/spin/index",
+    "i-button": "/component/iView/button/index",
     "i-rate": "/component/iView/rate/index"
   },
-  "enablePullDownRefresh": false,
+  "enablePullDownRefresh": true,
   "navigationBarTitleText": "收藏题库"
 }

+ 71 - 51
pages/exam/collection/index.wxml

@@ -1,94 +1,114 @@
 <wxs module="filter" src="../../../wxs/exam-fun.wxs"></wxs>
 
-<view class="exam-page p10" wx:if="{{item&& item.answerId>0}}">
+<view class="exam-page p10">
 	<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" >
+		<h1></h1>
+	</view>
+	<i-panel wx:for="{{list}}" i-class="exam-panel-title">
+		<i-cell-group i-class="exam-cell">
 			<!-- 单选题 -->
-			<i-cell wx:if="{{item.type==2}}">
-				<view>
-					<rich-text nodes="[单]{{item.title}}" />
+			<i-cell wx:if="{{item.type ==2}}">
+				<view class="single">
+					<rich-text nodes="{{index+1}}.[单]{{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)]}}">
+						<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 color="#2d8cf0" value="{{index+1}}" checked="{{item.select==index+1}}"
+									disabled="{{item.select>0?true:false}}">
+									{{preList[index]}}. {{item['answer'+(index+1)]}}
 								</radio>
 							</view>
 						</label>
 					</radio-group>
+
+					<view class="exam-clear mt20" wx:if="{{item.select>0}}">
+						<view class="exam-extend-item">
+							答题结果:
+							<text class="question-answer-right question-answer-result" wx:if="{{item.select==item.result}}">正确
+							</text>
+							<text class="question-answer-error question-answer-result" wx:else>错误</text>
+						</view>
+
+						<view class="exam-extend-item">
+							正确答案:
+							<text wx:if="{{item.type==2}}"> {{preList[item.result-1]}}</text>
+						</view>
+					</view>
 				</view>
 			</i-cell>
 			<!-- 多选题 -->
 			<i-cell wx:if="{{item.type==3}}">
 				<view>
-					<rich-text nodes="[多]{{item.title}}" />
-					<checkbox-group class="checkbox-answer" style="margin-top:30rpx" bindchange="checkboxChange"  >
-						<label class="checkbox" wx:for="{{preList}}" wx:key="index" wx:for-item="answer" 
+					<rich-text nodes="{{index+1}}.[多]{{item.title}}" />
+					<checkbox-group class="checkbox-answer" style="margin-top:30rpx" bindchange="checkboxChange"
+						data-index="{{index}}">
+						<label class="checkbox" wx:for="{{preList}}" wx:for-item="answer" wx:key=""
 							wx:if="{{item['answer'+(index+1)]}}">
 							<view class="checkbox-answer">
-								<checkbox color="#2d8cf0" value="{{index+1}}" checked="{{filter.isSelect( index+1, item.select)}}">
+								<checkbox color="#2d8cf0" value="{{index+1}}" disabled="{{!!item._select}}"
+									checked="{{filter.isSelect(index+1,item.select)}}">
 									{{answer}}. {{item['answer'+(index+1)]}}
 								</checkbox>
 							</view>
 						</label>
+
 					</checkbox-group>
+
+				</view>
+
+				<view class="exam-clear mt20" wx:if="{{isFinish || item._select}}">
+					<view class="exam-extend-item">
+						答题结果:
+						<text class="question-answer-right question-answer-result" wx:if="{{item.select==item.result}}">正确
+						</text>
+						<text class="question-answer-error question-answer-result" wx:else>错误</text>
+					</view>
+					<view class="exam-extend-item">
+						正确答案:
+						<text> {{filter.getMultResult(item.result)}}</text>
+					</view>
 				</view>
+
 			</i-cell>
 			<!-- 判断 -->
 			<i-cell wx:if="{{item.type==1}}">
 				<view>
-					<rich-text nodes="[判]{{item.title}}" />
+					<rich-text nodes="{{index+1}}.[判]{{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}}">
+								<radio color="#2d8cf0" value="{{index+1}}" checked="{{item.select==index+1}}"
+									disabled="{{item.select>0?true:false}}">
 									{{preList[index]}}. {{item['answer'+(index+1)]}}
 								</radio>
 							</view>
 						</label>
 					</radio-group>
 				</view>
+				<view class="exam-clear mt20" wx:if="{{ item.select>0}}">
+					<view class="exam-extend-item">
+						答题结果:
+						<text class="question-answer-right question-answer-result" wx:if="{{item.select==item.result}}">正确
+						</text>
+						<text class="question-answer-error question-answer-result" wx:else>错误</text>
+					</view>
+					<view class="exam-extend-item">
+						正确答案:
+						<text> {{item.result==1?'正确':'错误'}}</text>
+					</view>
+				</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==2}}"> 正确答案: {{preList[item.result-1]}}</text>
-				<text wx:elif="{{item.type==3}}"> 正确答案: {{filter.getMultResult(item.result)}}</text>
-				<text wx:else> 正确答案: {{item.result==1?'正确':'错误'}}</text>
-			</view>
+	</i-panel>
+	<view wx:if="{{from==-1}}" style="text-align:center;margin-top:40rpx">
+		<view wx:if="{{list.length>0}}">
+			<i-button  bindtap="emptyAnswer" type="primary" size="default">清空重做</i-button>
 		</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 wx:else>
+			<span>恭喜你,清空所有错题</span>
 		</view>
-	</i-panel>
+	</view>
 </view>
 
-<view wx:else style="text-align:center;margin-top:40rpx">
-	<view class="padding">没有更多错题</view>
-</view>

+ 1 - 1
pages/exam/do/index.js

@@ -139,7 +139,7 @@ Page({
         if( item.select == item.result){
           param.correct += 1
         }else{
-          errIds.push( item.answerId)
+          if( item.select ) errIds.push( item.answerId)
         }
         if( !item.select ) isFinish = false
     }

+ 27 - 0
pages/exam/group/group.js

@@ -0,0 +1,27 @@
+let app = getApp()
+Page({
+  data: {
+    answerId:0,
+    groupId:0,
+    tableData: []
+  },
+  onLoad: function(options) {
+    let groupId = +options.groupId||1;
+    let answerId = +options.answerId||0;
+    this.setData({ groupId, answerId });
+  },
+  onShow: function () {
+    app.checkLogin( userInfo =>{
+      this.setData({userInfo, from:0})
+      this.indexLoad()
+    })
+  },
+  indexLoad: function() {
+    let param = {groupId: this.data.groupId}
+    app.formPost('Exam.GetWxGroupPaperList', param ).then(res => {
+      if( res.code == 200){
+        this.setData({tableData: res.data})
+      }
+    })
+  }
+})

+ 9 - 0
pages/exam/group/group.json

@@ -0,0 +1,9 @@
+{
+  "usingComponents": {
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index",
+    "i-icon": "/component/iView/icon/index",
+    "i-message": "/component/iView/message/index",
+    "i-spin": "/component/iView/spin/index"
+  }
+}

+ 30 - 0
pages/exam/group/group.wxml

@@ -0,0 +1,30 @@
+<wxs module="filter" src="../../../wxs/exam-fun.wxs"></wxs>
+
+<view class="cate-section">
+  <navigator class="cate-item"  url="/pages/exam/answerIndex/index?groupId={{groupId}}" >
+    <i-icon type="other" size="40" color="#e96900a0" />
+    <text>顺序答题</text>
+  </navigator>
+
+  <navigator class="cate-item"  url="/pages/exam/collection/index?groupId={{groupId}}" >
+    <i-icon type="close" size="40" color="#e96900a0" />
+    <text>我的错题</text>
+  </navigator>
+
+  <navigator class="cate-item"  url="/pages/exam/do/index?id={{groupId}}" >
+    <i-icon type="shop_fill" size="40" color="#e96900a0" />
+    <text>模拟考试</text>
+  </navigator>
+</view>
+
+<view class="p20" >
+  <i-cell-group i-class="my-group-margin">
+    <i-cell title="{{item.title}}" wx:for="{{tableData}}" 
+      is-link 
+      url="/pages/exam/paper/paper?paperId={{item.paperId}}&title={{item.title}}" 
+      value="{{item.answerNumber}}" 
+      size="20">
+      <i-icon slot="icon" type="activity" size="28" color="#80848f" />
+    </i-cell>
+  </i-cell-group>
+</view>

+ 1 - 0
pages/exam/group/group.wxss

@@ -0,0 +1 @@
+/* pages/exam/group/group.wxss */

+ 7 - 3
pages/exam/index/index.js

@@ -64,10 +64,14 @@ Page({
     })
   },
   gotoExam:function( e ){
-    let groupId = e.currentTarget.dataset.id
+    let {groupId, answerId} = e.currentTarget.dataset.item
+
+    // wx.navigateTo({
+    //   url: `/pages/exam/do/index?id=${groupId}`
+    // })
     wx.navigateTo({
-      url: `/pages/exam/do/index?id=${groupId}`
-    })
+        url: `/pages/exam/group/group?groupId=${groupId}&answerId=${answerId}`
+      })
   },
   gotoCollection(){
     wx.navigateTo({

+ 1 - 13
pages/exam/index/index.wxml

@@ -28,22 +28,10 @@
   </view>
 
   <view wx:else>
-    <view class="cate-section">
-      <button class="cate-item" bindtap="gotoCollection">
-        <i-icon type="collection" size="40" color="#e96900a0" />
-        <text>收藏题库</text>
-      </button>
-
-      <button class="cate-item" bindtap="gotoHistory">
-        <i-icon type="createtask" size="40" color="#e96900a0" />
-        <text>考试记录</text>
-      </button>
-    </view>
-
     <i-panel>
       <view class="cate-section">
         <view wx:for="{{groups}}" wx:key="groupId" class="cate-item cate-item-3">
-          <button class="cate-item" wx:if="{{item.isBuy}}" bindtap="gotoExam" data-id="{{item.groupId}}">
+          <button class="cate-item" wx:if="{{item.isBuy}}" bindtap="gotoExam" data-item="{{item}}">
             <i-icon type="browse" size="40" color="#7595f1a0" />
             <text>{{item.title}}</text>
           </button>

+ 77 - 0
pages/exam/paper/paper.js

@@ -0,0 +1,77 @@
+let app = getApp()
+Page({
+  data: {
+    list: [],
+    paperId:0,
+    title:'',
+    preList:["A","B","C", "D","E","F"],
+    info:{},
+    id:0,
+    userInfo:{},
+    result: {}
+  },
+  onLoad: function(options) {
+    let paperId = +options.paperId||1
+    let title = options.title||'试卷'
+    this.setData({paperId, title})
+  },
+  onShow: function () {
+    app.checkLogin( userInfo =>{
+      this.setData({userInfo, from:0})
+      this.indexLoad()
+    })
+  },
+  indexLoad(){
+    let paperId = this.data.paperId;
+    app.formPost("exam.GetWxGroupPaperInfo", {paperId}).then(res => {
+      if (res.code ==200) {
+        let list = res.data.map( item =>{
+          if( item.select > 0)  item._select = true;
+          return item
+        })
+        this.setData({list });
+      }
+    })
+  },
+  radioChange( e ){
+    let index = e.currentTarget.dataset.index;
+    let list = this.data.list
+    list[index].select = +e.detail.value
+    this.submitAnswer(list[index], list[index].select== list[index].result?1:0 )
+    this.setData( {list} );
+  },
+  emptyAnswer(e){
+    let list = this.data.list.map( item =>{
+      item._select = false;
+      item.select = 0
+      return item
+    })
+    this.setData({list})
+  },
+  checkboxChange( e ){
+    let index = e.currentTarget.dataset.index;
+    let list = this.data.list
+    list[index].select = +e.detail.value.sort().join("")
+    let result = ""+list[index].result
+    if (list[index].select == result ){
+      list[index]._select = true
+      this.submitAnswer(list[index], 1 )
+    }else{
+      for( let i in e.detail.value){
+        if(result.indexOf( e.detail.value[i] )==-1 ){
+          list[index]._select = true
+          this.submitAnswer(list[index], 0 )
+        }
+      }
+    }
+    this.setData( {list} );
+  },
+  submitAnswer( answer, correct ){
+    let {paperId} = this.data
+    let {answerId, groupId, select} = answer
+    let param = {paperId, groupId, answerId, correct, select}
+    app.formPost('Exam.SubmitWxGroupPaperAnswer', param).then(res => {
+      console.log( res )
+    })
+  }
+})

+ 18 - 0
pages/exam/paper/paper.json

@@ -0,0 +1,18 @@
+{
+  "usingComponents": {
+    "i-panel": "/component/iView/panel/index",
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index",
+    "i-radio-group": "/component/iView/radio-group/index",
+    "i-radio": "/component/iView/radio/index",
+    "i-row": "/component/iView/row/index",
+    "i-col": "/component/iView/col/index",
+    "i-button": "/component/iView/button/index",
+    "i-input": "/component/iView/input/index",
+    "i-action-sheet": "/component/iView/action-sheet/index",
+    "i-modal": "/component/iView/modal/index",
+    "i-message": "/component/iView/message/index",
+    "i-spin": "/component/iView/spin/index"
+  },
+  "navigationBarTitleText": "在线模拟考试"
+}

+ 113 - 0
pages/exam/paper/paper.wxml

@@ -0,0 +1,113 @@
+<wxs module="filter" src="../../../wxs/exam-fun.wxs"></wxs>
+  <view class="exam-page mt0">
+    <view >
+      <i-button  bindtap="emptyAnswer" type="primary" size="default">清空重做</i-button>
+    </view>
+
+    <form bindsubmit='formSubmit'>  
+      <i-panel 
+        wx:for="{{list}}" 
+          wx:for-item="item" 
+          wx:key="answerId" 
+          i-class="exam-panel-title"> 
+        
+        <i-cell-group i-class="exam-cell">
+          <!-- 单选题 -->
+           <i-cell wx:if="{{item.type ==2}}"> 
+            <view class="single">
+              <rich-text nodes="{{index+1}}.[单]{{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}}"  disabled="{{item.select>0?true:false}}" >
+                      {{preList[index]}}. {{item['answer'+(index+1)]}}
+                    </radio>
+                  </view>
+                </label>
+              </radio-group>
+
+              <view class="exam-clear mt20" wx:if="{{item.select>0}}" >
+                <view class="exam-extend-item" >
+                  答题结果:
+                  <text class="question-answer-right question-answer-result" 
+                    wx:if="{{item.select==item.result}}">正确
+                  </text>
+                  <text class="question-answer-error question-answer-result" 
+                    wx:else>错误</text>
+                </view>
+
+                <view class="exam-extend-item">
+                  正确答案:
+                  <text wx:if="{{item.type==2}}"> {{preList[item.result-1]}}</text>
+                </view>
+              </view>
+            </view>
+          </i-cell> 
+          <!-- 多选题 -->
+          <i-cell wx:if="{{item.type==3}}"> 
+            <view >
+              <rich-text nodes="{{index+1}}.[多]{{item.title}}" />
+              <checkbox-group class="checkbox-answer" style="margin-top:30rpx" bindchange="checkboxChange" data-index="{{index}}">
+                <label class="checkbox" wx:for="{{preList}}" wx:for-item="answer" wx:key="" wx:if="{{item['answer'+(index+1)]}}">
+                  <view class="checkbox-answer">
+                    <checkbox color="#2d8cf0" value="{{index+1}}" disabled="{{!!item._select}}" checked="{{filter.isSelect(index+1,item.select)}}">
+                      {{answer}}. {{item['answer'+(index+1)]}}
+                    </checkbox>
+                  </view>
+                </label>
+                
+              </checkbox-group>
+
+            </view>
+
+            <view class="exam-clear mt20"  wx:if="{{isFinish || item._select}}">
+                <view class="exam-extend-item" >
+                  答题结果:
+                  <text class="question-answer-right question-answer-result" 
+                    wx:if="{{item.select==item.result}}">正确
+                  </text>
+                  <text class="question-answer-error question-answer-result" 
+                    wx:else>错误</text>
+                </view>
+                <view class="exam-extend-item">
+                  正确答案:
+                  <text> {{filter.getMultResult(item.result)}}</text>
+                </view>
+              </view>
+
+          </i-cell>
+          <!-- 判断 -->
+          <i-cell wx:if="{{item.type==1}}"> 
+            <view>
+              <rich-text nodes="{{index+1}}.[判]{{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}}" disabled="{{item.select>0?true:false}}" >
+                      {{preList[index]}}. {{item['answer'+(index+1)]}}
+                    </radio>
+                  </view>
+                </label>
+              </radio-group>
+            </view>
+            <view class="exam-clear mt20" wx:if="{{ item.select>0}}" >
+                <view class="exam-extend-item" >
+                  答题结果:
+                  <text class="question-answer-right question-answer-result" 
+                    wx:if="{{item.select==item.result}}">正确
+                  </text>
+                  <text class="question-answer-error question-answer-result" 
+                    wx:else>错误</text>
+                </view>
+                <view class="exam-extend-item">
+                  正确答案:
+                  <text> {{item.result==1?'正确':'错误'}}</text>
+                </view>
+              </view>
+          </i-cell>
+        </i-cell-group>
+
+      </i-panel>
+    </form>
+  </view>
+

+ 97 - 0
pages/exam/paper/paper.wxss

@@ -0,0 +1,97 @@
+/* pages/exam/paper/paper.wxss */.exam-page {
+  background: white;
+}
+
+.exam-count-down {
+  font-size: 15px;
+  line-height: 35px;
+}
+
+.view-wrap {
+  position: fixed;
+  width: 100%;
+  background: #fff6f6;
+  text-align: center;
+  height: 35px;
+  z-index: 999;
+}
+
+.view-wrap-hidden {
+  height: 35px;
+}
+
+.exam-name-title {
+  text-align: center;
+  margin-top: 10px;
+  font-size: 17px;
+}
+
+.exam-panel-title {
+  margin-top: 30px;
+}
+
+.exam-radio-item-label {
+  float: left;
+  margin-left: 10px;
+  line-height: 35px;
+}
+
+.exam-item-left {
+  float: left;
+}
+
+.exam-input-contain {
+  margin: 10px 2px !important;
+  border-width: 1px;
+  border-color: #dddee1;
+  border-style: solid;
+  width: 95%;
+  height: 40px;
+}
+
+.exam-input-contain-label {
+  float: left;
+  padding: 0px 15px;
+  line-height: 40px;
+}
+
+.exam-input-contain-content {
+  float: left;
+  height: 40px;
+}
+
+.exam-textarea-contain {
+  margin: 10px 2px !important;
+  border-width: 1px;
+  border-color: #dddee1;
+  border-style: solid;
+  width: 100%;
+}
+
+.exam-timeout-title{
+  font-size: 16px;
+  color: red;
+  margin-top: 10px;
+  margin-bottom: 20px;
+}
+
+.exam-clear {
+  clear: both;
+  margin-left: 20rpx;
+}
+
+.exam-extend-item {
+  padding: 4px;
+}
+
+.question-answer-error {
+  background-color: #fef0f0;
+  border-color: #fde2e2;
+  color: #f56c6c;
+}
+
+.question-answer-right {
+  background-color: #f0f9eb;
+  border-color: #e1f3d8;
+  color: #67c23a;
+}

+ 1 - 4
pages/study/index/index.wxss

@@ -21,10 +21,7 @@
   border: 0px !important;
 }
 
-.slide-image {
-  width: 100%;
-  height: 150px;
-}
+
 
 .index-cell {
   padding: 5px 15px !important;