|
@@ -1,327 +1,416 @@
|
|
|
<template>
|
|
|
- <div class="paper-container">
|
|
|
- <div class="paper-main-wrap">
|
|
|
- <!-- 试卷内容 -->
|
|
|
- <div class="paper-content">
|
|
|
- <div class="paper-line" style="margin-top:7%">
|
|
|
- <div id="pui_seal" title="点击设置"装订线"" style="display: block;">
|
|
|
- <img alt="装订线" title="装订线" src="http://zujuan.xkw.com/resource/image/v2/peal_line.png">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="paper-body">
|
|
|
- <!-- 试卷基础信息 -->
|
|
|
- <div class="paper-base-info" v-show="isShowBaseInfo">
|
|
|
- <div>
|
|
|
- <span class="base-info-item">分数:<span class="analysis-info" @click="isSetScore = !isSetScore">{{ paperInfo.score }}</span>分</span>
|
|
|
- <span class="base-info-item">题量:<span class="analysis-info">{{ paperInfo.item ? paperInfo.item.length : 0 }}</span></span>
|
|
|
- <span class="base-info-item">难度:<span class="analysis-info">{{ paperInfo.item.length ? paperDiff : 0 }}</span></span>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <Button class="base-info-btn" type="success" v-show="isShowSave" @click="onBackToBank">返回</Button>
|
|
|
- <Button class="base-info-btn" type="success" v-show="isShowSave" @click="savePaper">保存试卷</Button>
|
|
|
- <Button class="base-info-btn" type="info" @click="onHandleToggle" v-show="paperInfo.item.length">{{ isAllOpen ? '全部折叠' : '全部展开'}}</Button>
|
|
|
- <Button class="base-info-btn" type="info" @click="onSetScoreByType" v-show="paperInfo.item.length">题型配分</Button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="paper-container">
|
|
|
+ <div class="paper-main-wrap">
|
|
|
+ <!-- 试卷内容 -->
|
|
|
+ <div class="paper-content">
|
|
|
+ <div class="paper-line" style="margin-top:7%">
|
|
|
+ <div id="pui_seal" title="点击设置"装订线"" style="display: block;">
|
|
|
+ <img alt="装订线" title="装订线" src="http://zujuan.xkw.com/resource/image/v2/peal_line.png">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="paper-body">
|
|
|
+ <!-- 试卷基础信息 -->
|
|
|
+ <div class="paper-base-info" v-show="isShowBaseInfo">
|
|
|
+ <div>
|
|
|
+ <span class="base-info-item">分数:<span class="analysis-info" @click="isSetScore = !isSetScore">{{ paperInfo.score }}</span>分</span>
|
|
|
+ <span class="base-info-item">题量:<span class="analysis-info">{{ paperInfo.item ? paperInfo.item.length : 0 }}</span></span>
|
|
|
+ <span class="base-info-item">难度:<span class="analysis-info">{{ paperInfo.item.length ? paperDiff : 0 }}</span></span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <Button class="base-info-btn" type="success" v-show="isShowSave" @click="onBackToBank">返回</Button>
|
|
|
+ <Button class="base-info-btn" type="success" v-show="isShowSave" @click="savePaper">保存试卷</Button>
|
|
|
+ <Button class="base-info-btn" type="info" @click="onHandleToggle" v-show="paperInfo.item.length">{{ isAllOpen ? '全部折叠' : '全部展开'}}</Button>
|
|
|
+ <Button class="base-info-btn" type="info" @click="onSetScoreByType" v-show="paperInfo.item.length">题型配分</Button>
|
|
|
+ <Button class="base-info-btn" type="info" @click="isSetRules = true" v-show="paperInfo.item.length">阅卷规则</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <!-- 试卷头部信息 -->
|
|
|
- <div class="paper-header flex-col-center">
|
|
|
- <Tooltip content="点击可编辑修改主标题" placement="right">
|
|
|
- <p class="paper-title" v-show="isShowTitle" contenteditable="true" @blur="titleChange($event)">{{paperInfo.name}}</p>
|
|
|
- </Tooltip>
|
|
|
- </div>
|
|
|
- <!-- 题目类型及列表 -->
|
|
|
- <BaseExerciseList :paper="paperInfo" @dataUpdate="onListUpdate" ref="exList" :isShowTools="isShowTools" @toggleChange="onToggleChange"></BaseExerciseList>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <!-- 试卷头部信息 -->
|
|
|
+ <div class="paper-header flex-col-center">
|
|
|
+ <Tooltip content="点击可编辑修改主标题" placement="right">
|
|
|
+ <p class="paper-title" v-show="isShowTitle" contenteditable="true" @blur="titleChange($event)">{{paperInfo.name}}</p>
|
|
|
+ </Tooltip>
|
|
|
+ </div>
|
|
|
+ <!-- 题目类型及列表 -->
|
|
|
+ <BaseExerciseList :paper="paperInfo" @dataUpdate="onListUpdate" ref="exList" :isShowTools="isShowTools"
|
|
|
+ @toggleChange="onToggleChange"></BaseExerciseList>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <!-- 试题解析部分 -->
|
|
|
- <div class="paper-analysis" style="display:none">
|
|
|
- <div class="analysis-btns">
|
|
|
- <Button type="success" @click="savePaper">保存试卷</Button>
|
|
|
- <Button type="info" @click="goToPickExercise">重新选题</Button>
|
|
|
- <Button type="info" @click="onSetScoreByType">题型配分</Button>
|
|
|
- </div>
|
|
|
- <div class="analysis-infos">
|
|
|
- <RadioGroup v-model="viewModel" @on-change="onViewModelChange">
|
|
|
- <Radio label="type">题型视图</Radio>
|
|
|
- <Radio label="list">清单视图</Radio>
|
|
|
- </RadioGroup>
|
|
|
- <p class="analysis-title">基础信息</p>
|
|
|
- <div class="flex-row-center">
|
|
|
- <span>分数:<span class="analysis-info">{{ paperInfo.score }}</span>分</span>
|
|
|
- <span>题量:<span class="analysis-info">{{ exersicesList ? exersicesList.length : 0 }}</span></span>
|
|
|
- <span>难度:<span class="analysis-info">0.9</span></span>
|
|
|
- </div>
|
|
|
- <p class="analysis-title">题目列表</p>
|
|
|
- <div class="analysis-index-wrap">
|
|
|
- <span class="exercise-index-item" v-for="(item,index) in exersicesList">{{ index + 1 }}</span>
|
|
|
- </div>
|
|
|
- <p class="analysis-title">试卷分析</p>
|
|
|
- <div style="padding-top:10px;">
|
|
|
- <Table border :columns="analysisColumns" :data="analysisTableData"></Table>
|
|
|
- <BaseTypePie :echartsData="analysisTableData"></BaseTypePie>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <!-- 试题解析部分 -->
|
|
|
+ <div class="paper-analysis" style="display:none">
|
|
|
+ <div class="analysis-btns">
|
|
|
+ <Button type="success" @click="savePaper">保存试卷</Button>
|
|
|
+ <Button type="info" @click="goToPickExercise">重新选题</Button>
|
|
|
+ <Button type="info" @click="onSetScoreByType">题型配分</Button>
|
|
|
+ </div>
|
|
|
+ <div class="analysis-infos">
|
|
|
+ <RadioGroup v-model="viewModel" @on-change="onViewModelChange">
|
|
|
+ <Radio label="type">题型视图</Radio>
|
|
|
+ <Radio label="list">清单视图</Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ <p class="analysis-title">基础信息</p>
|
|
|
+ <div class="flex-row-center">
|
|
|
+ <span>分数:<span class="analysis-info">{{ paperInfo.score }}</span>分</span>
|
|
|
+ <span>题量:<span class="analysis-info">{{ exersicesList ? exersicesList.length : 0 }}</span></span>
|
|
|
+ <span>难度:<span class="analysis-info">0.9</span></span>
|
|
|
+ </div>
|
|
|
+ <p class="analysis-title">题目列表</p>
|
|
|
+ <div class="analysis-index-wrap">
|
|
|
+ <span class="exercise-index-item" v-for="(item,index) in exersicesList">{{ index + 1 }}</span>
|
|
|
+ </div>
|
|
|
+ <p class="analysis-title">试卷分析</p>
|
|
|
+ <div style="padding-top:10px;">
|
|
|
+ <Table border :columns="analysisColumns" :data="analysisTableData"></Table>
|
|
|
+ <BaseTypePie :echartsData="analysisTableData"></BaseTypePie>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <Modal v-model="isSetScore"
|
|
|
- title="设置试卷总分"
|
|
|
- width="400px"
|
|
|
- class="related-point-modal"
|
|
|
- style="z-index:99999">
|
|
|
- <span>总分</span>
|
|
|
- <InputNumber :max="200" :min="1" v-model="paperInfo.score" style="margin-left:20px"></InputNumber>
|
|
|
- <div slot="footer">
|
|
|
- <Button type="text" @click="isSetScore = false">取消</Button>
|
|
|
- <Button type="primary" @click="onSetScore">确定</Button>
|
|
|
- </div>
|
|
|
- </Modal>
|
|
|
- </div>
|
|
|
+ <!-- 设置试卷配分 -->
|
|
|
+ <Modal v-model="isSetScore" title="设置试卷总分" width="400px" class="related-point-modal" style="z-index:99999">
|
|
|
+ <span>总分</span>
|
|
|
+ <InputNumber :max="200" :min="1" v-model="paperInfo.score" style="margin-left:20px"></InputNumber>
|
|
|
+ <div slot="footer">
|
|
|
+ <Button type="text" @click="isSetScore = false">取消</Button>
|
|
|
+ <Button type="primary" @click="onSetScore">确定</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+
|
|
|
+ <!-- 设置阅卷规则 -->
|
|
|
+ <Modal v-model="isSetRules" title="设置阅卷规则" width="400px" class="related-point-modal rules-modal" style="z-index:99999">
|
|
|
+ <div class="rule-item">
|
|
|
+ <span class="rule-item-title">是否自动阅卷</span>
|
|
|
+ <i-switch v-model="paperInfo.markConfig.auto" />
|
|
|
+ </div>
|
|
|
+ <div class="rule-item" v-show="paperInfo.markConfig.auto">
|
|
|
+ <span class="rule-item-title">选择阅卷规则</span>
|
|
|
+ <RadioGroup v-model="paperInfo.markConfig.type" vertical>
|
|
|
+ <Radio :label="1">
|
|
|
+ <Icon type="social-android"></Icon>
|
|
|
+ <span>多选漏选不得分</span>
|
|
|
+ </Radio>
|
|
|
+ <Radio :label="2">
|
|
|
+ <Icon type="social-windows"></Icon>
|
|
|
+ <span>多选漏选的得一半分数</span>
|
|
|
+ </Radio>
|
|
|
+ <Radio :label="3">
|
|
|
+ <Icon type="social-windows"></Icon>
|
|
|
+ <span>多选漏选按个数得分</span>
|
|
|
+ </Radio>
|
|
|
+ <Radio :label="4">
|
|
|
+ <Icon type="social-windows"></Icon>
|
|
|
+ <span>多选漏选自定义分数</span>
|
|
|
+ </Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </div>
|
|
|
+ <div class="rule-item" v-show="paperInfo.markConfig.auto && paperInfo.markConfig.type === 4">
|
|
|
+ <span class="rule-item-title">设置多选选项分数</span>
|
|
|
+ <InputNumber :max="200" :min="1" v-model="paperInfo.markConfig.score"></InputNumber>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div slot="footer">
|
|
|
+ <Button type="text" @click="isSetRules = false">取消</Button>
|
|
|
+ <Button type="primary" @click="onSetMarkingRules">确定</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import BaseExerciseList from '../components/BaseExerciseList'
|
|
|
- import BaseTypePie from '../components/BaseTypePie'
|
|
|
- import questions from './list.json'
|
|
|
- export default {
|
|
|
- components: { BaseExerciseList, BaseTypePie },
|
|
|
- props: {
|
|
|
- paper: {
|
|
|
- type: Object,
|
|
|
- default:null
|
|
|
- },
|
|
|
- isShowTools: {
|
|
|
- type: Boolean,
|
|
|
- default:true
|
|
|
- },
|
|
|
- isShowBaseInfo: {
|
|
|
- type: Boolean,
|
|
|
- default:true
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- isAllOpen: false,
|
|
|
- isSetScore:false,
|
|
|
- isShowSave:false,
|
|
|
- exersicesList: [],
|
|
|
- list: [],
|
|
|
- schoolInfo: {},
|
|
|
- paperInfo: {
|
|
|
- name: "",
|
|
|
- score: 100,
|
|
|
- item: []
|
|
|
- },
|
|
|
- exersicesType: {
|
|
|
- Single: '单选题',
|
|
|
- Multiple: '多选题',
|
|
|
- Judge: '判断题',
|
|
|
- Complete: '填空题',
|
|
|
- Subjective: '问答题',
|
|
|
- Compose:'综合题'
|
|
|
- },
|
|
|
- exersicesDiff: ['容易', '较易', '一般', '较难', '困难'],
|
|
|
- diffColors: ['#32CF74', '#E8BE15', '#F19300', '#EB5E00', '#D30000'],
|
|
|
- filterType: '0',
|
|
|
- filterDiff: '0',
|
|
|
- filterSort: '0',
|
|
|
- pageSize: 5,
|
|
|
- pageNum: 1,
|
|
|
- totalNum: 100,
|
|
|
- allList: questions.result.data,
|
|
|
- isShowAnswer: false,
|
|
|
- isShowPart: false,
|
|
|
- isShowConcept: false,
|
|
|
- isShowTitle: true,
|
|
|
- isShowInfo: false,
|
|
|
- analysisColumns: [
|
|
|
- {
|
|
|
- title: '题型',
|
|
|
- key: 'name'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '数量(占比)',
|
|
|
- key: 'value'
|
|
|
- }
|
|
|
- ],
|
|
|
- analysisTableData: [],
|
|
|
- viewModel: 'type',
|
|
|
- paperDiff:0
|
|
|
+ import BaseExerciseList from '../components/BaseExerciseList'
|
|
|
+ import BaseTypePie from '../components/BaseTypePie'
|
|
|
+ import questions from './list.json'
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ BaseExerciseList,
|
|
|
+ BaseTypePie
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ paper: {
|
|
|
+ type: Object,
|
|
|
+ default: null
|
|
|
+ },
|
|
|
+ isShowTools: {
|
|
|
+ type: Boolean,
|
|
|
+ default: true
|
|
|
+ },
|
|
|
+ isShowBaseInfo: {
|
|
|
+ type: Boolean,
|
|
|
+ default: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isAllOpen: false,
|
|
|
+ isSetScore: false,
|
|
|
+ isSetRules: false,
|
|
|
+ isShowSave: false,
|
|
|
+ exersicesList: [],
|
|
|
+ list: [],
|
|
|
+ schoolInfo: {},
|
|
|
+ paperInfo: {
|
|
|
+ name: "",
|
|
|
+ score: 100,
|
|
|
+ answers:[],
|
|
|
+ markConfig: {
|
|
|
+ auto: false,
|
|
|
+ type: 0,
|
|
|
+ score: 0
|
|
|
+ },
|
|
|
+ item: []
|
|
|
+ },
|
|
|
+ exersicesType: {
|
|
|
+ Single: '单选题',
|
|
|
+ Multiple: '多选题',
|
|
|
+ Judge: '判断题',
|
|
|
+ Complete: '填空题',
|
|
|
+ Subjective: '问答题',
|
|
|
+ Compose: '综合题'
|
|
|
+ },
|
|
|
+ exersicesDiff: ['容易', '较易', '一般', '较难', '困难'],
|
|
|
+ diffColors: ['#32CF74', '#E8BE15', '#F19300', '#EB5E00', '#D30000'],
|
|
|
+ filterType: '0',
|
|
|
+ filterDiff: '0',
|
|
|
+ filterSort: '0',
|
|
|
+ pageSize: 5,
|
|
|
+ pageNum: 1,
|
|
|
+ totalNum: 100,
|
|
|
+ allList: questions.result.data,
|
|
|
+ isShowAnswer: false,
|
|
|
+ isShowPart: false,
|
|
|
+ isShowConcept: false,
|
|
|
+ isShowTitle: true,
|
|
|
+ isShowInfo: false,
|
|
|
+ analysisColumns: [{
|
|
|
+ title: '题型',
|
|
|
+ key: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数量(占比)',
|
|
|
+ key: 'value'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ analysisTableData: [],
|
|
|
+ viewModel: 'type',
|
|
|
+ paperDiff: 0
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
|
|
|
- },
|
|
|
- methods: {
|
|
|
+ /**
|
|
|
+ * 标题切换
|
|
|
+ * @param e
|
|
|
+ */
|
|
|
+ titleChange(e) {
|
|
|
+ this.paperInfo.name = e.target.innerHTML
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 标题切换
|
|
|
- * @param e
|
|
|
- */
|
|
|
- titleChange(e) {
|
|
|
- this.paperInfo.name = e.target.innerHTML
|
|
|
- },
|
|
|
+ onSetMarkingRules() {
|
|
|
+ this.isSetRules = false
|
|
|
+ },
|
|
|
|
|
|
- /** 切换全部展开与折叠 */
|
|
|
- onHandleToggle() {
|
|
|
- this.$refs.exList.onHandleToggle(this.isAllOpen)
|
|
|
- this.isAllOpen = !this.isAllOpen
|
|
|
- },
|
|
|
+ /** 切换全部展开与折叠 */
|
|
|
+ onHandleToggle() {
|
|
|
+ this.$refs.exList.onHandleToggle(this.isAllOpen)
|
|
|
+ this.isAllOpen = !this.isAllOpen
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * exList的collapseList变化
|
|
|
- * @param list
|
|
|
- */
|
|
|
- onToggleChange(list) {
|
|
|
- this.isAllOpen = list.length !== 0
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * exList的collapseList变化
|
|
|
+ * @param list
|
|
|
+ */
|
|
|
+ onToggleChange(list) {
|
|
|
+ this.isAllOpen = list.length !== 0
|
|
|
+ },
|
|
|
|
|
|
- /** 返回试卷库 */
|
|
|
- onBackToBank() {
|
|
|
- this.$router.push({
|
|
|
- name: 'testPaperList',
|
|
|
- params: {
|
|
|
- tabName: 'paper'
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ /** 返回试卷库 */
|
|
|
+ onBackToBank() {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'testPaperList',
|
|
|
+ params: {
|
|
|
+ tabName: 'paper'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- onSetScore() {
|
|
|
- this.isSetScore = false
|
|
|
- this.$refs.exList.exerciseList.map(item => item.score = 0)
|
|
|
- },
|
|
|
+ onSetScore() {
|
|
|
+ this.isSetScore = false
|
|
|
+ this.$refs.exList.exerciseList.map(item => item.score = 0)
|
|
|
+ },
|
|
|
|
|
|
|
|
|
- /** 保存试卷 */
|
|
|
- savePaper() {
|
|
|
- let hasSurplus = this.$refs.exList.surPlusScore === 0 // 判断是否有剩余分数未分配
|
|
|
- let noScoreList = this.$refs.exList.exerciseList.filter(item => item.score === 0) // 判断是否有未配分的题目
|
|
|
- if (hasSurplus) {
|
|
|
- if (!noScoreList.length) {
|
|
|
- this.paperInfo.item.forEach(i => {
|
|
|
- if (i.points.length && typeof (i.points[1]) !== 'string' && i.points[0]) {
|
|
|
- i.points = i.points.map(j => j.id)
|
|
|
- }
|
|
|
- })
|
|
|
- let saveParams = this.paperInfo
|
|
|
- this.$refs.exList.dataLoading = true
|
|
|
- this.$api.learnActivity.SaveExamPaper(saveParams).then(res => {
|
|
|
- if (res.error == null) {
|
|
|
- this.$refs.exList.dataLoading = false
|
|
|
- this.onBackToBank()
|
|
|
- this.$Message.success('保存成功!')
|
|
|
- } else {
|
|
|
- this.$Message.error('API ERROR!')
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error('API ERROR!')
|
|
|
- }
|
|
|
- )
|
|
|
- } else {
|
|
|
- this.$Message.warning(`存在未配分的题目,请配分后再保存!`)
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$Message.warning(`试卷配分未完成!剩余 ${this.$refs.exList.surPlusScore} 分数可分配`)
|
|
|
- }
|
|
|
+ /** 保存试卷 */
|
|
|
+ savePaper() {
|
|
|
+ let hasSurplus = this.$refs.exList.surPlusScore === 0 // 判断是否有剩余分数未分配
|
|
|
+ let noScoreList = this.$refs.exList.exerciseList.filter(item => item.score === 0) // 判断是否有未配分的题目
|
|
|
+ if (hasSurplus) {
|
|
|
+ if (!noScoreList.length) {
|
|
|
+ this.paperInfo.item.forEach(i => {
|
|
|
+ if (i.points.length && typeof(i.points[1]) !== 'string' && i.points[0]) {
|
|
|
+ i.points = i.points.map(j => j.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.paperInfo.answers = this.getAnswers(this.paperInfo.item)
|
|
|
+ let saveParams = this.paperInfo
|
|
|
+ this.$refs.exList.dataLoading = true
|
|
|
+ this.$api.learnActivity.SaveExamPaper(saveParams).then(res => {
|
|
|
+ if (res.error == null) {
|
|
|
+ this.$refs.exList.dataLoading = false
|
|
|
+ this.onBackToBank()
|
|
|
+ this.$Message.success('保存成功!')
|
|
|
+ } else {
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(`存在未配分的题目,请配分后再保存!`)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(`试卷配分未完成!剩余 ${this.$refs.exList.surPlusScore} 分数可分配`)
|
|
|
+ }
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 获取整张试卷的答案合计Answers */
|
|
|
+ getAnswers(items){
|
|
|
+ let arr = []
|
|
|
+ items.forEach((i,index) => {
|
|
|
+ if(i.type === 'Complete'){
|
|
|
+ i.answer.forEach(j => {
|
|
|
+ arr.push({
|
|
|
+ num:arr.length,
|
|
|
+ group:index,
|
|
|
+ type:i.type,
|
|
|
+ ans:[j],
|
|
|
+ score:i.score / i.answer.length
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ arr.push({
|
|
|
+ num:arr.length,
|
|
|
+ group:index,
|
|
|
+ type:i.type,
|
|
|
+ ans:i.answer,
|
|
|
+ score:i.score
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return arr
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 组件更新删除题目时的处理
|
|
|
- * @param list
|
|
|
- */
|
|
|
- onListUpdate(list) {
|
|
|
- console.log(list)
|
|
|
- list.forEach(i => {
|
|
|
- if (i.points.length && typeof (i.points[1]) !== 'string') {
|
|
|
- i.points = i.points.map(j => j.id)
|
|
|
- }
|
|
|
- })
|
|
|
- this.handleAnalysisData(list)
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 组件更新删除题目时的处理
|
|
|
+ * @param list
|
|
|
+ */
|
|
|
+ onListUpdate(list) {
|
|
|
+ console.log(list)
|
|
|
+ list.forEach(i => {
|
|
|
+ if (i.points.length && typeof(i.points[1]) !== 'string') {
|
|
|
+ i.points = i.points.map(j => j.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.handleAnalysisData(list)
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 处理试题分析数据
|
|
|
- * @param list 试题列表
|
|
|
- */
|
|
|
- handleAnalysisData(list) {
|
|
|
- let that = this
|
|
|
- this.analysisTableData = []
|
|
|
- this.exersicesList = list // 给试题列表组件传的值
|
|
|
- this.paperInfo.item = list
|
|
|
- const groupList = this._.groupBy(list, 'type')
|
|
|
- this._.mapKeys(groupList, function (value, key) {
|
|
|
- that.analysisTableData.push({ name: that.exersicesType[key], value: value.length })
|
|
|
- });
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 处理试题分析数据
|
|
|
+ * @param list 试题列表
|
|
|
+ */
|
|
|
+ handleAnalysisData(list) {
|
|
|
+ let that = this
|
|
|
+ this.analysisTableData = []
|
|
|
+ this.exersicesList = list // 给试题列表组件传的值
|
|
|
+ this.paperInfo.item = list
|
|
|
+ const groupList = this._.groupBy(list, 'type')
|
|
|
+ this._.mapKeys(groupList, function(value, key) {
|
|
|
+ that.analysisTableData.push({
|
|
|
+ name: that.exersicesType[key],
|
|
|
+ value: value.length
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- /** 重新挑题 */
|
|
|
- goToPickExercise() {
|
|
|
- this.$router.push({
|
|
|
- name: 'exercisesList',
|
|
|
- params: {
|
|
|
- paperInfo: this.paperInfo
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ /** 重新挑题 */
|
|
|
+ goToPickExercise() {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'exercisesList',
|
|
|
+ params: {
|
|
|
+ paperInfo: this.paperInfo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- /** 点击题型配分 */
|
|
|
- onSetScoreByType() {
|
|
|
- this.$refs.exList.onSetScoreByType()
|
|
|
- },
|
|
|
+ /** 点击题型配分 */
|
|
|
+ onSetScoreByType() {
|
|
|
+ this.$refs.exList.onSetScoreByType()
|
|
|
+ },
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 试卷的视图模式切换
|
|
|
- * @param val
|
|
|
- */
|
|
|
- onViewModelChange(val) {
|
|
|
- this.$refs.exList.viewModel = val
|
|
|
- this.$refs.exList.collapseList = []
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 试卷的视图模式切换
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ onViewModelChange(val) {
|
|
|
+ this.$refs.exList.viewModel = val
|
|
|
+ this.$refs.exList.collapseList = []
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 计算试卷题目平均难度
|
|
|
- * @param arr 试题集合
|
|
|
- */
|
|
|
- handleDiffCalc(arr) {
|
|
|
- let levelArr = arr.map(i => i.level)
|
|
|
- return this._.meanBy(levelArr).toFixed(1)
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 计算试卷题目平均难度
|
|
|
+ * @param arr 试题集合
|
|
|
+ */
|
|
|
+ handleDiffCalc(arr) {
|
|
|
+ let levelArr = arr.map(i => i.level)
|
|
|
+ return this._.meanBy(levelArr).toFixed(1)
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- this.isShowSave = window.location.pathname === '/home/evaluation/testPaper'
|
|
|
- let paper = this.paper || this.$route.params.paper || JSON.parse(localStorage.getItem('_paperInfo'))
|
|
|
- if (!paper) return
|
|
|
- localStorage.setItem('_paperInfo', JSON.stringify(paper))
|
|
|
- this.paperInfo = paper // 自己页面的值
|
|
|
- this.paperDiff = paper.item ? this.handleDiffCalc(paper.item) : 0
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.isShowSave = window.location.pathname === '/home/evaluation/testPaper'
|
|
|
+ let paper = this.paper || this.$route.params.paper || JSON.parse(localStorage.getItem('_paperInfo'))
|
|
|
+ if (!paper) return
|
|
|
+ localStorage.setItem('_paperInfo', JSON.stringify(paper))
|
|
|
+ this.paperInfo = paper // 自己页面的值
|
|
|
+ this.paperDiff = paper.item ? this.handleDiffCalc(paper.item) : 0
|
|
|
|
|
|
- },
|
|
|
- watch: {
|
|
|
- paper: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- console.log(newValue)
|
|
|
- this.paperInfo = newValue
|
|
|
- localStorage.setItem('_paperInfo', JSON.stringify(newValue))
|
|
|
- this.paperDiff = newValue.item ? this.handleDiffCalc(newValue.item) : 0
|
|
|
- },
|
|
|
- deep: true
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isAuto() {
|
|
|
+ return this.paperInfo.markConfig ? this.paperInfo.markConfig.auto : false
|
|
|
+ },
|
|
|
+ ruleType() {
|
|
|
+ return this.paperInfo.markConfig ? this.paperInfo.markConfig.type : 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ paper: {
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ console.log(newValue)
|
|
|
+ this.paperInfo = newValue
|
|
|
+ localStorage.setItem('_paperInfo', JSON.stringify(newValue))
|
|
|
+ this.paperDiff = newValue.item ? this.handleDiffCalc(newValue.item) : 4
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
<style src="../index/TestPaper.less" lang="less" scoped>
|
|
|
</style>
|
|
|
<style>
|
|
|
- .complete-line {
|
|
|
- padding: 0 45px;
|
|
|
- border-bottom: 2px solid rgb(128, 128, 128);
|
|
|
- }
|
|
|
+ .complete-line {
|
|
|
+ padding: 0 45px;
|
|
|
+ border-bottom: 2px solid rgb(128, 128, 128);
|
|
|
+ }
|
|
|
</style>
|