|
@@ -8,74 +8,74 @@
|
|
|
</div>
|
|
|
<div class="content-wrap" v-else>
|
|
|
<Loading :top="200" v-show="dataLoading" type="1"></Loading>
|
|
|
- <div class="list-view" v-for="(typeItem,typeIndex) in groupList">
|
|
|
- <p v-show="viewModel === 'type'" class="type-name">{{ numberConvertToUppercase(typeIndex + 1) }} : {{ exersicesType[typeItem.type] }} ( {{ typeItem.score }} 分)</p>
|
|
|
- <div class="exercise-item" v-for="(item,index) of typeItem.list" :key="index" @click="onQuestionToggle(exerciseList.indexOf(item),item.id,$event,typeItem.list)" @mouseenter="exerciseMouseover($event)" @mouseleave="exerciseMouseleave($event)">
|
|
|
- <div class="item-tools-wrap">
|
|
|
- <div class="item-tools-t flex-row-center" @click.stop="handleSetScore(item,exerciseList.indexOf(item))"><Icon type="ios-list-box-outline" />配分</div>
|
|
|
- <div class="item-tools-t flex-row-center" @click.stop="handleToolEdit(item)"><Icon type="ios-brush-outline" />编辑</div>
|
|
|
- <div class="item-tools-t flex-row-center" @click.stop="handleDelete(typeItem.list,item,index)"><Icon type="ios-archive-outline" />删除</div>
|
|
|
- <div class="item-tools-t flex-row-center" v-show="index != 0" @click.stop="handleMoveUp(typeItem.list,index)"><Icon type="md-arrow-up" />上移</div>
|
|
|
- <div class="item-tools-t flex-row-center" v-show="index != (typeItem.list.length - 1)" @click.stop="handleMoveDown(typeItem.list,index)"><Icon type="md-arrow-down" />下移</div>
|
|
|
- </div>
|
|
|
+ <div class="list-view" v-for="(typeItem,typeIndex) in groupList">
|
|
|
+ <p v-show="viewModel === 'type'" class="type-name">{{ numberConvertToUppercase(typeIndex + 1) }} : {{ exersicesType[typeItem.type] }} ( {{ typeItem.score }} 分)</p>
|
|
|
+ <div class="exercise-item" v-for="(item,index) of typeItem.list" :key="index" @click="onQuestionToggle(exerciseList.indexOf(item),item.id,$event,typeItem.list)" @mouseenter="exerciseMouseover($event)" @mouseleave="exerciseMouseleave($event)">
|
|
|
+ <div class="item-tools-wrap">
|
|
|
+ <div class="item-tools-t flex-row-center" @click.stop="handleSetScore(item,exerciseList.indexOf(item))"><Icon type="ios-list-box-outline" />配分</div>
|
|
|
+ <div class="item-tools-t flex-row-center" @click.stop="handleToolEdit(typeItem.list,item,index)"><Icon type="ios-brush-outline" />编辑</div>
|
|
|
+ <div class="item-tools-t flex-row-center" @click.stop="handleDelete(typeItem.list,item,index)"><Icon type="ios-archive-outline" />删除</div>
|
|
|
+ <div class="item-tools-t flex-row-center" v-show="index != 0" @click.stop="handleMoveUp(typeItem.list,index)"><Icon type="md-arrow-up" />上移</div>
|
|
|
+ <div class="item-tools-t flex-row-center" v-show="index != (typeItem.list.length - 1)" @click.stop="handleMoveDown(typeItem.list,index)"><Icon type="md-arrow-down" />下移</div>
|
|
|
+ </div>
|
|
|
|
|
|
- <!-- 题干部分 -->
|
|
|
- <div class="item-question" style="pointer-events:none">
|
|
|
- <p v-if="viewModel === 'list'">{{pageSize * (pageNum - 1) + exerciseList.indexOf(item) + 1}} : <span v-html="item.question"></span></p>
|
|
|
- <p v-else>{{ pageSize * (pageNum - 1) + index + 1 }} : <span v-html="item.question"></span></p>
|
|
|
- <span class="item-btn-toggle">
|
|
|
- <span class="item-score">{{ item.score }} 分</span>
|
|
|
+ <!-- 题干部分 -->
|
|
|
+ <div class="item-question" style="pointer-events:none">
|
|
|
+ <p v-if="viewModel === 'list'">{{pageSize * (pageNum - 1) + exerciseList.indexOf(item) + 1}} : <span v-html="item.question"></span></p>
|
|
|
+ <p v-else>{{ pageSize * (pageNum - 1) + index + 1 }} : <span v-html="item.question"></span></p>
|
|
|
+ <span class="item-btn-toggle">
|
|
|
+ <span class="item-score">{{ item.score }} 分</span>
|
|
|
|
|
|
- <Icon :type="collapseList.indexOf(index) > -1 ? 'ios-arrow-dropup' : 'ios-arrow-dropdown'" />
|
|
|
- <!--<Button type="primary">选题</Button>-->
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <!-- 选项部分 -->
|
|
|
- <div v-for="(option,optionIndex) in item.option" :key="optionIndex" class="item-options" style="pointer-events:none">
|
|
|
- <p class="item-option-content">{{String.fromCharCode(64 + parseInt(optionIndex+1))}} : <span v-html="option.value"></span></p>
|
|
|
- </div>
|
|
|
- <transition name="slide">
|
|
|
- <div v-show="collapseList.indexOf(exerciseList.indexOf(item)) > -1" class="toggle-area">
|
|
|
- <!-- 答案展示部分 -->
|
|
|
- <div class="item-explain" v-show="isShowAnswer">
|
|
|
- <span class="explain-title">【答案】</span>
|
|
|
- <div class="item-explain-details">
|
|
|
- <!-- 问答题答案 -->
|
|
|
- <div v-if="item.type === 'Subjective'">
|
|
|
- <span v-for="(answer,index) in item.answer" :key="index" v-html="item.answer.length ? answer : '未设置答案'"></span>
|
|
|
- </div>
|
|
|
- <!-- 填空题答案 -->
|
|
|
- <div v-else-if="item.type === 'Complete'">
|
|
|
- <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index" v-html="answer"></span>
|
|
|
- </div>
|
|
|
- <!-- 其余题型答案 -->
|
|
|
- <div v-else>
|
|
|
- <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index">{{answer}}</span>
|
|
|
- </div>
|
|
|
+ <Icon :type="collapseList.indexOf(index) > -1 ? 'ios-arrow-dropup' : 'ios-arrow-dropdown'" />
|
|
|
+ <!--<Button type="primary">选题</Button>-->
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <!-- 选项部分 -->
|
|
|
+ <div v-for="(option,optionIndex) in item.option" :key="optionIndex" class="item-options" style="pointer-events:none">
|
|
|
+ <p class="item-option-content">{{String.fromCharCode(64 + parseInt(optionIndex+1))}} : <span v-html="option.value"></span></p>
|
|
|
+ </div>
|
|
|
+ <transition name="slide">
|
|
|
+ <div v-show="collapseList.indexOf(exerciseList.indexOf(item)) > -1" class="toggle-area">
|
|
|
+ <!-- 答案展示部分 -->
|
|
|
+ <div class="item-explain" v-show="isShowAnswer">
|
|
|
+ <span class="explain-title">【答案】</span>
|
|
|
+ <div class="item-explain-details">
|
|
|
+ <!-- 问答题答案 -->
|
|
|
+ <div v-if="item.type === 'Subjective'">
|
|
|
+ <span v-for="(answer,index) in item.answer" :key="index" v-html="item.answer.length ? answer : '未设置答案'"></span>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <!-- 解析部分 -->
|
|
|
- <div class="item-explain" v-show="isShowAnswer">
|
|
|
- <span class="explain-title">【解析】</span>
|
|
|
- <div class="item-explain-details">
|
|
|
- <span v-html="item.explain || '暂无解析'"></span>
|
|
|
+ <!-- 填空题答案 -->
|
|
|
+ <div v-else-if="item.type === 'Complete'">
|
|
|
+ <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index" v-html="answer"></span>
|
|
|
+ </div>
|
|
|
+ <!-- 其余题型答案 -->
|
|
|
+ <div v-else>
|
|
|
+ <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index">{{answer}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 知识点部分 -->
|
|
|
- <div class="item-explain" v-show="isShowAnswer">
|
|
|
- <span class="explain-title">【知识点】</span>
|
|
|
- <div class="item-explain-details">
|
|
|
- <span v-if="!item.points.length">暂未绑定知识点</span>
|
|
|
- <div v-else>
|
|
|
- <span v-for="point in item.points" style="padding:0 10px;border:1px solid #808080;margin-left:10px">{{ point.name }}</span>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <!-- 解析部分 -->
|
|
|
+ <div class="item-explain" v-show="isShowAnswer">
|
|
|
+ <span class="explain-title">【解析】</span>
|
|
|
+ <div class="item-explain-details">
|
|
|
+ <span v-html="item.explain || '暂无解析'"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 知识点部分 -->
|
|
|
+ <div class="item-explain" v-show="isShowAnswer">
|
|
|
+ <span class="explain-title">【知识点】</span>
|
|
|
+ <div class="item-explain-details">
|
|
|
+ <span v-if="!item.points.length">暂未绑定知识点</span>
|
|
|
+ <div v-else>
|
|
|
+ <span v-for="point in item.points" style="padding:0 10px;border:1px solid #808080;margin-left:10px">{{ point ? point.name : '0' }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
- </transition>
|
|
|
- </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </transition>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<!-- 底部分页区域 -->
|
|
@@ -90,8 +90,7 @@
|
|
|
|
|
|
<Modal v-model="scoreModal"
|
|
|
title="题目配分"
|
|
|
- @on-ok="onConfirmScore"
|
|
|
- >
|
|
|
+ @on-ok="onConfirmScore">
|
|
|
<InputNumber :max="curItemScore + surPlusScore" :min="0" :step="scoreStep" v-model="curItemScore" @on-change="onScoreChange"></InputNumber>
|
|
|
<p>剩余可分配分数:{{ surPlusScore }}</p>
|
|
|
</Modal>
|
|
@@ -112,16 +111,31 @@
|
|
|
|
|
|
</Modal>
|
|
|
|
|
|
+ <Modal v-model="editExerciseModal"
|
|
|
+ class-name="edit-exercise-modal"
|
|
|
+ width="1200px"
|
|
|
+ footer-hide
|
|
|
+ title="编辑习题">
|
|
|
+
|
|
|
+ <BaseEditExercise :exerciseItem="currentExercise" @onEditSuccess="onEditSuccess" refId="componetListEdit"></BaseEditExercise>
|
|
|
+
|
|
|
+ <div slot="footer">
|
|
|
+ <Button type="success">确认</Button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </Modal>
|
|
|
+
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import BaseEditExercise from './BaseEditExercise'
|
|
|
import Loading from '@/common/Loading.vue'
|
|
|
export default {
|
|
|
props: ['paper'],
|
|
|
components: {
|
|
|
- Loading
|
|
|
+ Loading,BaseEditExercise
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -133,6 +147,7 @@
|
|
|
isShowUploadList: false,
|
|
|
typeScoreModel:false,
|
|
|
setPaperInfoModal: false,
|
|
|
+ editExerciseModal:false,
|
|
|
exersicesType: {
|
|
|
Single: '单选题',
|
|
|
Multiple: '多选题',
|
|
@@ -164,8 +179,10 @@
|
|
|
curItemScore: 0,
|
|
|
curIndex:0,
|
|
|
lastScore: 0,
|
|
|
- scoreStep:0.5,
|
|
|
- scoreModal:false
|
|
|
+ scoreStep: 0.5,
|
|
|
+ curTypeItems:[],
|
|
|
+ scoreModal: false,
|
|
|
+ currentExercise: {}
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -173,6 +190,50 @@
|
|
|
//console.log(this.exerciseList)
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * 题干展开与收缩
|
|
|
+ * @param index
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ onQuestionToggle(index, id, e, arr) {
|
|
|
+ e.stopPropagation()
|
|
|
+ let listIndex = this.collapseList.indexOf(index)
|
|
|
+ let arrIndex = arr.indexOf(this.exerciseList[index])
|
|
|
+ if (listIndex > -1) {
|
|
|
+ this.collapseList.splice(listIndex, 1)
|
|
|
+ } else {
|
|
|
+ /** 如果有知识点 则需要进行换取名称 */
|
|
|
+ let detailExercise = this.exerciseList[index]
|
|
|
+ console.log(detailExercise)
|
|
|
+ if (detailExercise.points.length && typeof (detailExercise.points[0]) === 'string') {
|
|
|
+ this.getPointsByIds(detailExercise.points).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ detailExercise.points = res
|
|
|
+ /* 查询到详细数据则替换掉原数据 */
|
|
|
+ this.exerciseList.splice(index, 1, detailExercise)
|
|
|
+ arr.splice(arrIndex, 1, detailExercise)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ /* 查询到详细数据则替换掉原数据 */
|
|
|
+ this.exerciseList.splice(index, 1, detailExercise)
|
|
|
+ arr.splice(arrIndex, 1, detailExercise)
|
|
|
+ }
|
|
|
+ /** 如果是首次展开 则需要获取详细数据 否则直接展开 */
|
|
|
+ if (!this.exerciseList[index].answer.length) {
|
|
|
+ //this.getDetailsById(arr, id, index).then(r => {
|
|
|
+ // this.collapseList.push(index)
|
|
|
+ // this.pageScrollTo(e.target.offsetTop + 60) // 490就是 content-wrap 距离顶部高度
|
|
|
+ //})
|
|
|
+ this.collapseList.push(index)
|
|
|
+ this.pageScrollTo(e.target.offsetTop + 60) // 490就是 content-wrap 距离顶部高度
|
|
|
+ } else {
|
|
|
+ this.collapseList.push(index)
|
|
|
+ this.pageScrollTo(e.target.offsetTop + 60) // 490就是 content-wrap 距离顶部高度
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 根据ID获取试题详细数据
|
|
|
* @param id 试题ID
|
|
@@ -182,8 +243,9 @@
|
|
|
this.$api.newEvaluation.FindExerciseById([id]).then(res => {
|
|
|
let detailExercise = res.result.data[0]
|
|
|
/** 如果有知识点 则需要进行换取名称 */
|
|
|
- if (detailExercise.points.length) {
|
|
|
+ if (detailExercise.points.length && !detailExercise.points.map(i => i.name).length) {
|
|
|
this.getPointsByIds(detailExercise.points).then(res => {
|
|
|
+ console.log(res)
|
|
|
detailExercise.points = res
|
|
|
/* 查询到详细数据则替换掉原数据 */
|
|
|
this.exerciseList.splice(index, 1, detailExercise)
|
|
@@ -206,6 +268,9 @@
|
|
|
* @param ids
|
|
|
*/
|
|
|
getPointsByIds(ids) {
|
|
|
+ if (typeof (ids[0]) !== 'string'){
|
|
|
+ ids = ids.map(item => item.id)
|
|
|
+ }
|
|
|
return new Promise((r, j) => {
|
|
|
this.$api.knowledge.FindKnowledgebyId(ids).then(res => {
|
|
|
if (res.result.data.length) {
|
|
@@ -220,29 +285,7 @@
|
|
|
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * 题干展开与收缩
|
|
|
- * @param index
|
|
|
- * @param id
|
|
|
- */
|
|
|
- onQuestionToggle(index, id, e, arr) {
|
|
|
- e.stopPropagation()
|
|
|
- let listIndex = this.collapseList.indexOf(index)
|
|
|
- if (listIndex > -1) {
|
|
|
- this.collapseList.splice(listIndex, 1)
|
|
|
- } else {
|
|
|
- /** 如果是首次展开 则需要获取详细数据 否则直接展开 */
|
|
|
- if (!this.exerciseList[index].answer.length) {
|
|
|
- this.getDetailsById(arr, id, index).then(r => {
|
|
|
- this.collapseList.push(index)
|
|
|
- this.pageScrollTo(e.target.offsetTop + 60) // 490就是 content-wrap 距离顶部高度
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.collapseList.push(index)
|
|
|
- this.pageScrollTo(e.target.offsetTop + 60) // 490就是 content-wrap 距离顶部高度
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 数字与中文转换
|
|
@@ -347,17 +390,26 @@
|
|
|
* 编辑单个试题
|
|
|
* @param item
|
|
|
*/
|
|
|
- handleToolEdit(item) {
|
|
|
- this.$api.newEvaluation.FindExerciseById(item.id).then(res => {
|
|
|
- res.result.data.options = res.result.data.option
|
|
|
- res.result.data.level = res.result.data.level || 1
|
|
|
- this.$router.push({
|
|
|
- name: 'createExercises',
|
|
|
- params: {
|
|
|
- item: res.result.data
|
|
|
- }
|
|
|
+ handleToolEdit(arr, item, index) {
|
|
|
+ if (item.points.length) {
|
|
|
+ this.getPointsByIds(item.points).then(res => {
|
|
|
+ item.points = res
|
|
|
+ this.curIndex = index // 题型分组下的index
|
|
|
+ this.currentExerciseIndex = this.exerciseList.indexOf(item) // 清单列表下的index
|
|
|
+ this.curTypeItems = arr
|
|
|
+ this.currentExercise = item
|
|
|
+ this.editExerciseModal = true
|
|
|
+
|
|
|
})
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ this.curIndex = index // 题型分组下的index
|
|
|
+ this.currentExerciseIndex = this.exerciseList.indexOf(item) // 清单列表下的index
|
|
|
+ this.curTypeItems = arr
|
|
|
+ this.currentExercise = item
|
|
|
+ this.editExerciseModal = true
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
|
|
@@ -367,7 +419,7 @@
|
|
|
* @param index
|
|
|
*/
|
|
|
handleSetScore(item, index) {
|
|
|
- this.curIndex = index
|
|
|
+ this.currentExerciseIndex = index
|
|
|
this.curItemScore = item.score
|
|
|
this.lastScore = item.score
|
|
|
this.scoreModal = true
|
|
@@ -410,6 +462,30 @@
|
|
|
|
|
|
},
|
|
|
|
|
|
+ /** 编辑成功 */
|
|
|
+ onEditSuccess(item) {
|
|
|
+ if (item.id) {
|
|
|
+ this.$api.newEvaluation.SaveSingleExercise(item).then(res => {
|
|
|
+ this.editExerciseModal = false
|
|
|
+ this.$Message.success("修改成功!")
|
|
|
+ this.exerciseList.splice(this.currentExerciseIndex, 1, item)
|
|
|
+ this.curTypeItems.splice(this.curIndex, 1, item)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.editExerciseModal = false
|
|
|
+ this.exerciseList.splice(this.currentExerciseIndex, 1, item)
|
|
|
+ this.curTypeItems.splice(this.curIndex, 1, item)
|
|
|
+ let listIndex = this.collapseList.indexOf(this.currentExerciseIndex);
|
|
|
+ if (listIndex > -1) {
|
|
|
+ this.collapseList.splice(listIndex, 1)
|
|
|
+ }
|
|
|
+ this.$Message.success("修改成功!")
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
|
|
|
/** 打开题型配分 */
|
|
|
onSetScoreByType() {
|
|
@@ -431,7 +507,9 @@
|
|
|
paper: {
|
|
|
handler(newPaper, oldValue) {
|
|
|
if (newPaper) {
|
|
|
-
|
|
|
+
|
|
|
+ console.log(newPaper)
|
|
|
+
|
|
|
let that = this
|
|
|
this.groupList = []
|
|
|
this.exerciseList = []
|
|
@@ -494,6 +572,7 @@
|
|
|
margin-top:20px;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
.components-el-container .exercise-item {
|
|
|
position:relative;
|
|
|
margin-top:30px;
|
|
@@ -578,3 +657,12 @@
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
</style>
|
|
|
+
|
|
|
+<style>
|
|
|
+
|
|
|
+ .edit-exercise-modal .ivu-modal-body {
|
|
|
+ max-height: 700px;
|
|
|
+ overflow: auto;
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+</style>
|