|
|
@@ -0,0 +1,318 @@
|
|
|
+<template>
|
|
|
+ <el-card class="bQuestion-card" shadow="hover">
|
|
|
+ <template #header>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="3">
|
|
|
+ <span><strong>S/N: </strong>{{curNum+1}} / {{totalNum}}</span>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="5">
|
|
|
+ <span><strong>题目类型: </strong>{{questionvo.type}}</span>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="6">
|
|
|
+ <div class="bQuestion-card-body-knowledgeID">
|
|
|
+ <span v-if="questionvo.knowledgeId && questionvo.knowledgeId.length !== 0">
|
|
|
+ <span><strong>KnowledgeId: </strong></span>
|
|
|
+ <el-tooltip v-for="item in questionvo.knowledgeId" effect="dark" placement="bottom">
|
|
|
+ <template #content>
|
|
|
+ {{map1(item)}}
|
|
|
+ </template>
|
|
|
+ <el-tag effect="dark" style="margin-right: 2px">{{item}}</el-tag>
|
|
|
+ </el-tooltip>
|
|
|
+ </span>
|
|
|
+ <span v-else>
|
|
|
+ <span><strong>KnowledgeId: </strong>null</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="6"/>
|
|
|
+ <el-col :span="2">
|
|
|
+ <el-button type="text" circle @click="expand" v-if="!isAll"><strong>查看全部</strong></el-button>
|
|
|
+ <el-button type="text" circle @click="withdraw" v-if="isAll"><strong>收起</strong></el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1">
|
|
|
+ <el-button type="primary" icon="el-icon-edit" circle @click="updateQuestion"></el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1">
|
|
|
+ <el-button v-if="isDelete === false" type="danger" icon="el-icon-delete" circle @click="deleteQuestion"></el-button>
|
|
|
+ <el-button v-else type="success" icon="el-icon-delete" circle @click="recoverQuestion"></el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <div class="bQuestion-card-body">
|
|
|
+ <div class="bQuestion-card-body-stem">
|
|
|
+ <div>
|
|
|
+ <MarkdownText :raw="'<strong>题目: </strong>'+questionvo.stem"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ <div class="stem-extension" v-if="isAll">
|
|
|
+ <div class="bQuestion-card-body-options" v-if="questionvo.type === 'choice'">
|
|
|
+ <div v-for="(item,index) in questionvo.options" >
|
|
|
+ <div v-if="questionvo.answer.split('').indexOf(index) !== -1" class="underline-correct-answer">
|
|
|
+ <MarkdownText :raw="index+': '+item"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <MarkdownText :raw="index+': '+item"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="bQuestion-card-body-options" v-if="questionvo.type === 'multiple_choice'">
|
|
|
+ <div v-for="(item,index) in questionvo.options" >
|
|
|
+ <div v-if="questionvo.answer.split(';').indexOf(index) !== -1" class="underline-correct-answer">
|
|
|
+ <MarkdownText :raw="index+': '+item"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <MarkdownText :raw="index+': '+item"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="bQuestion-card-body-blanks" v-if="questionvo.type === 'blank'">
|
|
|
+ <div v-for="index in Object.keys(questionvo.blanks).length">
|
|
|
+ <div class="correct_answer">
|
|
|
+ __{{index}}__: {{questionvo.blanks['__'+index+'__']}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="bQuestion-card-body-true_false" v-if="questionvo.type === 'true_false'">
|
|
|
+ <div class="correct_answer"> {{questionvo.answer}}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-divider v-if="isAll"></el-divider>
|
|
|
+
|
|
|
+ <div class="bQuestion-card-body-info" v-if="isAll">
|
|
|
+ <div class="info-block">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="10">
|
|
|
+ <strong>KeyPoints: </strong>{{questionvo.keyPoints}}
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <strong>题目难度: </strong>{{questionvo.weight}}/5
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <span><strong>Tags: </strong></span>
|
|
|
+ <span v-if="questionvo.tags && questionvo.tags.length !== 0">
|
|
|
+ <el-tag v-for="(item, index) in questionvo.tags" effect="dark">{{item}}</el-tag>
|
|
|
+ </span>
|
|
|
+ <span v-else>
|
|
|
+ <span>no tags</span>
|
|
|
+ </span>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div class="info-block"
|
|
|
+ v-if="questionvo.type === 'choice' ||
|
|
|
+ questionvo.type === 'multiple_choice' ||
|
|
|
+ questionvo.type === 'true_false' ||
|
|
|
+ questionvo.type === 'short_answer'">
|
|
|
+ <MarkdownText :raw="'<strong>正确答案: </strong>'+questionvo.answer"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div class="info-block"
|
|
|
+ v-if="questionvo.type === 'choice' ||
|
|
|
+ questionvo.type === 'multiple_choice' ||
|
|
|
+ questionvo.type === 'true_false'">
|
|
|
+ <MarkdownText :raw="'<strong>解析: </strong>'+questionvo.analysis"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ <div class="info-block" v-if="questionvo.type === 'blank' && questionvo.analysis.length > 5">
|
|
|
+ <MarkdownText :raw="'<strong>解析: </strong>'+questionvo.analysis"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ <div class="info-block" v-if="questionvo.type === 'short_answer' && questionvo.analysis.length > 5">
|
|
|
+ <MarkdownText :raw="'<strong>解析: </strong>'+questionvo.analysis"></MarkdownText>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-divider v-if="isAll"></el-divider>
|
|
|
+
|
|
|
+ <div class="bQuestion-card-footer" v-if="isAll">
|
|
|
+ <div>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="3">
|
|
|
+ <div><strong>状态: </strong>已审核</div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="5">
|
|
|
+ <div><strong>审核人: </strong>小苏</div>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="10"></el-col>
|
|
|
+
|
|
|
+ <el-col :span="6" v-if="!questionvo.lastModifiedTime">
|
|
|
+ <div><strong>CreateTime: </strong>{{toMyDate(questionvo.createdTime)}}</div>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="6" v-else>
|
|
|
+ <div><strong>lastModifiedTime: </strong>{{toMyDate(questionvo.lastModifiedTime)}}</div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <el-drawer
|
|
|
+ title="更新题目"
|
|
|
+ :before-close="handleClose"
|
|
|
+ v-model="dialog"
|
|
|
+ direction="rtl"
|
|
|
+ custom-class="question-drawer"
|
|
|
+ ref="drawer"
|
|
|
+ size="35%"
|
|
|
+ >
|
|
|
+ <QuestionUpdater :question="questionvo" @closeDialog="closeDialog"/>
|
|
|
+ </el-drawer>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import MarkdownText from "../MarkdownText";
|
|
|
+ import {map} from "../../utils/knowledgeMapper";
|
|
|
+ import {deleteQuestionById} from "../../api/question";
|
|
|
+ import QuestionUpdater from "../card/QuestionUpdater";
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "AbstractQuestionCard",
|
|
|
+ components: {
|
|
|
+ MarkdownText,
|
|
|
+ QuestionUpdater
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ questionvo: Object,
|
|
|
+ curNum: Number,
|
|
|
+ totalNum: Number,
|
|
|
+ },
|
|
|
+ data(){
|
|
|
+ return{
|
|
|
+ isAll: false,
|
|
|
+ isDelete: false,
|
|
|
+ dialog: false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ map1(abbreviation){
|
|
|
+ return map(abbreviation)
|
|
|
+ },
|
|
|
+ expand(){
|
|
|
+ if(!this.isAll){
|
|
|
+ this.isAll = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ withdraw(){
|
|
|
+ if(this.isAll){
|
|
|
+ this.isAll = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateQuestion(){
|
|
|
+ this.dialog = true;
|
|
|
+ },
|
|
|
+ handleClose(){
|
|
|
+ this.$confirm('此操作将丢失填写信息, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.dialog = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ closeDialog(){
|
|
|
+ this.dialog = false;
|
|
|
+ },
|
|
|
+ deleteQuestion(){
|
|
|
+ this.$confirm('此操作将永久删除该题目, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ deleteQuestionById(this.questionvo.id).then(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ this.isDelete = true;
|
|
|
+ }).catch( error => {
|
|
|
+ console.log(error);
|
|
|
+ this.$notify.error({
|
|
|
+ title: '错误',
|
|
|
+ message: '删除失败'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ recoverQuestion(){
|
|
|
+ alert("Delete successfully!");
|
|
|
+ },
|
|
|
+ toMyDate(instant){
|
|
|
+ let date = new Date(instant);
|
|
|
+ let year = date.getFullYear();
|
|
|
+ let month = date.getMonth() + 1;
|
|
|
+ let theDate = date.getDate();
|
|
|
+ let hour = date.getHours();
|
|
|
+ let minute = date.getMinutes();
|
|
|
+ let second = date.getSeconds();
|
|
|
+ if ( month < 10 ) { month = '0' + month; }
|
|
|
+ if ( theDate < 10 ) { theDate = '0' + theDate; }
|
|
|
+ if ( hour < 10 ) { hour = '0' + hour; }
|
|
|
+ if ( minute < 10 ) { minute = '0' + minute; }
|
|
|
+ if ( second < 10 ) { second = '0' + second; }
|
|
|
+ return year +"-"+ month +"-" + theDate + " "+ hour +":"+ minute +":"+ second;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .bQuestion-card{
|
|
|
+ margin: 20px;
|
|
|
+ font-size: 18px;
|
|
|
+ background-color: #eef7f2;
|
|
|
+ }
|
|
|
+ .bQuestion-card-body{
|
|
|
+ text-align: left;
|
|
|
+ margin-left: 32px;
|
|
|
+ font-size: 20px;
|
|
|
+ font-family: "Songti SC";
|
|
|
+ }
|
|
|
+
|
|
|
+ p {
|
|
|
+ display: block;
|
|
|
+ margin-block-start: 0px;
|
|
|
+ margin-block-end: 0px;
|
|
|
+ margin-inline-start: 0px;
|
|
|
+ margin-inline-end: 0px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bQuestion-card-body-options{
|
|
|
+ margin-top: 10px;
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .underline-correct-answer{
|
|
|
+ font-family: "Kaiti SC";
|
|
|
+ font-size: 22px;
|
|
|
+ color: #f1939c;
|
|
|
+ font-weight: bold;
|
|
|
+ text-decoration: underline;
|
|
|
+ }
|
|
|
+ .correct_answer{
|
|
|
+ font-family: "Kaiti SC";
|
|
|
+ font-size: 21px;
|
|
|
+ color: #f1939c;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-block{
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|