cyy 8 месяцев назад
Родитель
Сommit
5a55a460cc

+ 21 - 1
src/views/platform/bpmn/my-test/examDetail.vue

@@ -135,6 +135,15 @@
                                             readonly
                                             disabled
                                         />
+                                        <ibps-uploader
+                                            v-if="q.questionType === '简答题' && attachmentTF && q.fuJian"
+                                            v-model="q.fuJian"
+                                            download
+                                            multiple
+                                            :have-padding="false"
+                                            clearable
+                                            :readonly="true"
+                                        />
                                     </template>
                                 </div>
                             </div>
@@ -232,6 +241,8 @@ import { getImage } from '@/api/platform/file/attachment'
 import { Notify } from 'vant'
 export default {
   components: {
+    IbpsUploader: () =>
+      import('@/business/platform/file/uploader'),
     IbpsImage: () => import('@/business/platform/file/image')
   },
   props: {
@@ -261,7 +272,9 @@ export default {
       colors: { 1: '#00FF00', 2: '#7FFF00', 3: '#FFFF00', 4: '#FFA500', 5: '#FF0000' },
       texts: ['易', '偏易', '适中', '偏难', '难'],
       isUnFold: true,
-      isTF: {}
+      isTF: {},
+      attachmentTF: false,
+      gapFillingAutomatic: false
     }
   },
   watch: {
@@ -269,7 +282,14 @@ export default {
       this.paperList = val
     }
   },
+  created() {
+    this.attachmentTF =
+      this.$store.getters.setting?.examTag?.tagData?.attachmentTF || false
 
+    this.gapFillingAutomatic =
+      this.$store.getters.setting?.examTag?.tagData?.gapFillingAutomatic ||
+      false
+  },
   async mounted() {
     this.handelListData()
     // this.$nextTick(() => {

+ 110 - 41
src/views/platform/bpmn/my-test/examPop.vue

@@ -5,11 +5,13 @@
     <!-- 标题 -->
     <div class="mainColor">
         <van-row>
-            <van-col span="2" @click="handInAnExaminationPaperBtn()"> <van-icon
+            <van-col span="2" @click="handInAnExaminationPaperBtn()">
+              <van-icon
                 name="arrow-left"
                 size="20px"
                 color="	#1E90FF"
-            /></van-col>
+              />
+              </van-col>
             <van-col span="20"><span class="remain-time">剩余时间:&nbsp;&nbsp;&nbsp;&nbsp;</span><span
                 v-if="listDatas.duration=='不限'"
             >不限</span><van-count-down
@@ -73,8 +75,9 @@
                             :key="index"
                             class="radioAlign"
                             :name="item.label"
-                        >{{ `${item.label}.
-              ${item.value}` }}</van-radio>
+                        >
+                            {{ `${item.label}.${item.value}` }}
+                        </van-radio>
                     </van-radio-group>
                     <!-- 多选题 -->
                     <van-checkbox-group
@@ -89,7 +92,8 @@
                             :key="index"
                             class="radioAlign"
                             :name="item.label"
-                        >{{ `${item.label}.${item.value}` }}
+                        >
+                        {{ `${item.label}.${item.value}` }}
                         </van-checkbox>
                     </van-checkbox-group>
                 </div>
@@ -109,26 +113,44 @@
                     >{{ `${item.value}` }}</van-radio>
                 </van-radio-group>
                 <!-- 输入框 -->
-                <van-field
-                    v-if="popList[questionsIndex]&&popList[questionsIndex].questionType=='填空题'"
-                    v-model="popListAnswer[questionsIndex]"
-                    placeholder="请输入内容"
-                    :border="true"
-                    clearable
-                    maxlength="1000"
-                    class="fileBlank"
-                />
+                <div v-if="popList[questionsIndex]&&popList[questionsIndex].questionType=='填空题'">
+                  <van-field
+                      v-for="(item, index) in popList[questionsIndex].options"
+                      :key="'tian'+index"
+                      v-model="item.answer"
+                      placeholder="请输入内容"
+                      :border="true"
+                      clearable
+                      maxlength="1000"
+                      class="fileBlank"
+                      @input="fieleInput(item.answer,questionsIndex,index)"
+                  />
+                </div>
                 <!-- 简答题 -->
-                <van-field
-                    v-if="popList[questionsIndex]&&popList[questionsIndex].questionType=='简答题'"
-                    v-model="popListAnswer[questionsIndex]"
-                    placeholder="请输入内容"
-                    type="textarea"
-                    :border="true"
-                    clearable
-                    maxlength="2000"
-                    class="shortAnswer"
-                />
+                 <div v-if="popList[questionsIndex]&&popList[questionsIndex].questionType=='简答题'">
+                    <van-field
+                        v-model="popListAnswer[questionsIndex]"
+                        placeholder="请输入内容"
+                        type="textarea"
+                        :border="true"
+                        clearable
+                        maxlength="2000"
+                        class="shortAnswer"
+                    />
+                    <ibps-uploader
+                        v-if="attachmentTF"
+                        v-model="popList[questionsIndex]['fuJian']"
+                        :download="true"
+                        label="附件"
+                        placeholder="请上传附件"
+                        multiple
+                        accept="*"
+                        :readonly="false"
+                        :limit="5"
+                        :file-size="10 * 1024 * 1024"
+                        style="width: 100%; margin-top: 10px; font-size: 14px"
+                    />
+                 </div>
 
             </div>
             <!--按钮显示  -->
@@ -209,6 +231,10 @@ import { dbSqlConfig } from '@/constant'
 
 export default {
   name: 'exam-pop',
+  components: {
+    IbpsUploader: () =>
+      import('@/business/platform/file/uploader')
+  },
   props: {
     show: {
       type: Boolean,
@@ -297,7 +323,9 @@ export default {
         'font-size': '26rpx',
         'color': '#30c2bd'
       },
-      endInd: true
+      endInd: true,
+      attachmentTF: false,
+      gapFillingAutomatic: false
     }
   },
   watch: {
@@ -315,6 +343,7 @@ export default {
     popListAnswer: {
       handler: function(val, oldVal) {
         // if(val!=null){
+        console.log(val)
         let accomplish = 0
         this.noQuestionNumber.splice(0, this.noQuestionNumber.length)
         val.forEach((item, i) => {
@@ -322,6 +351,8 @@ export default {
             accomplish += 1
           } else if (item !== ' ' && item != null && item.length !== 0) {
             accomplish += 1
+          } else if (this.popList[i].fuJian !== '') {
+            accomplish += 1
           } else {
             this.noQuestionNumber.push(i + 1)
           }
@@ -333,9 +364,14 @@ export default {
       immediate: true
     }
   },
-  // created() {
-  // },
+  created() {
+    this.attachmentTF =
+      this.$store.getters.setting?.examTag?.tagData?.attachmentTF || false
 
+    this.gapFillingAutomatic =
+      this.$store.getters.setting?.examTag?.tagData?.gapFillingAutomatic ||
+      false
+  },
   async mounted() {
     const examId = this.listDatas.examId
     const bankId = this.bankId
@@ -413,7 +449,8 @@ export default {
               })
             }
             item.img = item.img ? JSON.parse(item.img) : ''
-            item.answer = item.questionType === '多选题' ? [] : null
+            item.answer = item.questionType === '多选题' || item.questionType === '填空题' ? [] : null
+            item.fuJian = ''
             this.popListAnswer.push(item.answer)
             if (item.img !== '' && item.img.length > 0) {
               let astr = ''
@@ -426,13 +463,13 @@ export default {
               }
 
               const sql1 = `select FILE_PATH_  from ibps_file_attachment  WHERE id_ in (${astr})`
-              this.$common.request(dbSqlConfig ? 'query' : 'sql', dbSqlConfig ? { key: 'yddkstchqwjlj', params: [astr] } : sql1).then(res => {
-                if (res.state === 200) {
-                  const data = res.variables.data
-                  if (data.length > 0) {
+              this.$common.request(dbSqlConfig ? 'query' : 'sql', dbSqlConfig ? { key: 'yddkstchqwjlj', params: [astr] } : sql1).then(res1 => {
+                if (res1.state === 200) {
+                  const data1 = res1.variables.data
+                  if (data1.length > 0) {
                     const pdfUrlA = []
-                    for (let g = 0; g < data.length; g++) {
-                      const dataItem = data[g]
+                    for (let g = 0; g < data1.length; g++) {
+                      const dataItem = data1[g]
                       //   console.log(BASE_API())
                       const url = BASE_API().slice(0, -4) + dataItem.FILE_PATH_
                       pdfUrlA.push(url)
@@ -548,6 +585,12 @@ export default {
     radioChange(t, i) { },
     checkboxGroupChange(n) {
 
+    },
+    fieleInput(val, qIndex, aIndex) {
+      if (this.popList[qIndex].questionType === '填空题' && val !== '') {
+        // this.popListAnswer[qIndex][aIndex] = val
+        this.$set(this.popListAnswer[qIndex], aIndex, val)
+      }
     },
     checkboxChange(n) {
       this.popListAnswer[this.questionsIndex].splice(0, this.popListAnswer[this.questionsIndex].length)
@@ -636,9 +679,13 @@ export default {
       that.popList.forEach((item, index) => {
         item.answer = that.popListAnswer[index]
         const autoType = ['单选题', '多选题', '判断题'].includes(item.questionType)
+        const autoFillType =
+          item.questionType === '填空题' &&
+          item.rateType === '自动' &&
+          this.gapFillingAutomatic
         const multipleType = ['多选题', '填空题'].includes(item.questionType)
         const selectType = ['多选题', '单选题'].includes(item.questionType)
-        submitData.push({
+        const obj = {
           parent_id_: that.id, // t_examination的id
           ti_mu_id_: item.questionId,
           ti_gan_: item.stem,
@@ -651,19 +698,34 @@ export default {
           ping_fen_fang_shi: item.rateType,
           ping_fen_ren_: item.rater,
           hui_da_: multipleType && item.answer ? JSON.stringify(item.answer) : item.answer,
-          shi_fou_yi_yue_: autoType ? '是' : '否',
+          shi_fou_yi_yue_: autoType || autoFillType ? '是' : '否',
           ping_yue_shi_jian: autoType ? time : '',
-          de_fen_: autoType ? this.getScore(item) : '',
+          de_fen_: autoType || autoFillType ? this.getScore(item) : '',
           jie_xi_: '',
           nan_du_: item.questionLevel || 0// 难度
-        })
+        }
+        if (this.attachmentTF) {
+          obj['fu_jian_'] = item.fuJian || ''
+        }
+        submitData.push(obj)
       })
       return submitData
     },
-    getScore({ questionType, answer, rightKey, score }) {
+    getScore({ questionType, answer, rightKey, score, options }) {
       if (questionType === '多选题') {
         const temp = rightKey.split(',')
         return answer.length === temp.length && answer.every(i => temp.includes(i)) ? score : 0
+      } else if (questionType === '填空题') {
+        const rightKeyArr = JSON.parse(rightKey)
+        const goal = Number((score / rightKeyArr.length).toFixed(2))
+        let add = 0
+        options.forEach((item, i) => {
+          const mid = rightKeyArr[i].split(',')
+          if (mid.includes(item.answer)) {
+            add += goal
+          }
+        })
+        return add
       } else {
         return answer === rightKey ? score : 0
       }
@@ -719,10 +781,17 @@ export default {
          /* background-color: #fcf9f9; */
        }
        .fileBlank{
-        font-size: 16px; background-color: #f7f7f7;
+          font-size: 16px; background-color: #f7f7f7;
+          margin-bottom: 2%;
        }
        .shortAnswer{
-        font-size: 16px; background-color: #f7f7f7; height: 10%;
+          font-size: 16px; background-color: #f7f7f7; height: 10%;
+       }
+       .ibps-cell-wrapper{
+          background: #fff;
+          .ibps-uploader.van-cell.van-cell--borderless.van-field{
+            background: #f8f8f8;
+          }
        }
     }
     .bodyFloor {