Browse Source

题库更新

y595705120 2 years ago
parent
commit
c11475409a

+ 1 - 2
app.json

@@ -23,8 +23,7 @@
     "pages/train/index/index",
     "pages/train/limitHome/index",
     "pages/train/limitDo/index",
-    "pages/train/limit/index",
-    "pages/newExam/orderTest/index"
+    "pages/train/limit/index"
     
   ],
   "tabBar": {

+ 16 - 9
pages/exam/collection/index.js

@@ -37,7 +37,7 @@ Page({
     let list = this.data.list
     list[index].select = +e.detail.value
     this.setData( {list} );
-    this.delAnswer( list[index].id )
+    this.delAnswer( list[index])
   },
   checkboxChange( e ){
     let index = e.currentTarget.dataset.index;
@@ -46,7 +46,7 @@ Page({
     let result = ""+list[index].result
     if (list[index].select == result ){
       list[index]._select = true
-      this.delAnswer(list[index].id )
+      this.delAnswer(list[index]  )
     }else{
       for( let i in e.detail.value){
         if(result.indexOf( e.detail.value[i] )==-1 ){
@@ -78,17 +78,24 @@ Page({
   stopPullDownRefresh(){
     wx.stopPullDownRefresh()
   },
-  delAnswer( id  ){
-    id = ''+id
+  delAnswer( info  ){
+    let {id, parentId, select,result} = info;
     let list = this.data.list
-    for( let i in list){
-      if( list[i].id == id ){
-        if(list[i].select != list[i].result){
-          return
+    let skip = false
+    let mselect = {};
+    if( parentId > 0 ){
+      for( let i in list){
+        if( list[i].parentId == parentId ){
+          if(list[i].select != list[i].result){
+            skip = true
+          }
         }
+        mselect[list[i].answerId] = list[i].select;
       }
+    }else{
+      if( select!= result) skip = true;
     }
-    app.formPost('Exam.DelErrorAnswer', {id}).then(res => {
+    app.formPost('Exam.DelErrorAnswer', {id,skip,mselect}).then(res => {
     }) 
   }
 })

+ 0 - 134
pages/newExam/orderTest/index.js

@@ -1,134 +0,0 @@
-let app = getApp()
-const util = require("../../../utils/util")
-Page({
-  data: {
-    preList:["A","B","C", "D", "E", "F"],
-    info:{},
-    total:0,
-    unfinish:0,
-    answerId:0,
-    index:0,
-    type:1,
-    answerMap:{},
-    showResult: false,
-    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 });
-  },
-  onChange(event){
-    const showResult = event.detail.value;
-    let {info} = this.data;
-    if( showResult ) {
-      info.select = info.result;
-    }else{
-      info.select = 0
-    }
-    this.setData({showResult, info})
-  },
-  onShow: function(){
-    app.checkLogin( userInfo =>{
-      this.setData({userInfo, from:0})
-      this.loadAnswer()
-    })
-  },
-  loadAnswer(  ){
-    let {groupId, type, showResult} = this.data
-    app.formPost('Exam.LoadAnswerNew', {groupId, type}).then(res => {
-      if (res.code ==200) {
-        let {unfinish, info, total} = res.data;
-        let index = total- unfinish;
-        if(showResult) info.select = info.result;
-        this.setData({unfinish, total, info, index})
-      }
-    })
-  },
-  checkAnswer( e ){
-    let {showResult, info, answerMap, groupId} = this.data;
-    let answerId= info.answerId||0;
-    if( showResult ) return;
-    if(!answerId) return; 
-    let param = {answerId, groupId}
-    // 多选
-    if( info.type == 3 ){
-      info.correct = info.select == info.result;
-    }else{
-      info.correct  = info.select == info.result;
-    }
-    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({info, next:true, answerMap})
-    }) 
-  },
-  radioChange( e ){
-    let info = this.data.info
-    info.select = +e.detail.value
-    this.setData( {info} );
-  },
-  checkboxChange( e ){
-    let info = this.data.info
-    let select = +e.detail.value.sort().join("")
-    let result = ""+info.result
-    if (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, showResult} = this.data
-    app.formPost('Exam.resetAnswerNew', {groupId, type}).then(res => {
-      if (res.code ==200) {
-        let {total, unfinish,info} = res.data
-        let index =  total - unfinish;
-        if(showResult) info.select = info.result;
-        this.setData({info, index, total, unfinish})
-      }
-    })
-  },
-  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;
-    if( action == "prev"){
-      if( total <= unfinish ) {
-        util.showMsg("已经在第一题")
-        return
-      }
-      unfinish+=1
-    }else{
-      if( unfinish < 1 ) {
-        util.showMsg("已经最后一题")
-        return;
-      }
-      unfinish-=1
-    }
-    app.formPost('Exam.finishAnswerNew', {groupId, index, type, correct, action}).then(res => {
-      if (res.code ==200) {
-        let info = res.data
-        let index = total-unfinish;
-        if( showResult) info.select = info.result;
-        this.setData({info, unfinish, index})
-      }
-    })
-  }
-})

+ 0 - 15
pages/newExam/orderTest/index.json

@@ -1,15 +0,0 @@
-{
-  "usingComponents": {
-    "i-panel": "/component/iView/panel/index",
-    "i-cell-group": "/component/iView/cell-group/index",
-    "i-cell": "/component/iView/cell/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-switch": "/component/iView/switch/index",
-    "i-spin": "/component/iView/spin/index"
-  },
-  "enablePullDownRefresh": false,
-  "navigationBarTitleText": "顺序答题"
-}

+ 0 - 116
pages/newExam/orderTest/index.wxml

@@ -1,116 +0,0 @@
-<wxs module="filter" src="../../../wxs/exam-fun.wxs"></wxs>
-
-<view class="exam-page p10" wx:if="{{index<total}}">
-  <view class="view-wrap">
-    <view class="exam-count-down">
-      {{types[type]}} ({{index+1}}/{{total}})
-      <text style="margin-left:10rpx;margin-right:10rpx" >{{showResult?'背景模式':'答题模式'}}</text>
-      <i-switch value="{{showResult}}" bind:change="onChange"></i-switch>
-    </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 && !showResult}}">
-            <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) && !showResult}}">
-          <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 && !showResult}}">
-          <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="flex-btn">
-    <button class="i-btn  i-btn-primary" style="padding: 0 50rpx" bindtap='finishAnswer' data-action="prev">上一题</button>
-    <button class="i-btn  i-btn-primary" style="padding: 0 50rpx" bindtap='finishAnswer' data-action="next">下一题</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>

+ 0 - 98
pages/newExam/orderTest/index.wxss

@@ -1,98 +0,0 @@
-/* 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;
-}

+ 4 - 3
pages/post/post.js

@@ -69,6 +69,9 @@ Page({
       }
     })
   },
+  onReady(res) {
+    this.videoContext = wx.createVideoContext('myVideo')
+  },
   onShareAppMessage: function () {
     let {postId, title} = this.data.info;
     return {
@@ -76,6 +79,4 @@ Page({
       path: `/pages/post/post?postId=${postId}`
     }
   }
-})
-
- 
+})

+ 6 - 1
pages/post/post.wxml

@@ -3,7 +3,7 @@
     {{info.title}}
   </view>
 
-  <view class=" tc">
+  <view class="tc">
     <text> {{info.publishTime}}</text>
     <i-icon type="browse" size="20" color="#80848f" />
     {{info.viewCount}}
@@ -13,6 +13,11 @@
     <i-button  bindtap="download" class="ml20 bsmall"> 下载附件</i-button>
   </view>
 
+  <view class="tc mt40" wx:if="{{info.video}}">
+    <video  id="myVideo" class="w95" src="{{info.video}}" autoplay object-fit="cover">
+    </video>
+  </view>
+
   <view class="wxParse artical-content">
     <rich-text nodes="{{info.content}}" space="emsp" bindtap="preview"></rich-text>
   </view>

+ 4 - 1
pages/post/post.wxss

@@ -19,4 +19,7 @@ page{
   line-height:180%;
   padding-right: 30rpx;
 }
-.w80{ width:90%}
+.w80{width:90%}
+.w95 {
+  width: 95%;
+}

+ 4 - 1
pages/train/orderTest/answer.js

@@ -122,16 +122,19 @@ Page({
   confirmAnswer(){
     let {id, groupId, type,answerId, index, info} = this.data
     let correct = 1
+    let result = [];
     if( !info.child ){
       correct = info.select == info.result?1:0;
+      result.push( info.select )
     }else{
       for( let i in info.child){
         if( info.child[i].select != info.child[i].result ){
           correct= 0
         }
+        result.push( info.child[i].select )
       }
     }
-    let param ={id, groupId, answerId, index, type, correct};
+    let param ={id, groupId, answerId, index, type, correct,result};
     app.formPost('Exam.finishAnswerLimitNew', param).then( res=>{
       if( res.code == 200){
         this.setData({isConfirm:true})