|
@@ -0,0 +1,137 @@
|
|
|
+<template>
|
|
|
+ <div class="paper-item-picker-container">
|
|
|
+ <div class="paper-list">
|
|
|
+ <p style="font-size:16px;margin-left:20px;" v-if="paperList.length">当前已挑选 <span style="font-weight:bold;color:#42a676">{{ checkList.length }}</span> 题</p>
|
|
|
+ <p style="font-size:16px;margin-left:20px;" v-if="!paperList.length">当前无试卷可选择!</p>
|
|
|
+ <Collapse simple v-if="paperList.length" accordion @on-change="onPaperClick">
|
|
|
+ <Panel v-for="(paper,index) in paperList" color="primary" :name="paper.id">
|
|
|
+ <span style="display:inline-flex;align-items: center">
|
|
|
+ <span style="margin-right:10px">{{ paper.name }}</span>
|
|
|
+ <Tag color="blue">{{ paper.scoring ? paper.scoring.length : 0 }}题</Tag>
|
|
|
+ <span style="margin-left: 8px;" v-for="(tag,tagIndex) in paper.tags">
|
|
|
+ <Tag color="geekblue">{{ tag }}</Tag>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 8px;" v-if="paper.mode">
|
|
|
+ <Tag color="green">{{ paper.mode }}</Tag>
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <template #content>
|
|
|
+ <div class="question-list" v-if="questionList.length">
|
|
|
+ <div :class="[ 'question-item',checkList.find(i => i.id === item.id) ? 'question-item-active' : 'question-item' ]" v-for="(item,index) in questionList" @click="onQuestionClick(item,index)">
|
|
|
+ <div class="question-stem">
|
|
|
+ <span>{{ index + 1 }}.</span>
|
|
|
+ <span v-html="item.question">{{ }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </Panel>
|
|
|
+ </Collapse>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: 'BasePaperItemPicker',
|
|
|
+ props: {
|
|
|
+ gradeCode: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ },
|
|
|
+ subjectCode: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ periodCode: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ paperList: [],
|
|
|
+ questionList: [],
|
|
|
+ checkList: [],
|
|
|
+ originQuestionList: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ console.error(this.gradeCode, this.subjectCode, this.periodCode)
|
|
|
+ this.findPaper()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onQuestionClick(item, index) {
|
|
|
+ let findIndex = this.checkList.findIndex(i => i.id === item.id)
|
|
|
+ if (findIndex > -1) {
|
|
|
+ this.checkList.splice(findIndex, 1)
|
|
|
+ } else {
|
|
|
+ let newItem = this.originQuestionList.find(i => i.id === item.id)
|
|
|
+ newItem.score = 0
|
|
|
+ this.checkList.push(newItem)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ findPaper() {
|
|
|
+ this.$api.learnActivity.FindExamPaper({
|
|
|
+ '@DESC': "createTime",
|
|
|
+ 'code': this.isSchool ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
|
|
|
+ 'gradeIds[*]': this.isSchool ? this.gradeCode.map(i => i + '') : [],
|
|
|
+ 'periodId': this.isSchool ? this.periodCode : [],
|
|
|
+ 'scope': this.isSchool ? 'school' : "private",
|
|
|
+ 'subjectId': this.isSchool ? [this.subjectCode] : []
|
|
|
+ }).then(res => {
|
|
|
+ this.paperList = res.papers
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async onPaperClick(paperId) {
|
|
|
+ if (!paperId.length) return
|
|
|
+ this.question = []
|
|
|
+ let paper = this.paperList.find(i => i.id === paperId[0])
|
|
|
+ let fullPaperJson = await this.$evTools.getFullPaper(paper)
|
|
|
+ this.questionList = fullPaperJson.item
|
|
|
+ this.originQuestionList = this._.cloneDeep(fullPaperJson.item)
|
|
|
+ this.questionList.forEach(i => {
|
|
|
+ i.question = i.question.replace(/<[^>]+>/g, "")
|
|
|
+ })
|
|
|
+ console.log(fullPaperJson)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isSchool() {
|
|
|
+ return this.$route.name === 'newSchoolPaper'
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+.paper-item-picker-container {
|
|
|
+ .ivu-collapse {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ .ivu-collapse-header {
|
|
|
+ height: 50px !important;
|
|
|
+ line-height: 50px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ivu-collapse-content {
|
|
|
+ padding: 0 45px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .question-item {
|
|
|
+ margin: 10px 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ border: 1px dashed #ccc;
|
|
|
+ padding: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .question-item-active {
|
|
|
+ background: #42a676;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|