|
@@ -0,0 +1,576 @@
|
|
|
+<template>
|
|
|
+ <div class="ev-list-container">
|
|
|
+ <!-- 筛选部分 -->
|
|
|
+ <div class="filter-wrap">
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">来源:</span>
|
|
|
+ <RadioGroup v-model="filterOrigin" type="button" @on-change="filterOriginChange">
|
|
|
+ <Radio :label="userId">私有题库</Radio>
|
|
|
+ <Radio :label="schoolCode">学校公用库</Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">学段:</span>
|
|
|
+ <RadioGroup v-model="filterPeriod" type="button" @on-change="filterPeriodChange">
|
|
|
+ <Radio v-for="(item,index) in periodList" :key="index" :label="index">{{ item.periodName }}</Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">年级:</span>
|
|
|
+ <CheckboxGroup v-model="filterGrade" border @on-change="filterGradeChange">
|
|
|
+ <Checkbox lable="all">全部</Checkbox>
|
|
|
+ <Checkbox v-for="(item,index) in gradeList" :key="index" :label="item.gradeCode">{{ item.gradeName }}</Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">科目:</span>
|
|
|
+ <CheckboxGroup v-model="filterSubject" border @on-change="filterSubjectChange">
|
|
|
+ <Checkbox lable="all">全部</Checkbox>
|
|
|
+ <Checkbox v-for="(item,index) in subjectList" :key="index" :label="item.subjectCode">{{ item.subjectName }}</Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">题型:</span>
|
|
|
+ <CheckboxGroup v-model="filterType" border @on-change="filterTypeChange">
|
|
|
+ <Checkbox label="all">全部</Checkbox>
|
|
|
+ <Checkbox label="Single">单选</Checkbox>
|
|
|
+ <Checkbox label="Multiple">多选</Checkbox>
|
|
|
+ <Checkbox label="Judge">判断</Checkbox>
|
|
|
+ <Checkbox label="Complete">填空</Checkbox>
|
|
|
+ <Checkbox label="Subjective">问答</Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">难度:</span>
|
|
|
+ <CheckboxGroup v-model="filterDiff" border @on-change="filterDiffChange">
|
|
|
+ <Checkbox label="all">全部</Checkbox>
|
|
|
+ <Checkbox v-for="(item,index) in exersicesDiff" :key="index" :label="index + 1">{{ item }}</Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">层次:</span>
|
|
|
+ <CheckboxGroup v-model="filterField" border @on-change="filterFieldChange">
|
|
|
+ <Checkbox label="all">全部</Checkbox>
|
|
|
+ <Checkbox label="0">应用</Checkbox>
|
|
|
+ <Checkbox label="1">综合</Checkbox>
|
|
|
+ <Checkbox label="2">理解</Checkbox>
|
|
|
+ <Checkbox label="3">评鉴</Checkbox>
|
|
|
+ <Checkbox label="4">知识</Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="filter-title">排序:</span>
|
|
|
+ <RadioGroup v-model="filterSort" type="button" @on-change="filterSortChange">
|
|
|
+ <Radio label="createTime">新增时间<Icon type="md-arrow-round-down" /></Radio>
|
|
|
+ <Radio label="usageCount">使用次数<Icon type="md-arrow-round-down" /></Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="ev-list-operation">
|
|
|
+ <Checkbox v-model="isShowAnswer" style="visibility:hidden"></Checkbox>
|
|
|
+ <span class="import-exercise">
|
|
|
+ <Button type="info" @click="goCreateExercise">新建习题</Button>
|
|
|
+ <Upload multiple action="api/ImportExercise/uploadWord" :headers="headers" :show-upload-list="isShowUploadList" :on-success="uploadSuccess">
|
|
|
+ <Button type="info">导入习题</Button>
|
|
|
+ </Upload>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <!-- 筛选部分结束 -->
|
|
|
+ <!-- 题目列表部分 -->
|
|
|
+ <div v-if="exerciseList.length === 0" class="no-data-text">
|
|
|
+ <img src="../../../assets/icon/no_data.svg" width="120" />
|
|
|
+ <span style="margin-top:15px;color:#808080">暂无数据</span>
|
|
|
+ </div>
|
|
|
+ <div class="content-wrap" v-else>
|
|
|
+ <Loading :top="100" v-show="dataLoading" type="1"></Loading>
|
|
|
+ <div class="exercise-item" v-for="(item,index) of exerciseList" :key="index" @click="onQuestionToggle(index,item.id,$event)">
|
|
|
+ <!-- 题干部分 -->
|
|
|
+ <div class="item-question" style="pointer-events:none">
|
|
|
+ <p>{{ pageSize * (pageNum - 1) + index + 1 }} : <span v-html="item.question"></span></p>
|
|
|
+ <span class="item-btn-toggle">
|
|
|
+ <Icon :type="collapseList.indexOf(index) > -1 ? 'ios-arrow-dropup' : 'ios-arrow-dropdown'" />
|
|
|
+ </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(index) > -1" class="toggle-area">
|
|
|
+ <!-- 如果是组合题 -->
|
|
|
+ <div v-for="(childQuestion,childIndex) in item.children" :key="childIndex">
|
|
|
+ <div v-if="item.children.length">
|
|
|
+ <div class="item-question">
|
|
|
+ <p>{{childIndex+1}} : <span v-html="childQuestion.question"></span></p>
|
|
|
+ </div>
|
|
|
+ <div v-for="(childOption,childOptionIndex) in childQuestion.option" :key="childOptionIndex">
|
|
|
+ <p>{{String.fromCharCode(64 + parseInt(childOptionIndex+1))}} : <span v-html="childOption.value"></span></p>
|
|
|
+ </div>
|
|
|
+ <div class="item-answer" v-show="isShowAnswer">
|
|
|
+ <span style="color:#01b4ef">【答案】:</span>
|
|
|
+ <span v-html="childQuestion.answer[0] || childQuestion.answer" v-if="childQuestion.type === 'Subjective'"></span>
|
|
|
+ <span :class="[ childQuestion.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,answerIndex) in childQuestion.answer" :key="answerIndex" v-else-if="childQuestion.type === 'Complete'" v-html="answer"></span>
|
|
|
+ <span :class="[ childQuestion.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,answerIndex) in childQuestion.answer" :key="answerIndex" v-else>{{answer}}</span>
|
|
|
+ </div>
|
|
|
+ <div class="item-explain" v-show="isShowAnswer">
|
|
|
+ <span style="color:#01b4ef">【解析】:</span>
|
|
|
+ <span v-html="childQuestion.explain || '暂无解析'"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 组合题结束 -->
|
|
|
+ <!-- 答案展示部分 -->
|
|
|
+ <div class="item-explain" v-show="isShowAnswer">
|
|
|
+ <span class="explain-title">【答案】</span>
|
|
|
+ <div class="item-explain-details">
|
|
|
+ <span v-html="item.answer" v-if="item.type === 'Subjective'"></span>
|
|
|
+ <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index" v-else-if="item.type === 'Complete'" v-html="answer"></span>
|
|
|
+ <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index" v-else>{{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>
|
|
|
+ </div>
|
|
|
+ <!-- 知识点部分 -->
|
|
|
+ <div class="item-explain" v-show="isShowAnswer">
|
|
|
+ <span class="explain-title">【知识点】</span>
|
|
|
+ <div class="item-explain-details">
|
|
|
+ <span v-html="item.points.length ? item.points : '暂未绑定知识点'"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 底部题目操作栏 -->
|
|
|
+ <div class="item-tools">
|
|
|
+ <span class="item-tools-info">题型:{{ exersicesType[item.type] }}</span>
|
|
|
+ <span class="item-tools-info">难度:{{ exersicesDiff[item.level] }}</span>
|
|
|
+ <span class="item-tools-info">使用次数:{{ item.usageCount }} 次</span>
|
|
|
+ <span class="item-tools-info" style="border:0">更新时间:{{ formatDateTime(new Date(item.createTime * 1000)) }}</span>
|
|
|
+ <!--<Button type="info" :style="{backgroundColor:basketList.all.indexOf(item) > -1 ? '#bbbbbb' : ''}" @click="handleChoose(item)">{{basketList.all.indexOf(item) > -1 ? '已选入' : '选题'}} </Button>-->
|
|
|
+
|
|
|
+ <Button type="primary" @click="handleEdit(item)" style="margin-right:10px">选题</Button>
|
|
|
+ <div class="item-tools-action">
|
|
|
+ <Icon type="md-trash" />删除
|
|
|
+ </div>
|
|
|
+ <div class="item-tools-action">
|
|
|
+ <Icon type="md-create" />编辑
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </transition>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 底部分页区域 -->
|
|
|
+ <Page :total="totalNum"
|
|
|
+ show-sizer
|
|
|
+ show-total
|
|
|
+ :page-size="pageSize"
|
|
|
+ :current="pageNum"
|
|
|
+ @on-page-size-change="pageSizeChange"
|
|
|
+ @on-change="pageChange"
|
|
|
+ :page-size-opts="[5,10,15,20]" />
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ import Loading from '@/common/Loading.vue'
|
|
|
+ import { setTimeout } from 'core-js'
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ Loading
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ userId: 'habook0001',
|
|
|
+ schoolCode: '',
|
|
|
+ dataLoading: false,
|
|
|
+ exerciseList: [],
|
|
|
+ schoolInfo: {},
|
|
|
+ isShowUploadList: false,
|
|
|
+ exersicesType: {
|
|
|
+ Single: '单选',
|
|
|
+ Multiple: '多选',
|
|
|
+ Judge: '判断',
|
|
|
+ Complete: '填空',
|
|
|
+ Subjective: '问答',
|
|
|
+ Compose: '综合题'
|
|
|
+ },
|
|
|
+ exersicesDiff: ['容易', '较易', '一般', '较难', '困难'],
|
|
|
+ diffColors: ['#32CF74', '#E8BE15', '#F19300', '#EB5E00', '#D30000'],
|
|
|
+ filterType: ['all'],
|
|
|
+ filterOrigin: 'habook0001',
|
|
|
+ filterDiff: ['all'],
|
|
|
+ filterField: ['all'],
|
|
|
+ filterSort: 'createTime',
|
|
|
+ filterPeriod: 0,
|
|
|
+ filterGrade: [false],
|
|
|
+ filterSubject: [false],
|
|
|
+ totalNum: 0,
|
|
|
+ isShowAnswer: true,
|
|
|
+ importLoading: false,
|
|
|
+ pageSize: 5,
|
|
|
+ pageNum: 1,
|
|
|
+ currentPage: 1,
|
|
|
+ collapseList: [],
|
|
|
+ periodList: [],
|
|
|
+ gradeList: [],
|
|
|
+ subjectList: [],
|
|
|
+ filterParams: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getSchoolInfo()
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 获取区班校信息 */
|
|
|
+ getSchoolInfo() {
|
|
|
+ this.$store.dispatch('schoolBaseInfo/getSchoolBaseData').then(res => {
|
|
|
+ this.schoolInfo = JSON.parse(JSON.stringify(res.data))
|
|
|
+ this.schoolCode = res.data.schoolCode
|
|
|
+ this.periodList = res.data.period
|
|
|
+ this.gradeList = res.data.period[0].grades
|
|
|
+ this.subjectList = res.data.period[0].subjects
|
|
|
+ this.doFilter();
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 执行筛选条件获取数据 */
|
|
|
+ doFilter() {
|
|
|
+ this.dataLoading = true
|
|
|
+ this.collapseList = [] // 所有详情都收起来
|
|
|
+ /** 定义查询接口的参数规格 */
|
|
|
+ this.filterParams = {
|
|
|
+ '@CURRPAGE': this.pageNum,
|
|
|
+ '@PAGESIZE': this.pageSize,
|
|
|
+ '@DESC': this.filterSort,
|
|
|
+ 'scopeCode': this.filterOrigin,
|
|
|
+ 'period': [this.periodList[this.filterPeriod].periodCode],
|
|
|
+ 'grade': this.deleteFalse(this.filterGrade),
|
|
|
+ 'subject': this.deleteFalse(this.filterSubject),
|
|
|
+ 'scopeCode': this.filterOrigin,
|
|
|
+ 'level': this.deleteFalse(this.filterDiff),
|
|
|
+ 'type': this.deleteFalse(this.filterType),
|
|
|
+ 'field': this.deleteFalse(this.filterField),
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查询总数参数 */
|
|
|
+ let findCountParams = {
|
|
|
+ "collectionName": "ExamItem",
|
|
|
+ "queryDict": {
|
|
|
+ 'scopeCode': this.filterOrigin,
|
|
|
+ 'period': [this.periodList[this.filterPeriod].periodCode],
|
|
|
+ 'grade': this.deleteFalse(this.filterGrade),
|
|
|
+ 'subject': this.deleteFalse(this.filterSubject),
|
|
|
+ 'scopeCode': this.filterOrigin,
|
|
|
+ 'level': this.deleteFalse(this.filterDiff),
|
|
|
+ 'type': this.deleteFalse(this.filterType),
|
|
|
+ 'field': this.deleteFalse(this.filterField),
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.getExerciseList(this.filterParams)
|
|
|
+ this.getResultCount(findCountParams)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取最新题库列表
|
|
|
+ * @param data
|
|
|
+ */
|
|
|
+ getExerciseList(data) {
|
|
|
+ let that = this
|
|
|
+ this.$api.newEvaluation.FindExerciseList(data).then(res => {
|
|
|
+ this.exerciseList = res.result.data
|
|
|
+ setTimeout(() => {
|
|
|
+ that.dataLoading = false
|
|
|
+ }, 1000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取筛选结果数量
|
|
|
+ * @param data
|
|
|
+ */
|
|
|
+ getResultCount(data) {
|
|
|
+ this.$api.newEvaluation.FindCount(data).then(res => {
|
|
|
+ this.totalNum = res.result.data[0]
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据ID获取试题详细数据
|
|
|
+ * @param id 试题ID
|
|
|
+ */
|
|
|
+ getDetailsById(id, index) {
|
|
|
+ this.$api.newEvaluation.FindExerciseById(id).then(res => {
|
|
|
+ /* 查询到详细数据则替换掉原数据 */
|
|
|
+ this.exerciseList.splice(index, 1, res.result.data)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 题干展开与收缩
|
|
|
+ * @param index
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ onQuestionToggle(index, id, e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ let listIndex = this.collapseList.indexOf(index)
|
|
|
+ if (listIndex > -1) {
|
|
|
+ this.collapseList.splice(listIndex, 1)
|
|
|
+ } else {
|
|
|
+ this.collapseList.push(index)
|
|
|
+ if (!this.exerciseList[index].answer.length) this.getDetailsById(id, index)
|
|
|
+ }
|
|
|
+ this.pageScrollTo(e.target.offsetTop + 490) // 490就是 content-wrap 距离顶部高度
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选学段条件
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterPeriodChange(val) {
|
|
|
+ //this.filterPeriod = this.periodList[val].periodCode
|
|
|
+ this.gradeList = this.schoolInfo.period[val].grades
|
|
|
+ this.subjectList = this.schoolInfo.period[val].subjects
|
|
|
+ this.filterGrade = [false]
|
|
|
+ this.filterSubject = [false]
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选年级
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterGradeChange(val) {
|
|
|
+ if (val !== [false] && val.indexOf(false) === 0) {
|
|
|
+ this.filterGrade.splice(val.indexOf(false), 1)
|
|
|
+ } else if (val.indexOf(false) > 0) {
|
|
|
+ this.filterGrade = [false]
|
|
|
+ }
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选科目
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterSubjectChange(val) {
|
|
|
+ if (val !== [false] && val.indexOf(false) === 0) {
|
|
|
+ this.filterSubject.splice(val.indexOf(false), 1)
|
|
|
+ } else if (val.indexOf(false) > 0) {
|
|
|
+ this.filterSubject = [false]
|
|
|
+ }
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据题库加载题目
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterOriginChange(origin) {
|
|
|
+ this.filterOrigin = origin
|
|
|
+ this.pageChange(1)
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选题型
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterTypeChange(val) {
|
|
|
+ if (val !== ['all'] && val.indexOf('all') === 0) {
|
|
|
+ this.filterType.splice(val.indexOf('all'), 1)
|
|
|
+ } else if (val.indexOf('all') > 0) {
|
|
|
+ this.filterType = ['all']
|
|
|
+ }
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选难度
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterDiffChange(val) {
|
|
|
+ if (val !== ['all'] && val.indexOf('all') === 0) {
|
|
|
+ this.filterDiff.splice(val.indexOf('all'), 1)
|
|
|
+ } else if (val.indexOf('all') > 0) {
|
|
|
+ this.filterDiff = ['all']
|
|
|
+ }
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选认知层次
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterFieldChange(val) {
|
|
|
+ if (val !== ['all'] && val.indexOf('all') === 0) {
|
|
|
+ this.filterField.splice(val.indexOf('all'), 1)
|
|
|
+ } else if (val.indexOf('all') > 0) {
|
|
|
+ this.filterField = ['all']
|
|
|
+ }
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 排序条件更换
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ filterSortChange(val) {
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除筛选条件里面的False值与All值
|
|
|
+ * @param arr
|
|
|
+ */
|
|
|
+ deleteFalse(arr) {
|
|
|
+ let list = JSON.parse(JSON.stringify(arr))
|
|
|
+ list.forEach((item, index) => { if (!item || item === 'all') list.splice(index, 1) })
|
|
|
+ return list
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 返回创建试题页面 */
|
|
|
+ goCreateExercise() {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'createExercises'
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 切换页码操作
|
|
|
+ * @param page
|
|
|
+ */
|
|
|
+ pageChange(page) {
|
|
|
+ this.pageNum = page
|
|
|
+ this.doFilter()
|
|
|
+ this.pageScrollTo(0)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面滚动事件
|
|
|
+ * @param scrollDistance 页面滚动距离
|
|
|
+ */
|
|
|
+ pageScrollTo(scrollDistance) {
|
|
|
+ let parentVm = this.$parent.$parent.$parent.$parent.$parent.$parent
|
|
|
+ parentVm.$refs['evScroll'].scrollTo(
|
|
|
+ {
|
|
|
+ y: scrollDistance
|
|
|
+ },
|
|
|
+ 500, 'easeInQuad'
|
|
|
+ )
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 切换每页显示数量
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ pageSizeChange(val) {
|
|
|
+ this.pageSize = val
|
|
|
+ this.pageChange(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新时间日期格式化
|
|
|
+ * @param date
|
|
|
+ */
|
|
|
+ formatDateTime(date) {
|
|
|
+ var y = date.getFullYear();
|
|
|
+ var m = date.getMonth() + 1;
|
|
|
+ m = m < 10 ? ('0' + m) : m;
|
|
|
+ var d = date.getDate();
|
|
|
+ d = d < 10 ? ('0' + d) : d;
|
|
|
+ var h = date.getHours();
|
|
|
+ h = h < 10 ? ('0' + h) : h;
|
|
|
+ var minute = date.getMinutes();
|
|
|
+ minute = minute < 10 ? ('0' + minute) : minute;
|
|
|
+ var second = date.getSeconds();
|
|
|
+ second = second < 10 ? ('0' + second) : second;
|
|
|
+ return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 编辑习题
|
|
|
+ handleEdit(item) {
|
|
|
+ item.options = item.option
|
|
|
+ item.difficulty = item.difficulty || 2
|
|
|
+ this.$router.push({
|
|
|
+ name: 'createExercises',
|
|
|
+ params: {
|
|
|
+ item: item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 导入试题
|
|
|
+ uploadSuccess(response, file, fileList) {
|
|
|
+ let that = this
|
|
|
+ this.importLoading = true
|
|
|
+ if (response.error === null) {
|
|
|
+ let requestData = { htmlString: response.result.data.HtmlString }
|
|
|
+ this.$api.SaveAnalyzeHtml(requestData).then(res => {
|
|
|
+ if (res.error === null) {
|
|
|
+ setTimeout(function () {
|
|
|
+ that.$Message.success('文件上传解析成功!')
|
|
|
+ that.exerciseList = res.result.data
|
|
|
+ that.importLoading = false
|
|
|
+ }, 1000)
|
|
|
+ // this.saveItemBank(res.result.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$Message.error('对不起,文档解析失败!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 保存试题到数据库
|
|
|
+ saveItemBank(list) {
|
|
|
+ this.$api.SaveItemBank(list).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ headers() {
|
|
|
+ let hd = {}
|
|
|
+ hd['Authorization'] = 'Bearer ' + localStorage.getItem('token')
|
|
|
+ return hd
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+ @import "../index/ExercisesList.css";
|
|
|
+</style>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .circle {
|
|
|
+ border: solid 1px red;
|
|
|
+ background-color: red;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .slide-enter-active {
|
|
|
+ transition: all .3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ .slide-leave-active {
|
|
|
+ transition: all .3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ .slide-enter, .slide-leave-to {
|
|
|
+ transform: translateY(10px);
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+</style>
|