浏览代码

#3676 C1088 艺术评测--区级/校级艺术评测,优化发布评测试卷挑选流程

XW 6 月之前
父节点
当前提交
ada5bfb140
共有 1 个文件被更改,包括 114 次插入9 次删除
  1. 114 9
      TEAMModelOS/ClientApp/src/view/artexam/ExamSetting.vue

+ 114 - 9
TEAMModelOS/ClientApp/src/view/artexam/ExamSetting.vue

@@ -3,12 +3,16 @@
     <!-- 评测试卷 -->
     <div class="attr-item">
       <span>{{$t('ae.ae16')}}</span>
-      <Tag v-for="paper in subjectSetting.paper" color="blue">
-        {{ paper.name }}
-      </Tag>
+      <span v-for="(paper, index) in subjectSetting.paper" :key="index">
+        <Tag color="blue" v-if="index < 2">{{ paper.name }}</Tag>
+      </span>
+      <span v-show="subjectSetting.paper.length > 2">...</span>
       <span class="choose-paper" @click="selectPaper()">
         {{ subjectSetting.paper.length ? $t('ae.ae17') : $t('ae.ae18') }}
       </span>
+      <span v-show="subjectSetting.paper.length">
+        (已选{{ subjectSetting.paper.length }}张试卷)
+      </span>
     </div>
     <!-- 作答方式 -->
     <div class="attr-item">
@@ -45,6 +49,24 @@
             </Radio>
           </RadioGroup>
         </p>
+        <div style="margin-top: 15px;">
+          <span>{{ $t('evaluation.paperTag') }}:</span>
+          <Select v-model="selectTags" multiple style="width: 300px" @on-change="onfilterChange">
+            <Option v-for="item in tags" :value="item" :key="item">{{ item }}</Option>
+          </Select>
+        </div>
+        <div style="margin: 15px 0px 20px;">
+          <span>{{ $t('evaluation.paperList.paperName') }}:</span>
+          <Input v-special-char suffix="ios-search" v-model="searchVal" clearable
+            :placeholder="$t('evaluation.paperList.searchPaper')" style="width: 300px" @on-click="onfilterChange"
+            @on-change="onfilterChange" />
+        </div>
+        <div style="display: flex; float: right; width: 70px;">
+          <input type="checkbox" name="" id="" v-model="allCheck">
+          <label for="" style="margin-left: 5px;">全选</label>
+          <!-- <Checkbox v-model="allCheck" @on-change="checkAllPaper">全选</Checkbox> -->
+          <!-- <Button type="primary" @click="allCheck = true">Primary</Button> -->
+        </div>
         <div class="papaer-list-wrap">
           <vuescroll>
             <div :class="['paper-item', subjectSetting.paper.find(i => i.id === item.id) ? 'paper-item-active' : '']" v-for="(item,index) in paperListShow" :key="index">
@@ -69,11 +91,15 @@
                     {{ item.itemSort === 1 ? $t('evaluation.paperList.sortByOrder') : $t('evaluation.paperList.sortByType') }}
                   </span>
                 </span>
+                <span class="info-item">
+                  {{ $t('evaluation.tag') }}:
+                  <span class="info-bold" v-for="(tag, tagIndex) in item.tags" :key="tagIndex"><Tag color="blue">{{ tag }}</Tag></span>
+                </span>
               </div>
               <span v-if="item.id == selectedId" style="margin-left:20px;display:block;" class="paper-item-tools">
                 <Icon custom="iconfont icon-choose" style="margin-right:5px;" :title="$t('learnActivity.manual.stdPaper')" />
               </span>
-              <div v-else class="paper-item-tools">
+              <div v-else class="paper-item-tools" v-show="!isCheckAll">
                 <span @click.stop="choosePaper(index)">
                   <Icon custom="iconfont icon-choose" style="margin-right:5px;" />
                   {{ subjectSetting.paper.find(i => i.id === item.id) ? '取消选择' :  $t('learnActivity.manual.stPaper')}}
@@ -132,6 +158,11 @@ export default {
         tmd: [],
         school: []
       },
+      tags: [],
+      selectTags: [],
+      searchVal: '',
+      allCheck: false,
+      isCheckAll: false,
     }
   },
   methods: {
@@ -211,14 +242,19 @@ export default {
       this.findPaperList()
     },
     findPaperList() {
+      this.selectTags = []
+      this.searchVal = ''
+      this.tags = []
       if (!this.paperResource) {
         this.$Message.error(this.$t('ae.ae27'))
       }
       if (this.paperResource == 'hbcn' && this.paperList.tmd.length) {
-        return this.paperListShow = this.paperList.tmd.filter(item => item.subjectBindId === this.subject)
+        this.paperListShow = this.paperList.tmd.filter(item => item.subjectBindId === this.subject)
+        return this.tags = [...new Set(this.paperListShow.map(i => i.tags).flat(1))]
       }
       if (this.paperList.school.length) {
-        return this.paperListShow = this.paperList.school.filter(item => item.subjectBindId === this.subject)
+        this.paperListShow = this.paperList.school.filter(item => item.subjectBindId === this.subject)
+        return this.tags = [...new Set(this.paperListShow.map(i => i.tags).flat(1))]
       }
       let params = {
         schoolCode: this.paperResource
@@ -231,21 +267,89 @@ export default {
             this.paperList.school = res.papers
           }
           this.paperListShow = res.papers.filter(item => item.subjectBindId === this.subject)
+          this.tags = [...new Set(this.paperListShow.map(i => i.tags).flat(1))]
         }
       )
     },
+    /* 标签选择发生变化 */
+    onfilterChange() {
+      let subList = (this.paperResource == 'hbcn' && this.paperList.tmd.length) ? this.paperList.tmd.filter(item => item.subjectBindId === this.subject) : this.paperList.school.filter(item => item.subjectBindId === this.subject)
+      this.paperListShow = subList.filter(item => (this.searchVal ? item.name.includes(this.searchVal) : true) && (this.selectTags.length ? this.selectTags.find(j => item.tags.includes(j)) : true))
+      // this.allCheck = false
+    },
+    async checkAllPaper(value) {
+      let sasInfo
+      if (this.isArea) {
+        sasInfo = await this.$tools.getBlobSas("hbcn")
+        sasInfo.sas = "?" + sasInfo.sas
+      } else if (this.paperResource == this.$store.state.userInfo.schoolCode) {
+        sasInfo = {
+          sas: "?" + this.$store.state.user.schoolProfile.blob_sas,
+          url: this.$store.state.user.schoolProfile.blob_uri.slice(0, this.$store.state.user.schoolProfile.blob_uri.lastIndexOf('/')),
+          name: this.$store.state.userInfo.schoolCode
+        }
+      } else {
+        sasInfo = await this.$tools.getBlobSas("hbcn")
+        sasInfo.sas = "?" + sasInfo.sas
+      }
+      let noType = [] //试卷题目不符
+      this.isCheckAll = true
+      let promiseArr = []
+      this.paperListShow.forEach(item => {
+        try {
+          promiseArr.push(new Promise(async (resolve, reject) => {
+            let indexData = await this.$tools.getFile(`${sasInfo.url}/${sasInfo.name}${item.blob}/index.json${sasInfo.sas}`)
+            if (indexData) {
+              let paperIndex = JSON.parse(indexData)
+              let quTyep = ['single', 'multiple', 'judge']
+              if (paperIndex.slides.some(s => !quTyep.includes(s.type))) {
+                noType.push(item.name)
+              } else {
+                // this.subjectSetting.paper = this.paperListShow[index]
+                let findIndex = this.subjectSetting.paper.findIndex(i => i.id === item.id)
+                if(findIndex > -1 && !value){
+                  this.subjectSetting.paper.splice(findIndex,1)
+                } else if(findIndex === -1 && value) {
+                  this.subjectSetting.paper.push(item)
+                }
+              }
+            }
+            resolve(true)
+          }))
+        } catch (e) {
+          console.log(e)
+          // this.$Message.error(this.$t('ae.ae44'))
+        }
+      })
+      Promise.all(promiseArr).then(res => {
+        if(noType.length) {
+          let message = noType.join('、')
+          this.$Modal.info({
+            title: this.$t('ae.ae42'),
+            content: `${this.$t('ae.ae43')}(${message})`
+          })
+        }
+        this.isCheckAll = false
+        this.$Message.success('加入成功')
+        sessionStorage.setItem('art_paper_resource', this.paperResource)
+      })
+    },
   },
   watch: {
     subjectSetting: {
       deep: true,
       handler(n, o) {
-        console.error(this.subjectSetting)
         this.$emit('on-exam-change', {
           data: this.subjectSetting,
           subject: this.subject
         })
       }
-    }
+    },
+    allCheck: {
+      handler(n, o) {
+        this.checkAllPaper(n)
+      },
+    },
   },
   created() {
     // 判断是否为区级发布
@@ -348,7 +452,8 @@ export default {
   }
 }
 .papaer-list-wrap {
-  height: 600px;
+  height: 550px;
+  margin-bottom: 15px;
 }
 .choose-paper {
   color: #2d8cf0;